diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-04-21 20:37:49 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-04-21 20:37:49 +0000 |
commit | 16ce7976b81fd8d319cafc61853343f1a4477619 (patch) | |
tree | 6724ec331c1f56bfd4bfc5e0a67c80b78f190399 | |
parent | 396be026741eaf5fa78b97b8d277ca770c489bcb (diff) | |
download | ATCD-16ce7976b81fd8d319cafc61853343f1a4477619.tar.gz |
ChangeLogTag:Mon Apr 21 15:36:06 2003 Nanbor Wang <nanbor@cs.wustl.edu>
326 files changed, 40535 insertions, 0 deletions
diff --git a/TAO/CIAO/CIDLC/DesignNotes b/TAO/CIAO/CIDLC/DesignNotes new file mode 100644 index 00000000000..b01fd452762 --- /dev/null +++ b/TAO/CIAO/CIDLC/DesignNotes @@ -0,0 +1,457 @@ + +Intention of this file is to capture and document CIDL complier design +ideas/decisions. + +Conceptual parts of CIDL compiler design +---------------------------------------- + +Option Parser Consists of option parser and option + database. + +C Preprocessor Interfacing Represents mechanism of preprocessing + cidl files. + +IDL Compiler Interfacing Represents mechanism of invoking IDL + compiler. + +Scanner Scanner for preprocessed cidl file. + +Parser CIDL grammar parser. Consists of grammar + and semantic rules. + +Syntax Tree Intermediate representation of cidl file. + Consists of syntax tree nodes itself and + perhaps symbol tables. + +Semantic Analyzer Traverses Syntax Tree and performs + semantic analysis as well as some + semantic expansions. + + +Code Generation Stream Stream to output generated code to. Used + by concrete Code Generators + +Code Generators +{ + + Executor Mapping Generator Generator for local executor mapping. + + Executor Implementation Generator Generator for partial implementation + of local executor mapping. + + Skeleton Thunk Generator Generator for skeleton thunks i.e. + code that implements skeleton and + thunks user-defined functions to + executor mapping. +} + +Compiler driver Establishes order of execution of + different components as part of + compilation process. + + +How everything works together +----------------------------- + +(1) Compiler Driver executes Option Parser to populate Option Database + +(2) Compiler Driver executes C Preprocessor on a supplied cidl file + +(3) Compiler Driver executes Parser which uses Scanner to scan preprocessed + cidl file and generates Syntax Tree by means of semantic rules. + +(4) At this point we have Syntax Tree corresponding to the original cidl + file. Compiler Driver executes Executor Mapping Generator, + Executor Implementation Generator and Skeleton Thunk Generator on + Syntax Tree. + + + +General Design Ideas/Decision +------------- + +[IDEA]: There is an effort to use autoconf/automake in ACE/TAO. Maybe it's + a good idea to start using it with CIDLC? There is one side advantage + of this approach: if we decide to embed GCC CPP then we will have to + use configure (or otherwise ACE-ify the code which doesn't sound like + a right solution). + +[IDEA]: CIDLC is a prototype for a new IDLC, PSDLC and IfR model. Here are + basic concepts: + + - use common IDL grammar, semantic rules and syntax tree nodes + for IDLC, CIDLC, PSDLC and IfR. Possibly have several libraries + for example ast_idl-2.so, ast_idl-3.so, scaner_idl-2.so + scaner_idl-3.so, parser_idl-2.so, parser_idl-3.so. Dependency + graph would look like this: + + + ast_idl-2.so scanner_idl-2.so + | | + |---------------------------------| + | | | + | | | + | parser_idl-2.so | + | | | + ast_idl-3.so | scanner_idl-3.so + | | | + | | | + | | | + ---------parser_idl-3.so--------- + + Same idea applies for CIDL and PSDL. + + + - use the same internal representation (syntax tree) in all + compilers and IfR. This way at some stage if we will need + to make one of the compilers IfR-integrated (import keyword?) + then it will be a much easier task than it's now. This internal + representation may also be usable in typecodes + + @@ boris: not clear to me. + + @@ jeff: A typecode is like a piece of the Syntax Tree with these + exceptions - + + (1) There is no typecode for an IDL module. + + (2) Typecodes for interfaces and valuetypes lack some of the + information in the corresponding Syntax Tree nodes. + + With these exceptions in mind, a typecode can be composed and + traversed in the same manner as a Syntax Tree, perhaps with + different classes than used to compose the ST itself. + + @@ boris: Ok, let me see if I got it right. So when typecode + is kept in parsed state (as opposite to binary) (btw, when + does it happen?) it makes sense to apply the same techniques + (if in fact not the same ST nodes and traversal mechs) as + for XIDL compilation. + +[IDEA]: We should be consistent with the way external compilers that we call + report errors. For now those are CPP and IDLC. + +Option Parser +------------- + +[IDEA]: Use Spirit parser framework to generate option parser. + +[IDEA]: Option Database is probably a singleton. + + @@ jeff: This is a good idea, especially when passing some of the + options to a preprocessor or spawned IDL compier. But I think we + will still need 'state' classes for the front and back ends (to + hold values set by command line options and default values) so + we can keep them decoupled). + + + @@ boris: I understand what you mean. Though I think we will be + able to do with one 'runtime database'. Each 'compiler module' + will be able to populate its 'namespace' with (1) default + values, (2) with module-specific options and (3) arbitrary + runtime information. I will present prototopy design shortly. + + +[IDEA]: It seems we will have to execute at least two external programs + as part of CIDLC execution: CPP and IDLC. Why wouldn't we follow + GCC specs model (gcc -dumpspecs). Here are candidates to be put into + specs: + + - default CPP name and options + - default IDLC name and options + - default file extensions and formats for different mappings + - other ideas? + +[IDEA]: Provide short and long option names (e.g. -o and --output-dir) + for every option (maybe except -I, -D, etc). + + +C Preprocessor Interfacing +-------------------------- + +[IDEA]: Embed/require GCC CPP + +[IDEA]: We need a new model of handling includes in CIDLC (as well as IDLC). + Right now I'm mentally testing a new model (thanks to Carlos for the + comments). Soon I will put the description here. + +[IDEA]: We cannot move cidl file being preprocessed to for example /tmp + as it's currently the case with IDLC. + +[IDEA]: Can we use pipes (ACE Pipes) portably to avoid temporary files? + (Kitty, you had some ideas about that?) + + + +IDL Compiler Interfacing +------------------------ + +[IDEA]: Same as for CPP: Can we use pipes? + + @@ jeff: check with Nanbor on this. I think there may be CCM/CIAO + use cases where we need the intermediate IDL file. + +[IDEA]: Will need a mechanism to pass options to IDLC from CIDLC command + line (would be nice to have this ability for CPP as well). + Something like -x in xterm? Better ideas? + + + +Scanner +------ + +[IDEA]: Use Spirit framework to construct scanner. The resulting sequence + can be sequence of objects? BTW, Spirit parser expects a "forward + iterator"-based scanner. So this basically mean that we may have to + keep the whole sequence in memory. BTW, this is another good reason + to have scanner: if we manage to make scanner a predictable parser + (i.e. no backtracking) then we don't have to keep the whole + preprocessed cidl file in memory. + + + +Parser +------ + +[IDEA]: Use Spirit framework to construct parser. + +[IDEA]: Define IDL grammar as a number of grammar capsules. This way it's + much easier to reuse/inherit even dynamically. Need to elaborate + this idea. + +[IDEA]: Use functors as semantic actions. This way we can specify (via + functor's data member) on which Syntax Tree they are working. + Bad side: semantic rules are defined during grammar construction. + However we can use a modification of the factory method pattern. + Better ideas? + + @@ jeff: I think ST node creation with a factory + is a good idea - another ST implementation could be plugged in, + as long as it uses a factory with the same method names. + + @@ boris: Right. In fact it's our 'improved' way of handling 'BE' + usecases. + + + +Syntax Tree +----------- + +[IDEA]: Use interface repository model as a base for Syntax Tree hierarchy. + +[IDEA]: Currently (in IDLC) symbol lookup is accomplished by AST navigation, + and is probably the biggest single bottleneck in performance. Perhaps + a separate symbol table would be preferable. Also, lookups could be + specialized, e.g., for declaration, for references, and perhaps a + third type for argument-related lookups. + +[NOTE]: If we are to implement symbol tables then we need to think how we + are going to inherit (extend) this tables. + +[NOTE]: Inheritance/supports graphs: these graphs need to be traversed at + several points in the back end. Currently they are rebuilt for each + use, using an n-squared algorithm. We could at least build them only + once for each interface/valuetype, perhaps even with a better + algorithm. It could be integrated into inheritance/supports error + checking at node creation time, which also be streamlined. + + @@ boris: Well, I think we should design our Syntax Tree so that + every interface/valuetype has a list (flat?) of interfaces it + inherits from/supports. + +[IDEA]: We will probably want to use factories to instantiate Syntax Tree + Nodes (STN). This will allow a concrete code generators to alter (i.e. + inherit off and extend) vanilla STNs (i.e. alternative to BE nodes + in current IDLC design). + + +Common Syntax Tree traversal Design Ideas/Decision +-------------------------------------------------- + +[IDEA] If we specify Syntax Tree traversal facility then we will be able + to specify (or even plug dynamically) Syntax Tree traversal agents + that may not only generate something but also annotate or modify + Syntax Tree. We are already using this technique for a number of + features (e.g. AMI, IDL3 extension, what else?) but all these agents + are hardwired inside TAO IDLC. If we have this facility then we will + be able to produce modular and highly extensible design. Notes: + + - Some traversal agents can change Syntax Tree so that it will be + unusable by some later traversal agents. So maybe the more + generic approach would be to produce new Syntax Tree? + + @@ jeff: Yes, say for example that we were using a common ST + representation for the IDL compiler and the IFR. We would not + want to send the extra AMI nodes to the IFR so in that case + simple modification of the ST might not be best. + +[IDEA] Need a generic name for "Syntax Tree Traversal Agents". What about + "Syntax Tree Traverser"? + + +Code Generation Stream +---------------------- + +[IDEA] Use language indentation engines for code generation (like a c-mode + in emacs). The idea is that code like this + + out << "long foo (long arg0, " << endl + << " long arg1) " << endl + << "{ " << endl + << " return arg0 + arg1; " << endl + << "} " << endl; + + will result in a generated code like this: + + namespace N + { + ... + + long foo (long arg0, + long arg1) + { + return arg0 + arg1; + } + + ... + } + + Note that no special actions were taken to ensure proper indentation. + Instead the stream's indentation engine is responsible for that. + The same mech can be used for different languages (e.g. XML). + + +Code Generators +--------------- + +[IDEA] It makes sense to establish a general concept of code generators. + "Executor Mapping Generator", "Executor Implementation Generator" + and "Skeleton Thunk Generator" would be a concrete code generators. + +[IDEA] Expression evaluation: currently the result (not the expression) + is generated, which may not always be necessary. + + @@ boris: I would say may not always be correct + + + However, for purposes of type coercion and other checking (such as + for positive integer values in string, array and sequence bounds) + evaluation must be done internally. + + @@ boris: note that evaluation is needed to only verify that things + are correct. You don't have to (shouldn't?) substitute original + (const) expression with what's been evaluated. + + + @@ jeff: it may be necessary in some cases to append 'f' or 'U' to + a generated number to avoid a C++ compiler warning. + + @@ boris: shouldn't this 'f' and 'U' be in IDL as well? + +[IDEA] I wonder if it's a good idea to use a separate pass over syntax tree + for semantic checking (e.g. type coercion, positive values for + sequence bounds). + + @@ jeff: This may hurt performance a little - more lookups - but it + will improve error reporting. + + @@ boris: As we dicussed earlier this pass could be used to do + 'semantic expansions' (e.g. calculate a flat list of interface's + children, etc). Also I don't think we should worry about speed + very much here (of course I don't say we have to be stupid ;-) + In fact if we are trading better design vs faster compilation + at this stage we should always go for better design. + + +Executor Mapping Generator +-------------------------- + + + +Executor Implementation Generator +-------------------------------- + +[IDEA]: Translate CIDL composition to C++ namespace. + + + +Skeleton Thunk Generator +------------------------ + + + + +Compiler driver +--------------- + + + +Vault +----- + +Some thoughts from Jeff that I are not directly related to CIDLC and are +rather current IDLC design defects: + +* AMI/AMH implied IDL: more can be done in the BE preprocessing pass, + hopefully eliminating a big chunk of the huge volume of AMI/AMH visitor + code. The implied IDL generated for CCM types, for example, leaves almost + nothing extra for the visitors to do. + +* Fwd decl redefinition: forward declaration nodes all initially contain a + heap-allocated dummy full-definition member, later replaced by a copy + of the full definition. This needs to be streamlined. + +* Memory leaks: inconsistent copying/passing policies make it almost + impossible to eliminate the huge number of leaks. The front end will be + more and more reused, and it may be desirable to make it executable as a + function call, in which case it will important to eliminate the leaks. + Perhaps copying of AST nodes can be eliminated with reference counting or + just with careful management, similarly for string identifiers and literals. + Destroy() methods have been put in all the node classes, and are called + recursively from the AST root at destruction time, but they are far from + doing a complete job. + +* Visitor instantiation: the huge visitor factory has already been much + reduced, and the huge enum of context state values is being reduced. + However there will still be an abundance of switch statements at nearly + every instance of visitor creation at scope nesting. We could make better + use of polymorphism to get rid of them. + +* Node narrowing: instead of the impenetrable macros we use now, we + could either generate valuetype-like downcast methods for the (C)IDL + types, or we could just use dynamic_cast. + +* Error reporting: making error messages more informative, and error recovery + could both be a lot better, as they are in most other IDL compilers. If a + recursive descent parser is used (such as Spirit), there is a simple + generic algorithm for error recovery. + + +* FE/BE node classes: if BE node classes are implemented at all, there should + be a complete separation of concerns - BE node classes should contain only + info related to code generation, and FE node classes should contain only + info related to the AST representation. As the front end becomes more + modular and reusable, this will become more and more necessary. + + @@ boris: It doesn't seem we will need two separate and parallel hierarhies. + +* Undefined fwd decls: now that we have dropped support for platforms without + namespaces, the code generated for fwd declarations not defined in the same + translation unit can be much improved, most likely by the elimination of + generated flat-name global methods, and perhaps other improvements as well. + +* Strategized code generation: many places now have either lots of + duplication, or an explosion of branching in a single visitor. Adding code + generation for use cases incrementally may give us an opportunity to + refactor and strategize it better. + +* Node generator: this class does nothing more than call 'new' and pass + unchanged the arguments it gets to the appropriate constructor - it can be + eliminated. + +* Virtual methods: there are many member functions in the IDL compiler that + are needlessly virtual. + +* Misc. leveraging: redesign of mechanisms listed above can have an effect + on other mechanisms, such as the handling of pragma prefix, typeprefix, and + reopened modules. diff --git a/TAO/CIAO/CIDLC/README b/TAO/CIAO/CIDLC/README new file mode 100644 index 00000000000..5cc8c2628ec --- /dev/null +++ b/TAO/CIAO/CIDLC/README @@ -0,0 +1,58 @@ +A place holder for CIAO's CIDL compiler. + +Please see some infromation about rationale behind naming convention at +the end of this file. + +* Executor mapping can be found at: Chapter 3.3 of formal/02-06-65 + + <filename>E.* + +* Templates for generic servants (container glue code) will be + available from $CIAO_ROOT/docs/templates/ + + These classes should be put into CIAO_GLUE namespace. + + <filename>G.* + +* Component descriptors: Chapter 6.4 of formal/02-06-65 + + <flatname>.ccd + + How to import this information into GME 2000? + +* I think it may be a good thing to do to be able to represent IDL + definition in XML format and be able to exchange (import/export) IDL + definitions via XML documents. What is the spec. for this? + +* Likewise, it would be cool to have component-aware IfR so we can + either import component definitions into GME tools through the XML + files, or allow GME tools to query component capabilities via IfR. + +* Need to fix the collocated valuetype passed by reference bug. + + +----------------------------------------------------------------- +Naming Convention. + +The CIAO's CIDL compiler directory was called CIDLC which stands for +CIDL Compiler (like CC stands for C Compiler, etc). This directory +wasn't called CCIDLC (CIAO's CIDL Compiler) or CIAO_CIDLC because +that would incure needless tautology since the directory structure +(.../CIAO/tools/CIDLC) already implies that it's CIAO's CIDC. + +Now about CIDLC executable name. The logical name of the excutable +implied by directory name (CIDLC) would be cidlc (like cc for +C Compiler). However there was a concern originally expressed by +Nanbor that cidlc is too generic name and when installed for +example as /usr/bin/cidlc would loose it's CIAO's context. + +At the same time recommended by FHS (Filesystem Hierarchy Standard) +package installation location is /opt/<package>. Thus if installation +directory would be for instance /opt/CIAO then naming CIDLC executable +ciao_cidlc would create needless tautology (i.e./opt/CIAO/bin/ciao_cidlc). +Though in my opinion there is nothing bad in having generic name like +cidlc (user always can execute cidlc --version) and as suggested by FHS +installations like /usr/bin/ciao_cidl are non-conformant the decision was +made to call CIAO's CIDLC execuatable ciao_cidlc. + +-boris diff --git a/TAO/CIAO/CIDLC/parser_examples/README b/TAO/CIAO/CIDLC/parser_examples/README new file mode 100644 index 00000000000..df0a141b2cc --- /dev/null +++ b/TAO/CIAO/CIDLC/parser_examples/README @@ -0,0 +1,70 @@ +// $Id$ + + Parser Examples + +This directory contains examples of a (C)IDL parser hierarchy using Spirit. Each +example (IDL2, IDL3 and CIDL) is in its own directory and has its own test file. +The Spirit files (these examples were compiled using Spirit 1.6.0) should be +unpacked so the directory spirit-1.6.0 is in the CIDLC directory. The builds +include too many files from Spirit to check them into the respository individually, +at least right now, but it is easy enough to download Spirit and unpack it. It +can be obtained at + +http://spirit.sourceforge.net/ + +Spirit 1.6.0 can be downloaded along with the necessary parts of Boost 1.30.0. + +All I have at the moment are MSVC 7.1 solution and project files. Makefiles will +be forthcoming, or interested parties can contribute them ;-). + +***************************************************************** + +To use mwc, make sure you have the environment variable + + SPIRIT_DIR + +defined to point to the location where Spirit library is available, +and generate using one of the following: + +MSVC6: mwc -type vc6 +MSVC7: mwc -type vc7 +UNIX: mwc + +***************************************************************** + + +Uncommenting + +#define SPIRIT_DEBUG + +at the top of any driver file and recompiling will cause debug info to be +generated as the test file is parsed. + +Each grammar file embeds the one it is a superset of. Some rules are overridden +in the superset grammar as necessary. As Boris suggests, we could create members +in superset grammars that are assigned references to rules from subset grammars, +thus enabling us to eliminate constructs like + +idl3.idl2.* + +and so forth, although I think it may be informative sometimes to see at a +glance which grammar a rule originates from. It will also be possible to +compile each grammar into a DLL, but so much of the code is template-based that +I'm not sure it will be worth it. I welcome suggestions and opinions about these +issues. + +The CIDL grammar is incomplete, including only the rules underneath +'composition'. We are using at present a much smaller subset than that, but it +was convenient to implement composition's subrules down to the terminals. + +The IDL2 grammar header file contains a simple utility parse() method derived +from the Spirit C grammar example. There is also a simple grammar for skipping +whitespace and comments, as well as #line and #pragma directives. All of these +features will need to be made more industrial-strength, and of course there +are many additional features that will need to be added - #includes, +error processing, etc. etc. + + +Jeff Parsons + +4/8/03
\ No newline at end of file diff --git a/TAO/CIAO/CIDLC/parser_examples/cidl/cidl.cpp b/TAO/CIAO/CIDLC/parser_examples/cidl/cidl.cpp new file mode 100644 index 00000000000..128ce40bd23 --- /dev/null +++ b/TAO/CIAO/CIDLC/parser_examples/cidl/cidl.cpp @@ -0,0 +1,29 @@ +// $Id$ + +#if defined(_DEBUG) +//#define SPIRIT_DEBUG +#endif // defined(_DEBUG) + +#include "cidl_grammar.h" + +int +main (int argc, char* argv[]) +{ +// Start grammar definition + cerr << "CIDL Grammar checker implemented with Spirit ..." << endl; + +// main driver code +cidl_grammar g; + + if (2 == argc) + { + parse (g, + argv[1]); + } + else + { + cerr << "No filename given" << endl; + } + + return 0; +} diff --git a/TAO/CIAO/CIDLC/parser_examples/cidl/cidl.mpc b/TAO/CIAO/CIDLC/parser_examples/cidl/cidl.mpc new file mode 100644 index 00000000000..6fbaaf8337d --- /dev/null +++ b/TAO/CIAO/CIDLC/parser_examples/cidl/cidl.mpc @@ -0,0 +1,11 @@ +project(cidl) : aceexe { + exename = cidl + includes += .. $(SPIRIT_DIR) $(SPIRIT_DIR)/miniboost + Source_Files { + cidl.cpp + cidl_grammar.cpp + } + Header_Files { + cidl_grammar.h + } +}
\ No newline at end of file diff --git a/TAO/CIAO/CIDLC/parser_examples/cidl/cidl.vcproj b/TAO/CIAO/CIDLC/parser_examples/cidl/cidl.vcproj new file mode 100644 index 00000000000..6f76134b619 --- /dev/null +++ b/TAO/CIAO/CIDLC/parser_examples/cidl/cidl.vcproj @@ -0,0 +1,145 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="7.10" + Name="cidl" + ProjectGUID="{8059742C-5DA9-4318-8D04-7938CBB0D538}" + Keyword="Win32Proj"> + <Platforms> + <Platform + Name="Win32"/> + </Platforms> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="Debug" + IntermediateDirectory="Debug" + ConfigurationType="1" + CharacterSet="2"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="..,$(SPIRIT_DIR),$(SPIRIT_DIR)\miniboost" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="TRUE" + BasicRuntimeChecks="0" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="FALSE" + DebugInformationFormat="3"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)/cidl.exe" + LinkIncremental="2" + GenerateDebugInformation="TRUE" + ProgramDatabaseFile="$(OutDir)/cidl.pdb" + SubSystem="1" + TargetMachine="1"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="Release" + IntermediateDirectory="Release" + ConfigurationType="1" + CharacterSet="2"> + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="4" + UsePrecompiledHeader="3" + WarningLevel="3" + Detect64BitPortabilityProblems="TRUE" + DebugInformationFormat="3"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)/cidl.exe" + LinkIncremental="1" + GenerateDebugInformation="TRUE" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> + <File + RelativePath=".\cidl.cpp"> + </File> + <File + RelativePath=".\cidl_grammar.cpp"> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="TRUE"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> + <File + RelativePath=".\cidl_grammar.h"> + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/TAO/CIAO/CIDLC/parser_examples/cidl/cidl_grammar.cpp b/TAO/CIAO/CIDLC/parser_examples/cidl/cidl_grammar.cpp new file mode 100644 index 00000000000..ce3a5ac1b40 --- /dev/null +++ b/TAO/CIAO/CIDLC/parser_examples/cidl/cidl_grammar.cpp @@ -0,0 +1,309 @@ +// $Id$ + +#include "idl3/idl3_grammar.cpp" + +#ifndef CIDL_GRAMMAR_C +#define CIDL_GRAMMAR_C + +template<typename ScannerT> +rule<ScannerT> const & +cidl_grammar::definition<ScannerT>::start (void) const +{ + return specification; +} + +template<typename ScannerT> +cidl_grammar::definition<ScannerT>::definition ( + cidl_grammar const & self + ) + : idl3 (self.idl3_g), + DOT ('.') +{ + keywords = + "composition", "entity", "process", "service", "session", + "catalog", "executor", "implements", "bindsTo", "storedOn", + "segment", "facet", "delegatesTo", "storage", "storagehome", + "proxy"; + + CIDL_COMPOSITION = strlit<>("composition"); + CIDL_ENTITY = strlit<>("entity"); + CIDL_PROCESS = strlit<>("process"); + CIDL_SERVICE = strlit<>("service"); + CIDL_SESSION = strlit<>("session"); + CIDL_CATALOG = strlit<>("catalog"); + CIDL_EXECUTOR = strlit<>("executor"); + CIDL_IMPLEMENTS = strlit<>("implements"); + CIDL_BINDS_TO = strlit<>("bindsTo"); + CIDL_STORED_ON = strlit<>("storedOn"); + CIDL_SEGMENT = strlit<>("segment"); + CIDL_FACET = strlit<>("facet"); + CIDL_DELEGATES_TO = strlit<>("delegatesTo"); + CIDL_STORAGE = strlit<>("storage"); + CIDL_STORAGEHOME = strlit<>("storagehome"); + CIDL_PROXY = strlit<>("proxy"); + + idl3.idl2.IDENTIFIER = + lexeme_d + [ + ((alpha_p | '_') >> *(alnum_p | '_')) + - (idl3.idl2.keywords >> anychar_p - (alnum_p | '_')) + - (idl3.keywords >> anychar_p - (alnum_p | '_')) + - (this->keywords >> anychar_p - (alnum_p | '_')) + ] + ; + + BOOST_SPIRIT_DEBUG_RULE (CIDL_COMPOSITION); + BOOST_SPIRIT_DEBUG_RULE (CIDL_ENTITY); + BOOST_SPIRIT_DEBUG_RULE (CIDL_PROCESS); + BOOST_SPIRIT_DEBUG_RULE (CIDL_SERVICE); + BOOST_SPIRIT_DEBUG_RULE (CIDL_SESSION); + BOOST_SPIRIT_DEBUG_RULE (CIDL_CATALOG); + BOOST_SPIRIT_DEBUG_RULE (CIDL_EXECUTOR); + BOOST_SPIRIT_DEBUG_RULE (CIDL_IMPLEMENTS); + BOOST_SPIRIT_DEBUG_RULE (CIDL_BINDS_TO); + BOOST_SPIRIT_DEBUG_RULE (CIDL_STORED_ON); + BOOST_SPIRIT_DEBUG_RULE (CIDL_SEGMENT); + BOOST_SPIRIT_DEBUG_RULE (CIDL_FACET); + BOOST_SPIRIT_DEBUG_RULE (CIDL_DELEGATES_TO); + BOOST_SPIRIT_DEBUG_RULE (CIDL_STORAGE); + BOOST_SPIRIT_DEBUG_RULE (CIDL_STORAGEHOME); + BOOST_SPIRIT_DEBUG_RULE (CIDL_PROXY); + + BOOST_SPIRIT_DEBUG_RULE (specification); + BOOST_SPIRIT_DEBUG_RULE (composition); + BOOST_SPIRIT_DEBUG_RULE (category); + BOOST_SPIRIT_DEBUG_RULE (composition_body); + BOOST_SPIRIT_DEBUG_RULE (catalog_use_dcl); + BOOST_SPIRIT_DEBUG_RULE (home_executor_def); + BOOST_SPIRIT_DEBUG_RULE (proxy_home_def); + BOOST_SPIRIT_DEBUG_RULE (catalog_dcl); + BOOST_SPIRIT_DEBUG_RULE (catalog_type_spec); + BOOST_SPIRIT_DEBUG_RULE (catalog_label); + BOOST_SPIRIT_DEBUG_RULE (home_executor_body); + BOOST_SPIRIT_DEBUG_RULE (home_impl_dcl); + BOOST_SPIRIT_DEBUG_RULE (abstract_storage_home_binding); + BOOST_SPIRIT_DEBUG_RULE (stored_on_dcl); + BOOST_SPIRIT_DEBUG_RULE (executor_def); + BOOST_SPIRIT_DEBUG_RULE (abstract_storage_home_delegation_spec); + BOOST_SPIRIT_DEBUG_RULE (executor_delegation_spec); + BOOST_SPIRIT_DEBUG_RULE (absract_spec); + BOOST_SPIRIT_DEBUG_RULE (home_type_name); + BOOST_SPIRIT_DEBUG_RULE (abstract_storage_home_name); + BOOST_SPIRIT_DEBUG_RULE (abstract_storage_hom_label); + BOOST_SPIRIT_DEBUG_RULE (executor_body); + BOOST_SPIRIT_DEBUG_RULE (executor_member); + BOOST_SPIRIT_DEBUG_RULE (segment_def); + BOOST_SPIRIT_DEBUG_RULE (feature_delegation_spec); + BOOST_SPIRIT_DEBUG_RULE (segment_member); + BOOST_SPIRIT_DEBUG_RULE (segment_persistence_dcl); + BOOST_SPIRIT_DEBUG_RULE (facet_dcl); + BOOST_SPIRIT_DEBUG_RULE (feature_delegation_list); + BOOST_SPIRIT_DEBUG_RULE (feature_delegation); + BOOST_SPIRIT_DEBUG_RULE (feature_name); + BOOST_SPIRIT_DEBUG_RULE (storage_member_name); + BOOST_SPIRIT_DEBUG_RULE (delegation_list); + BOOST_SPIRIT_DEBUG_RULE (delegation); + BOOST_SPIRIT_DEBUG_RULE (operation_name); + BOOST_SPIRIT_DEBUG_RULE (operation_list); + BOOST_SPIRIT_DEBUG_RULE (proxy_home_member); + BOOST_SPIRIT_DEBUG_RULE (home_delegation_spec); + + specification + = *idl3.import >> +idl3.idl2.declaration + ; + + idl3.idl2.declaration + = idl3.idl2.type_dcl >> idl3.idl2.SEMI + | idl3.idl2.const_dcl >> idl3.idl2.SEMI + | idl3.idl2.except_dcl >> idl3.idl2.SEMI + | idl3.idl2.interface >> idl3.idl2.SEMI + | idl3.idl2.module >> idl3.idl2.SEMI + | idl3.idl2.value >> idl3.idl2.SEMI + | idl3.type_id_dcl >> idl3.idl2.SEMI + | idl3.type_prefix_dcl >> idl3.idl2.SEMI + | idl3.event >> idl3.idl2.SEMI + | idl3.component >> idl3.idl2.SEMI + | idl3.home_dcl >> idl3.idl2.SEMI + | composition >> idl3.idl2.SEMI + ; + + composition + = CIDL_COMPOSITION >> category >> idl3.idl2.IDENTIFIER + >> idl3.idl2.LBRACE >> composition_body >> idl3.idl2.RBRACE + ; + + category + = CIDL_ENTITY + | CIDL_PROCESS + | CIDL_SERVICE + | CIDL_SESSION + ; + + composition_body + = !catalog_use_dcl >> home_executor_def >> !proxy_home_def + ; + + catalog_use_dcl + = idl3.IDL_USES >> CIDL_CATALOG >> idl3.idl2.LBRACE + >> +catalog_dcl >> idl3.idl2.RBRACE >> idl3.idl2.SEMI + ; + + catalog_dcl + = catalog_type_spec >> catalog_label + ; + + catalog_type_spec + = idl3.idl2.scoped_name + ; + + catalog_label + = idl3.idl2.IDENTIFIER + ; + + home_executor_def + = idl3.IDL_HOME >> CIDL_EXECUTOR >> idl3.idl2.IDENTIFIER + >> idl3.idl2.LBRACE >> home_executor_body + >> idl3.idl2.RBRACE >> idl3.idl2.SEMI + ; + + home_executor_body + = home_impl_dcl >> !abstract_storage_home_binding + >> !stored_on_dcl >> executor_def + >> !abstract_storage_home_delegation_spec + >> !executor_delegation_spec >> !abstract_spec + ; + + home_impl_dcl + = CIDL_IMPLEMENTS >> home_type_name >> idl3.idl2.SEMI + ; + + home_type_name + = idl3.idl2.scoped_name + ; + + abstract_storage_home_binding + = CIDL_BINDS_TO >> abstract_storage_home_name + >> idl3.idl2.SEMI + ; + + abstract_storage_home_name + = catalog_label >> DOT >> abstract_storage_home_label + ; + + abstract_storage_home_label + = idl3.idl2.IDENTIFIER + ; + + home_persistence_dcl + = CIDL_STORED_ON >> abstract_storage_home_name + >> idl3.idl2.SEMI + ; + + executor_def + = idl3.IDL_MANAGES >> idl3.idl2.IDENTIFIER + >> !executor_body >> idl3.idl2.SEMI + ; + + executor_body + = idl3.idl2.LBRACE >> +executor_member >> idl3.idl2.RBRACE + ; + + executor_member + = segment_def + | feature_delegation_spec + ; + + segment_def + = CIDL_SEGMENT >> idl3.idl2.IDENTIFIER >> idl3.idl2.LBRACE + >> +segment_member >> idl3.idl2.RBRACE + ; + + segment_member + = segment_persistence_dcl >> idl3.idl2.SEMI + | facet_dcl >> idl3.idl2.SEMI + ; + + segment_persistence_dcl + = CIDL_STORED_ON >> abstract_storage_home_name + >> idl3.idl2.SEMI + ; + + facet_dcl + = idl3.IDL_PROVIDES >> CIDL_FACET >> idl3.idl2.IDENTIFIER + >> *(idl3.idl2.COMMA >> idl3.idl2.IDENTIFIER) + ; + + feature_delegation_spec + = CIDL_DELEGATES_TO >> CIDL_STORAGE + >> feature_delegation_list + ; + + feature_delegation_list + = idl3.idl2.LPAREN >> feature_delegation + >> *(idl3.idl2.COMMA >> feature_delegation) + >> idl3.idl2.RPAREN + ; + + feature_delegation + = feature_name >> idl3.idl2.COLON >> storage_member_name + ; + + feature_name + = idl3.idl2.IDENTIFIER + ; + + storage_member_name + = idl3.idl2.IDENTIFIER + ; + + abstract_storage_home_delegation_spec + = CIDL_DELEGATES_TO >> idl3.idl2.IDL_ABSTRACT + >> CIDL_STORAGEHOME >> delegation_list >> idl3.idl2.SEMI + ; + + executor_delegation_spec + = CIDL_DELEGATES_TO >> CIDL_EXECUTOR >> delegation_list + >> idl3.idl2.SEMI + ; + + delegation_list + = idl3.idl2.LPAREN >> delegation + >> *(idl3.idl2.COMMA >> delegation) >> idl3.idl2.RPAREN + ; + + delegation + = operation_name >> !(idl3.idl2.COLON >> operation_name) + ; + + operation_name + = idl3.idl2.IDENTIFIER + ; + + abstract_spec + = idl3.idl2.IDL_ABSTRACT >> operation_list + >> idl3.idl2.SEMI + ; + + operation_list + = idl3.idl2.LPAREN >> operation_name + >> *(idl3.idl2.COMMA >> operation_name) + >> idl3.idl2.RPAREN + ; + + proxy_home_def + = CIDL_PROXY >> idl3.IDL_HOME >> idl3.idl2.IDENTIFIER + >> idl3.idl2.LBRACE >> +proxy_home_member + >> idl3.idl2.RBRACE >> idl3.idl2.SEMI + ; + + proxy_home_member + = home_delegation_spec >> idl3.idl2.SEMI + | abstract_spec + ; + + home_delegation_spec + = CIDL_DELEGATES_TO >> idl3.IDL_HOME >> delegation_list + ; +} + +#endif /* CIDL_GRAMMAR_C */ diff --git a/TAO/CIAO/CIDLC/parser_examples/cidl/cidl_grammar.h b/TAO/CIAO/CIDLC/parser_examples/cidl/cidl_grammar.h new file mode 100644 index 00000000000..7f7ba05d63c --- /dev/null +++ b/TAO/CIAO/CIDLC/parser_examples/cidl/cidl_grammar.h @@ -0,0 +1,54 @@ +// $Id$ +// +// IDL3 Grammar checker implemented with Spirit (http://spirit.sourceforge.net/) +// +#ifndef CIDL_GRAMMAR_H +#define CIDL_GRAMMAR_H + +#include "idl3/idl3_grammar.h" + +struct cidl_grammar : public grammar<cidl_grammar> +{ + idl3_grammar idl3_g; + + template <typename ScannerT> + struct definition + { + definition (cidl_grammar const & self); + rule<ScannerT> const & start (void) const; + + idl3_grammar::definition<ScannerT> idl3; + + symbols<> keywords; + + chlit<> + DOT; + + rule<ScannerT> + CIDL_COMPOSITION, CIDL_ENTITY, CIDL_PROCESS, CIDL_SERVICE, + CIDL_SESSION, CIDL_CATALOG, CIDL_EXECUTOR, CIDL_IMPLEMENTS, + CIDL_BINDS_TO, CIDL_STORED_ON, CIDL_SEGMENT, CIDL_FACET, + CIDL_DELEGATES_TO, CIDL_STORAGE, CIDL_STORAGEHOME, CIDL_PROXY; + + rule<ScannerT> + specification, composition, category, composition_body, + catalog_use_dcl, home_executor_def, proxy_home_def, + catalog_dcl, catalog_type_spec, catalog_label, + home_executor_body, home_impl_dcl, abstract_storage_home_binding, + stored_on_dcl, executor_def, home_persistence_dcl, + abstract_storage_home_delegation_spec, executor_delegation_spec, + abstract_spec, home_type_name, abstract_storage_home_name, + abstract_storage_home_label, executor_body, executor_member, + segment_def, feature_delegation_spec, segment_member, + segment_persistence_dcl, facet_dcl, feature_delegation_list, + feature_delegation, feature_name, storage_member_name, + delegation_list, delegation, operation_name, operation_list, + proxy_home_member, home_delegation_spec; + }; +}; + +#include "cidl_grammar.cpp" + +#endif /* CIDL_GRAMMAR_H */ + + diff --git a/TAO/CIAO/CIDLC/parser_examples/cidl/hello.cidl b/TAO/CIAO/CIDLC/parser_examples/cidl/hello.cidl new file mode 100644 index 00000000000..6366067f450 --- /dev/null +++ b/TAO/CIAO/CIDLC/parser_examples/cidl/hello.cidl @@ -0,0 +1,17 @@ +// $Id$ -*- IDL -*- + +// Component implementation definition of hello.idl. +// Since we currently don't have a CCIDL (CIAO CIDL) compiler available, +// we need to generate the servant implementation manually. + +import HelloWorld; // Do we need this? +import HelloHome; // This should import all related defitions. + +composition session hello_example +{ + home executor HelloHome_Exec + { + implements HelloHome; // This implies that HelloWorld_Exec + manages HelloWorld_Exec; // implements HellowWorld. + }; +}; diff --git a/TAO/CIAO/CIDLC/parser_examples/idl2/idl2.cpp b/TAO/CIAO/CIDLC/parser_examples/idl2/idl2.cpp new file mode 100644 index 00000000000..43471c7358b --- /dev/null +++ b/TAO/CIAO/CIDLC/parser_examples/idl2/idl2.cpp @@ -0,0 +1,27 @@ +// $Id$ + +#if defined(_DEBUG) +//#define SPIRIT_DEBUG +#endif // defined(_DEBUG) + +#include "idl2_grammar.h" + +int +main (int argc, char* argv[]) +{ + cerr << "IDL2 Grammar checker implemented with Spirit ..." << endl; + +idl2_grammar g; + + if (2 == argc) + { + parse (g, + argv[1]); + } + else + { + cerr << "No filename given" << endl; + } + + return 0; +} diff --git a/TAO/CIAO/CIDLC/parser_examples/idl2/idl2.mpc b/TAO/CIAO/CIDLC/parser_examples/idl2/idl2.mpc new file mode 100644 index 00000000000..4a2d79b80cb --- /dev/null +++ b/TAO/CIAO/CIDLC/parser_examples/idl2/idl2.mpc @@ -0,0 +1,11 @@ +project(idl2) : aceexe { + exename = idl2 + includes += .. $(SPIRIT_DIR) $(SPIRIT_DIR)/miniboost + Source_Files { + idl2.cpp + idl2_grammar.cpp + } + Header_Files { + idl2_grammar.h + } +}
\ No newline at end of file diff --git a/TAO/CIAO/CIDLC/parser_examples/idl2/idl2.vcproj b/TAO/CIAO/CIDLC/parser_examples/idl2/idl2.vcproj new file mode 100644 index 00000000000..4316ab47a21 --- /dev/null +++ b/TAO/CIAO/CIDLC/parser_examples/idl2/idl2.vcproj @@ -0,0 +1,152 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="7.10" + Name="idl2" + ProjectGUID="{81B2195C-C013-4A95-BA25-65C50E4D584A}" + Keyword="Win32Proj"> + <Platforms> + <Platform + Name="Win32"/> + </Platforms> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="Debug" + ConfigurationType="1" + CharacterSet="2"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="..,$(SPIRIT_DIR),$(SPIRIT_DIR)\miniboost" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="TRUE" + BasicRuntimeChecks="0" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="FALSE" + DebugInformationFormat="4"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)/idl2.exe" + LinkIncremental="2" + GenerateDebugInformation="TRUE" + ProgramDatabaseFile="$(OutDir)/idl2.pdb" + SubSystem="1" + TargetMachine="1"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="Release" + IntermediateDirectory="Release" + ConfigurationType="1" + CharacterSet="2"> + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="4" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="TRUE" + DebugInformationFormat="3"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)/c.exe" + LinkIncremental="1" + GenerateDebugInformation="TRUE" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> + <File + RelativePath=".\idl2.cpp"> + <FileConfiguration + Name="Debug|Win32"> + <Tool + Name="VCCLCompilerTool" + RuntimeLibrary="5"/> + </FileConfiguration> + </File> + <File + RelativePath=".\idl2_grammar.cpp"> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="TRUE"> + <Tool + Name="VCCLCompilerTool" + RuntimeLibrary="5"/> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> + <File + RelativePath=".\idl2_grammar.h"> + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/TAO/CIAO/CIDLC/parser_examples/idl2/idl2_grammar.cpp b/TAO/CIAO/CIDLC/parser_examples/idl2/idl2_grammar.cpp new file mode 100644 index 00000000000..e7a81cbecbc --- /dev/null +++ b/TAO/CIAO/CIDLC/parser_examples/idl2/idl2_grammar.cpp @@ -0,0 +1,973 @@ +// $Id$ + +#ifndef IDL2_GRAMMAR_C +#define IDL2_GRAMMAR_C + +#include "idl2_grammar.h" + +template<typename ScannerT> +rule<ScannerT> const & +skip_grammar::definition<ScannerT>::start (void) const +{ + return this->skip; +} + +template<typename ScannerT> +skip_grammar::definition<ScannerT>::definition ( + skip_grammar const & /* self */ + ) +{ + this->skip = + space_p // Skip whitespace + | "//" >> *(anychar_p - eol_p) >> eol_p +// | "//" >> *(anychar_p - '\n') >> !eol_p // C++ comment +// | comment_p("//") >> !end_p // Not on MSVC 7.1 + | comment_p("/*", "*/") // C comment + | comment_p("#line") // TODO + | comment_p("#pragma") + ; +} + +// ============================================================ + +template<typename ScannerT> +rule<ScannerT> const & +idl2_grammar::definition<ScannerT>::start (void) const +{ + return specification; +} + +template<typename ScannerT> +idl2_grammar::definition<ScannerT>::definition ( + idl2_grammar const & /* self */ + ) + : LSHIFT("<<"), RSHIFT(">>"), SCOPE("::"), + SEMI(';'), COMMA(','), COLON(':'), ASSIGN('='), + MINUS('-'), PLUS('+'), MULT('*'), DIV('/'), MOD('%'), + AND('&'), NOT('~'), OR('|'), XOR('^'), + LPAREN('('), RPAREN(')'), LANGLE('<'), RANGLE('>'), + LBRACK('['), RBRACK(']'), LBRACE('{'), RBRACE('}') +{ + // IDL2 keywords. + keywords = + "abstract", "any", "attribute", "boolean", "case", + "char", "const", "context", "custom", "default", + "double", "enum", "exception", "factory", "FALSE", + "fixed", "float", "in", "inout", "interface", + "local", "long", "module", "native", "Object", + "octet", "oneway", "out", "private", "public", + "raises", "readonly", "short", "sequence", "string", + "struct", "supports", "switch", "TRUE", "truncatable", + "typedef", "union", "unsigned", "ValueBase", + "valuetype", "void", "wchar", "wstring"; + + // IDL2 tokens. + IDL_ABSTRACT = strlit<>("abstract"); + IDL_ANY = strlit<>("any"); + IDL_ATTRIBUTE = strlit<>("attribute"); + IDL_BOOLEAN = strlit<>("boolean"); + IDL_CASE = strlit<>("case"); + IDL_CHAR = strlit<>("char"); + IDL_CONST = strlit<>("const"); + IDL_CONTEXT = strlit<>("context"); + IDL_CUSTOM = strlit<>("custom"); + IDL_DEFAULT = strlit<>("default"); + IDL_DOUBLE = strlit<>("double"); + IDL_ENUM = strlit<>("enum"); + IDL_EXCEPTION = strlit<>("exception"); + IDL_FACTORY = strlit<>("factory"); + IDL_FALSE = strlit<>("FALSE"); + IDL_FIXED = strlit<>("fixed"); + IDL_FLOAT = strlit<>("float"); + IDL_IN = strlit<>("in"); + IDL_INOUT = strlit<>("inout"); + IDL_INTERFACE = strlit<>("interface"); + IDL_LOCAL = strlit<>("local"); + IDL_LONG = strlit<>("long"); + IDL_MODULE = strlit<>("module"); + IDL_NATIVE = strlit<>("native"); + IDL_OBJECT = strlit<>("Object"); + IDL_OCTET = strlit<>("octet"); + IDL_ONEWAY = strlit<>("oneway"); + IDL_OUT = strlit<>("out"); + IDL_PRIVATE = strlit<>("private"); + IDL_PUBLIC = strlit<>("public"); + IDL_RAISES = strlit<>("raises"); + IDL_READONLY = strlit<>("readonly"); + IDL_SHORT = strlit<>("short"); + IDL_SEQUENCE = strlit<>("sequence"); + IDL_STRING = strlit<>("string"); + IDL_STRUCT = strlit<>("struct"); + IDL_SUPPORTS = strlit<>("supports"); + IDL_SWITCH = strlit<>("switch"); + IDL_TRUE = strlit<>("TRUE"); + IDL_TRUNCATABLE = strlit<>("truncatable"); + IDL_TYPEDEF = strlit<>("typedef"); + IDL_UNION = strlit<>("union"); + IDL_UNSIGNED = strlit<>("unsigned"); + IDL_VALUEBASE = strlit<>("ValueBase"); + IDL_VALUETYPE = strlit<>("valuetype"); + IDL_VOID = strlit<>("void"); + IDL_WCHAR = strlit<>("wchar"); + IDL_WSTRING = strlit<>("wstring"); + + // IDL2 identifiers. + IDENTIFIER = + lexeme_d + [ + ((alpha_p | '_') >> *(alnum_p | '_')) + - (keywords >> anychar_p - (alnum_p | '_')) + ] + ; + + // Character literals. + CHARACTER_LITERAL = + anychar_p + ; + + // Wide character literals. + WIDE_CHARACTER_LITERAL = + lexeme_d + [ + chlit<>('L') >> anychar_p + ] + ; + + // String literals. + STRING_LITERAL_PART = + lexeme_d + [ + chlit<>('\"') >> + *(strlit<>("\"\"") | anychar_p - chlit<>('\"')) >> + chlit<>('\"') + ] + ; + + STRING_LITERAL = +STRING_LITERAL_PART; + + // Wide string literals. + WIDE_STRING_LITERAL_PART = + chlit<>('L') >> STRING_LITERAL_PART + ; + + WIDE_STRING_LITERAL = +WIDE_STRING_LITERAL_PART; + + // Integer literals. + INTEGER_LITERAL_HEX = + lexeme_d + [ + chlit<>('0') + >> nocase_d[chlit<>('x')] + >> +xdigit_p + >> !nocase_d[chlit<>('l') | chlit<>('u')] + ] + ; + + INTEGER_LITERAL_OCT = + lexeme_d + [ + chlit<>('0') + >> +range<>('0', '7') + >> !nocase_d[chlit<>('l') | chlit<>('u')] + ] + ; + + INTEGER_LITERAL_DEC = + lexeme_d + [ + +digit_p + >> !nocase_d[chlit<>('l') | chlit<>('u')] + ] + ; + + INTEGER_LITERAL = + INTEGER_LITERAL_HEX + | INTEGER_LITERAL_OCT + | INTEGER_LITERAL_DEC + ; + + // Floating point literals. + // 12345[eE][+-]?123[lLfF]? + FLOATING_PT_LITERAL_1 = + lexeme_d + [ + +digit_p + >> (chlit<>('e') | chlit<>('E')) + >> !(chlit<>('+') | chlit<>('-')) + >> +digit_p + >> !nocase_d[chlit<>('l') | chlit<>('f')] + ] + ; + + // .123([eE][+-]?123)?[lLfF]? + FLOATING_PT_LITERAL_2 = + lexeme_d + [ + chlit<>('.') + >> +digit_p + >> !( + (chlit<>('e') | chlit<>('E')) + >> !(chlit<>('+') | chlit<>('-')) + >> +digit_p + ) + >> !nocase_d[chlit<>('l') | chlit<>('f')] + ] + ; + + // 12345.(123)?([eE][+-]?123)?[lLfF]? + FLOATING_PT_LITERAL_3 = + lexeme_d + [ + +digit_p + >> chlit<>('.') + >> *digit_p + >> !( + (chlit<>('e') | chlit<>('E')) + >> !(chlit<>('+') | chlit<>('-')) + >> +digit_p + ) + >> !nocase_d[chlit<>('l') | chlit<>('f')] + ] + ; + + FLOATING_PT_LITERAL = + FLOATING_PT_LITERAL_1 + | FLOATING_PT_LITERAL_2 + | FLOATING_PT_LITERAL_3 + ; + + // Boolean literals. + BOOLEAN_LITERAL = + IDL_TRUE + | IDL_FALSE + ; + + // Debug support for terminals. + BOOST_SPIRIT_DEBUG_RULE (IDL_ABSTRACT); + BOOST_SPIRIT_DEBUG_RULE (IDL_ANY); + BOOST_SPIRIT_DEBUG_RULE (IDL_ATTRIBUTE); + BOOST_SPIRIT_DEBUG_RULE (IDL_BOOLEAN); + BOOST_SPIRIT_DEBUG_RULE (IDL_CASE); + BOOST_SPIRIT_DEBUG_RULE (IDL_CHAR); + BOOST_SPIRIT_DEBUG_RULE (IDL_CONST); + BOOST_SPIRIT_DEBUG_RULE (IDL_CONTEXT); + BOOST_SPIRIT_DEBUG_RULE (IDL_CUSTOM); + BOOST_SPIRIT_DEBUG_RULE (IDL_DEFAULT); + BOOST_SPIRIT_DEBUG_RULE (IDL_DOUBLE); + BOOST_SPIRIT_DEBUG_RULE (IDL_ENUM); + BOOST_SPIRIT_DEBUG_RULE (IDL_EXCEPTION); + BOOST_SPIRIT_DEBUG_RULE (IDL_FACTORY); + BOOST_SPIRIT_DEBUG_RULE (IDL_FALSE); + BOOST_SPIRIT_DEBUG_RULE (IDL_FIXED); + BOOST_SPIRIT_DEBUG_RULE (IDL_FLOAT); + BOOST_SPIRIT_DEBUG_RULE (IDL_IN); + BOOST_SPIRIT_DEBUG_RULE (IDL_INOUT); + BOOST_SPIRIT_DEBUG_RULE (IDL_INTERFACE); + BOOST_SPIRIT_DEBUG_RULE (IDL_LOCAL); + BOOST_SPIRIT_DEBUG_RULE (IDL_LONG); + BOOST_SPIRIT_DEBUG_RULE (IDL_MODULE); + BOOST_SPIRIT_DEBUG_RULE (IDL_NATIVE); + BOOST_SPIRIT_DEBUG_RULE (IDL_OBJECT); + BOOST_SPIRIT_DEBUG_RULE (IDL_OCTET); + BOOST_SPIRIT_DEBUG_RULE (IDL_ONEWAY); + BOOST_SPIRIT_DEBUG_RULE (IDL_OUT); + BOOST_SPIRIT_DEBUG_RULE (IDL_PRIVATE); + BOOST_SPIRIT_DEBUG_RULE (IDL_PUBLIC); + BOOST_SPIRIT_DEBUG_RULE (IDL_RAISES); + BOOST_SPIRIT_DEBUG_RULE (IDL_READONLY); + BOOST_SPIRIT_DEBUG_RULE (IDL_SHORT); + BOOST_SPIRIT_DEBUG_RULE (IDL_SEQUENCE); + BOOST_SPIRIT_DEBUG_RULE (IDL_STRING); + BOOST_SPIRIT_DEBUG_RULE (IDL_STRUCT); + BOOST_SPIRIT_DEBUG_RULE (IDL_SWITCH); + BOOST_SPIRIT_DEBUG_RULE (IDL_TRUE); + BOOST_SPIRIT_DEBUG_RULE (IDL_TRUNCATABLE); + BOOST_SPIRIT_DEBUG_RULE (IDL_TYPEDEF); + BOOST_SPIRIT_DEBUG_RULE (IDL_UNION); + BOOST_SPIRIT_DEBUG_RULE (IDL_UNSIGNED); + BOOST_SPIRIT_DEBUG_RULE (IDL_VALUEBASE); + BOOST_SPIRIT_DEBUG_RULE (IDL_VALUETYPE); + BOOST_SPIRIT_DEBUG_RULE (IDL_VOID); + BOOST_SPIRIT_DEBUG_RULE (IDL_WCHAR); + BOOST_SPIRIT_DEBUG_RULE (IDL_WSTRING); + BOOST_SPIRIT_DEBUG_RULE (IDENTIFIER); + BOOST_SPIRIT_DEBUG_RULE (STRING_LITERAL); + BOOST_SPIRIT_DEBUG_RULE (WIDE_STRING_LITERAL); + BOOST_SPIRIT_DEBUG_RULE (CHARACTER_LITERAL); + BOOST_SPIRIT_DEBUG_RULE (WIDE_CHARACTER_LITERAL); + BOOST_SPIRIT_DEBUG_RULE (INTEGER_LITERAL_HEX); + BOOST_SPIRIT_DEBUG_RULE (INTEGER_LITERAL_OCT); + BOOST_SPIRIT_DEBUG_RULE (INTEGER_LITERAL_DEC); + BOOST_SPIRIT_DEBUG_RULE (INTEGER_LITERAL); + BOOST_SPIRIT_DEBUG_RULE (FLOATING_PT_LITERAL_1); + BOOST_SPIRIT_DEBUG_RULE (FLOATING_PT_LITERAL_2); + BOOST_SPIRIT_DEBUG_RULE (FLOATING_PT_LITERAL_3); + BOOST_SPIRIT_DEBUG_RULE (FLOATING_PT_LITERAL); + BOOST_SPIRIT_DEBUG_RULE (BOOLEAN_LITERAL); + + // Debug support for non-terminals. + BOOST_SPIRIT_DEBUG_RULE (specification); + BOOST_SPIRIT_DEBUG_RULE (declaration); + BOOST_SPIRIT_DEBUG_RULE (type_dcl); + BOOST_SPIRIT_DEBUG_RULE (module); + BOOST_SPIRIT_DEBUG_RULE (const_type); + BOOST_SPIRIT_DEBUG_RULE (integer_type); + BOOST_SPIRIT_DEBUG_RULE (signed_int); + BOOST_SPIRIT_DEBUG_RULE (unsigned_int); + BOOST_SPIRIT_DEBUG_RULE (signed_short_int); + BOOST_SPIRIT_DEBUG_RULE (signed_long_int); + BOOST_SPIRIT_DEBUG_RULE (signed_longlong_int); + BOOST_SPIRIT_DEBUG_RULE (unsigned_short_int); + BOOST_SPIRIT_DEBUG_RULE (unsigned_long_int); + BOOST_SPIRIT_DEBUG_RULE (unsigned_longlong_int); + BOOST_SPIRIT_DEBUG_RULE (char_type); + BOOST_SPIRIT_DEBUG_RULE (wide_char_type); + BOOST_SPIRIT_DEBUG_RULE (boolean_type); + BOOST_SPIRIT_DEBUG_RULE (floating_pt_type); + BOOST_SPIRIT_DEBUG_RULE (string_type); + BOOST_SPIRIT_DEBUG_RULE (wide_string_type); + BOOST_SPIRIT_DEBUG_RULE (fixed_pt_const_type); + BOOST_SPIRIT_DEBUG_RULE (scoped_name); + BOOST_SPIRIT_DEBUG_RULE (scoped_name_helper); + BOOST_SPIRIT_DEBUG_RULE (octet_type); + BOOST_SPIRIT_DEBUG_RULE (const_exp); + BOOST_SPIRIT_DEBUG_RULE (or_expr); + BOOST_SPIRIT_DEBUG_RULE (xor_expr); + BOOST_SPIRIT_DEBUG_RULE (and_expr); + BOOST_SPIRIT_DEBUG_RULE (shift_expr); + BOOST_SPIRIT_DEBUG_RULE (add_expr); + BOOST_SPIRIT_DEBUG_RULE (mult_expr); + BOOST_SPIRIT_DEBUG_RULE (unary_expr); + BOOST_SPIRIT_DEBUG_RULE (unary_operator); + BOOST_SPIRIT_DEBUG_RULE (primary_expr); + BOOST_SPIRIT_DEBUG_RULE (literal); + BOOST_SPIRIT_DEBUG_RULE (positive_int_const); + BOOST_SPIRIT_DEBUG_RULE (type_declarator); + BOOST_SPIRIT_DEBUG_RULE (struct_type); + BOOST_SPIRIT_DEBUG_RULE (union_type); + BOOST_SPIRIT_DEBUG_RULE (enum_type); + BOOST_SPIRIT_DEBUG_RULE (simple_declarator); + BOOST_SPIRIT_DEBUG_RULE (constr_forward_decl); + BOOST_SPIRIT_DEBUG_RULE (type_spec); + BOOST_SPIRIT_DEBUG_RULE (declarators); + BOOST_SPIRIT_DEBUG_RULE (simple_type_spec); + BOOST_SPIRIT_DEBUG_RULE (constr_type_spec); + BOOST_SPIRIT_DEBUG_RULE (base_type_spec); + BOOST_SPIRIT_DEBUG_RULE (template_type_spec); + BOOST_SPIRIT_DEBUG_RULE (any_type); + BOOST_SPIRIT_DEBUG_RULE (object_type); + BOOST_SPIRIT_DEBUG_RULE (value_base_type); + BOOST_SPIRIT_DEBUG_RULE (fixed_pt_type); + BOOST_SPIRIT_DEBUG_RULE (sequence_type); + BOOST_SPIRIT_DEBUG_RULE (declarator); + BOOST_SPIRIT_DEBUG_RULE (complex_declarator); + BOOST_SPIRIT_DEBUG_RULE (array_declarator); + BOOST_SPIRIT_DEBUG_RULE (member_list); + BOOST_SPIRIT_DEBUG_RULE (member); + BOOST_SPIRIT_DEBUG_RULE (switch_type_spec); + BOOST_SPIRIT_DEBUG_RULE (switch_body); + BOOST_SPIRIT_DEBUG_RULE (case_decl); + BOOST_SPIRIT_DEBUG_RULE (case_label); + BOOST_SPIRIT_DEBUG_RULE (element_spec); + BOOST_SPIRIT_DEBUG_RULE (enumerator); + BOOST_SPIRIT_DEBUG_RULE (fixed_array_size); + BOOST_SPIRIT_DEBUG_RULE (const_exp_helper); + BOOST_SPIRIT_DEBUG_RULE (or_expr_helper); + BOOST_SPIRIT_DEBUG_RULE (xor_expr_helper); + BOOST_SPIRIT_DEBUG_RULE (and_expr_helper); + BOOST_SPIRIT_DEBUG_RULE (shift_expr_helper); + BOOST_SPIRIT_DEBUG_RULE (add_expr_helper); + BOOST_SPIRIT_DEBUG_RULE (mult_expr_helper); + BOOST_SPIRIT_DEBUG_RULE (except_dcl); + BOOST_SPIRIT_DEBUG_RULE (interface); + BOOST_SPIRIT_DEBUG_RULE (interface_dcl); + BOOST_SPIRIT_DEBUG_RULE (forward_dcl); + BOOST_SPIRIT_DEBUG_RULE (interface_header); + BOOST_SPIRIT_DEBUG_RULE (interface_body); + BOOST_SPIRIT_DEBUG_RULE (interface_name); + BOOST_SPIRIT_DEBUG_RULE (interface_inheritance_spec); + BOOST_SPIRIT_DEBUG_RULE (export); + BOOST_SPIRIT_DEBUG_RULE (attr_dcl); + BOOST_SPIRIT_DEBUG_RULE (op_dcl); + BOOST_SPIRIT_DEBUG_RULE (param_type_spec); + BOOST_SPIRIT_DEBUG_RULE (op_attribute); + BOOST_SPIRIT_DEBUG_RULE (op_type_spec); + BOOST_SPIRIT_DEBUG_RULE (parameter_dcls); + BOOST_SPIRIT_DEBUG_RULE (raises_expr); + BOOST_SPIRIT_DEBUG_RULE (context_expr); + BOOST_SPIRIT_DEBUG_RULE (param_dcl); + BOOST_SPIRIT_DEBUG_RULE (param_attribute); + BOOST_SPIRIT_DEBUG_RULE (value); + BOOST_SPIRIT_DEBUG_RULE (value_dcl); + BOOST_SPIRIT_DEBUG_RULE (value_abs_dcl); + BOOST_SPIRIT_DEBUG_RULE (value_box_dcl); + BOOST_SPIRIT_DEBUG_RULE (value_forward_dcl); + BOOST_SPIRIT_DEBUG_RULE (value_inheritance_spec); + BOOST_SPIRIT_DEBUG_RULE (value_name); + BOOST_SPIRIT_DEBUG_RULE (value_header); + BOOST_SPIRIT_DEBUG_RULE (value_element); + BOOST_SPIRIT_DEBUG_RULE (state_member); + BOOST_SPIRIT_DEBUG_RULE (init_dcl); + BOOST_SPIRIT_DEBUG_RULE (init_param_decls); + BOOST_SPIRIT_DEBUG_RULE (init_param_decl); + BOOST_SPIRIT_DEBUG_RULE (init_param_attribute); + + // Rules. + + // Parser start symbol. + specification + = +declaration + ; + + declaration + = type_dcl >> SEMI + | const_dcl >> SEMI + | except_dcl >> SEMI + | interface >> SEMI + | module >> SEMI + | value >> SEMI + ; + + module + = IDL_MODULE >> IDENTIFIER + >> LBRACE >> +declaration >> RBRACE + ; + + interface + = longest_d + [ + interface_dcl + | forward_dcl + ] + ; + + interface_dcl + = interface_header >> LBRACE >> interface_body >> RBRACE + ; + + forward_dcl + = !(IDL_ABSTRACT | IDL_LOCAL) >> IDL_INTERFACE >> IDENTIFIER + ; + + interface_header + = !(IDL_ABSTRACT | IDL_LOCAL) + >> IDL_INTERFACE >> IDENTIFIER + >> !interface_inheritance_spec + ; + + interface_body + = *export + ; + + export + = type_dcl >> SEMI + | const_dcl >> SEMI + | except_dcl >> SEMI + | attr_dcl >> SEMI + | op_dcl >> SEMI + ; + + interface_inheritance_spec + = COLON >> interface_name >> *(COMMA >> interface_name) + ; + + interface_name + = scoped_name + ; + + scoped_name + = !SCOPE >> IDENTIFIER >> scoped_name_helper + ; + + scoped_name_helper + = SCOPE >> IDENTIFIER >> scoped_name_helper + | epsilon_p + ; + + value + = longest_d + [ + value_dcl + | value_abs_dcl + | value_box_dcl + | value_forward_dcl + ] + ; + + value_forward_dcl + = !IDL_ABSTRACT >> IDL_VALUETYPE >> IDENTIFIER + ; + + value_box_dcl + = IDL_VALUETYPE >> IDENTIFIER >> type_spec + ; + + value_abs_dcl + = IDL_ABSTRACT >> IDL_VALUETYPE >> IDENTIFIER + >> !value_inheritance_spec >> LBRACE + >> *export >> RBRACE + ; + + value_dcl + = value_header >> LBRACE >> *value_element >> RBRACE + ; + + value_header + = !IDL_CUSTOM >> IDL_VALUETYPE >> IDENTIFIER + >> !value_inheritance_spec + ; + + value_inheritance_spec + = !(COLON >> !IDL_TRUNCATABLE >> value_name + >> *(COMMA >> value_name)) + >> !(IDL_SUPPORTS >> interface_name + >> *(COMMA >> interface_name )) + ; + + value_name + = scoped_name + ; + + value_element + = export + | state_member + | init_dcl + ; + + state_member + = (IDL_PUBLIC | IDL_PRIVATE) + >> type_spec >> declarators >> SEMI + ; + + init_dcl + = IDL_FACTORY >> IDENTIFIER >> LPAREN + >> !init_param_decls >> RPAREN >> SEMI + ; + + init_param_decls + = init_param_decl >> *(COMMA >> init_param_decl) + ; + + init_param_decl + = init_param_attribute >> param_type_spec >> simple_declarator + ; + + init_param_attribute + = IDL_IN + ; + + const_dcl + = IDL_CONST >> const_type + >> IDENTIFIER >> ASSIGN >> const_exp + ; + + const_type + = integer_type + | char_type + | wide_char_type + | boolean_type + | floating_pt_type + | string_type + | wide_string_type + | fixed_pt_const_type + | scoped_name + | octet_type + ; + + const_exp + = or_expr + ; + + or_expr + = xor_expr >> or_expr_helper + ; + + or_expr_helper + = OR >> xor_expr + | epsilon_p + ; + + xor_expr + = and_expr >> xor_expr_helper + ; + + xor_expr_helper + = XOR >> xor_expr + | epsilon_p + ; + + and_expr + = shift_expr >> and_expr_helper + ; + + and_expr_helper + = AND >> and_expr + | epsilon_p + ; + + shift_expr + = add_expr >> shift_expr_helper + ; + + shift_expr_helper + = LSHIFT >> shift_expr + | RSHIFT >> shift_expr + | epsilon_p + ; + + add_expr + = mult_expr >> add_expr_helper + ; + + add_expr_helper + = PLUS >> add_expr + | MINUS >> add_expr + | epsilon_p + ; + + mult_expr + = unary_expr >> mult_expr_helper + ; + + mult_expr_helper + = MULT >> mult_expr + | DIV >> mult_expr + | MOD >> mult_expr + | epsilon_p + ; + + unary_expr + = !unary_operator >> primary_expr + ; + + unary_operator + = PLUS + | MINUS + | NOT + ; + + primary_expr + = longest_d + [ + scoped_name + | literal + | LPAREN >> const_exp >> RPAREN + ] + ; + + literal + = longest_d + [ + INTEGER_LITERAL + | STRING_LITERAL + | WIDE_STRING_LITERAL + | CHARACTER_LITERAL + | WIDE_CHARACTER_LITERAL +// | FIXED_PT_LITERAL + | FLOATING_PT_LITERAL + | BOOLEAN_LITERAL + ] + ; + + positive_int_const + = const_exp + ; + + type_dcl + = IDL_TYPEDEF >> type_declarator + | struct_type + | union_type + | enum_type + | IDL_NATIVE >> simple_declarator + | constr_forward_decl + ; + + type_declarator + = type_spec >> declarators + ; + + type_spec + = simple_type_spec + | constr_type_spec + ; + + simple_type_spec + = base_type_spec + | template_type_spec + | scoped_name + ; + + base_type_spec + = floating_pt_type + | integer_type + | char_type + | wide_char_type + | boolean_type + | octet_type + | any_type + | object_type + | value_base_type + ; + + template_type_spec + = sequence_type + | string_type + | wide_string_type + | fixed_pt_type + ; + + constr_type_spec + = struct_type + | union_type + | enum_type + ; + + declarators + = declarator >> *(COMMA >> declarator) + ; + + declarator + = longest_d + [ + simple_declarator + | complex_declarator + ] + ; + + complex_declarator + = array_declarator + ; + + simple_declarator + = IDENTIFIER + ; + + + floating_pt_type + = IDL_FLOAT + | IDL_DOUBLE + | IDL_LONG >> IDL_DOUBLE + ; + + integer_type + = signed_int + | unsigned_int + ; + + signed_int + = longest_d + [ + signed_short_int + | signed_long_int + | signed_longlong_int + ] + ; + + unsigned_int + = longest_d + [ + unsigned_short_int + | unsigned_long_int + | unsigned_longlong_int + ] + ; + + signed_short_int + = IDL_SHORT + ; + + signed_long_int + = IDL_LONG + ; + + signed_longlong_int + = IDL_LONG >> IDL_LONG + ; + + unsigned_short_int + = IDL_UNSIGNED >> IDL_SHORT + ; + + unsigned_long_int + = IDL_UNSIGNED >> IDL_LONG + ; + + unsigned_longlong_int + = IDL_UNSIGNED >> IDL_LONG >> IDL_LONG + ; + + char_type + = IDL_CHAR + ; + + wide_char_type + = IDL_WCHAR + ; + + boolean_type + = IDL_BOOLEAN + ; + + octet_type + = IDL_OCTET + ; + + any_type + = IDL_ANY + ; + + object_type + = IDL_OBJECT + ; + + struct_type + = IDL_STRUCT >> IDENTIFIER + >> LBRACE >> member_list >> RBRACE + ; + + member_list + = +member + ; + + member + = type_spec >> declarators >> SEMI + ; + + union_type + = IDL_UNION >> IDENTIFIER >> IDL_SWITCH + >> LPAREN >> switch_type_spec >> RPAREN + >> LBRACE >> switch_body >> RBRACE + ; + + switch_type_spec + = integer_type + | char_type + | boolean_type + | enum_type + | scoped_name + ; + + switch_body + = +case_decl + ; + + case_decl + = +case_label >> element_spec >> SEMI + ; + + case_label + = IDL_CASE >> const_exp >> COLON + | IDL_DEFAULT >> COLON + ; + + element_spec + = type_spec >> declarator + ; + + enum_type + = IDL_ENUM >> IDENTIFIER + >> LBRACE >> enumerator + >> *(COMMA >> enumerator) >> RBRACE + ; + + enumerator + = IDENTIFIER + ; + + sequence_type + = IDL_SEQUENCE >> LANGLE >> simple_type_spec + >> !(COMMA >> positive_int_const) >> RANGLE + ; + + string_type + = IDL_STRING >> !(LANGLE >> positive_int_const >> RANGLE) + ; + + wide_string_type + = IDL_WSTRING + ; + + array_declarator + = IDENTIFIER >> +fixed_array_size + ; + + fixed_array_size + = LBRACK >> positive_int_const >> RBRACK + ; + + attr_dcl + = !IDL_READONLY >> IDL_ATTRIBUTE >> param_type_spec + >> simple_declarator >> *(COMMA >> simple_declarator) + ; + + except_dcl + = IDL_EXCEPTION >> IDENTIFIER + >> LBRACE >> *member >> RBRACE + ; + + op_dcl + = !op_attribute >> op_type_spec >> IDENTIFIER + >> parameter_dcls >> !raises_expr >> !context_expr + ; + + op_attribute + = IDL_ONEWAY + ; + + op_type_spec + = param_type_spec + | IDL_VOID + ; + + parameter_dcls + = LPAREN >> !(param_dcl >> *(COMMA >> param_dcl)) >> RPAREN + ; + + param_dcl + = param_attribute >> param_type_spec >> simple_declarator + ; + + param_attribute + = longest_d + [ + IDL_IN + | IDL_INOUT + ] + | IDL_OUT + ; + + raises_expr + = IDL_RAISES >> LPAREN >> scoped_name + >> *(COMMA >> scoped_name) + >> RPAREN + ; + + context_expr + = IDL_CONTEXT >> LPAREN >> STRING_LITERAL + >> *(COMMA >> STRING_LITERAL) + >> RPAREN + ; + + param_type_spec + = base_type_spec + | string_type + | wide_string_type + | scoped_name + ; + + fixed_pt_type + = IDL_FIXED >> LANGLE + >> positive_int_const >> COMMA >> positive_int_const + >> RANGLE + ; + + fixed_pt_const_type + = IDL_FIXED + ; + + value_base_type + = IDL_VALUEBASE + ; +} + +#endif /* IDL2_GRAMMAR_C */ diff --git a/TAO/CIAO/CIDLC/parser_examples/idl2/idl2_grammar.h b/TAO/CIAO/CIDLC/parser_examples/idl2/idl2_grammar.h new file mode 100644 index 00000000000..d7d7832f10d --- /dev/null +++ b/TAO/CIAO/CIDLC/parser_examples/idl2/idl2_grammar.h @@ -0,0 +1,166 @@ +// $Id$ +// +// IDL2 Grammar checker implemented with Spirit (http://spirit.sourceforge.net/) +// +#ifndef IDL2_GRAMMAR_H +#define IDL2_GRAMMAR_H + +#include <iostream> +#include <fstream> +#include <vector> + +// This is caused by using 'this' in a base member initialization. +#pragma warning (disable: 4355) + +#include <boost/spirit/core.hpp> +#include <boost/spirit/utility.hpp> +#include <boost/spirit/symbols.hpp> + +using namespace boost::spirit; +using namespace std; + +// Global parsing utility function. +template<typename GrammarT> +void +parse (GrammarT const & g, + char const * filename) +{ + ifstream in (filename); + + if (!in) + { + cerr << "Could not open input file: " << filename << endl; + return; + } + + // Turn off white space skipping on the stream. + in.unsetf (ios::skipws); + + vector<char> vec; + std::copy (istream_iterator<char> (in), + istream_iterator<char> (), + std::back_inserter(vec)); + + vector<char>::const_iterator start = vec.begin (); + vector<char>::const_iterator end = vec.end (); + + skip_grammar skip; + + parse_info<vector<char>::const_iterator> result = parse (start, + end, + g, + skip); + + if (result.full) + { + cerr << filename << " Parses OK" << endl; + } + else + { + cerr << filename << " Fails Parsing" << endl; + + for (int i = 0; i < 50; i++) + { + if (result.stop == end) + { + break; + } + + cerr << *result.stop++; + } + + cerr << endl; + } +} + +// We use this to skip whitespace, comments, and whatever else. +struct skip_grammar : public grammar<skip_grammar> +{ + template <typename ScannerT> + struct definition + { + definition (skip_grammar const & self); + rule<ScannerT> const & start (void) const; + + rule<ScannerT> skip; + }; +}; + +struct idl2_grammar : public grammar<idl2_grammar> +{ + template <typename ScannerT> + struct definition + { + definition (idl2_grammar const & /* self */); + rule<ScannerT> const & start (void) const; + + // Keyword table. + symbols<> keywords; + + // Non-alphanumeric terminals. + strlit<> + LSHIFT, RSHIFT, SCOPE; + chlit<> + SEMI, COMMA, COLON, ASSIGN, MINUS, PLUS, MULT, DIV, MOD, + AND, NOT, OR, XOR, LPAREN, RPAREN, LANGLE, RANGLE, + LBRACK, RBRACK, LBRACE, RBRACE; + + // IDL2 keywords. + rule<ScannerT> + IDL_ABSTRACT, IDL_ANY, IDL_ATTRIBUTE, IDL_BOOLEAN, + IDL_CASE, IDL_CHAR, IDL_CONST, IDL_CONTEXT, IDL_CUSTOM, + IDL_DEFAULT, IDL_DOUBLE, IDL_ENUM, IDL_EXCEPTION, + IDL_FACTORY, IDL_FALSE, IDL_FIXED, IDL_FLOAT, + IDL_IN, IDL_INOUT, IDL_INTERFACE, IDL_LOCAL, IDL_LONG, + IDL_MODULE, IDL_NATIVE, IDL_OBJECT, IDL_OCTET, + IDL_ONEWAY, IDL_OUT, IDL_PRIVATE, IDL_PUBLIC, + IDL_RAISES, IDL_READONLY, IDL_SHORT, IDL_SEQUENCE, + IDL_STRING, IDL_STRUCT, IDL_SUPPORTS, IDL_SWITCH, + IDL_TRUE, IDL_TRUNCATABLE, IDL_TYPEDEF, IDL_UNION, + IDL_UNSIGNED, IDL_VALUEBASE, IDL_VALUETYPE, IDL_VOID, + IDL_WCHAR, IDL_WSTRING; + + // Identifier and literals. + rule<ScannerT> + IDENTIFIER, + CHARACTER_LITERAL, WIDE_CHARACTER_LITERAL, STRING_LITERAL_PART, + STRING_LITERAL, WIDE_STRING_LITERAL_PART, WIDE_STRING_LITERAL, + INTEGER_LITERAL_HEX, INTEGER_LITERAL_OCT, INTEGER_LITERAL_DEC, + INTEGER_LITERAL, FLOATING_PT_LITERAL_1, FLOATING_PT_LITERAL_2, + FLOATING_PT_LITERAL_3, FLOATING_PT_LITERAL, BOOLEAN_LITERAL; + + // IDL2 non-terminals. + rule<ScannerT> + specification, declaration, const_dcl, module, const_type, type_dcl, + integer_type, signed_int, unsigned_int, signed_short_int, + signed_long_int, signed_longlong_int, unsigned_short_int, + unsigned_long_int, unsigned_longlong_int, + char_type, wide_char_type, boolean_type, floating_pt_type, + string_type, wide_string_type, fixed_pt_const_type, scoped_name, + scoped_name_helper, octet_type, const_exp, or_expr, xor_expr, + and_expr, shift_expr, add_expr, mult_expr, unary_expr, + unary_operator, primary_expr, literal, fixed_pt_literal, + positive_int_const, type_declarator, struct_type, union_type, + enum_type, simple_declarator, constr_forward_decl, type_spec, + declarators, simple_type_spec, constr_type_spec, base_type_spec, + template_type_spec, any_type, object_type, value_base_type, + fixed_pt_type, sequence_type, declarator, complex_declarator, + array_declarator, member_list, member, switch_type_spec, + switch_body, case_decl, case_label, element_spec, enumerator, + fixed_array_size, const_exp_helper, or_expr_helper, + xor_expr_helper, and_expr_helper, shift_expr_helper, add_expr_helper, + mult_expr_helper, except_dcl, interface, interface_dcl, + forward_dcl, interface_header, interface_body, interface_name, + interface_inheritance_spec, export, attr_dcl, op_dcl, + param_type_spec, op_attribute, op_type_spec, parameter_dcls, + raises_expr, context_expr, param_dcl, param_attribute, value, + value_dcl, value_abs_dcl, value_box_dcl, value_forward_dcl, + value_inheritance_spec, value_name, value_header, value_element, + state_member, init_dcl, init_param_decls, init_param_decl, + init_param_attribute; + }; +}; + +#include "idl2_grammar.cpp" + +#endif /* IDL2_GRAMMAR_H */ diff --git a/TAO/CIAO/CIDLC/parser_examples/idl2/test_idl2.idl b/TAO/CIAO/CIDLC/parser_examples/idl2/test_idl2.idl new file mode 100644 index 00000000000..6d49f808cb4 --- /dev/null +++ b/TAO/CIAO/CIDLC/parser_examples/idl2/test_idl2.idl @@ -0,0 +1,103 @@ +// $Id$ -*- IDL -*- + +module outer +{ + const string<34> hello = "Goodbye"; + const long foolong = -321; + + module inner + { + typedef unsigned long long fooulonglong; + typedef fooulonglong tdef2; + typedef sequence<tdef2> tdef2seq; + typedef long foolongarray[(3 * (-3 + 9 - 1) / 3 % 2) << 1]; + + struct foostruct + { + short shmem; + any anymem; + Object objmem; + sequence<string<12>, 25> seqmem; + inner::tdef2 tdef2mem[6][5][3]; + }; + + enum fooenum + { + ONE, + TWO + }; + + union foounion switch (fooenum) + { + case TWO: + case ONE: long lmem; + default: string strmem; + }; + + native foonative; + const double foodouble = 321.1416E-12f; + + exception fooemptyexcept {}; + exception fooexcept + { + string message; + }; + + abstract interface foofwd; + abstract interface foofwd {}; + local interface foofulliface : fooemptyiface, foofwd + { + const short shconst = 5; + typedef foofwd footdef; + struct ifacestruct {string str;}; + exception ifaceexcept {}; + attribute long attr; + readonly attribute foounion foounionattr; + void emptyop (); + fooenum fullop (in string strinarg, + in foofwd inobjarg, + inout foounion inoutarg, + out foostruct outarg) + raises (::outer::inner::fooexcept, + fooemptyexcept) + context ("fee", "fi", "fo", "fum"); + oneway void onewayop (in inner::foonative inarg); + }; + + abstract valuetype absval {}; + valuetype vfwd; + valuetype vfwd + { + const short vshconst = 5; + typedef foofwd vfootdef; + struct valstruct {string str;}; + exception valexcept {}; + attribute long vattr; + readonly attribute foounion vfoounionattr; + void vemptyop (); + fooenum fullop (in string strinarg, + in foofwd inobjarg, + inout foounion inoutarg, + out foostruct outarg) + raises (::outer::inner::fooexcept, + fooemptyexcept) + context ("fee", "fi", "fo", "fum"); + }; + + valuetype child : vfwd, absval + { + }; + + valuetype supporter supports fooemptyiface, foofwd + { + }; + + custom valuetype child_supporter : vfwd, absval supports foofwd + { + private foostruct foostructmember; + public long longmember; + public outer::inner::vfwd valmember; + factory cs_factory (in long longarg, in string stringarg); + }; + }; +}; diff --git a/TAO/CIAO/CIDLC/parser_examples/idl3/idl3.cpp b/TAO/CIAO/CIDLC/parser_examples/idl3/idl3.cpp new file mode 100644 index 00000000000..fb9f58de958 --- /dev/null +++ b/TAO/CIAO/CIDLC/parser_examples/idl3/idl3.cpp @@ -0,0 +1,29 @@ +// $Id$ + +#if defined(_DEBUG) +//#define SPIRIT_DEBUG +#endif // defined(_DEBUG) + +#include "idl3_grammar.h" + +int +main (int argc, char* argv[]) +{ +// Start grammar definition + cerr << "IDL3 Grammar checker implemented with Spirit ..." << endl; + +// main driver code +idl3_grammar g; + + if (2 == argc) + { + parse (g, + argv[1]); + } + else + { + cerr << "No filename given" << endl; + } + + return 0; +} diff --git a/TAO/CIAO/CIDLC/parser_examples/idl3/idl3.mpc b/TAO/CIAO/CIDLC/parser_examples/idl3/idl3.mpc new file mode 100644 index 00000000000..73f2c2f4d8f --- /dev/null +++ b/TAO/CIAO/CIDLC/parser_examples/idl3/idl3.mpc @@ -0,0 +1,11 @@ +project(idl3) : aceexe { + exename = idl3 + includes += .. $(SPIRIT_DIR) $(SPIRIT_DIR)/miniboost + Source_Files { + idl3.cpp + idl3_grammar.cpp + } + Header_Files { + idl3_grammar.h + } +}
\ No newline at end of file diff --git a/TAO/CIAO/CIDLC/parser_examples/idl3/idl3.vcproj b/TAO/CIAO/CIDLC/parser_examples/idl3/idl3.vcproj new file mode 100644 index 00000000000..7c201828ee3 --- /dev/null +++ b/TAO/CIAO/CIDLC/parser_examples/idl3/idl3.vcproj @@ -0,0 +1,153 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="7.10" + Name="idl3" + ProjectGUID="{5F3379E4-2944-4FEE-A04A-CD04C3B66401}" + RootNamespace="idl3" + Keyword="ManagedCProj"> + <Platforms> + <Platform + Name="Win32"/> + </Platforms> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + CharacterSet="2" + ManagedExtensions="TRUE"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="..,$(SPIRIT_DIR),$(SPIRIT_DIR)\miniboost" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="FALSE" + BasicRuntimeChecks="0" + RuntimeLibrary="1" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)\idl3.exe" + LinkIncremental="2" + GenerateDebugInformation="TRUE" + AssemblyDebug="1" + ProgramDatabaseFile="$(OutDir)/idl3.pdb" + SubSystem="1"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + CharacterSet="2" + ManagedExtensions="TRUE"> + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="WIN32;NDEBUG" + MinimalRebuild="FALSE" + RuntimeLibrary="0" + UsePrecompiledHeader="3" + WarningLevel="3" + DebugInformationFormat="3"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)\$(ProjectName).exe" + LinkIncremental="1" + GenerateDebugInformation="TRUE"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> + <File + RelativePath=".\idl3.cpp"> + <FileConfiguration + Name="Debug|Win32"> + <Tool + Name="VCCLCompilerTool" + MinimalRebuild="TRUE" + BasicRuntimeChecks="3" + RuntimeLibrary="5" + DebugInformationFormat="4" + CompileAsManaged="0"/> + </FileConfiguration> + </File> + <File + RelativePath=".\idl3_grammar.cpp"> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="TRUE"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> + <File + RelativePath=".\idl3_grammar.h"> + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/TAO/CIAO/CIDLC/parser_examples/idl3/idl3_grammar.cpp b/TAO/CIAO/CIDLC/parser_examples/idl3/idl3_grammar.cpp new file mode 100644 index 00000000000..2aafc491ce4 --- /dev/null +++ b/TAO/CIAO/CIDLC/parser_examples/idl3/idl3_grammar.cpp @@ -0,0 +1,349 @@ +// $Id$ + +#include "idl3_grammar.h" + +#ifndef IDL3_GRAMMAR_C +#define IDL3_GRAMMAR_C + +template<typename ScannerT> +rule<ScannerT> const & +idl3_grammar::definition<ScannerT>::start (void) const +{ + return specification; +} + +template<typename ScannerT> +idl3_grammar::definition<ScannerT>::definition ( + idl3_grammar const & self + ) + : idl2 (self.idl2_g) +{ + keywords = + "import", "typeid", "typeprefix", "getraises", "setraises", + "component", "provides", "uses", "multiple", "emits", + "publishes", "consumes", "home", "manages", "primarykey", + "finder", "eventtype"; + + IDL_IMPORT = strlit<>("import"); + IDL_TYPEID = strlit<>("typeid"); + IDL_TYPEPREFIX = strlit<>("typeprefix"); + IDL_GETRAISES = strlit<>("getraises"); + IDL_SETRAISES = strlit<>("setraises"); + IDL_COMPONENT = strlit<>("component"); + IDL_PROVIDES = strlit<>("provides"); + IDL_USES = strlit<>("uses"); + IDL_MULTIPLE = strlit<>("multiple"); + IDL_EMITS = strlit<>("emits"); + IDL_PUBLISHES = strlit<>("publishes"); + IDL_CONSUMES = strlit<>("consumes"); + IDL_HOME = strlit<>("home"); + IDL_MANAGES = strlit<>("manages"); + IDL_PRIMARYKEY = strlit<>("primarykey"); + IDL_FINDER = strlit<>("finder"); + IDL_EVENTTYPE = strlit<>("eventtype"); + + idl2.IDENTIFIER = + lexeme_d + [ + ((alpha_p | '_') >> *(alnum_p | '_')) + - (idl2.keywords >> anychar_p - (alnum_p | '_')) + - (this->keywords >> anychar_p - (alnum_p | '_')) + ] + ; + + BOOST_SPIRIT_DEBUG_RULE (IDL_IMPORT); + BOOST_SPIRIT_DEBUG_RULE (IDL_TYPEID); + BOOST_SPIRIT_DEBUG_RULE (IDL_TYPEPREFIX); + BOOST_SPIRIT_DEBUG_RULE (IDL_GETRAISES); + BOOST_SPIRIT_DEBUG_RULE (IDL_SETRAISES); + BOOST_SPIRIT_DEBUG_RULE (IDL_COMPONENT); + BOOST_SPIRIT_DEBUG_RULE (IDL_PROVIDES); + BOOST_SPIRIT_DEBUG_RULE (IDL_USES); + BOOST_SPIRIT_DEBUG_RULE (IDL_MULTIPLE); + BOOST_SPIRIT_DEBUG_RULE (IDL_EMITS); + BOOST_SPIRIT_DEBUG_RULE (IDL_PUBLISHES); + BOOST_SPIRIT_DEBUG_RULE (IDL_CONSUMES); + BOOST_SPIRIT_DEBUG_RULE (IDL_HOME); + BOOST_SPIRIT_DEBUG_RULE (IDL_MANAGES); + BOOST_SPIRIT_DEBUG_RULE (IDL_PRIMARYKEY); + BOOST_SPIRIT_DEBUG_RULE (IDL_FINDER); + BOOST_SPIRIT_DEBUG_RULE (IDL_EVENTTYPE); + + BOOST_SPIRIT_DEBUG_RULE (specification); + BOOST_SPIRIT_DEBUG_RULE (import); + BOOST_SPIRIT_DEBUG_RULE (imported_scope); + BOOST_SPIRIT_DEBUG_RULE (type_id_dcl); + BOOST_SPIRIT_DEBUG_RULE (type_prefix_dcl); + BOOST_SPIRIT_DEBUG_RULE (readonly_attr_spec); + BOOST_SPIRIT_DEBUG_RULE (attr_spec); + BOOST_SPIRIT_DEBUG_RULE (readonly_attr_declarator); + BOOST_SPIRIT_DEBUG_RULE (attr_declarator); + BOOST_SPIRIT_DEBUG_RULE (attr_raises_expr); + BOOST_SPIRIT_DEBUG_RULE (get_excep_expr); + BOOST_SPIRIT_DEBUG_RULE (set_excep_expr); + BOOST_SPIRIT_DEBUG_RULE (exception_list); + BOOST_SPIRIT_DEBUG_RULE (component); + BOOST_SPIRIT_DEBUG_RULE (component_dcl); + BOOST_SPIRIT_DEBUG_RULE (component_forward_dcl); + BOOST_SPIRIT_DEBUG_RULE (component_header); + BOOST_SPIRIT_DEBUG_RULE (component_body); + BOOST_SPIRIT_DEBUG_RULE (component_inheritance_spec); + BOOST_SPIRIT_DEBUG_RULE (component_export); + BOOST_SPIRIT_DEBUG_RULE (supported_interface_spec); + BOOST_SPIRIT_DEBUG_RULE (component_export); + BOOST_SPIRIT_DEBUG_RULE (provides_dcl); + BOOST_SPIRIT_DEBUG_RULE (uses_dcl); + BOOST_SPIRIT_DEBUG_RULE (emits_dcl); + BOOST_SPIRIT_DEBUG_RULE (publishes_dcl); + BOOST_SPIRIT_DEBUG_RULE (consumes_dcl); + BOOST_SPIRIT_DEBUG_RULE (interface_type); + BOOST_SPIRIT_DEBUG_RULE (home_dcl); + BOOST_SPIRIT_DEBUG_RULE (home_header); + BOOST_SPIRIT_DEBUG_RULE (home_body); + BOOST_SPIRIT_DEBUG_RULE (home_inheritance_spec); + BOOST_SPIRIT_DEBUG_RULE (home_export); + BOOST_SPIRIT_DEBUG_RULE (primary_key_spec); + BOOST_SPIRIT_DEBUG_RULE (factory_dcl); + BOOST_SPIRIT_DEBUG_RULE (finder_dcl); + BOOST_SPIRIT_DEBUG_RULE (event); + BOOST_SPIRIT_DEBUG_RULE (event_dcl); + BOOST_SPIRIT_DEBUG_RULE (event_abs_dcl); + BOOST_SPIRIT_DEBUG_RULE (event_forward_dcl); + BOOST_SPIRIT_DEBUG_RULE (event_header); + + specification + = *import >> +idl2.declaration + ; + + idl2.declaration + = idl2.type_dcl >> idl2.SEMI + | idl2.const_dcl >> idl2.SEMI + | idl2.except_dcl >> idl2.SEMI + | idl2.interface >> idl2.SEMI + | idl2.module >> idl2.SEMI + | idl2.value >> idl2.SEMI + | type_id_dcl >> idl2.SEMI + | type_prefix_dcl >> idl2.SEMI + | event >> idl2.SEMI + | component >> idl2.SEMI + | home_dcl >> idl2.SEMI + ; + + idl2.export + = idl2.type_dcl >> idl2.SEMI + | idl2.const_dcl >> idl2.SEMI + | idl2.except_dcl >> idl2.SEMI + | idl2.attr_dcl >> idl2.SEMI + | idl2.op_dcl >> idl2.SEMI + | type_id_dcl >> idl2.SEMI + | type_prefix_dcl >> idl2.SEMI + ; + + idl2.init_dcl + = idl2.IDL_FACTORY >> idl2.IDENTIFIER >> idl2.LPAREN + >> !idl2.init_param_decls >> idl2.RPAREN + >> !idl2.raises_expr >> idl2.SEMI + ; + + idl2.attr_dcl + = readonly_attr_spec + | attr_spec + ; + + import + = IDL_IMPORT >> imported_scope >> idl2.SEMI + ; + + imported_scope + = idl2.scoped_name + | idl2.STRING_LITERAL + ; + + type_id_dcl + = IDL_TYPEID >> idl2.scoped_name >> idl2.STRING_LITERAL + ; + + type_prefix_dcl + = IDL_TYPEPREFIX >> idl2.scoped_name >> idl2.STRING_LITERAL + ; + + readonly_attr_spec + = idl2.IDL_READONLY >> idl2.IDL_ATTRIBUTE + >> idl2.param_type_spec + >> readonly_attr_declarator + ; + + readonly_attr_declarator + = idl2.simple_declarator >> idl2.raises_expr + | idl2.simple_declarator + >> *(idl2.COMMA >> idl2.simple_declarator) + ; + + attr_spec + = idl2.IDL_ATTRIBUTE >> idl2.param_type_spec + >> attr_declarator + ; + + attr_declarator + = idl2.simple_declarator >> attr_raises_expr + | idl2.simple_declarator + >> *(idl2.COMMA >> idl2.simple_declarator) + ; + + attr_raises_expr + = get_excep_expr >> !set_excep_expr + | set_excep_expr + ; + + get_excep_expr + = IDL_GETRAISES >> exception_list + ; + + set_excep_expr + = IDL_SETRAISES >> exception_list + ; + + exception_list + = idl2.LPAREN >> idl2.scoped_name + >> *(idl2.COMMA >> idl2.scoped_name) >> idl2.RPAREN + ; + + component + = component_dcl + | component_forward_dcl + ; + + component_forward_dcl + = IDL_COMPONENT >> idl2.IDENTIFIER + ; + + component_dcl + = component_header >> idl2.LBRACE + >> component_body >> idl2.RBRACE + ; + + component_header + = IDL_COMPONENT >> idl2.IDENTIFIER + >> !component_inheritance_spec + >> !supported_interface_spec + ; + + supported_interface_spec + = idl2.IDL_SUPPORTS >> idl2.scoped_name + >> *(idl2.COMMA >> idl2.scoped_name) + ; + + component_inheritance_spec + = idl2.COLON >> idl2.scoped_name + ; + + component_body + = *component_export + ; + + component_export + = provides_dcl >> idl2.SEMI + | uses_dcl >> idl2.SEMI + | emits_dcl >> idl2.SEMI + | publishes_dcl >> idl2.SEMI + | consumes_dcl >> idl2.SEMI + | idl2.attr_dcl >> idl2.SEMI + ; + + provides_dcl + = IDL_PROVIDES >> interface_type >> idl2.IDENTIFIER + ; + + interface_type + = idl2.scoped_name + | idl2.IDL_OBJECT + ; + + uses_dcl + = IDL_USES >> !IDL_MULTIPLE + >> interface_type >> idl2.IDENTIFIER + ; + + emits_dcl + = IDL_EMITS >> idl2.scoped_name >> idl2.IDENTIFIER + ; + + publishes_dcl + = IDL_PUBLISHES >> idl2.scoped_name >> idl2.IDENTIFIER + ; + + consumes_dcl + = IDL_CONSUMES >> idl2.scoped_name >> idl2.IDENTIFIER + ; + + home_dcl + = home_header >> home_body + ; + + home_header + = IDL_HOME >> idl2.IDENTIFIER + >> !home_inheritance_spec + >> !supported_interface_spec + >> IDL_MANAGES >> idl2.scoped_name + >> !primary_key_spec + ; + + home_inheritance_spec + = idl2.COLON >> idl2.scoped_name + ; + + primary_key_spec + = IDL_PRIMARYKEY >> idl2.scoped_name + ; + + home_body + = idl2.LBRACE >> *home_export >> idl2.RBRACE + ; + + home_export + = idl2.export + | factory_dcl >> idl2.SEMI + | finder_dcl >> idl2.SEMI + ; + + factory_dcl + = idl2.IDL_FACTORY >> idl2.IDENTIFIER >> idl2.LPAREN + >> !idl2.init_param_decls >>idl2.RPAREN + >> !idl2.raises_expr + ; + + finder_dcl + = IDL_FINDER >> idl2.IDENTIFIER >> idl2.LPAREN + >> !idl2.init_param_decls >>idl2.RPAREN + >> !idl2.raises_expr + ; + + event + = event_dcl + | event_abs_dcl + | event_forward_dcl + ; + + event_forward_dcl + = !idl2.IDL_ABSTRACT >> IDL_EVENTTYPE >> idl2.IDENTIFIER + ; + + event_abs_dcl + = !idl2.IDL_ABSTRACT >> IDL_EVENTTYPE >> idl2.IDENTIFIER + >> !idl2.value_inheritance_spec >> idl2.LBRACE + >> *idl2.export >> idl2.RBRACE + ; + + event_dcl + = event_header >> idl2.LBRACE >> *idl2.value_element + >> idl2.RBRACE + ; + + event_header + = !idl2.IDL_CUSTOM >> IDL_EVENTTYPE >> idl2.IDENTIFIER + >> !idl2.value_inheritance_spec + ; +} + +#endif /* IDL3_GRAMMAR_C */ + diff --git a/TAO/CIAO/CIDLC/parser_examples/idl3/idl3_grammar.h b/TAO/CIAO/CIDLC/parser_examples/idl3/idl3_grammar.h new file mode 100644 index 00000000000..5473f470bc2 --- /dev/null +++ b/TAO/CIAO/CIDLC/parser_examples/idl3/idl3_grammar.h @@ -0,0 +1,51 @@ +// $Id$ +// +// IDL3 Grammar checker implemented with Spirit (http://spirit.sourceforge.net/) +// +#ifndef IDL3_GRAMMAR_H +#define IDL3_GRAMMAR_H + +#include "idl2/idl2_grammar.h" + +struct idl3_grammar : public grammar<idl3_grammar> +{ + idl2_grammar idl2_g; + + template <typename ScannerT> + struct definition + { + definition (idl3_grammar const & self); + rule<ScannerT> const & start (void) const; + + idl2_grammar::definition<ScannerT> idl2; + + symbols<> keywords; + + rule<ScannerT> + IDL_IMPORT, IDL_TYPEID, IDL_TYPEPREFIX, IDL_GETRAISES, + IDL_SETRAISES, IDL_COMPONENT, IDL_PROVIDES, IDL_USES, + IDL_MULTIPLE, IDL_EMITS, IDL_PUBLISHES, IDL_CONSUMES, + IDL_HOME, IDL_MANAGES, IDL_PRIMARYKEY, IDL_FINDER, + IDL_EVENTTYPE; + + rule<ScannerT> + specification, + import, imported_scope, type_id_dcl, type_prefix_dcl, + readonly_attr_spec, attr_spec, readonly_attr_declarator, + attr_declarator, attr_raises_expr, get_excep_expr, + set_excep_expr, exception_list, component, component_dcl, + component_forward_dcl, component_header, component_body, + component_inheritance_spec, component_export, + supported_interface_spec, provides_dcl, uses_dcl, emits_dcl, + publishes_dcl, consumes_dcl, interface_type, home_dcl, + home_header, home_body, home_inheritance_spec, home_export, + primary_key_spec, factory_dcl, finder_dcl, event, event_dcl, + event_abs_dcl, event_forward_dcl, event_header; + + }; +}; + +#include "idl3_grammar.cpp" + +#endif /* IDL3_GRAMMAR_H */ + diff --git a/TAO/CIAO/CIDLC/parser_examples/idl3/test_idl3.idl b/TAO/CIAO/CIDLC/parser_examples/idl3/test_idl3.idl new file mode 100644 index 00000000000..a2d3a3d4bd6 --- /dev/null +++ b/TAO/CIAO/CIDLC/parser_examples/idl3/test_idl3.idl @@ -0,0 +1,73 @@ +// $Id$ -*- IDL -*- + +import "groovy.idl"; +import skaboodliator::bingabay; + +module mod +{ + interface dummy {}; + + interface foo + { + exception dingdong {}; + exception ramalama {}; + readonly attribute long foo_attr, foo_attr2; + readonly attribute mod::foo self_attr raises (dingdong); + attribute string get_str getraises (ramalama, dingdong); + attribute string set_str setraises (ramalama, dingdong); + attribute long bb getraises (dingdong, ramalama) + setraises (ramalama); + typeid dingdong "THE:witch/is:dead"; + }; + + valuetype val + { + factory f () raises (dingdong, ramalama); + private string pstr; + }; + + abstract eventtype efwd; + abstract eventtype efwd supports foo + { + attribute string pstr; + }; + + custom eventtype cust + { + public string pstr; + factory f () raises (dingdong, ramalama); + }; + + eventtype empty_ev : cust, efwd supports foo, dummy + { + }; + + component bar; + component emptybar supports foo + { + }; + + component fullbar : emptybar + { + attribute val cc getraises (dingdong, ramalama) + setraises (ramalama, dingdong); + provides pfoo foo; + uses ufoo foo; + uses multiple umfoo foo; + emits emitter efwd; + publishes pcust cust; + consumes cempty empty_ev; + }; + + home fullhome manages fullbar + { + void op (); + factory finit (in string strarg, in wstring wstrarg) + raises (dingdong); + finder flookup () raises (ramalama, dingdong); + }; + + typeid foo "ABRA:cadabra/hocus/pocus:1.234"; +}; + +typeprefix mod "dre.vanderbilt.edu"; diff --git a/TAO/CIAO/CIDLC/parser_examples/parser_examples.sln b/TAO/CIAO/CIDLC/parser_examples/parser_examples.sln new file mode 100644 index 00000000000..51237fdef2e --- /dev/null +++ b/TAO/CIAO/CIDLC/parser_examples/parser_examples.sln @@ -0,0 +1,37 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "idl2", "idl2\idl2.vcproj", "{81B2195C-C013-4A95-BA25-65C50E4D584A}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "idl3", "idl3\idl3.vcproj", "{5F3379E4-2944-4FEE-A04A-CD04C3B66401}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cidl", "cidl\cidl.vcproj", "{8059742C-5DA9-4318-8D04-7938CBB0D538}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {81B2195C-C013-4A95-BA25-65C50E4D584A}.Debug.ActiveCfg = Debug|Win32 + {81B2195C-C013-4A95-BA25-65C50E4D584A}.Debug.Build.0 = Debug|Win32 + {81B2195C-C013-4A95-BA25-65C50E4D584A}.Release.ActiveCfg = Release|Win32 + {81B2195C-C013-4A95-BA25-65C50E4D584A}.Release.Build.0 = Release|Win32 + {5F3379E4-2944-4FEE-A04A-CD04C3B66401}.Debug.ActiveCfg = Debug|Win32 + {5F3379E4-2944-4FEE-A04A-CD04C3B66401}.Debug.Build.0 = Debug|Win32 + {5F3379E4-2944-4FEE-A04A-CD04C3B66401}.Release.ActiveCfg = Release|Win32 + {5F3379E4-2944-4FEE-A04A-CD04C3B66401}.Release.Build.0 = Release|Win32 + {8059742C-5DA9-4318-8D04-7938CBB0D538}.Debug.ActiveCfg = Debug|Win32 + {8059742C-5DA9-4318-8D04-7938CBB0D538}.Debug.Build.0 = Debug|Win32 + {8059742C-5DA9-4318-8D04-7938CBB0D538}.Release.ActiveCfg = Release|Win32 + {8059742C-5DA9-4318-8D04-7938CBB0D538}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/TAO/CIAO/ChangeLog b/TAO/CIAO/ChangeLog new file mode 100644 index 00000000000..44fcead425a --- /dev/null +++ b/TAO/CIAO/ChangeLog @@ -0,0 +1,1713 @@ +Mon Apr 21 15:36:06 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * *: Merged with main trunk. + +Wed Apr 16 22:56:32 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + The followings are fixes to make CIAO to compile and work on + Linux. + + * bin/generate_component_mpc.pl: + * examples/handcrafted/Display/HUDisplay.mpc: + * examples/handcrafted/Display/GPS/GPS.mpc: + * examples/handcrafted/Display/NavDisplay/NavDisplay.mpc: + * examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI.mpc: + * examples/handcrafted/Display/RateGen/RateGen.mpc: + * examples/handcrafted/Hello/hello.mpc: + * tools/Assembly_Deployer/Assembly_Deployer.mpc: Reordered the + source file listing so that IDL files will always be compiled + before other files to avoid non-existing generated file + problem. Also added missing library dependencies to some MPC + files. + + * examples/handcrafted/Display/HUDisplay_svnt.cpp: + * examples/handcrafted/Display/HUDisplay_svnt.inl: + * examples/handcrafted/Display/GPS/GPSE.idl: + * examples/handcrafted/Display/GPS/GPS_exec.cpp: + * examples/handcrafted/Display/GPS/GPS_exec.h: + * examples/handcrafted/Display/GPS/GPS_svnt.cpp: + * examples/handcrafted/Display/GPS/GPS_tracing_exec.cpp: + * examples/handcrafted/Display/GPS/GPS_tracing_exec.h: + * examples/handcrafted/Display/NavDisplay/NavDisplay_exec.cpp: + * examples/handcrafted/Display/NavDisplay/NavDisplay_exec.h: + * examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.cpp: + * examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.cpp: + * examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.h: + * examples/handcrafted/Display/RateGen/RateGenE.idl: + * examples/handcrafted/Display/RateGen/RateGen_exec.cpp: + * examples/handcrafted/Display/RateGen/RateGen_exec.h: + * examples/handcrafted/Display/RateGen/RateGen_svnt.cpp: + * examples/handcrafted/Display/RateGen/client.cpp: + * examples/handcrafted/Display/RateGen/controller.cpp: + * examples/handcrafted/Hello/client.cpp: + * examples/handcrafted/Hello/helloE.idl: + * examples/handcrafted/Hello/hello_servants.cpp: + * tools/Assembly_Deployer/Assembly_Impl.cpp: + * tools/Assembly_Deployer/Assembly_Manager.cpp: + * tools/Assembly_Deployer/Assembly_Visitors.h: + * tools/Assembly_Deployer/Assembly_Visitors.inl: + * tools/ComponentServer/ComponentServer.cpp: + * tools/ComponentServer/ComponentServer_test_client.cpp: + * tools/Daemon/controller_i.cpp: + * tools/Daemon/controller_i.h: + * tools/ServerActivator/ServerActivator_test_client.cpp: + * tools/XML_Helpers/Assembly_Handlers.cpp: + * tools/XML_Helpers/Assembly_Spec.cpp: + * tools/XML_Helpers/Assembly_Spec.inl: + * tools/XML_Helpers/Cascadable_DocHandler.cpp: + * tools/XML_Helpers/Softpkg_Handlers.cpp: Fixed compilation errors + and warnings. They include + + Using a _var in places where a _ptr is expected. + + Incorrect Capitalization of file names. + + Unused variables warnings. + + Exception throw specification mis-matches. + + * docs/templates/CIAO_Glue_Session_Template.cpp: Propagated + previous fixes into the tempate code. + + * ciao/Container_Base.cpp: Removed a redundant ACE_INLINE decl. + +Tue Apr 15 17:07:52 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * tools/XML_Helpers/Assembly_Spec.h: + * tools/XML_Helpers/Softpkg_Handlers.h: + * tools/XML_Helpers/XMLHelpers.mpc: + * tools/XML_Helpers/XML_Utils.h: + * tools/XML_Helpers/XML_Helpers_Export.h: Refactored these files + to make them into a library. + + * tools/XML_Helpers/XML_Helpers.dsw: + * tools/XML_Helpers/Helper_Test.dsp: + * tools/Daemon/CIAO_Daemon.dsp: + * tools/Daemon/Daemon.dsw: + * tools/Daemon/DaemonController.dsp: Removed these project files + and depend solely on MPC generated files. + + * tools/Assembly_Deployer/Assembly_Deployer.mpc: + * tools/Daemon/Daemon.mpc: Updated MPC files to link with the new + XML_Helpers library. + +Tue Apr 15 11:07:36 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * ciao/Daemon.idl: + * ciao/Daemon_Impl.h: + * ciao/Daemon_Impl.inl: + * ciao/Daemon_Impl.cpp: + * tools/Daemon/Daemon.idl: + * tools/Daemon/Daemon_Impl.h: + * tools/Daemon/Daemon_Impl.inl: + * tools/Daemon/Daemon_Impl.cpp: + * ciao/CCM_Core.mpc: + * ciao/CIAO_Server.dsp: + * tools/Daemon/CIAO_Daemon.dsp: + * tools/Daemon/Daemon.mpc: + * tools/Daemon/DaemonController.dsp: Moved Daemon idl file and + implementations out of CIAO_Server library into Daemon + implemenation. + + Removed HomeRegistrar related files from the projects of the + CIAO_Server library. They need to be moved a a proper place in + the near future. + + * docs/todo.html: Document other refactoring needed in the + CCM_Core libraries. + +Mon Apr 14 17:06:37 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * examples/handcrafted/Display/HUDisplay_svnt.cpp: + * examples/handcrafted/Display/HUDisplay_svnt.h: + * examples/handcrafted/Display/GPS/GPS_exec.cpp: + * examples/handcrafted/Display/GPS/GPS_exec.h: + * examples/handcrafted/Display/GPS/GPS_svnt.cpp: + * examples/handcrafted/Display/GPS/GPS_svnt.h: + * examples/handcrafted/Display/GPS/GPS_tracing_exec.cpp: + * examples/handcrafted/Display/GPS/GPS_tracing_exec.h: + * examples/handcrafted/Display/NavDisplay/NavDisplay_exec.cpp: + * examples/handcrafted/Display/RateGen/RateGen_exec.cpp: + * examples/handcrafted/Display/RateGen/RateGen_exec.h: + * examples/handcrafted/Display/RateGen/client.cpp: + * examples/handcrafted/Display/RateGen/controller.cpp: + * examples/handcrafted/Display/RateGen/run_test.pl: + * examples/handcrafted/Display/descriptors/NOTE.txt: Updated + docuemntation. Changed to inherit Pulse_Handler from + ACE_Task_Base. Reworked controller.cpp so that it won't look + like the process that actually generates the events. + +Mon Apr 14 14:57:51 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * examples/handcrafted/Display/RateGen/controller.cpp: Changed to + perform only one action in each exection of this program. I.e., + it either switch on or off the RateGen component and exit + immediately. This is to avoid the mis-conception that the + controller actually generates the Rate. + +Sat Apr 12 12:36:08 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * CIDLC/parser_examples/cidl/cidl.vcproj: + * CIDLC/parser_examples/idl2/idl2.vcproj: + * CIDLC/parser_examples/idl3/idl3.vcproj: Changed the extra + include paths from: + + ..,../spirit-1.3.0,../spirit-1.3.0/miniboost + + to: + + ..,$(SPIRIT_DIR),$(SPIRIT_DIR)/miniboost + + to be consistent with the MPC files and to decouple Spirit from + CIAO's directory strucutre. + +Sat Apr 12 10:48:13 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * docs/templates/CIAO_Glue_Session_Template.cpp: + * docs/templates/CIAO_Glue_Session_Template.inl: Incorporated + changes for fixing gcc compilation warnings. + + * tools/Assembly_Deployer/Assembly_Manager.cpp: + * tools/ComponentServer/ComponentServer.cpp: + * tools/ComponentServer/ComponentServer_test_client.cpp: + * tools/Daemon/CIAO_Daemon.cpp: + * tools/Simple_Component_Server/Simple_Component_Server.cpp: Added + misiing newlines in usage messages. + +Sat Apr 12 01:25:35 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * CIDLC/parser_examples/README: + * CIDLC/parser_examples/cidl/cidl.mpc: + * CIDLC/parser_examples/idl2/idl2.mpc: + * CIDLC/parser_examples/idl3/idl3.mpc: Added new MPC files to take + advantage of MPC/MWC tool. Updated the README to provide some + minimal instructions. + +Tue Apr 8 23:10:43 2003 Jeff Parsons <j.parsons@vanderbilt.edu> + + * CIDLC/parser_examples/README: + * CIDLC/parser_examples/parser_examples.sln: + * CIDLC/parser_examples/cidl/cidl.cpp: + * CIDLC/parser_examples/cidl/cidl.vcproj: + * CIDLC/parser_examples/cidl/cidl_grammar.cpp: + * CIDLC/parser_examples/cidl/cidl_grammar.h: + * CIDLC/parser_examples/cidl/hello.cidl: + * CIDLC/parser_examples/idl2/idl2.cpp: + * CIDLC/parser_examples/idl2/idl2.vcproj: + * CIDLC/parser_examples/idl2/idl2_grammar.cpp: + * CIDLC/parser_examples/idl2/idl2_grammar.h: + * CIDLC/parser_examples/idl2/test_idl2.idl: + * CIDLC/parser_examples/idl3/idl3.cpp: + * CIDLC/parser_examples/idl3/idl3.vcproj: + * CIDLC/parser_examples/idl3/idl3_grammar.cpp: + * CIDLC/parser_examples/idl3/idl3_grammar.h: + * CIDLC/parser_examples/idl3/test_idl3.idl: + + Added parser examples (IDL2, IDL3, and CIDL) using the Spirit + parser. + +Tue Apr 08 19:42:16 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * examples/handcrafted/Display/GPS/GPS_tracing_exec.h: Fixed + a class name mismatch. + +Mon Apr 07 21:20:37 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * ciao/ServerActivator_Impl.cpp: Fixed a couple of compilation + warnings with gcc. + + * ciao/CIAO_Client.dsp: + * ciao/CIAO_Container.dsp: + * ciao/CIAO_Server.dsp: Turned on RTTI to sync up with the new Any + implementation. + + * ciao/CIAO_common.h: + * ciao/Cookies.cpp: Fixed the use of old CORBA_* types. They are + no longer available in the newer version of ACE/TAO. + +Sun Apr 06 20:36:39 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * examples/handcrafted/Display/CIAO_Installation_Data.ini: + * examples/handcrafted/Display/HUDisplay.cad: + * examples/handcrafted/Display/GPS/GPS.csd: + * examples/handcrafted/Display/GPS/GPS.ssd: + * examples/handcrafted/Display/NavDisplay/NavDisplay.csd: + * examples/handcrafted/Display/NavDisplay/NavDisplay.ssd: + * examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI.csd: + * examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI.ssd: + * examples/handcrafted/Display/RateGen/RateGen.csd: + * examples/handcrafted/Display/RateGen/RateGen.ssd: Removed these + files as they have already been moved to the + examples/handcrafted/Display/descriptors/ subdirectory. + + * examples/handcrafted/Display/NOTE: Updated obsolete notes. + + Thanks to Andrey Nechypurenko + <Andrey.Nechypurenko@mchp.siemens.de> for the following + changes. He reported, motivated or sent patches for them. + + * examples/handcrafted/Display/descriptors/NOTE.txt: Fixed several + typos. + + * examples/handcrafted/Display/descriptors/DuelDisplay.cad: + * examples/handcrafted/Display/descriptors/GPS_tracing.csd: + * examples/handcrafted/Display/descriptors/HUDisplayGUI.cad: + * examples/handcrafted/Display/descriptors/RemoteDisplayGUI.cad: + Updated these assembly descriptors to use the new GPS component + that emulate a trace (instead of the random coordinates). + + * examples/handcrafted/Display/NavDisplay/client.cpp: + * examples/handcrafted/Display/NavDisplayGUI_exec/run_test.pl: + Removed these testing artifacts because NavDisplay component + requires other component to function properly. + + * tools/XML_Helpers/Assembly_Spec.inl: Fixed VC7.1 compilation + error. + + * examples/handcrafted/Display/GPS/GPS.mpc: + * examples/handcrafted/Display/GPS/GPS_tracing_exec.cpp: + * examples/handcrafted/Display/GPS/GPS_tracing_exec.h: Added a + new implementation for the GPS component. This implementation + simulates coordinates of a trace instead of some random + positions. + + * examples/handcrafted/Display/NavDisplay/NavDisplay.mpc: + * examples/handcrafted/Display/NavDisplayGUI_exec/DetailView.cpp: + * examples/handcrafted/Display/NavDisplayGUI_exec/MapView.cpp: + * examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.cpp: + * examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.h: + Please find in attachment slightly modified version of + NavDisplayGUI. I have modified it slightly mainly in order to + let the GUI component to find background and animation images + either based on ACE_ROOT or using ../NavDisplayGUI_exec/. + + * examples/handcrafted/Display/NavDisplayGUI_exec/README: Removed + the mentioning of run_test.pl. It's no longer valid. + +Sat Apr 05 20:08:27 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * ciao/CCM_Deployment.idl: + * ciao/Component_Base.idl: + The operation Components::Deployment::Assembly::build can throw + CreateFailure exception. It was missing in the IDL files. + + * ciao/Server_init.cpp: + Register OBV factory for CIAO::Cookie also. + + * docs/templates/CIAO_Glue_Session_Template.cpp: + Made sure we duplicate the object reference before adding them + to subscriber/connection active maps. + + * examples/handcrafted/Display/HUDisplay.idl: + * examples/handcrafted/Display/HUDisplay.mpc: + * examples/handcrafted/Display/HUDisplay_svnt.h: + * examples/handcrafted/Display/HUDisplay_svnt.inl: + * examples/handcrafted/Display/GPS/GPS_exec.cpp: + * examples/handcrafted/Display/GPS/GPS_exec.h: + * examples/handcrafted/Display/GPS/GPS_svnt.cpp: + * examples/handcrafted/Display/NavDisplay/NavDisplay_exec.cpp: + * examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.cpp: + * examples/handcrafted/Display/RateGen/RateGen.mpc: + * examples/handcrafted/Display/RateGen/RateGen_svnt.cpp: + Updated the example to support 2-dimentional position interface. + Also fixed the reference counting problem in the servant glue + code. + + + * examples/handcrafted/Display/RateGen/controller.cpp: + Added a new + + * examples/handcrafted/Display/descriptors/HUDisplay.cad: + * examples/handcrafted/Display/descriptors/HUDisplayGUI.cad: + * examples/handcrafted/Display/descriptors/RemoteDisplay.cad: + * examples/handcrafted/Display/descriptors/RemoteDisplayGUI.cad: + Added variety of different composition example. See NOTE.txt + under the same directory for more information. + + * examples/handcrafted/Display/descriptors/test.dat: + Added a "Remote" entry so showcase how to deploy a system across + several machines. + + * tools/Assembly_Deployer/Assembly_Deployer.cpp: + * tools/Assembly_Deployer/Assembly_Deployer.mpc: + * tools/Assembly_Deployer/Assembly_Impl.cpp: + * tools/Assembly_Deployer/Assembly_Impl.h: + * tools/Assembly_Deployer/Assembly_Manager.cpp: + * tools/Assembly_Deployer/Assembly_Visitors.h: + Added support for establishing connections according to + Assembly_Spec. + + * tools/Assembly_Deployer/Assembly_Service.idl: + * tools/Assembly_Deployer/Assembly_Service_Impl.cpp: + * tools/Assembly_Deployer/Assembly_Service_Impl.h: + Added a simple interface in an attempt to solve the unreliable + shutdown problem. + + * tools/XML_Helpers/Assembly_Handlers.cpp: + * tools/XML_Helpers/Assembly_Handlers.h: + * tools/XML_Helpers/Assembly_Handlers.inl: + * tools/XML_Helpers/Assembly_Spec.cpp: + * tools/XML_Helpers/Assembly_Spec.h: + Fixed "connectevent" parsing. I had the "source" and + "destination" interface reversed. + +Fri Apr 04 22:40:11 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * examples/handcrafted/Display/descriptors/*: Moved all XML + descriptors and deployment configuration into this newly created + subdirectory to simply procedures to test this example. + + * examples/handcrafted/Display/NavDisplay/NavDisplay_exec.cpp: + Changed to thow a BAD_INV_ORDER exception is the receptacle is + not connected instead of a MSVC structural exception. + + * tools/Daemon/Daemon.mpc: + * tools/Daemon/DaemonController.dsp: + * tools/XML_Helpers/Assembly_Handlers.cpp: + * tools/XML_Helpers/Assembly_Spec.cpp: + * tools/XML_Helpers/Assembly_Spec.h: + * tools/XML_Helpers/Assembly_Spec.inl: + * tools/Assembly_Deployer/Assembly_Deployer.cpp: + * tools/Assembly_Deployer/Assembly_Deployer.mpc: + * tools/Assembly_Deployer/Assembly_Impl.cpp: + * tools/Assembly_Deployer/Assembly_Impl.h: + * tools/Assembly_Deployer/Assembly_Impl.inl: + * tools/Assembly_Deployer/Assembly_Manager.cpp: + * tools/Assembly_Deployer/Assembly_Visitors.h: + * tools/Assembly_Deployer/Assembly_Visitors.inl: + * tools/Assembly_Deployer/Deployment_Configuration.cpp: + * tools/Assembly_Deployer/Deployment_Configuration.h: + * tools/Assembly_Deployer/Deployment_Configuration.inl: Added more + support for component installation when building an Assembly. + +Thu Apr 03 15:08:20 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * ciao/Assembly_Impl.*: + * tools/Assembly_Deployer/Assembly_Impl.*: Moved the Assembly + implementaiton files to the tools/Assembly_Deployer/ directory. + + * ciao/CCM_Core.mpc: + * ciao/CIAO_Server.dsp: Removed Assembly_Impl.*. + +Thu Apr 03 13:11:49 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * tools/XML_Helpers/Assembly_Spec.h: + * tools/XML_Helpers/Assembly_Handlers.h: + * tools/XML_Helpers/Assembly_Handlers.cpp: Added support for parsing + component and home registering info. Otherwise, it'd be hard to + use a composed application. + +Wed Apr 02 17:08:00 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * tools/XML_Helpers/Assembly_Handlers.cpp: + * tools/XML_Helpers/Assembly_Handlers.h: + * tools/XML_Helpers/Assembly_Handlers.inl: + * tools/XML_Helpers/Assembly_Spec.cpp: + * tools/XML_Helpers/Assembly_Spec.h: + * tools/XML_Helpers/Assembly_Spec.inl: + * tools/XML_Helpers/Helper_Test.dsp: Added implementations for + handling componentassembly XML documents and building the + assembly specification information. These handlers currently + process only "crucial" information needed to get a system up and + running, i.e., they do not yet extract all types of information + in a componentassembly document. + + Also important is that all XML handlers in CIAO assume all XML + documents they process are valid and well-formed. ACEXML + currently does not validate XML document yet. Therefore, you + need to validate the XML documents using other XML parser (such + as msxml) shall CIAO's assembly parsing behave strangely as the + handlers assume a validator has already taken up most of the + checking responsibility. + + * tools/XML_Helpers/Softpkg_Handlers.cpp: + * tools/XML_Helpers/Softpkg_Handlers.h: + * tools/XML_Helpers/Softpkg_Handlers.inl: + * tools/XML_Helpers/XML_Utils.cpp: + * tools/XML_Helpers/XML_Utils.h: Added a new + parse_componentassembly utility function and moved some of the + helper functions out of Softpkg_Handlers. + + * tools/XML_Helpers/main.cpp: + + * bin/generate_component_mpc.pl: Added dependent library to the + list of libraries client program links to. + + * docs/XML/componentassembly.dtd: Fixed a typo in DTD definition. + + * examples/handcrafted/Display/HUDisplay.cad: Added a + + * examples/handcrafted/Display/NavDisplay/NavDisplay.mpc: + * examples/handcrafted/Display/NavDisplay/client.cpp: + * examples/handcrafted/Display/NavDisplay/run_test.pl: Added a + client program to test the component. + + * examples/handcrafted/Display/NavDisplayGUI_exec/AddNavUnitCmd.cpp: + * examples/handcrafted/Display/NavDisplayGUI_exec/AddNavUnitCmd.h: + * examples/handcrafted/Display/NavDisplayGUI_exec/Command.h: + * examples/handcrafted/Display/NavDisplayGUI_exec/DetailView.cpp: + * examples/handcrafted/Display/NavDisplayGUI_exec/DetailView.h: + * examples/handcrafted/Display/NavDisplayGUI_exec/MapView.cpp: + * examples/handcrafted/Display/NavDisplayGUI_exec/MapView.h: + * examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayEIC.cpp: + * examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI.csd: + * examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI.mpc: + * examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI.ssd: + * examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.cpp: + * examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.h: + * examples/handcrafted/Display/NavDisplayGUI_exec/NavUnit.cpp: + * examples/handcrafted/Display/NavDisplayGUI_exec/NavUnit.h: + * examples/handcrafted/Display/NavDisplayGUI_exec/NodeItem.cpp: + * examples/handcrafted/Display/NavDisplayGUI_exec/NodeItem.h: + * examples/handcrafted/Display/NavDisplayGUI_exec/QuitCmd.cpp: + * examples/handcrafted/Display/NavDisplayGUI_exec/QuitCmd.h: + * examples/handcrafted/Display/NavDisplayGUI_exec/README: + * examples/handcrafted/Display/NavDisplayGUI_exec/RootPanel.cpp: + * examples/handcrafted/Display/NavDisplayGUI_exec/RootPanel.h: + * examples/handcrafted/Display/NavDisplayGUI_exec/UpdatePositionCmd.cpp: + * examples/handcrafted/Display/NavDisplayGUI_exec/UpdatePositionCmd.h: + * examples/handcrafted/Display/NavDisplayGUI_exec/Worker.cpp: + * examples/handcrafted/Display/NavDisplayGUI_exec/Worker.h: + * examples/handcrafted/Display/NavDisplayGUI_exec/moc_DetailView.cpp: + * examples/handcrafted/Display/NavDisplayGUI_exec/moc_MapView.cpp: + * examples/handcrafted/Display/NavDisplayGUI_exec/moc_NodeItem.cpp: + * examples/handcrafted/Display/NavDisplayGUI_exec/moc_RootPanel.cpp: + * examples/handcrafted/Display/NavDisplayGUI_exec/run_test.pl: + * examples/handcrafted/Display/NavDisplayGUI_exec/trolltech.gif: + * examples/handcrafted/Display/NavDisplayGUI_exec/worldmap1.gif: + Added a Qt GUI based component to showcase how we can + reconfigure a system using different component easily. Thanks + to Andrey Nechypurenko <andreynech@mchp.siemens.com> for + contributing the implementation. + + * examples/handcrafted/Display/CIAO_Installation_Data.ini: Added + deployment information for the new GUI NavDisplay component + implementation. + + * examples/handcrafted/Hello/client.dsp: + * examples/handcrafted/Hello/hello_executors.dsp: + * examples/handcrafted/Hello/hello_servants.dsp: + * examples/handcrafted/Hello/hello_stub.dsp: Hmm, I probably + checked in the MPC/MWC generated project accidentally. :) + +Mon Mar 24 16:17:21 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * examples/handcrafted/Display/GPS/GPS_svnt.cpp: + * examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.cpp: + Added implementation for servant factory methods. Thanks to + Andrey Nechypurenko <andreynech@yahoo.com> for reporting this. + +Fri Mar 21 15:51:57 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * docs/new_components.html: Revised naming convention for + user-defined component executor impl IDL. + + * bin/generate_component_mpc.pl: Added an option for adding + user-defined component executor impl IDL automatically, + according the the naming convention. Fixed the dependencies to + "dependent" libraries. + + * examples/handcrafted/Display/RateGen/RateGen.csd: + * examples/handcrafted/Display/RateGen/RateGen.ssd: Simplified the + XML descriptors. + + * examples/handcrafted/Display/RateGen/RateGen.mpc: + * examples/handcrafted/Display/RateGen/RateGenEI.idl: + * examples/handcrafted/Display/RateGen/RateGen_exec.h: Fixed + dependencies and naming convention. + + * examples/handcrafted/Display/GPS/GPS.csd: + * examples/handcrafted/Display/GPS/GPS.mpc: + * examples/handcrafted/Display/GPS/GPS.ssd: + * examples/handcrafted/Display/GPS/GPSEI.idl: + * examples/handcrafted/Display/GPS/GPS_exec.cpp: + * examples/handcrafted/Display/GPS/GPS_exec.h: + + * examples/handcrafted/Display/NavDisplay/NavDisplay.csd: + * examples/handcrafted/Display/NavDisplay/NavDisplay.mpc: + * examples/handcrafted/Display/NavDisplay/NavDisplay.ssd: + * examples/handcrafted/Display/NavDisplay/NavDisplayEI.idl: + * examples/handcrafted/Display/NavDisplay/NavDisplay_exec.cpp: + * examples/handcrafted/Display/NavDisplay/NavDisplay_exec.h: + + * examples/handcrafted/Display/CIAO_Installation_Data.ini: Added + component implementaions for GPS and NavDisplay. + +Thu Mar 20 21:50:07 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * ciao/ComponentInstallation_Impl.cpp: Added a more comprehensive + error printout. + + * docs/index.html: Fixed a broken link. + + * docs/templates/CIAO_Glue_Session_Template.cpp: + * docs/templates/CIAO_Glue_Session_Template.h: Added the servant + factory entry point function that I missed. + + * examples/handcrafted/Display/RateGen/RateGen_svnt.cpp: + * examples/handcrafted/Display/RateGen/RateGen_svnt.h: Fixed up + the servant DLL entry point. + + * examples/handcrafted/Display/RateGen/RateGen.mpc: + * examples/handcrafted/Display/RateGen/RateGen_comp.idl: + * examples/handcrafted/Display/RateGen/RateGen_exec.cpp: + * examples/handcrafted/Display/RateGen/RateGen_exec.h: Added the + actual implementation for component executor. + + * examples/handcrafted/Display/CIAO_Installation_Data.ini: Added + this deployment datafile. This file will contain information + describing all the components used in this example. + + * examples/handcrafted/Display/RateGen/RateGen.csd: + * examples/handcrafted/Display/RateGen/RateGen.ssd: Added XML + component descriptors. + + * examples/handcrafted/Display/RateGen/client.cpp: Added a test + client program. + + * examples/handcrafted/Display/RateGen/run_test.pl: Added a test + script to test out this single component. + + * tools/ComponentServer/ComponentServer_test_client.cpp: Changed + the client program to debug RateGen component. We need to make + this test client more robust so we can use it to debug different + component implementations more easily. + +Tue Mar 18 16:36:07 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * bin/generate_component_mpc.pl: + * examples/handcrafted/Display/HUDisplay.mpc: + * examples/handcrafted/Display/GPS/GPS.mpc: + * examples/handcrafted/Display/NavDisplay/NavDisplay.mpc: + * examples/handcrafted/Display/RateGen/RateGen.mpc: Updated the + script and regenerated mpc file to record the original options + used to generate the MPC files. + + * examples/handcrafted/Display/NOTE: Added more info on how to + generate Makefiles/Projects for this example. + + * examples/handcrafted/Display/RateGen/RateGen.idl: Fixed a typo. + + * examples/handcrafted/Display/RateGen/RateGen_Impl.idl: + * examples/handcrafted/Display/RateGen/RateGen_exec.cpp: + * examples/handcrafted/Display/RateGen/RateGen_exec.h: Added the + actual component and home implementations. This particular + component implementation shows how to suppoort SessionComponent + interface in a component implementation (you will need to do + that for any non-trivial component implementations that require + to access component-specific context.) + +Tue Mar 18 12:03:29 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * examples/handcrafted/Hello/hello_servants.cpp: + * examples/handcrafted/Hello/hello_servants.h: Renamed various + "_ciao_deactivate*" operations to "ciao_passivate*" to be more + consistent with the CCM opertions. + + * docs/templates/CIAO_Glue_Session_Template.cpp: + * docs/templates/CIAO_Glue_Session_Template.h: + * docs/templates/CIAO_Glue_Session_Template.inl: + * examples/handcrafted/Display/GPS/GPS_svnt.cpp: + * examples/handcrafted/Display/GPS/GPS_svnt.h: + * examples/handcrafted/Display/GPS/GPS_svnt.inl: + * examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.cpp: + * examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.h: + * examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.inl: + * examples/handcrafted/Display/RateGen/RateGen_svnt.cpp: + * examples/handcrafted/Display/RateGen/RateGen_svnt.h: + * examples/handcrafted/Display/RateGen/RateGen_svnt.inl: + Propagated the SessionComponent opertion support to CIDL + templates and the multiple component example "generated" files. + +Mon Mar 17 23:10:47 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * ciao/Container_Base.cpp: + * ciao/Container_Base.h: + * examples/handcrafted/Hello/hello_servants.cpp: + * examples/handcrafted/Hello/hello_servants.h: Added support for + SessionComponent specific operations, + ccm_{activate,passivate,remove}. These changes still need to be + propagated to the CIDL templates. + + We also need to review how Deployment::Container and CCMHome + manage the lifecyles of homes, components, and facet servants. + +Sun Mar 16 21:57:10 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * docs/templates/CIAO_Glue_Session_Template.h: + * docs/templates/CIAO_Glue_Session_Template.inl: + * examples/handcrafted/Display/GPS/GPS_svnt.h: + * examples/handcrafted/Display/GPS/GPS_svnt.inl: + * examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.h: + * examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.inl: + * examples/handcrafted/Display/RateGen/RateGen_svnt.cpp: + * examples/handcrafted/Display/RateGen/RateGen_svnt.h: + * examples/handcrafted/Display/RateGen/RateGen_svnt.inl: Added + code to support SessionComponent::set_session_context operation + and make sure the Context objects also inherit from + TAO_Local_RefCounted_Object. + + * examples/handcrafted/Hello/helloE.idl: + * examples/handcrafted/Hello/hello_executors.h: + * examples/handcrafted/Hello/hello_servants.cpp: + * examples/handcrafted/Hello/hello_servants.h: Changed to implement + component specific context as a SessionContext, plus the + aforementioned changes. + +Sun Mar 16 11:43:20 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * docs/ConfigValues.html: + * docs/index.html: Updated the main document entry page. It is + grossly outdated. + + * tools/ComponentServer/ComponentServer.mpc: + * tools/Daemon/Daemon.mpc: + * tools/ServerActivator/ServerActivator.mpc: + * tools/XML_Helpers/XMLHelpers.mpc: Added more mpc files. + +Sat Mar 15 11:43:34 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * ciao/Makefile: + * ciao/Makefile.client: + * ciao/Makefile.container: + * ciao/Makefile.server: Removed Makefiles. I depend on MPC files + exclusively at the moment. + + * ciao/Assembly_Impl.cpp: + * ciao/Assembly_Impl.h: + * ciao/CCM_Core.mpc: + * ciao/Container_Base.cpp: + * ciao/Container_Base.h: + * ciao/Container_Impl.h: + * ciao/Daemon_Impl.h: + * ciao/Object_Set_T.cpp: + * ciao/ServerActivator_Impl.h: Fixed Linux build errors. Some + warnings are not fixed due to incomplete implementations and I + want to make sure they got addressed in some future point. + +Fri Mar 14 23:19:52 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * ciao/CCM_Core.mpc: Updated the core MPC file to reflect recent + added files. + +Fri Mar 14 16:08:22 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * docs/todo.html: Recorded a compilation error in the generated + code that I commented out for later "study." + + * examples/handcrafted/Display/NavDisplay/NavDisplay.idl: Fixed a + typo. + + * examples/handcrafted/Display/NavDisplay/NavDisplayE.idl: + * examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.cpp: + * examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.h: + * examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.inl: + Added new "generated" code. + + * docs/templates/CIAO_Glue_Session_Template.cpp: + * docs/templates/CIAO_Glue_Session_Template.h: + * docs/templates/CIAO_Glue_Session_Template.inl: + * docs/templates/Executor.idl: Updated templates based on the code + they generated. + +Thu Mar 13 20:11:49 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * examples/handcrafted/Display/NavDisplay/NavDisplay.idl: + * examples/handcrafted/Display/GPS/GPS.idl: + * examples/handcrafted/Display/Configuration-0.png: Updated the + port names so they make more sense in the context. Thanks to + Dave Sharp and Wendy Rolls for the suggestions. + + * examples/handcrafted/Display/RateGen/RateGen_svnt.h: Added the + missing factory entry point for the servant home. + + * examples/handcrafted/Display/GPS/GPSE.idl: + * examples/handcrafted/Display/GPS/GPS_svnt.cpp: + * examples/handcrafted/Display/GPS/GPS_svnt.h: + * examples/handcrafted/Display/GPS/GPS_svnt.inl: Added new + "generated" code. + + * docs/templates/CIAO_Glue_Session_Template.cpp: + * docs/templates/CIAO_Glue_Session_Template.h: + * docs/templates/CIAO_Glue_Session_Template.inl: + * docs/templates/Executor.idl: Updated templates based on the code + they generated (manually. Did I mention how much fun it was to + generate code manually?) + +Wed Mar 12 23:29:27 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * bin/generate_component_mpc.pl: Fixed an incomplete library + expansion and added a flag to specify library path + dependencies. + + * docs/releasenotes.html: Updated the status of single component + deployment capability. I forgot to do that when it was done. + + * examples/handcrafted/Display/NOTE: Added directions on how to + generate various mpc files. + + * examples/handcrafted/Display/GPS/GPS.mpc: + * examples/handcrafted/Display/NavDisplay/NavDisplay.mpc: + * examples/handcrafted/Display/RateGen/RateGen.mpc: Regenerated + MPC files to fix incomplete dependent library names and to add + library path dependencies. + + * examples/handcrafted/Display/HUDisplay.idl: + * examples/handcrafted/Display/RateGen/RateGen.idl: + * examples/handcrafted/Display/HUDisplayE.idl: + * examples/handcrafted/Display/RateGen/RateGenE.idl: Moved the + opmode interface definition from RateGen.idl back to + HUDisplay.idl. This interface is a supported interface of + RateGen but it should be viewed as a shared interface. + + * examples/handcrafted/Display/RateGen/RateGen_svnt.cpp: + * examples/handcrafted/Display/RateGen/RateGen_svnt.h: + * examples/handcrafted/Display/RateGen/RateGen_svnt.inl: Added + more handcrafted servant glue code for RateGen component. + + * docs/templates/CIAO_Glue_Session_Template.cpp: + * docs/templates/CIAO_Glue_Session_Template.h: + * docs/templates/CIAO_Glue_Session_Template.inl: + * docs/templates/Executor.idl: Updated and fixed CIDL template + code based on results from using these templates manually. + +Wed Mar 12 00:03:56 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * examples/handcrafted/Display/HUDisplay_svnt.h: + * examples/handcrafted/Display/HUDisplay_svnt.cpp: Added forgotten + _get_component implementation. + +Tue Mar 11 22:47:06 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * examples/handcrafted/Display/HUDisplayE.idl: Removed redundant + operations that have already been defined in the facet interface. + + * examples/handcrafted/Display/HUDisplay_svnt.cpp: + * examples/handcrafted/Display/HUDisplay_svnt.h: + * examples/handcrafted/Display/HUDisplay_svnt.inl: Added hand + generated code based on the glue code template in + + docs/templates/ + + * docs/templates/CIAO_Glue_Session_Template.cpp: + * docs/templates/CIAO_Glue_Session_Template.h: + * docs/templates/CIAO_Glue_Session_Template.inl: Updated template + code based on results from hand generated code. + +Tue Mar 11 15:18:52 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * bin/generate_component_mpc.pl: Added this new to auto-generate + the mpc files for a single component implementation. The mpc + file generated by the script should work for most simple + component implementation, without modification and can serve as + a template for more complicated ones. This script also + generates hints that can be fed back to a shell to create the + necessary export definition files. + + * docs/todo.html: Added improvement items that can be done for + generate_component_mpc.pl. + + * bin/gen_export_files.cmd: Removed. The new + generate_component_mpc script provides more accurate hints on + how to create export files. + + + Renamed and reorganized all files in the following + multi-component example according to the guideline I set in + docs/new_component.html. + + * examples/handcrafted/Display/Display.mpc: + * examples/handcrafted/Display/HUD_skel_export.h: + * examples/handcrafted/Display/HUD_stub_export.h: + * examples/handcrafted/Display/GPS/GPS_skel_export.h: + * examples/handcrafted/Display/NavDisplay/NavDisplay_skel_export.h: + * examples/handcrafted/Display/RateGen/RateGen_skel_export.h: + Removed. + + * examples/handcrafted/Display/HUDisplay.mpc: + * examples/handcrafted/Display/HUDisplay_stub_export.h: + * examples/handcrafted/Display/HUDisplay_svnt_export.h: + * examples/handcrafted/Display/GPS/GPS_exec_export.h: + * examples/handcrafted/Display/GPS/GPS_svnt_export.h: + * examples/handcrafted/Display/NavDisplay/NavDisplay_exec_export.h: + * examples/handcrafted/Display/NavDisplay/NavDisplay_svnt_export.h: + * examples/handcrafted/Display/RateGen/RateGen_exec_export.h: + * examples/handcrafted/Display/RateGen/RateGen_svnt_export.h: + Modified. + + * examples/handcrafted/Display/HUDisplay.idl: + * examples/handcrafted/Display/HUDisplayE.idl: + * examples/handcrafted/Display/GPS/GPS.mpc: + * examples/handcrafted/Display/GPS/GPS_stub_export.h: + * examples/handcrafted/Display/NavDisplay/NavDisplay.mpc: + * examples/handcrafted/Display/NavDisplay/NavDisplay_stub_export.h: + * examples/handcrafted/Display/RateGen/RateGen.idl: + * examples/handcrafted/Display/RateGen/RateGen.mpc: + * examples/handcrafted/Display/RateGen/RateGen_stub_export.h: + Added. + +Tue Mar 11 11:41:39 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * bin/generate_component_mpc.pl: Added a MPC file generater perl + script for creating new MPC definitions for single component + implementations. + +Sun Mar 09 14:38:59 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * docs/new_components.html: Added this new document to describe + files involved in creating a new components. + + * docs/com-impl.html: Added a link to the new component + implementation. document + + * docs/imgs/File-Gen-Existing.png: + * docs/imgs/File-Gen-Future.png: + * docs/imgs/File_Generation_Flow.vsd: Updated the tools/files + collaboration diagram to reflect the latest plan. + + * examples/handcrafted/Hello/hello.mpc: Updated the MPC file to + make sure it works properly. We need to figure out a way to + auto-generate a template of this file. + +Thu Mar 06 20:29:42 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + The following changes integrate the XML parsing of softpkg + descriptors with the daemon management framework so we can now + instantiate and test a single component implementation using + its softpkg descriptor. + + * ciao/ComponentServer_Impl.cpp: + * ciao/ComponentServer_Impl.h: + * ciao/ComponentServer_Impl.inl: Added a cached + ComponentInstallation reference so we can pass it to the + containers this ComponentServer creates. + + * ciao/Container_Impl.cpp: + * ciao/Container_Impl.h: Added an extra argument in init for + taking in the ComponentInstallation reference. Also modified + the install_home related mechanisms to use ComponentInstallation + interface to acquire the actual implementation "locations". + + * tools/ServerActivator/ServerActivator_test_client.cpp: + * tools/ComponentServer/ComponentServer_test_client.cpp: Changed + to use UUID. + + * tools/XML_Helpers/Cascadable_DocHandler.h: Removed a redundant + export decl. + + * tools/Daemon/DaemonController.dsp: Added files from the + XML_Helpers directories for the added XML handling capability. + + * tools/Daemon/CIAO_Daemon.cpp: + * tools/Daemon/Softpkg_Commands.cpp: + * tools/Daemon/Softpkg_Commands.h: Added new commands to start and + terminate ComponentServer for running one component home. + + * examples/handcrafted/Hello/CIAO_Installation_Data.ini: + * examples/handcrafted/Hello/client.cpp: + * examples/handcrafted/Hello/hello.ssd: + * examples/handcrafted/Hello/run_test.pl: Changed and set up the + test to start up a ComponentServer via Daemon. + +Wed Mar 05 21:43:44 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + Moved all Daemon controller related classes into CIAO::Daemon_i + namespace. + + * tools/Daemon/Softpkg_Commands.cpp: + * tools/Daemon/Softpkg_Commands.h: + * tools/Daemon/Softpkg_Commands.inl: Added two new "start_home" + and "end_home" command for starting up and shutting down a + ComponentServer for a single component home. Still need + implementation. + + * tools/Daemon/DaemonController.cpp: + * tools/Daemon/DaemonController.dsp: + + * tools/Daemon/controller_i.cpp: + * tools/Daemon/controller_i.h: + * tools/Daemon/controller_i.inl: + * tools/Daemon/Daemon_Commands.cpp: + * tools/Daemon/Daemon_Commands.h: + * tools/Daemon/Daemon_Commands.inl: Moved most of the Daemon + controlling commands into this file. + +Tue Mar 04 20:40:21 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * examples/handcrafted/Display/RateGen/RateGenE.idl: Fixed a typo. + Thanks to Jeff Gray <gray@cis.uab.edu> for pointing it out. + +Thu Feb 27 22:15:48 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * ciao/ComponentServer_Impl.h: Fixed a cut-n-paste error in a comment. + + * ciao/ServerActivator_Impl.cpp: + * ciao/ServerActivator_Impl.h: Changed to cache an IOR to + the ComponentInstallation interface and pass the IOR with + -ORBInitRef option to the ComponentServer. We will need it when + installing a component home in the container. + + * examples/handcrafted/Hello/hello_servants.cpp: + * examples/handcrafted/Hello/hello_servants.h: Removed inheriting + the component specific context from the SessionContext local + interface. This component example should be run as Service + component, not Session component. + + * tools/ServerActivator/README: + * tools/Daemon/CIAO_Daemon.cpp: + * tools/ServerActivator/ServerActivator.cpp: Changed to propagate + the ComponentInstallation somehow. + + * tools/ServerActivator/ServerActivator_test_client.cpp: Removed a + redundant $Id$ tag. + +Sat Feb 22 23:45:52 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * docs/releasenotes.html: + * docs/todo.html: Updated information regarding different + component deployment schemes. + + * examples/handcrafted/Hello/hello.csd: + * examples/handcrafted/Hello/hello.ssd: Fixed syntax errors. + + * tools/XML_Helpers/Softpkg_Handlers.cpp: + * tools/XML_Helpers/Softpkg_Handlers.h: + * tools/XML_Helpers/Softpkg_Handlers.inl: + * tools/XML_Helpers/XML_Utils.cpp: + * tools/XML_Helpers/XML_Utils.h: + * tools/XML_Helpers/XML_Utils.inl: Added these new file to extract + necessary information to install the component specified in a + .csd (component softpkg descriptor) file. The + Softpkg_Handlers.* contain the XML Handler(s) for parsing the + csd document and XML_Utils.* contain the file Assembly tools can + use to extract the needed info. Notice that the XML handler + currently don't do a lot of validation. + + * tools/XML_Helpers/Cascadable_DocHandler.cpp: + * tools/XML_Helpers/Cascadable_DocHandler.h: + * tools/XML_Helpers/Cascadable_DocHandler.i: Added error handling + functions and allows it to accept a Locator from the parser to + show error location. + + * tools/XML_Helpers/Svcconf.dsp: + * tools/XML_Helpers/Svcconf.dsw: Renamed these files to the + following: + + * tools/XML_Helpers/XMLHelpers.dsp: + * tools/XML_Helpers/Helper_Test.dsw: + * tools/XML_Helpers/main.cpp: Added new files into the project + file and changed the project and workspace name. + + +Thu Feb 20 22:15:08 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + Manually generated the following XML descriptors. These are the + minimum to install a component. Currently, I just get the UUID + using win32's UUIDGEN or GUIDGEN. + + * examples/handcrafted/Hello/hello.csd: Component softpkg descriptor. + + * examples/handcrafted/Hello/hello.ssd: CIAO's servant softpkg + descriptor. + + * examples/handcrafted/Hello/hello.ccd: CORBA component descriptor. + +Wed Feb 19 13:30:19 2003 Boris Kolpackov <boris@isis-server.isis.vanderbilt.edu> + + * CIDLC/DesignNotes: Reorganized stuff a bit again and added some + comments on Jeff's comments. + +Mon Feb 17 17:47:55 2003 Boris Kolpackov <boris@isis-server.isis.vanderbilt.edu> + + * CIDLC/DesignNotes: Reorganized stuff a bit and added some new + ideas/notes. + +Sun Feb 16 21:30:42 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * docs/releasenotes.html: Updated release info with the following. + + * ciao/ComponentInstallation_Impl.cpp: + * ciao/ComponentInstallation_Impl.h: Fixed a problem of empty + persistent backing store file. I need to store the + configuration data under a subsection (as oppose to the root + section.) + + * ciao/CIAO_Server.dsp: + * ciao/Daemon.idl: + * ciao/Daemon_Impl.cpp: + * ciao/Daemon_Impl.h: + * ciao/Daemon_Impl.inl: Added a generic server process control + interface that provides operations to query available service + interfaces and to shutdown the server process. + + * tools/Daemon/CIAO_Daemon.cpp: + * tools/Daemon/CIAO_Daemon.dsp: + * tools/Daemon/CIAO_Installation_Data.ini: + * tools/Daemon/Daemon.dsw: + * tools/Daemon/README: + * tools/Daemon/DaemonController.cpp: + * tools/Daemon/DaemonController.dsp: + * tools/Daemon/controller_i.cpp: + * tools/Daemon/controller_i.h: + * tools/Daemon/controller_i.inl: Added new per-host CIAO_Daemon + implementaion which offer both ComponentInstallation interface + which manages the local component implementation cache, and + ServerActivator interface which the Assembly framework interacts + with to spawn new ComponentServer processes. See the README + file in this directory and releasenotes.html for more details. + + There's also a DaemonController tool which provides a command + line interface to control the daemon process and to interact + with ComponentInstallation and ServerActivation interfaces. + +Sat Feb 15 22:54:11 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * ciao/CIAO_Server.dsp: + * ciao/ComponentInstallation_Impl.cpp: + * ciao/ComponentInstallation_Impl.h: + * ciao/ComponentInstallation_Impl.inl: Filled in the + implementation for ComponentInstallation interface. We + currently only provide a naive implemntation for this + interface. It currently manages the pathnames to various + component implementations so a Container can fetch a + implementation from its UUID. + + * examples/handcrafted/Hello/hello_servants.dsp: Added CIAO_server + to the list of link libraries. I need to move the base + container implementation from the CIAO_Server library to + CIAO_Container library. + +Fri Feb 14 23:15:39 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * docs/todo.html: Added info on why the Assembly tools should + be responsible of the act of home registration. + + * ciao/Container_Impl.cpp: + * ciao/ServerActivator_Impl.cpp: + * ciao/ComponentServer_Impl.cpp: Changed the use of ACE_NEW_RETURN + to ACE_NEW_THROW_EX. + + * ciao/ComponentServer_Impl.h: Cosmetic changes. + + * examples/handcrafted/Hello/hello_servants.cpp: + * examples/handcrafted/Hello/hello_servants.h: Fixed <unsubscribe> + signature based on RTF 1.1. + + * tools/ComponentServer/ComponentServer.cpp: Added comments + explaining why we are not init'ing the component server right + now. + + * tools/ServerActivator/README: + * examples/handcrafted/Hello/client.cpp: + * tools/ServerActivator/ServerActivator_test_client.cpp: Forced in + hack to test out installing the HelloWorldHome using the new + ServerActivator -> ComponentServer -> Container interfaces. + + * tools/Simple_Component_Server/Simple_Component_Server.cpp: Fix + +Fri Feb 14 17:10:50 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * docs/ConfigValues.html: Updated more supported ConfigValues types. + + * docs/releasenotes.html: + * docs/todo.html: + + * ciao/Client_init.cpp: + * ciao/Server_init.cpp: + * ciao/Client_init.h: + * ciao/Server_init.h: Removed "ciao/" from the include paths. We + now always include ciao core files as they are specified in the + include path directly. + + * ciao/CIAO_Server.dsp: + * ciao/CIAO_Servers.idl: + * ciao/ComponentServer_Impl.cpp: + * ciao/ComponentServer_Impl.h: + * ciao/ComponentServer_Impl.inl: + * ciao/Container_Base.cpp: + * ciao/Container_Base.h: + * ciao/Container_Impl.cpp: + * ciao/Container_Impl.h: + * ciao/Container_Impl.inl: + * ciao/Object_Set_T.cpp: + * ciao/Object_Set_T.h: + * ciao/Object_Set_T.inl: + * ciao/ServerActivator_Impl.cpp: + * ciao/ServerActivator_Impl.h: + * ciao/ServerActivator_Impl.inl: Filled in more implementations. + + * tools/ServerActivator/README: + * tools/ServerActivator/ServerActivator.cpp: + * tools/ServerActivator/ServerActivator.dsp: + * tools/ServerActivator/ServerActivator.dsw: + * tools/ServerActivator/ServerActivator_test_client.cpp: + * tools/ServerActivator/ServerActivator_test_client.dsp: Added a + ServerActivator implementation. + + * tools/ComponentServer/ComponentServer.cpp: + * tools/ComponentServer/ComponentServer.dsp: + * tools/ComponentServer/ComponentServer.dsw: + * tools/ComponentServer/ComponentServer_test_client.cpp: + * tools/ComponentServer/ComponentServer_test_client.dsp: + * tools/ComponentServer/README: Added a more comprehensive + ComponentServer implementation. + +Sun Feb 09 20:39:05 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * docs/todo.html: Added more todo items as we go along. :) + + * ciao/Component_Base.idl: + * ciao/CCM_Deployment.idl: Changed the create method in + ::Components::Deployment::AssemblyFactory to create_assembly per + CCM RTF 1.1. + + * ciao/Assembly_Impl.cpp: + * ciao/Assembly_Impl.h: + * ciao/Assembly_Impl.inl: CCM RTF 1.1 changes. Also added other + test code in the file and explained how to create an Assembly + object. + + * ciao/CIAO_Core.mpc: + * ciao/CIAO_Client.dsp: + * ciao/CIAO_Server.dsp: + * ciao/CIAO_Value.idl: Added a CIAO internal cookie valuetype so + we can downcast the incoming ::Components::Cookie back to CIAO's + internal implementation type CIAO::Cookie easily. The original + "brute force cast" didn't work and CIAO::Cookie also provides a + way to fish out the internal octetseq we need internally. + + * ciao/Cookies.cpp: + * ciao/Cookies.h: + * ciao/Cookies.inl: Changed to inherit the internal cookie + implementation from OBV_CIAO::Cookie instead of + OBV_Components::Cookie. Also changed the extract method to be + static. + + * ciao/Client_init.cpp: Added a new valuefactory to create + ::Components::Cookie valuetype when receiving CIAO::Cookie from + the server. This should really be handled by supporting + truncatable valuetype in TAO. + + * docs/templates/CIAO_Glue_Session_Template.inl: Applied some of + the bug fixes from using Active Map and Cookie. These template + files need to be reviewed further. + + * tests/temp/README: + * tests/temp/assembly/README: + * tests/temp/assembly/assembly.dsw: + * tests/temp/assembly/client.cpp: + * tests/temp/assembly/client.dsp: + * tests/temp/assembly/control.idl: + * tests/temp/assembly/control.mpc: + * tests/temp/assembly/run_test.pl: + * tests/temp/assembly/server.cpp: + * tests/temp/assembly/server.dsp: Added this test to make sure the + demonstrate how to use AssemblyFactory and Assembly interface, + and the Assembly's are being managed properly. More + importantly, I used this test to make sure the internal + implementation for Cookie and Active_Object_Map are working + correctly. + + * tools/XML_Helpers/Svcconf.dsp: + * tools/XML_Helpers/Svcconf.dsw: + * tools/XML_Helpers/Svcconf_Handler.cpp: + * tools/XML_Helpers/Svcconf_Handler.h: + * tools/XML_Helpers/Svcconf_Handler.i: + * tools/XML_Helpers/main.cpp: + * tools/XML_Helpers/svc.conf.xml: Added an example to demonstrate + how to write a subclass of Cascadable_DocHandler and how to use + the Skip_DocHandler. Just so I won't forget how to use them. + +Sat Feb 08 20:45:20 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * ciao/*: WiP intermediate checkins. + + * ciao/Object_Set_T.h: + * ciao/Object_Set_T.cpp (object_in_set): Added a new method to + check if an object is already in the set or not. + +Fri Feb 07 23:35:35 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * ciao/Object_Set_T.h: + * ciao/Object_Set_T.i: + * ciao/Object_Set_T.cpp: Added a naive implementation of an object + reference set. It is naive because it simply keeps object + references in an objref_var array without checking for + duplication. More importantly, it takes O(n) to to look for an + object reference and return it. What we really need is a + thread-safe hash_set<> like class here. Since this is mostly + used only during setup/assemble time for a CIAO application, + i.e., not on critical path, this class serves as a place holder + for later, more efficient implementation. + + This new class is needed to support ServerActivator, + ComponentServer, and Container interface in + Components::Deployment module. + + * docs/ConfigVAlues.html: Added this new document page to record + what configuration values can be used to initialize + ComponentServer's and Container's. + + * docs/todo.html: Documented more future todo tasks and ideas. + +Tue Feb 04 23:10:56 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * docs/todo.html: Added a new item descirbing things that need to + be done for component/home configuration using CCM's XML + property files. + + * tools/XML_Helpers/Handler-Interaction.png: + * tools/XML_Helpers/Handler-Interaction.vsd: + * tools/XML_Helpers/README: Files that document how to use + Cascadable_DocHandler and interactions among handlers of + different layers. + + * tools/XML_Helpers/Cascadable_DocHandler.cpp: + * tools/XML_Helpers/Cascadable_DocHandler.h: + * tools/XML_Helpers/Cascadable_DocHandler.i: A + ACEXML_DefaultHandler subclass which can be easily cascaded + together to handle hierarchical XML document structure. There + is also a Skip_DocHandler class which subclasses from + Cascadable_DocHandler and can be used to skip over some certain + XML tags completely. These helper classes should probably be + collected under ACEXML in the future. + +Sun Feb 02 21:05:39 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * ciao/Cookies.cpp (insert): Fixed a warning. + + * ciao/CCM_Base.idl: Changed to include <orb.idl> instead of <corba.pidl>. + + * ciao/CCM_Event.idl: Fixed a typo I put in last. + +Sun Feb 02 15:23:26 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * docs/XML/componentassembly.dtd: + * docs/XML/corbacomponent.dtd: + * docs/XML/properties.dtd: + * docs/XML/softpkg.dtd: Updated these files with the ones from my + web page. They are now in-sync with the latest RTF. + +Wed Jan 29 13:27:01 2003 Jeff Parsons <j.parsons@vanderbilt.edu> + + * CIDLC/DesignNotes: + + Added a list of items from the IDL compiler that need redesign and + can perhaps be done incrementally in the CIDL compiler, and + eventually integrated back into the IDL compiler. + +Wed Jan 22 16:05:18 2003 Boris S Kolpackov <boris@isis-server.isis.vanderbilt.edu> + + * CIDLC/DesignNotes: added some more ideas. + +Wed Jan 22 13:54:12 2003 Boris S Kolpackov <boris@isis-server.isis.vanderbilt.edu> + + * CIDLC/DesignNotes: added this file to capture and document CIDL + complier design ideas/decisions. + +Tue Jan 21 16:20:44 2003 Boris S Kolpackov <boris@isis-server.isis.vanderbilt.edu> + + * tools/CIDLC: + * CIDLC: moved CIDLC directory one level up. + +Mon Jan 13 15:23:09 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * docs/templates/Executor.idl: Added meta-code for user-defined + oeprations, factory operations, and finder operations. + + * docs/templates/CIAO_Glue_Session_Template.cpp: + * docs/templates/CIAO_Glue_Session_Template.h: + * docs/templates/CIAO_Glue_Session_Template.inl: Filled in the + rest of the CIDL generated Servant Glue code templates. + +Mon Jan 13 11:18:37 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * ciao/Component_Base.idl: + * ciao/CCM_Base.idl: Based on Components 1.1 RTF + Events::unsubscribe operations now return the unsubscribed + consumber object reference instead of void. + + * docs/templates/CIAO_Glue_Session_Template.cpp: + * docs/templates/CIAO_Glue_Session_Template.h: + * docs/templates/CIAO_Glue_Session_Template.inl: Filled in most of + the operations for component servant. Only opeations left + unimplemented include Events::get_*_publishers which I will + implement in the *_Context class later. + + There are several other oeprations that throw NO_IMPLEMENT + exception or are no-op currently. Missing them probably is okay + for now. Next up, Home Servant template. + +Mon Jan 13 00:27:03 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * docs/templates/CIAO_Glue_Session_Template.cpp: + * docs/templates/CIAO_Glue_Session_Template.h: + * docs/templates/CIAO_Glue_Session_Template.inl: Filled in a great + more generated code. This is almost done, finally. + + * docs/templates/CIAO_Glue_Session_Template.cpp: + * docs/templates/CIAO_Glue_Session_Template.h: + * docs/templates/CIAO_Glue_Session_Template.inl: + * docs/templates/Executor.idl: Changed to lead template comments + with '##' instead of # to diffentiate them from preprocessor + directives that we should generate. + + * ciao/HomeRegistrar_i.inl: + * ciao/HomeRegistrar_i.cpp: Fixed incorrect uses of exception macros. + + * ciao/Cookies.h: + * ciao/Cookies.cpp: Added a new insert method which "encode" an + Active_Objref_Map key into the Cookie. + + * ciao/Container_Base.inl: + * ciao/Container_Base.cpp: + * ciao/Container_Base.h: Added a new get_objref method which + basically allow us to get the component reference using POA's + servant_to_reference operation. Added a new inline file and + fixed some incorrect uses of exception macros. + + * ciao/Component_Base.idl: + * ciao/CCM_Base.idl: Based on Components 1.1 RTF + Receptacles::disconnect operations now return the disconnected + object reference instead of void. + +Fri Jan 10 12:03:00 2003 Boris S Kolpackov <boris@isis-server.isis.vanderbilt.edu> + + * tools/CCIDL: + * tools/CIDLC: + * tools/CIDLC/README: Renamed CCIDL to CIDLC. Added some + explanations about naming convention choosen for CIDL compiler. + +Thu Jan 09 00:57:37 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * docs/templates/cidl_template.cidl: Added an example CIDL file. + + * docs/templates/CIAO_Glue_Session_Template.h: + * docs/templates/CIAO_Glue_Session_Template.inl: + * docs/templates/CIAO_Glue_Session_Template.cpp: Added more + implementation code. + +Wed Jan 08 16:48:28 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * docs/templates/CIAO_Glue_Session_Template.h: Added the complete + list of operations that needs to be supported. Next up, the + implementation templates. + + * ciao/Active_Objref_Map.cpp: + * ciao/Active_Objref_Map.h: Defined a typedef called + CIAO::Active_Objref_Map for managing CORBA::Object_var's using + the ACE_Active_Map_Manager and instantiate the template. + + * ciao/Cookies.cpp: + * ciao/Cookies.h: Added insertion/extraction of + ACE_Active_Map_Manager_Key operations. + +Tue Jan 07 23:28:28 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * ciao/CIAO_common.h: Added a new file to collect common CIAO + macros. + + * ciao/CIAO_Component_i.cpp: + * ciao/CIAO_Component_i.h: Removed. + * ciao/Client_init.cpp: + * ciao/Client_init.h: The old CIAO_client_init in + CIAO_Component_i is now called Client_init under CIAO namespace. + This function initlializes the value factories for client side ORB. + + * ciao/Server_init.cpp: + * ciao/Server_init.h: Added new function Server_init under CIAO + namespace to initialize server side value factories for server + side ORB. + + * ciao/Cookies.cpp: + * ciao/Cookies.h: + * ciao/Cookies.inl: Added server-side implementation of + Components::Cookie called CIAO::Map_Key_Cookie. This + implementation is only used within the containers (i.e., server + side). Client doesn't need to know how to interpret a Cookie. + + * ciao/Container_Base.h: + * ciao/HomeRegistrar_i.h: Fixed various ACE-guideline conformity + problems. + + * ciao/CCM_Core.mpc: + * ciao/CIAO_Client.dsp: + * ciao/CIAO_Container.dsp: + * ciao/CIAO_Server.dsp: + * ciao/Makefile.client: + * ciao/Makefile.container: + * ciao/Makefile.server: Updated various makefiles/projects. + +Tue Jan 07 07:48:02 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * ciao/Container_Base.cpp (install_servant): Changed to decrease + the refcount of servant by one to make sure servants get + "released" properly. + +Fri Jan 03 11:27:12 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * docs/templates/Executor.idl: This pseudo-meta IDL template file + summarizes the standard executor mapping and serves as a + template for CCIDL compiler. + +Sun Dec 22 23:12:49 2002 Nanbor Wang <nanbor@cs.wustl.edu> + + * examples/handcrafted/Display/RateGen/RateGen.idl: + * examples/handcrafted/Display/GPS/GPS.idl: + * examples/handcrafted/Display/NavDisplay/NavDisplay.idl: + * examples/handcrafted/Display/HUDisplay.idl: + * examples/handcrafted/Display/Display.mpc: Added more files for + this multi-component example. + + The followings should go to the ChangeLog under $(ACE_ROOT) + + * bin/MakeProjectCreator/configs/ciao_client.mpc: + * bin/MakeProjectCreator/configs/ciao_component.mpc: + * bin/MakeProjectCreator/configs/ciao_server.mpc: Added libpaths + defintions. + +Sat Dec 21 15:09:55 2002 Nanbor Wang <nanbor@cs.wustl.edu> + + * tools/Simple_Component_Server/Simple_Component_Server.dsp: + * examples/handcrafted/Hello/run_test.pl: Changed to generate + Simple_Component_Server executable in the project directory. + + * examples/handcrafted/Hello/hello.mpc: + * ciao/CCM_Core.mpc: + * tools/Simple_Component_Server/Simple_Component_Server.mpc: + Created MPC specifications. + + The followings should go to the ChangeLog under $(ACE_ROOT) + + * bin/MakeProjectCreator/configs/ciao_client.mpc: + * bin/MakeProjectCreator/configs/ciao_component.mpc: + * bin/MakeProjectCreator/configs/ciao_server.mpc: Created MPC + templates for CIAO client, component implmentation, and server + tools. + +Fri Dec 20 23:09:53 2002 Nanbor Wang <nanbor@cs.wustl.edu> + + * ciao/Makefile.server: Added HomeRegistrar.idl and + HomeRegistrar_i to the makefile. + + * tools/Simple_Component_Server/Makefile: Added a new makefile. + +Fri Dec 20 20:32:53 2002 Nanbor Wang <nanbor@cs.wustl.edu> + + * ciao/CCM_Component.idl: + * ciao/CCM_Container.idl: + * ciao/Container_Base.cpp: + * ciao/Makefile.client: + * ciao/Makefile.container: + * ciao/Makefile.server: Fixed compilation erros and Makefiles on + Linux. + +Thu Dec 19 20:44:39 2002 Nanbor Wang <nanbor@cs.wustl.edu> + + * examples/handcrafted/Display/README: + * examples/handcrafted/Display/Configuration-0.png: Added new + files explaining the purpose of the the new example and what it + will do. + +Wed Dec 18 20:37:06 2002 Nanbor Wang <nanbor@cs.wustl.edu> + + * examples/handcrafted/Hello/run_test.pl: Added a script to + automate running this stuff. + + * examples/handcrafted/Hello/README: Replaced the reference to + CIAO_single_com_server to Simple_Component_Server. + +Tue Dec 17 23:30:59 2002 Nanbor Wang <nanbor@cs.wustl.edu> + + * tools/CIAO_single_com_server/*: + * tools/Simple_Component_Server/*: Changed the name of the simple + server from CIAO_single_com_server to Simple_Component_Server. + The original name didn't make too much sense at all. + +Tue Dec 17 22:49:32 2002 Nanbor Wang <nanbor@cs.wustl.edu> + + * ciao/CIAO_Server.dsp: + * ciao/HomeRegistrar.idl: + * ciao/HomeRegistrar_i.{h,inl,cpp}: Added a NameService based + HomeFinder extension. This interface defines the registration + operation, which is not defined in the CCM specification. This + is part of the CIAO_Server library. + + * tools/CIAO_single_com_server/CIAO_single_com_server.cpp: Changed + to register installed components with the HomeRegistrar instead + of dumping the IOR into a file. The only thing that gets dumped + into a file now is the IOR for the HomeFinder interface which + HomeRegistrar inherits. + + * examples/handecrafted/Hello/README: Added information on the + procedures one should follow to run this test. + + * examples/handcrafted/Hello/config: Updated the component server + config file to include the repo ids and canonical name for the + home. + + * examples/handcrafted/Hello/client.dsp: + * examples/handcrafted/Hello/client.cpp: Changed to use acquire + the home object reference thru the HomeFinder interface, instead + of passing it in explicitly. + + * examples/handcrafted/Hello/hello.dsw: + * examples/handcrafted/Hello/server.cpp: + * examples/handcrafted/Hello/server.dsp: Removed server from the + workspace. As we now have a true component server, we no longer + need a server process for this example. + + +Mon Dec 16 10:56:46 2002 Nanbor Wang <nanbor@cs.wustl.edu> + + * tools/CIAO_single_com_server/CIAO_single_com_server.cpp: Fixed + command line argument parsing problem. We now process the + command line argument for ORB correctly. + +Sun Dec 15 23:54:16 2002 Nanbor Wang <nanbor@cs.wustl.edu> + + * tools/CIAO_single_com_server/*: Added a new prototype component + server. We can now run session components on a generic server + using a proprietary config file for component installation. + + * ciao/Container_Base.{h,cpp}: Fixed incorrect usage of ACE_DLL + where executor and servant Dlls got unloaded prematurely. + +Wed Dec 11 14:39:08 2002 Nanbor Wang <nanbor@cs.wustl.edu> + + A lot have changed since last ChangeLog entry. Most of the + changes are intermediate so I didn't even try to record them. + + * ciao/CCMCore.dsw: + * ciao/CIAO_Container.dsp: + * ciao/CIAO_Server.dsp: Moved Container_Base.* from CIAO_Container + library to CIAO_Server library. These classes in Container_Base + are really run-time container management interfaces than + container interfaces themselves. + + * ciao/Container_Base.cpp: + * ciao/Container_Base.h: Added _ciao_install_home which enable + installing a component home from relevant DLL named and entry + points. We are not managing the lifecycle of DLL objects in the + implementation yet (we just never unlink DLL. :) This will have + to be changed in the future. + + * examples/handcrafted/Hello/hello_servants.cpp: + * examples/handcrafted/Hello/hello_servants.h: Added an entry + point "create_HelloWorld_Servant" so we can use the glue code + with the new "generic server." + + * examples/handcrafted/Hello/server.cpp: + * examples/handcrafted/Hello/server.dsp: Reworked the server + implementation so that it is no longer tied to a specific + component implementation. I.e., we can use the same server to + host any *one* component now. + + * examples/handcrafted/Hello/client.dsp: Added a missing link + directory. + +Tue Nov 05 23:42:04 2002 Nanbor Wang <nanbor@cs.wustl.edu> + + * CCMCore.dsp: + * CIAO_BaseC.cpp: + * CIAO_BaseC.h: + * CIAO_BaseC.i: + * CIAO_ComponentC.cpp: + * CIAO_ComponentC.h: + * CIAO_ComponentC.i: + * CIAO_ContainerC.cpp: + * CIAO_ContainerC.h: + * CIAO_ContainerC.i: + * CIAO_Container_ExC.cpp: + * CIAO_Container_ExC.h: + * CIAO_Container_ExC.i: + * CIAO_DeploymentC.cpp: + * CIAO_DeploymentC.h: + * CIAO_DeploymentC.i: + * CIAO_EventC.cpp: + * CIAO_EventC.h: + * CIAO_EventC.i: + * CIAO_TransactionC.cpp: + * CIAO_TransactionC.h: + * CIAO_TransactionC.i: + * Component_BaseC.cpp: + * Component_BaseC.h: + * Component_BaseC.i: + * Component_BaseS.cpp: + * Component_BaseS.h: + * Component_BaseS.i: + * Component_BaseS_T.cpp: + * Component_BaseS_T.h: + * Component_BaseS_T.i: + * CosPersistentStateC.cpp: + * CosPersistentStateC.h: + * CosPersistentStateC.i: + * CosPersistentStateS.cpp: + * CosPersistentStateS.h: + * CosPersistentStateS.i: + * CosPersistentStateS_T.cpp: + * CosPersistentStateS_T.h: + * CosPersistentStateS_T.i: Removed generated files. + + * CCMCore.dsw: + * CIAO_CLIENT_Export.h: + * CIAO_Client.dsp: + * CIAO_Component.pidl: + * CIAO_Container.dsp: + * CIAO_Container_Export.h: + * CIAO_SERVER_Export.h: + * CIAO_Server.dsp: + * README: Split up the CCM Core library into 3 libraries for clients, + component implementations, and component servers. + +Thu Sep 26 15:20:13 2002 Nanbor Wang <nanbor@cs.wustl.edu> + + * ciao/CCMCore.dsp: + * ciao/CIAO_Base.pidl: + * ciao/CIAO_BaseC.cpp: + * ciao/CIAO_BaseC.h: + * ciao/CIAO_BaseC.i: + * ciao/CIAO_Component.pidl: + * ciao/CIAO_ComponentC.cpp: + * ciao/CIAO_ComponentC.h: + * ciao/CIAO_ComponentC.i: + * ciao/CIAO_Container.pidl: + * ciao/CIAO_ContainerC.cpp: + * ciao/CIAO_ContainerC.h: + * ciao/CIAO_ContainerC.i: + * ciao/CIAO_Container_Ex.pidl: + * ciao/CIAO_Container_ExC.cpp: + * ciao/CIAO_Container_ExC.h: + * ciao/CIAO_Container_ExC.i: + * ciao/CIAO_Deployment.pidl: + * ciao/CIAO_DeploymentC.cpp: + * ciao/CIAO_DeploymentC.h: + * ciao/CIAO_DeploymentC.i: + * ciao/CIAO_Event.pidl: + * ciao/CIAO_EventC.cpp: + * ciao/CIAO_EventC.h: + * ciao/CIAO_EventC.i: + * ciao/CIAO_Transaction.pidl: + * ciao/CIAO_TransactionC.cpp: + * ciao/CIAO_TransactionC.h: + * ciao/CIAO_TransactionC.i: Changed to split the component idl + file into severl smaller idl files. + + * ciao/Makefile: An empty place holder for now. + + * ciao/Version.h: + * ciao/ciao.rc: Added version information files. + +Thu Jul 18 22:14:59 2002 Nanbor Wang <nanbor@cs.wustl.edu> + + * examples/handcrafted/Philosophers/Philosophers.idl (Example): + +Mon Jun 17 17:35:31 2002 Nanbor Wang <nanbor@cs.wustl.edu> + + * docs/index.html: + * docs/imgs/CCM.vsd: + * docs/imgs/basic-container.png: + * docs/imgs/component-basic.png: + * docs/imgs/deployment.png: + * docs/imgs/extended-container.png: + * docs/imgs/home-config.png: Added CIAO documentation. diff --git a/TAO/CIAO/bin/generate_component_mpc.pl b/TAO/CIAO/bin/generate_component_mpc.pl new file mode 100755 index 00000000000..c7e8d9af83e --- /dev/null +++ b/TAO/CIAO/bin/generate_component_mpc.pl @@ -0,0 +1,168 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# Create a MPC file content for a single component implementation. + +use Getopt::Std; + +############################################################################## +# Grab the options + +$flags = join (" ", @ARGV); + +if (!getopts ('dcnip:l:h') || $opt_h) { + print "generate_component_mpc.pl [-d] [-h] component_name\n"; + print "\n"; + print " -d Turn on debug mode\n"; + print " -p Dependent component name\n"; + print " -l Dependent component path\n"; + print " -i Use an executor definition IDL file\n"; + print " -n Supress component make/project\n"; + print " -c Create a client makefile\n"; + print "\n"; + print "generate_component_mpc creates and save a minimum mpc file\n"; + print "called $com_name.mpc that is needed for a single component implementation\n"; + exit (1); +} + +if (defined $opt_d) { + print "Debugging Turned on\n"; + + if (defined $opt_f) { + print "Dependency to $opt_f\n"; + } +} + + +if ($#ARGV < 0) { + print STDERR "No component_name specified, use -h for help\n"; + exit (1); +} + +$com_name = shift @ARGV; +$UCOM_NAME = uc $com_name; + +############################################################################## +# Prologue + +if (defined $opt_p) { + $stub_depend = "depends += $opt_p".'_stub'; + $svnt_depend = "$opt_p".'_svnt'; + $lib_depend = "$opt_p".'_stub '."$opt_p".'_svnt'; + $client_depend = "$com_name".'_stub '."$opt_p"."_stub"; +} +else { + $client_depend = "$com_name".'_stub'; +} + +if (defined $opt_l) { + $lib_paths = "libpaths += $opt_l"; +} + +if (defined $opt_c) { + $client_def = +' +project ('."$com_name".'_client) : ciao_client { + exename = client + depends += '."$client_depend".' + + IDL_Files { + } + + Source_Files { + client.cpp + } +} +'; +} + +if (defined $opt_i) { + $exec_impl_idl = "$com_name".'EI.idl'; + $exec_impl_cpp = "$com_name".'EIC.cpp'; +} + + +if (! defined $opt_n) { + $component_def = +' +project('."$com_name".'_exec) : ciao_server { + depends += '."$com_name".'_svnt + sharedname = '."$com_name".'_exec + libs += '."$com_name".'_stub '."$com_name".'_svnt'." $lib_depend + $lib_paths".' + idlflags += -Wb,export_macro='."$UCOM_NAME".'_EXEC_Export -Wb,export_include='."$com_name".'_exec_export.h + dllflags = '."$UCOM_NAME".'_EXEC_BUILD_DLL + + IDL_Files {'." + $exec_impl_idl".' + } + + Source_Files {'." + $exec_impl_cpp + $com_name".'_exec.cpp + } +} +'; +} + +$mpc_template = '// $Id$ +// This file is generated with "'."generate_component_mpc.pl $flags".'" + +project('."$com_name".'_stub): ciao_client {'." + $stub_depend".' + sharedname = '."$com_name".'_stub + idlflags += -Wb,stub_export_macro='."$UCOM_NAME".'_STUB_Export -Wb,stub_export_include='."$com_name".'_stub_export.h -Wb,skel_export_macro='."$UCOM_NAME".'_SVNT_Export -Wb,skel_export_include='."$com_name".'_svnt_export.h + dllflags = '."$UCOM_NAME".'_STUB_BUILD_DLL + + IDL_Files { + '."$com_name".'.idl + } + + Source_Files { + '."$com_name".'C.cpp + } +} + +project('."$com_name".'_svnt) : ciao_server { + depends += '."$svnt_depend $com_name".'_stub + sharedname = '."$com_name".'_svnt + libs += '."$com_name".'_stub'." $lib_depend + $lib_paths".' + idlflags += -Wb,export_macro='."$UCOM_NAME".'_SVNT_Export -Wb,export_include='."$com_name".'_svnt_export.h + dllflags = '."$UCOM_NAME".'_SVNT_BUILD_DLL + + IDL_Files { + '."$com_name".'E.idl + } + + Source_Files { + '."$com_name".'EC.cpp + '."$com_name".'S.cpp + '."$com_name".'_svnt.cpp + } +} +'." +$component_def + +$client_def +"; + +############################################################################## +# Static Stuff + +############################################################################## +# Print the stuff out + + +# MPC files +open (MPCFILE, ">", "$com_name".".mpc"); +print MPCFILE $mpc_template; + +print "Run the following command also:\n\n"; +print "\tgenerate_export_file.pl $UCOM_NAME".'_STUB > '."$com_name".'_stub_export.h'."\n"; +print "\tgenerate_export_file.pl $UCOM_NAME".'_SVNT > '."$com_name".'_svnt_export.h'."\n"; +if (! defined $opt_n) { + print "\tgenerate_export_file.pl $UCOM_NAME".'_EXEC > '."$com_name".'_exec_export.h'."\n"; +} diff --git a/TAO/CIAO/ciao/Active_Objref_Map.cpp b/TAO/CIAO/ciao/Active_Objref_Map.cpp new file mode 100644 index 00000000000..00558f8f796 --- /dev/null +++ b/TAO/CIAO/ciao/Active_Objref_Map.cpp @@ -0,0 +1,11 @@ +// $Id$ + +#include "ciao/Active_Objref_Map.h" + + + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +template class ACE_Active_Map_Manager<CORBA::Object_var>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Active_Map_Manager<CORBA::Object_var>; +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/CIAO/ciao/Active_Objref_Map.h b/TAO/CIAO/ciao/Active_Objref_Map.h new file mode 100644 index 00000000000..9bdf7fdffc3 --- /dev/null +++ b/TAO/CIAO/ciao/Active_Objref_Map.h @@ -0,0 +1,35 @@ +// $Id$ + +/** + * @file Active_Objref_Map.h + * + * A CIAO implementation of object reference map which enables + * fast insertion/deletion/indexing of object reference thru + * map-generated keys. + * + * @sa ACE_Active_Map_Manager + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#ifndef CIAO_ACTIVE_OBJREF_MAP_H +#define CIAO_ACTIVE_OBJREF_MAP_H +#include "ace/pre.h" + +#include "ace/Active_Map_manager_T.h" +#include "ciao/CIAO_Container_Export.h" +#include "tao/corbafwd.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO +{ + typedef ACE_Active_Map_Manager<CORBA::Object_var> Active_Objref_Map; + + CIAO_CONTAINER_SINGLETON_DECLARATION (ACE_Active_Map_Manager<CORBA::Object_var>); +} + +#include "ace/post.h" +#endif /* CIAO_ACTIVE_OBJREF_MAP_H */ diff --git a/TAO/CIAO/ciao/CCMCore.dsw b/TAO/CIAO/ciao/CCMCore.dsw new file mode 100644 index 00000000000..633fcd721d5 --- /dev/null +++ b/TAO/CIAO/ciao/CCMCore.dsw @@ -0,0 +1,59 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "CIAO_Client"=.\CIAO_Client.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "CIAO_Container"=.\CIAO_Container.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name CIAO_Client
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "CIAO_Server"=.\CIAO_Server.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name CIAO_Container
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/TAO/CIAO/ciao/CCM_Base.idl b/TAO/CIAO/ciao/CCM_Base.idl new file mode 100644 index 00000000000..e49d135152b --- /dev/null +++ b/TAO/CIAO/ciao/CCM_Base.idl @@ -0,0 +1,144 @@ +// $Id$ + +/** + * @@ Compile this file with: + * + * tao_idl -Gv -I W:/ACE_wrappers/TAO -I W:/ACE_wrappers/TAO/orbsvcs/orbsvcs Component_Base.idl + * tao_idl -Gv -I ../.. -I ../../orbsvcs/orbsvcs \ + * -Wb,export_macro=CIAO_Export \ + * -Wb,export_include=CIAO_export.h \ + * -Wb,pre_include="ace/pre.h" \ + * -Wb,post_include="ace/post.h" \ + * CCM_Base.idl + */ + +//#define CIAO_HAS_IMPORT_KEYWORD + +#if defined (CIAO_HAS_IMPORT_KEYWORD) +import ::CORBA; +#else +#include <orb.idl> +#endif /* CIAO_HAS_IMPORT_KEYWORD */ + +#if !defined (CCM_BASE_IDL) +#define CCM_BASE_IDL + +module Components +{ + /** + * @@ Commented out temporarily for lack of typePrefix support. + */ + typeprefix Components "omg.org"; + + typedef string FeatureName; + typedef sequence<FeatureName> NameList; + + valuetype Cookie + { + private CORBA::OctetSeq cookieValue; + }; + + valuetype PortDescription + { + public FeatureName Name; + public CORBA::RepositoryId type_id; + }; + + valuetype FacetDescription : PortDescription + { + public Object facet_ref; + }; + + typedef sequence<FacetDescription> FacetDescriptions; + + typedef unsigned long FailureReason; + + exception InvalidName {}; + exception InvalidConnection {}; + exception ExceededConnectionLimit {}; + exception AlreadyConnected {}; + exception NoConnection {}; + exception CookieRequired {}; + exception CreateFailure { + FailureReason reason; + }; + exception FinderFailure + { + FailureReason reason; + }; + exception RemoveFailure + { + FailureReason reason; + }; + exception DuplicateKeyValue {}; + exception InvalidKey {}; + exception UnknownKeyValue {}; + exception NoKeyAvailable {}; + exception BadEventType + { + CORBA::RepositoryId expected_event_type; + }; + exception HomeNotFound {}; + exception WrongComponentType {}; + + typedef FailureReason InvalidConfigurationReason; + const InvalidConfigurationReason UnknownConfigValueName = 0; + const InvalidConfigurationReason InvalidConfigValueType = 1; + const InvalidConfigurationReason ConfigValueRequired = 2; + const InvalidConfigurationReason ConfigValueNotExpected = 3; + exception InvalidConfiguration + { + InvalidConfigurationReason reason; + FeatureName name; + }; + exception IllegalState {}; + + interface Navigation + { + Object provide_facet (in FeatureName name) + raises (InvalidName); + FacetDescriptions get_all_facets(); + FacetDescriptions get_named_facets (in NameList names) + raises (InvalidName); + boolean same_component (in Object object_ref); + }; + + valuetype ConnectionDescription + { + public Cookie ck; + public Object objref; + }; + typedef sequence<ConnectionDescription> ConnectionDescriptions; + + valuetype ReceptacleDescription : PortDescription + { + public boolean is_multiple; + public ConnectionDescriptions connections; + }; + typedef sequence<ReceptacleDescription> ReceptacleDescriptions; + + interface Receptacles + { + Cookie connect (in FeatureName name, in Object connection ) + raises (InvalidName, + InvalidConnection, + AlreadyConnected, + ExceededConnectionLimit); + + // @@ Changed to return the previously connected object reference -- basef on RTF 1.1. + Object disconnect (in FeatureName name, in Cookie ck) + raises (InvalidName, + InvalidConnection, + CookieRequired, + NoConnection); + + ConnectionDescriptions get_connections (in FeatureName name) + raises (InvalidName); + + ReceptacleDescriptions get_all_receptacles (); + + ReceptacleDescriptions get_named_receptacles (in NameList names) + raises (InvalidName); + }; +}; +#endif /* CCM_BASE_IDL */ diff --git a/TAO/CIAO/ciao/CCM_Component.idl b/TAO/CIAO/ciao/CCM_Component.idl new file mode 100644 index 00000000000..a1547d815e4 --- /dev/null +++ b/TAO/CIAO/ciao/CCM_Component.idl @@ -0,0 +1,117 @@ +// $Id$ + +/** + * @@ Compile this file with: + * + * tao_idl -Gv -I ../.. -I ../../orbsvcs/orbsvcs \ + * -Wb,export_macro=CIAO_Export \ + * -Wb,export_include=CIAO_export.h \ + * -Wb,pre_include="ace/pre.h" \ + * -Wb,post_include="ace/post.h" \ + * CCM_Component.idl + */ + +#if !defined (CCM_COMPONENT_IDL) +#define CCM_COMPONENT_IDL + +#include "CCM_Event.idl" +#include "tao/IFR_Client/IFR_Base.pidl" + +module Components +{ + abstract valuetype PrimaryKeyBase {}; + + interface CCMObject; //forward reference + + interface CCMHome + { + CORBA::IRObject get_component_def (); + CORBA::IRObject get_home_def (); + void remove_component ( in CCMObject comp) + raises (RemoveFailure); + }; + typedef sequence<CCMHome> CCMHomes; + + interface KeylessCCMHome + { + CCMObject create_component() + raises (CreateFailure); + }; + + interface HomeFinder + { + CCMHome find_home_by_component_type (in CORBA::RepositoryId comp_repid) + raises (HomeNotFound); + + CCMHome find_home_by_home_type (in CORBA::RepositoryId home_repid) + raises (HomeNotFound); + + CCMHome find_home_by_name (in string home_name) + raises (HomeNotFound); + }; + + interface Configurator + { + void configure (in CCMObject comp) + raises (WrongComponentType); + }; + + valuetype ConfigValue + { + public FeatureName name; + public any value; + }; + + typedef sequence<ConfigValue> ConfigValues; + + interface StandardConfigurator : Configurator + { + void set_configuration (in ConfigValues descr); + }; + + interface HomeConfiguration : CCMHome + { + void set_configurator (in Configurator cfg); + void set_configuration_values (in ConfigValues config); + void complete_component_configuration (in boolean b); + void disable_home_configuration(); + }; + + valuetype ComponentPortDescription + { + public FacetDescriptions facets; + public ReceptacleDescriptions receptacles; + public ConsumerDescriptions consumers; + public EmitterDescriptions emitters; + public PublisherDescriptions publishers; + }; + + interface CCMObject : Navigation, Receptacles, Events + { + CORBA::IRObject get_component_def ( ); + CCMHome get_ccm_home( ); + PrimaryKeyBase get_primary_key( ) + raises (NoKeyAvailable); + void configuration_complete( ) + raises (InvalidConfiguration); + void remove() + raises (RemoveFailure); + ComponentPortDescription get_all_ports (); + }; + + // @@ Enumeration and DefaultEnumeration are only for EJB to CCM + // mapping? At any rate, we should be able to skip them for now. + abstract valuetype Enumeration + { + boolean has_more_elements(); + CCMObject next_element(); + }; + + typedef sequence<CCMObject> CCMObjectSeq; + + valuetype DefaultEnumeration : Enumeration + { + private CCMObjectSeq objects; + }; +}; +#endif /* CCM_COMPONENT_IDL */ diff --git a/TAO/CIAO/ciao/CCM_Container.idl b/TAO/CIAO/ciao/CCM_Container.idl new file mode 100644 index 00000000000..accd0402e81 --- /dev/null +++ b/TAO/CIAO/ciao/CCM_Container.idl @@ -0,0 +1,138 @@ +// $Id$ + +/** + * @@ Compile this file with: + * + * tao_idl -Gv -I ../.. -I ../../orbsvcs/orbsvcs \ + * -Wb,export_macro=CIAO_Export \ + * -Wb,export_include=CIAO_export.h \ + * -Wb,pre_include="ace/pre.h" \ + * -Wb,post_include="ace/post.h" \ + * CCM_Container.idl + */ + +//#define CIAO_HAS_IMPORT_KEYWORD + +#if !defined (CCM_CONTAINER_IDL) +#define CCM_CONTAINER_IDL + +#include "CCM_Component.idl" +#include "SecurityLevel2.idl" +#include "CCM_Transaction.idl" + +// *************** Basic Container interfaces *************** + +module Components +{ + typeprefix Components "omg.org"; + + typedef SecurityLevel2::Credentials Principal; + + local interface CCMContext + { + Principal get_caller_principal(); + + CCMHome get_CCM_home(); + + boolean get_rollback_only() + raises (IllegalState); + + Transaction::UserTransaction get_user_transaction() + raises (IllegalState); + + boolean is_caller_in_role (in string role); + + void set_rollback_only() + raises (IllegalState); + }; + + enum CCMExceptionReason + { + SYSTEM_ERROR, + CREATE_ERROR, + REMOVE_ERROR, + DUPLICATE_KEY, + FIND_ERROR, + OBJECT_NOT_FOUND, + NO_SUCH_ENTITY + }; + + exception CCMException + { + CCMExceptionReason reason; + }; + + local interface EnterpriseComponent {}; + + local interface SessionContext : CCMContext + { + Object get_CCM_object() + raises (IllegalState); + }; + + local interface SessionComponent : EnterpriseComponent + { + void set_session_context ( in SessionContext ctx) + raises (CCMException); + + void ccm_activate() + raises (CCMException); + + void ccm_passivate() + raises (CCMException); + + void ccm_remove () + raises (CCMException); + }; + + local interface SessionSynchronization + { + void after_begin () + raises (CCMException); + + void before_completion () + raises (CCMException); + + void after_completion (in boolean committed) + raises (CCMException); + }; + + local interface EntityContext : CCMContext + { + Object get_CCM_object () + raises (IllegalState); + + PrimaryKeyBase get_primary_key () + raises (IllegalState); + }; + + local interface EntityComponent : EnterpriseComponent + { + void set_entity_context (in EntityContext ctx) + raises (CCMException); + + void unset_entity_context () + raises (CCMException); + + void ccm_activate () + raises (CCMException); + + void ccm_load () + raises (CCMException); + + void ccm_store () + raises (CCMException); + + void ccm_passivate () + raises (CCMException); + + void ccm_remove () + raises (CCMException); + }; + + + local interface HomeExecutorBase + { + }; +}; +#endif /* CCM_CONTAINER_IDL */ diff --git a/TAO/CIAO/ciao/CCM_Container_Ex.idl b/TAO/CIAO/ciao/CCM_Container_Ex.idl new file mode 100644 index 00000000000..0aeb481807d --- /dev/null +++ b/TAO/CIAO/ciao/CCM_Container_Ex.idl @@ -0,0 +1,183 @@ +// $Id$ + +/** + * @@ Compile this file with: + * + * tao_idl -Gv -I ../.. -I ../../orbsvcs/orbsvcs \ + * -Wb,export_macro=CIAO_Export \ + * -Wb,export_include=CIAO_export.h \ + * -Wb,pre_include="ace/pre.h" \ + * -Wb,post_include="ace/post.h" \ + * CCM_Container_Ex.idl + */ + +//#define CIAO_HAS_IMPORT_KEYWORD + +#if !defined (CCM_CONTAINER_EX_IDL) +#define CCM_CONTAINER_EX_IDL + +#include "CCM_Container.idl" +#include <CosPersistentState.idl> + +// *************** Extended Container Interfaces *************** + +module Components +{ + typeprefix Components "omg.org"; + + enum BadComponentReferenceReason + { + NON_LOCAL_REFERENCE, + NON_COMPONENT_REFERENCE, + WRONG_CONTAINER + }; + + typedef CosPersistentState::CatalogBase CatalogBase; + typedef CosPersistentState::_TypeId _TypeId; + + typedef short SegmentId; + const SegmentId COMPONENT_SEGMENT = 0; + + typedef short FacetId; + const FacetId COMPONENT_FACET = 0; + + typedef sequence<octet> IdData; + typedef CosPersistentState::Pid PersistentId; + + typedef short StateIdType; + const StateIdType PERSISTENT_ID = 0; + + exception BadComponentReference + { + BadComponentReferenceReason reason; + }; + exception PolicyMismatch {}; + exception PersistenceNotAvailable {}; + exception UnknownActualHome {}; + exception ProxyHomeNotSupported {}; + exception InvalidStateIdData {}; + + local interface HomeRegistration + { + void register_home (in CCMHome home_ref, + in string home_name); + + void unregister_home (in CCMHome home_ref); + }; + + local interface CCM2Context : CCMContext + { + HomeRegistration get_home_registration (); + + void req_passivate () + raises (PolicyMismatch); + + CatalogBase get_persistence (in _TypeId catalog_type_id) + raises (PersistenceNotAvailable); + }; + + local interface ProxyHomeRegistration : HomeRegistration + { + void register_proxy_home (in CCMHome rhome, + in CCMHome ahome) + raises (UnknownActualHome, + ProxyHomeNotSupported); + }; + + local interface Session2Context : SessionContext, CCM2Context + { + Object create_ref (in CORBA::RepositoryId repid); + + Object create_ref_from_oid (in CORBA::OctetSeq oid, + in CORBA::RepositoryId repid); + + CORBA::OctetSeq get_oid_from_ref (in Object objref) + raises (IllegalState, + BadComponentReference); + }; + + abstract valuetype StateIdValue + { + StateIdType get_sid_type(); + IdData get_sid_data(); + }; + + local interface StateIdFactory + { + StateIdValue create (in IdData data) + raises (InvalidStateIdData); + }; + + valuetype PersistentIdValue : StateIdValue + { + private PersistentId pid; + + PersistentId get_pid(); + factory init (in PersistentId pid); + }; + + valuetype SegmentDescr + { + private StateIdValue sid; + private SegmentId seg; + + StateIdValue get_sid(); + SegmentId get_seg_id(); + factory init (in StateIdValue sid, + in SegmentId seg); + }; + + typedef sequence<SegmentDescr> SegmentDescrSeq; + + local interface ComponentId + { + FacetId get_target_facet(); + + SegmentId get_target_segment(); + + StateIdValue get_target_state_id (in StateIdFactory sid_factory) + raises (InvalidStateIdData); + + StateIdValue get_segment_state_id (in SegmentId seg, + in StateIdFactory sid_factory) + raises (InvalidStateIdData); + + ComponentId create_with_new_target (in FacetId new_target_facet, + in SegmentId new_target_segment); + + SegmentDescrSeq get_segment_descrs (in StateIdFactory sid_factory) + raises (InvalidStateIdData); + }; + + local interface Entity2Context : EntityContext, CCM2Context + { + ComponentId get_component_id () + raises (IllegalState); + + ComponentId create_component_id (in FacetId target_facet, + in SegmentId target_segment, + in SegmentDescrSeq seq_descrs); + + ComponentId create_monolithic_component_id (in FacetId target_facet, + in StateIdValue sid); + + Object create_ref_from_cid (in CORBA::RepositoryId repid, + in ComponentId cid); + + ComponentId get_cid_from_ref (in Object objref) + raises (BadComponentReference); + }; + + local interface ExecutorLocator : EnterpriseComponent + { + Object obtain_executor (in string name) + raises (CCMException); + + void release_executor (in Object exc) + raises (CCMException); + + void configuration_complete() + raises (InvalidConfiguration); + }; +}; +#endif /* CCM_CONTAINER_EX_IDL */ diff --git a/TAO/CIAO/ciao/CCM_Core.mpc b/TAO/CIAO/ciao/CCM_Core.mpc new file mode 100644 index 00000000000..90989f2a051 --- /dev/null +++ b/TAO/CIAO/ciao/CCM_Core.mpc @@ -0,0 +1,81 @@ +project (CIAO_Client) : taolib_with_idl { + depends += IFR_Client + sharedname = CIAO_Client + libs += TAO TAO_IFR_Client + idlflags += -I $(TAO_ROOT) -Wb,stub_export_include=CIAO_Client_Export.h -Wb,skel_export_include=CIAO_Container_Export.h -Wb,pre_include="ace/pre.h" -Wb,post_include="ace/post.h" + dllflags = CIAO_CLIENT_BUILD_DLL + + IDL_Files { + CCM_Base.idl + CCM_Event.idl + CCM_Component.idl + CIAO_Value.idl + } + + Source_Files { + CCM_BaseC.cpp + CCM_EventC.cpp + CCM_ComponentC.cpp + CIAO_ValueC.cpp + Client_init.cpp + } +} + +project (CIAO_Container) : taolib_with_idl { + depends += CIAO_Client PortableServer Security + sharedname = CIAO_Container + libs += TAO TAO_PortableServer TAO_IFR_Client TAO_Security CIAO_Client + idlflags += -I $(TAO_ROOT) -I$ $(TAO_ROOT)/orbsvcs/orbsvcs -Wb,export_include=CIAO_Container_Export.h -Wb,pre_include="ace/pre.h" -Wb,post_include="ace/post.h" + dllflags = CIAO_CONTAINER_BUILD_DLL + includes += $(TAO_ROOT)/orbsvcs/orbsvcs + + IDL_Files { + CCM_Transaction.idl + CosPersistentState.idl + CCM_Container.idl + CCM_Container_Ex.idl + } + + Source_Files { + CCM_TransactionC.cpp + CosPersistentStateC.cpp + CCM_ContainerC.cpp + CCM_Container_ExC.cpp + CCM_BaseS.cpp + CCM_EventS.cpp + CCM_ComponentS.cpp + Cookies.cpp + } +} + +project (CIAO_Server) :taolib_with_idl { + depends += CIAO_Container + sharedname = CIAO_Server + libs += TAO TAO_PortableServer TAO_IFR_Client TAO_Security + idlflags += -I$(TAO_ROOT) -I$(TAO_ROOT)/orbsvcs/orbsvcs -Wb,export_include=CIAO_Server_Export.h -Wb,pre_include="ace/pre.h" -Wb,post_include="ace/post.h" + + dllflags = CIAO_SERVER_BUILD_DLL + includes += $(TAO_ROOT)/orbsvcs/orbsvcs + + IDL_Files { + CCM_Deployment.idl + CIAO_Servers.idl +// HomeRegistrar.idl + } + + Source_Files { + CCM_DeploymentC.cpp + CCM_DeploymentS.cpp + CIAO_ServersC.cpp + CIAO_ServersS.cpp +// HomeRegistrarC.cpp +// HomeRegistrarS.cpp + ComponentInstallation_Impl.cpp + ComponentServer_Impl.cpp + Container_Base.cpp + Container_Impl.cpp +// HomeRegistrar_i.cpp + Server_init.cpp + ServerActivator_Impl.cpp + } +} diff --git a/TAO/CIAO/ciao/CCM_Deployment.idl b/TAO/CIAO/ciao/CCM_Deployment.idl new file mode 100644 index 00000000000..441466de3e5 --- /dev/null +++ b/TAO/CIAO/ciao/CCM_Deployment.idl @@ -0,0 +1,155 @@ +// $Id$ + +/** + * @@ Compile this file with: + * + * tao_idl -Gv -I ../.. -I ../../orbsvcs/orbsvcs \ + * -Wb,export_macro=CIAO_Export \ + * -Wb,export_include=CIAO_export.h \ + * -Wb,pre_include="ace/pre.h" \ + * -Wb,post_include="ace/post.h" \ + * CCM_Deployment.idl + */ + +//#define CIAO_HAS_IMPORT_KEYWORD + +#if !defined (CCM_DEPLOYMENT_IDL) +#define CCM_DEPLOYMENT_IDL + +#include "CCM_Component.idl" + +// *************** Packaging and Deployment *************** + +module Components +{ + typeprefix Components "omg.org"; + + module Deployment + { + typedef string UUID; + typedef string Location; + + enum AssemblyState + { + INACTIVE, + INSERVICE + }; + + exception UnknownImplId {}; + exception InvalidLocation {}; + exception InstallationFailure + { + FailureReason reason; + }; + exception InvalidAssembly {}; + + interface ComponentInstallation + { + void install(in UUID implUUID, + in Location component_loc) + raises (InvalidLocation, + InstallationFailure); + + void replace(in UUID implUUID, + in Location component_loc) + raises (InvalidLocation, + InstallationFailure); + + void remove(in UUID implUUID) + raises (UnknownImplId, + RemoveFailure); + + Location get_implementation (in UUID implUUID) + raises (UnknownImplId, + InstallationFailure); + }; + + interface Assembly + { + void build() + raises (CreateFailure); + + void tear_down() + raises (RemoveFailure); + + AssemblyState get_state(); + }; + + interface AssemblyFactory + { + Cookie create_assembly (in Location assembly_loc) + raises (InvalidLocation, + CreateFailure); + + Assembly lookup(in Cookie c) + raises (InvalidAssembly); + + void destroy(in Cookie c) + raises (InvalidAssembly, + RemoveFailure); + }; + + interface ComponentServer; // Forward decl. + typedef sequence<ComponentServer> ComponentServers; + + interface ServerActivator + { + ComponentServer create_component_server (in ConfigValues config) + raises (CreateFailure, + InvalidConfiguration); + + void remove_component_server (in ComponentServer server) + raises (RemoveFailure); + + ComponentServers get_component_servers (); + }; + + interface Container; // Forward decl. + typedef sequence<Container> Containers; + + interface ComponentServer + { + readonly attribute ConfigValues configuration; + + ServerActivator get_server_activator (); + Container create_container (in ConfigValues config) + raises (CreateFailure, + InvalidConfiguration); + + void remove_container (in Container cref) + raises (RemoveFailure); + + Containers get_containers (); + + void remove () + raises (RemoveFailure); + }; + + exception ImplEntryPointNotFound {}; + + interface Container + { + readonly attribute ConfigValues configuration; + + ComponentServer get_component_server (); + + CCMHome install_home (in UUID id, + in string entrypt, + in ConfigValues config) + raises (UnknownImplId, + ImplEntryPointNotFound, + InstallationFailure, + InvalidConfiguration); + + void remove_home (in CCMHome href) + raises (RemoveFailure); + + CCMHomes get_homes (); + void remove () + raises (RemoveFailure); + + }; + + }; +}; +#endif /* CCM_DEPLOYMENT_IDL */ diff --git a/TAO/CIAO/ciao/CCM_Event.idl b/TAO/CIAO/ciao/CCM_Event.idl new file mode 100644 index 00000000000..7773eedd186 --- /dev/null +++ b/TAO/CIAO/ciao/CCM_Event.idl @@ -0,0 +1,100 @@ +// $Id$ + +/** + * @@ Compile this file with: + * + * tao_idl -Gv -I ../.. -I ../../orbsvcs/orbsvcs \ + * -Wb,export_macro=CIAO_Export \ + * -Wb,export_include=CIAO_export.h \ + * -Wb,pre_include="ace/pre.h" \ + * -Wb,post_include="ace/post.h" \ + * CCM_Event.idl + */ + +//#define CIAO_HAS_IMPORT_KEYWORD + +#if !defined (CCM_EVENT_IDL) +#define CCM_EVENT_IDL + +#include "CCM_Base.idl" + +module Components +{ + typeprefix Components "omg.org"; + + abstract valuetype EventBase {}; + + interface EventConsumerBase + { + void push_event (in EventBase evt) raises (BadEventType); + }; + + valuetype ConsumerDescription : PortDescription + { + public EventConsumerBase consumer; + }; + typedef sequence<ConsumerDescription> ConsumerDescriptions; + + valuetype EmitterDescription : PortDescription + { + public EventConsumerBase consumer; + }; + typedef sequence<EmitterDescription> EmitterDescriptions; + + valuetype SubscriberDescription + { + public Cookie ck; + public EventConsumerBase consumer; + }; + typedef sequence<SubscriberDescription> SubscriberDescriptions; + + valuetype PublisherDescription : PortDescription + { + public SubscriberDescriptions consumer; + }; + typedef sequence<PublisherDescription> PublisherDescriptions; + + interface Events + { + EventConsumerBase get_consumer (in FeatureName sink_name) + raises (InvalidName); + + Cookie subscribe (in FeatureName publisher_name, + in EventConsumerBase subscriber) + raises (InvalidName, + AlreadyConnected, + InvalidConnection, + ExceededConnectionLimit); + + EventConsumerBase unsubscribe (in FeatureName publisher_name, + in Cookie ck) + raises (InvalidName, + InvalidConnection); + + void connect_consumer (in FeatureName emitter_name, + in EventConsumerBase consumer) + raises (InvalidName, + AlreadyConnected, + InvalidConnection); + + EventConsumerBase disconnect_consumer (in FeatureName source_name) + raises (InvalidName, + NoConnection); + + ConsumerDescriptions get_all_consumers (); + + ConsumerDescriptions get_named_consumers (in NameList names) + raises (InvalidName); + + EmitterDescriptions get_all_emitters (); + + EmitterDescriptions get_named_emitters (in NameList names) + raises (InvalidName); + + PublisherDescriptions get_all_publishers (); + + PublisherDescriptions get_named_publishers (in NameList names) + raises (InvalidName); + }; +}; +#endif /* CCM_EVENT_IDL */ diff --git a/TAO/CIAO/ciao/CCM_Transaction.idl b/TAO/CIAO/ciao/CCM_Transaction.idl new file mode 100644 index 00000000000..c0c8cdc2c1d --- /dev/null +++ b/TAO/CIAO/ciao/CCM_Transaction.idl @@ -0,0 +1,89 @@ +// $Id$ + +/** + * @@ Compile this file with: + * + * tao_idl -Gv -I ../.. -I ../../orbsvcs/orbsvcs \ + * -Wb,export_macro=CIAO_Export \ + * -Wb,export_include=CIAO_export.h \ + * -Wb,pre_include="ace/pre.h" \ + * -Wb,post_include="ace/post.h" \ + * CCM_Transaction.idl + */ + +//#define CIAO_HAS_IMPORT_KEYWORD + +#if !defined (CCM_TRANSACTION_IDL) +#define CCM_TRANSACTION_IDL + +module Components +{ + typeprefix Components "omg.org"; + + // @@ Components::Transaction is still there. + module Transaction + { + + typedef sequence<octet> TranToken; + + exception NoTransaction {}; + exception NotSupported {}; + exception SystemError {}; + exception RollbackError {}; + exception HeuristicMixed {}; + exception HeuristicRollback {}; + exception Security {}; + exception InvalidToken {}; + + enum Status + { + ACTIVE, + MARKED_ROLLBACK, + PREPARED, + COMMITTED, + ROLLED_BACK, + NO_TRANSACTION, + PREPARING, + COMMITTING, + ROLLING_BACK + }; + + local interface UserTransaction { + void begin () + raises (NotSupported, + SystemError); + + void commit () + raises (RollbackError, + NoTransaction, + HeuristicMixed, + HeuristicRollback, + Security, + SystemError); + + void rollback () + raises (NoTransaction, + Security, + SystemError); + + void set_rollback_only () + raises (NoTransaction, + SystemError); + + Status get_status() + raises (SystemError); + + void set_timeout (in long to) + raises (SystemError); + + TranToken suspend () + raises (NoTransaction, + SystemError); + + void resume (in TranToken txtoken) + raises (InvalidToken, + SystemError); + }; + }; +}; +#endif /* CCM_TRANSACTION_IDL */ diff --git a/TAO/CIAO/ciao/CIAO_Client.dsp b/TAO/CIAO/ciao/CIAO_Client.dsp new file mode 100644 index 00000000000..a8a7b55236b --- /dev/null +++ b/TAO/CIAO/ciao/CIAO_Client.dsp @@ -0,0 +1,409 @@ +# Microsoft Developer Studio Project File - Name="CIAO_Client" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=CIAO_Client - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "CIAO_Client.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "CIAO_Client.mak" CFG="CIAO_Client - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "CIAO_Client - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "CIAO_Client - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "CIAO_Client - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CIAO_CLIENT_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I ".." /I "..\..\.." /I "..\.." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CIAO_CLIENT_BUILD_DLL" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 ace.lib tao.lib TAO_IFR_Client.lib /nologo /dll /machine:I386 /out:"..\..\..\bin\CIAO_Client.dll" /libpath:"..\..\..\ace" /libpath:"..\..\tao" /libpath:"..\..\tao\IFR_Client"
+
+!ELSEIF "$(CFG)" == "CIAO_Client - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "CIAO_Client___Win32_Debug"
+# PROP BASE Intermediate_Dir "CIAO_Client___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CIAO_CLIENT_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /Zi /Od /I ".." /I "..\..\.." /I "..\.." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CIAO_CLIENT_BUILD_DLL" /YX /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib taod.lib TAO_IFR_Clientd.lib /nologo /dll /debug /machine:I386 /out:"..\..\..\bin\CIAO_Clientd.dll" /pdbtype:sept /libpath:"..\..\..\ace" /libpath:"..\..\tao" /libpath:"..\..\tao\IFR_Client"
+
+!ENDIF
+
+# Begin Target
+
+# Name "CIAO_Client - Win32 Release"
+# Name "CIAO_Client - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\CCM_BaseC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CCM_ComponentC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CCM_EventC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CIAO_ValueC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Client_init.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\CCM_BaseC.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CCM_ComponentC.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CCM_EventC.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CIAO_CLIENT_Export.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CIAO_ValueC.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Client_init.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\ciao.rc
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter "i,inl"
+# Begin Source File
+
+SOURCE=.\CCM_Base.idl
+
+!IF "$(CFG)" == "CIAO_Client - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputName)
+InputPath=.\CCM_Base.idl
+InputName=CCM_Base
+
+BuildCmds= \
+ ..\..\..\bin\release\tao_idl -Ge 1 -Sc -I ../.. -I ../../orbsvcs/orbsvcs -Wb,skel_export_macro=CIAO_CONTAINER_Export -Wb,skel_export_include=CIAO_CONTAINER_export.h -Wb,stub_export_macro=CIAO_CLIENT_Export -Wb,stub_export_include=CIAO_CLIENT_export.h -Wb,pre_include="ace/pre.h" -Wb,post_include="ace/post.h" $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "CIAO_Client - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputName)
+InputPath=.\CCM_Base.idl
+InputName=CCM_Base
+
+BuildCmds= \
+ ..\..\..\bin\tao_idl -Ge 1 -Sc -I ../.. -I ../../orbsvcs/orbsvcs -Wb,stub_export_macro=CIAO_CLIENT_Export -Wb,stub_export_include=CIAO_CLIENT_export.h -Wb,pre_include="ace/pre.h" -Wb,skel_export_macro=CIAO_CONTAINER_Export -Wb,skel_export_include=CIAO_CONTAINER_export.h -Wb,post_include="ace/post.h" $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\CCM_Component.idl
+
+!IF "$(CFG)" == "CIAO_Client - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputName)
+InputPath=.\CCM_Component.idl
+InputName=CCM_Component
+
+BuildCmds= \
+ ..\..\..\bin\release\tao_idl -Ge 1 -Sc -I ../.. -I ../../orbsvcs/orbsvcs -Wb,skel_export_macro=CIAO_CONTAINER_Export -Wb,skel_export_include=CIAO_CONTAINER_export.h -Wb,stub_export_macro=CIAO_CLIENT_Export -Wb,stub_export_include=CIAO_CLIENT_export.h -Wb,pre_include="ace/pre.h" -Wb,post_include="ace/post.h" $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "CIAO_Client - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputName)
+InputPath=.\CCM_Component.idl
+InputName=CCM_Component
+
+BuildCmds= \
+ ..\..\..\bin\tao_idl -Ge 1 -Sc -I ../.. -I ../../orbsvcs/orbsvcs -Wb,stub_export_macro=CIAO_CLIENT_Export -Wb,stub_export_include=CIAO_CLIENT_export.h -Wb,pre_include="ace/pre.h" -Wb,skel_export_macro=CIAO_CONTAINER_Export -Wb,skel_export_include=CIAO_CONTAINER_export.h -Wb,post_include="ace/post.h" $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\CCM_Event.idl
+
+!IF "$(CFG)" == "CIAO_Client - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputName)
+InputPath=.\CCM_Event.idl
+InputName=CCM_Event
+
+BuildCmds= \
+ ..\..\..\bin\release\tao_idl -Ge 1 -Sc -I ../.. -I ../../orbsvcs/orbsvcs -Wb,skel_export_macro=CIAO_CONTAINER_Export -Wb,skel_export_include=CIAO_CONTAINER_export.h -Wb,stub_export_macro=CIAO_CLIENT_Export -Wb,stub_export_include=CIAO_CLIENT_export.h -Wb,pre_include="ace/pre.h" -Wb,post_include="ace/post.h" $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "CIAO_Client - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputName)
+InputPath=.\CCM_Event.idl
+InputName=CCM_Event
+
+BuildCmds= \
+ ..\..\..\bin\tao_idl -Ge 1 -Sc -I ../.. -I ../../orbsvcs/orbsvcs -Wb,stub_export_macro=CIAO_CLIENT_Export -Wb,stub_export_include=CIAO_CLIENT_export.h -Wb,pre_include="ace/pre.h" -Wb,skel_export_macro=CIAO_CONTAINER_Export -Wb,skel_export_include=CIAO_CONTAINER_export.h -Wb,post_include="ace/post.h" $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\CIAO_Value.idl
+
+!IF "$(CFG)" == "CIAO_Client - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputName)
+InputPath=.\CIAO_Value.idl
+InputName=CIAO_Value
+
+BuildCmds= \
+ ..\..\..\bin\release\tao_idl -Ge 1 -Sc -I ../.. -I ../../orbsvcs/orbsvcs -Wb,skel_export_macro=CIAO_CONTAINER_Export -Wb,skel_export_include=CIAO_CONTAINER_export.h -Wb,stub_export_macro=CIAO_CLIENT_Export -Wb,stub_export_include=CIAO_CLIENT_export.h -Wb,pre_include="ace/pre.h" -Wb,post_include="ace/post.h" $(InputName).idl \
+ del $(InputName)S.* \
+
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "CIAO_Client - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputName)
+InputPath=.\CIAO_Value.idl
+InputName=CIAO_Value
+
+BuildCmds= \
+ ..\..\..\bin\tao_idl -Ge 1 -Sc -I ../.. -I ../../orbsvcs/orbsvcs -Wb,stub_export_macro=CIAO_CLIENT_Export -Wb,stub_export_include=CIAO_CLIENT_export.h -Wb,pre_include="ace/pre.h" -Wb,skel_export_macro=CIAO_CONTAINER_Export -Wb,skel_export_include=CIAO_CONTAINER_export.h -Wb,post_include="ace/post.h" $(InputName).idl \
+ del $(InputName)S.* \
+
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\CIAO_ValueC.i
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/CIAO/ciao/CIAO_Client_Export.h b/TAO/CIAO/ciao/CIAO_Client_Export.h new file mode 100644 index 00000000000..a566e94b0c2 --- /dev/null +++ b/TAO/CIAO/ciao/CIAO_Client_Export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl CIAO_CLIENT +// ------------------------------ +#ifndef CIAO_CLIENT_EXPORT_H +#define CIAO_CLIENT_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (CIAO_CLIENT_HAS_DLL) +# define CIAO_CLIENT_HAS_DLL 1 +#endif /* ! CIAO_CLIENT_HAS_DLL */ + +#if defined (CIAO_CLIENT_HAS_DLL) && (CIAO_CLIENT_HAS_DLL == 1) +# if defined (CIAO_CLIENT_BUILD_DLL) +# define CIAO_CLIENT_Export ACE_Proper_Export_Flag +# define CIAO_CLIENT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define CIAO_CLIENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* CIAO_CLIENT_BUILD_DLL */ +# define CIAO_CLIENT_Export ACE_Proper_Import_Flag +# define CIAO_CLIENT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define CIAO_CLIENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* CIAO_CLIENT_BUILD_DLL */ +#else /* CIAO_CLIENT_HAS_DLL == 1 */ +# define CIAO_CLIENT_Export +# define CIAO_CLIENT_SINGLETON_DECLARATION(T) +# define CIAO_CLIENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* CIAO_CLIENT_HAS_DLL == 1 */ + +// Set CIAO_CLIENT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (CIAO_CLIENT_NTRACE) +# if (ACE_NTRACE == 1) +# define CIAO_CLIENT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define CIAO_CLIENT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !CIAO_CLIENT_NTRACE */ + +#if (CIAO_CLIENT_NTRACE == 1) +# define CIAO_CLIENT_TRACE(X) +#else /* (CIAO_CLIENT_NTRACE == 1) */ +# define CIAO_CLIENT_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (CIAO_CLIENT_NTRACE == 1) */ + +#endif /* CIAO_CLIENT_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/ciao/CIAO_Container.dsp b/TAO/CIAO/ciao/CIAO_Container.dsp new file mode 100644 index 00000000000..4883db98f84 --- /dev/null +++ b/TAO/CIAO/ciao/CIAO_Container.dsp @@ -0,0 +1,415 @@ +# Microsoft Developer Studio Project File - Name="CIAO_Container" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=CIAO_Container - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "CIAO_Container.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "CIAO_Container.mak" CFG="CIAO_Container - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "CIAO_Container - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "CIAO_Container - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "CIAO_Container - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CIAO_CONTAINER_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I ".." /I "..\..\.." /I "..\.." /I "..\..\orbsvcs\orbsvcs" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CIAO_CONTAINER_BUILD_DLL" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 ace.lib tao.lib TAO_IFR_Client.lib TAO_Security.lib TAO_PortableServer.lib /nologo /dll /machine:I386 /out:"..\..\..\bin\CIAO_Container.dll" /libpath:"..\..\orbsvcs\orbsvcs" /libpath:"..\..\..\ace" /libpath:"..\..\tao" /libpath:"..\..\tao\IFR_Client" /libpath:"..\..\tao\PortableServer"
+
+!ELSEIF "$(CFG)" == "CIAO_Container - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CIAO_CONTAINER_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /Zi /Od /I ".." /I "..\..\.." /I "..\.." /I "..\..\orbsvcs\orbsvcs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CIAO_CONTAINER_BUILD_DLL" /YX /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib taod.lib TAO_IFR_Clientd.lib TAO_Securityd.lib TAO_PortableServerd.lib /nologo /dll /debug /machine:I386 /out:"..\..\..\bin\CIAO_Containerd.dll" /pdbtype:sept /libpath:"..\..\orbsvcs\orbsvcs" /libpath:"..\..\..\ace" /libpath:"..\..\tao" /libpath:"..\..\tao\IFR_Client" /libpath:"..\..\tao\PortableServer"
+
+!ENDIF
+
+# Begin Target
+
+# Name "CIAO_Container - Win32 Release"
+# Name "CIAO_Container - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\CCM_BaseS.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CCM_ComponentS.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CCM_Container_ExC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CCM_ContainerC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CCM_EventS.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CCM_TransactionC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Cookies.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CosPersistentStateC.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\CCM_BaseS.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CCM_ComponentS.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CCM_Container_ExC.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CCM_ContainerC.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CCM_EventS.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CCM_TransactionC.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CIAO_Container_Export.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Cookies.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CosPersistentStateC.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i,inl"
+# Begin Source File
+
+SOURCE=.\CCM_BaseS.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\CCM_ComponentS.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\CCM_Container_ExC.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\CCM_ContainerC.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\CCM_EventS.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\CCM_TransactionC.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\Cookies.inl
+# End Source File
+# Begin Source File
+
+SOURCE=.\CosPersistentStateC.i
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\CCM_Container.idl
+
+!IF "$(CFG)" == "CIAO_Container - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputName)
+InputPath=.\CCM_Container.idl
+InputName=CCM_Container
+
+BuildCmds= \
+ ..\..\..\bin\release\tao_idl -Ge 1 -Sc -I ../.. -I ../../orbsvcs/orbsvcs -Wb,export_macro=CIAO_CONTAINER_Export -Wb,export_include=CIAO_CONTAINER_export.h -Wb,pre_include="ace/pre.h" -Wb,post_include="ace/post.h" $(InputName).idl \
+ del $(InputName)S.* \
+
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "CIAO_Container - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputName)
+InputPath=.\CCM_Container.idl
+InputName=CCM_Container
+
+BuildCmds= \
+ ..\..\..\bin\tao_idl -Ge 1 -Sc -I ../.. -I ../../orbsvcs/orbsvcs -Wb,export_macro=CIAO_CONTAINER_Export -Wb,export_include=CIAO_CONTAINER_export.h -Wb,pre_include="ace/pre.h" -Wb,post_include="ace/post.h" $(InputName).idl \
+ del $(InputName)S.* \
+
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\CCM_Container_Ex.idl
+
+!IF "$(CFG)" == "CIAO_Container - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputName)
+InputPath=.\CCM_Container_Ex.idl
+InputName=CCM_Container_Ex
+
+BuildCmds= \
+ ..\..\..\bin\release\tao_idl -Ge 1 -Sc -I ../.. -I ../../orbsvcs/orbsvcs -Wb,export_macro=CIAO_CONTAINER_Export -Wb,export_include=CIAO_CONTAINER_export.h -Wb,pre_include="ace/pre.h" -Wb,post_include="ace/post.h" $(InputName).idl \
+ del $(InputName)S.* \
+
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "CIAO_Container - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputName)
+InputPath=.\CCM_Container_Ex.idl
+InputName=CCM_Container_Ex
+
+BuildCmds= \
+ ..\..\..\bin\tao_idl -Ge 1 -Sc -I ../.. -I ../../orbsvcs/orbsvcs -Wb,export_macro=CIAO_CONTAINER_Export -Wb,export_include=CIAO_CONTAINER_export.h -Wb,pre_include="ace/pre.h" -Wb,post_include="ace/post.h" $(InputName).idl \
+ del $(InputName)S.* \
+
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\CCM_Transaction.idl
+
+!IF "$(CFG)" == "CIAO_Container - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputName)
+InputPath=.\CCM_Transaction.idl
+InputName=CCM_Transaction
+
+BuildCmds= \
+ ..\..\..\bin\release\tao_idl -Ge 1 -Sc -I ../.. -I ../../orbsvcs/orbsvcs -Wb,export_macro=CIAO_CONTAINER_Export -Wb,export_include=CIAO_CONTAINER_export.h -Wb,pre_include="ace/pre.h" -Wb,post_include="ace/post.h" $(InputName).idl \
+ del $(InputName)S.* \
+
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "CIAO_Container - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputName)
+InputPath=.\CCM_Transaction.idl
+InputName=CCM_Transaction
+
+BuildCmds= \
+ ..\..\..\bin\tao_idl -Ge 1 -Sc -I ../.. -I ../../orbsvcs/orbsvcs -Wb,export_macro=CIAO_CONTAINER_Export -Wb,export_include=CIAO_CONTAINER_export.h -Wb,pre_include="ace/pre.h" -Wb,post_include="ace/post.h" $(InputName).idl \
+ del $(InputName)S.* \
+
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\CosPersistentState.idl
+
+!IF "$(CFG)" == "CIAO_Container - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputName)
+InputPath=.\CosPersistentState.idl
+InputName=CosPersistentState
+
+BuildCmds= \
+ ..\..\..\bin\release\tao_idl -Ge 1 -Sc -I ../.. -I ../../orbsvcs/orbsvcs -Wb,export_macro=CIAO_CONTAINER_Export -Wb,export_include=CIAO_CONTAINER_export.h -Wb,pre_include="ace/pre.h" -Wb,post_include="ace/post.h" $(InputName).idl \
+ del $(InputName)S.* \
+
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "CIAO_Container - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputName)
+InputPath=.\CosPersistentState.idl
+InputName=CosPersistentState
+
+BuildCmds= \
+ ..\..\..\bin\tao_idl -Ge 1 -Sc -I ../.. -I ../../orbsvcs/orbsvcs -Wb,export_macro=CIAO_CONTAINER_Export -Wb,export_include=CIAO_CONTAINER_export.h -Wb,pre_include="ace/pre.h" -Wb,post_include="ace/post.h" $(InputName).idl \
+ del $(InputName)S.* \
+
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/CIAO/ciao/CIAO_Container_Export.h b/TAO/CIAO/ciao/CIAO_Container_Export.h new file mode 100644 index 00000000000..74ba838721d --- /dev/null +++ b/TAO/CIAO/ciao/CIAO_Container_Export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl CIAO_CONTAINER +// ------------------------------ +#ifndef CIAO_CONTAINER_EXPORT_H +#define CIAO_CONTAINER_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (CIAO_CONTAINER_HAS_DLL) +# define CIAO_CONTAINER_HAS_DLL 1 +#endif /* ! CIAO_CONTAINER_HAS_DLL */ + +#if defined (CIAO_CONTAINER_HAS_DLL) && (CIAO_CONTAINER_HAS_DLL == 1) +# if defined (CIAO_CONTAINER_BUILD_DLL) +# define CIAO_CONTAINER_Export ACE_Proper_Export_Flag +# define CIAO_CONTAINER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define CIAO_CONTAINER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* CIAO_CONTAINER_BUILD_DLL */ +# define CIAO_CONTAINER_Export ACE_Proper_Import_Flag +# define CIAO_CONTAINER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define CIAO_CONTAINER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* CIAO_CONTAINER_BUILD_DLL */ +#else /* CIAO_CONTAINER_HAS_DLL == 1 */ +# define CIAO_CONTAINER_Export +# define CIAO_CONTAINER_SINGLETON_DECLARATION(T) +# define CIAO_CONTAINER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* CIAO_CONTAINER_HAS_DLL == 1 */ + +// Set CIAO_CONTAINER_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (CIAO_CONTAINER_NTRACE) +# if (ACE_NTRACE == 1) +# define CIAO_CONTAINER_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define CIAO_CONTAINER_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !CIAO_CONTAINER_NTRACE */ + +#if (CIAO_CONTAINER_NTRACE == 1) +# define CIAO_CONTAINER_TRACE(X) +#else /* (CIAO_CONTAINER_NTRACE == 1) */ +# define CIAO_CONTAINER_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (CIAO_CONTAINER_NTRACE == 1) */ + +#endif /* CIAO_CONTAINER_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/ciao/CIAO_Export.h b/TAO/CIAO/ciao/CIAO_Export.h new file mode 100644 index 00000000000..5ed6f44bb9c --- /dev/null +++ b/TAO/CIAO/ciao/CIAO_Export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl CIAO +// ------------------------------ +#ifndef CIAO_EXPORT_H +#define CIAO_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (CIAO_HAS_DLL) +# define CIAO_HAS_DLL 1 +#endif /* ! CIAO_HAS_DLL */ + +#if defined (CIAO_HAS_DLL) && (CIAO_HAS_DLL == 1) +# if defined (CIAO_BUILD_DLL) +# define CIAO_Export ACE_Proper_Export_Flag +# define CIAO_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define CIAO_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* CIAO_BUILD_DLL */ +# define CIAO_Export ACE_Proper_Import_Flag +# define CIAO_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define CIAO_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* CIAO_BUILD_DLL */ +#else /* CIAO_HAS_DLL == 1 */ +# define CIAO_Export +# define CIAO_SINGLETON_DECLARATION(T) +# define CIAO_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* CIAO_HAS_DLL == 1 */ + +// Set CIAO_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (CIAO_NTRACE) +# if (ACE_NTRACE == 1) +# define CIAO_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define CIAO_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !CIAO_NTRACE */ + +#if (CIAO_NTRACE == 1) +# define CIAO_TRACE(X) +#else /* (CIAO_NTRACE == 1) */ +# define CIAO_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (CIAO_NTRACE == 1) */ + +#endif /* CIAO_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/ciao/CIAO_Server.dsp b/TAO/CIAO/ciao/CIAO_Server.dsp new file mode 100644 index 00000000000..7091a4785ee --- /dev/null +++ b/TAO/CIAO/ciao/CIAO_Server.dsp @@ -0,0 +1,357 @@ +# Microsoft Developer Studio Project File - Name="CIAO_Server" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=CIAO_Server - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "CIAO_Server.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "CIAO_Server.mak" CFG="CIAO_Server - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "CIAO_Server - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "CIAO_Server - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "CIAO_Server - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CIAO_SERVER_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I ".." /I "..\..\.." /I "..\.." /I "..\..\orbsvcs\orbsvcs" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CIAO_SERVER_BUILD_DLL" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 ace.lib tao.lib TAO_IFR_Client.lib CIAO_Client.lib CIAO_Container.lib TAO_Security.lib TAO_PortableServer.lib /nologo /dll /machine:I386 /out:"..\..\..\bin\CIAO_Server.dll" /libpath:"..\..\..\ace" /libpath:"..\..\tao" /libpath:"..\..\tao\IFR_Client" /libpath:"..\..\orbsvcs\orbsvcs" /libpath:"..\..\tao\PortableServer"
+
+!ELSEIF "$(CFG)" == "CIAO_Server - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "CIAO_Server___Win32_Debug"
+# PROP BASE Intermediate_Dir "CIAO_Server___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CIAO_SERVER_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /Zi /Od /I ".." /I "..\..\.." /I "..\.." /I "..\..\orbsvcs\orbsvcs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CIAO_SERVER_BUILD_DLL" /YX /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib taod.lib TAO_IFR_Clientd.lib CIAO_Clientd.lib CIAO_Containerd.lib TAO_Securityd.lib TAO_PortableServerd.lib /nologo /dll /debug /machine:I386 /out:"..\..\..\bin\CIAO_Serverd.dll" /pdbtype:sept /libpath:"..\..\..\ace" /libpath:"..\..\tao" /libpath:"..\..\tao\IFR_Client" /libpath:"..\..\orbsvcs\orbsvcs" /libpath:"..\..\tao\PortableServer"
+
+!ENDIF
+
+# Begin Target
+
+# Name "CIAO_Server - Win32 Release"
+# Name "CIAO_Server - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\CCM_DeploymentC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CCM_DeploymentS.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CIAO_ServersC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\CIAO_ServersS.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ComponentInstallation_Impl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ComponentServer_Impl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Container_Base.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Container_Impl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Server_init.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ServerActivator_Impl.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm"
+# Begin Source File
+
+SOURCE=.\CCM_DeploymentC.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CCM_DeploymentS.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CIAO_ServersC.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\CIAO_ServersS.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ComponentInstallation_Impl.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ComponentServer_Impl.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Container_Base.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Container_Impl.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Server_init.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ServerActivator_Impl.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\CCM_Deployment.idl
+
+!IF "$(CFG)" == "CIAO_Server - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputName)
+InputPath=.\CCM_Deployment.idl
+InputName=CCM_Deployment
+
+BuildCmds= \
+ ..\..\..\bin\release\tao_idl -Ge 1 -Sc -I ../.. -I ../../orbsvcs/orbsvcs -Wb,export_macro=CIAO_SERVER_Export -Wb,export_include=CIAO_SERVER_export.h -Wb,pre_include="ace/pre.h" -Wb,post_include="ace/post.h" $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "CIAO_Server - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputName)
+InputPath=.\CCM_Deployment.idl
+InputName=CCM_Deployment
+
+BuildCmds= \
+ ..\..\..\bin\tao_idl -Ge 1 -Sc -I ../.. -I ../../orbsvcs/orbsvcs -Wb,export_macro=CIAO_SERVER_Export -Wb,export_include=CIAO_SERVER_export.h -Wb,pre_include="ace/pre.h" -Wb,post_include="ace/post.h" $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\CIAO_Servers.idl
+
+!IF "$(CFG)" == "CIAO_Server - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputName)
+InputPath=.\CIAO_Servers.idl
+InputName=CIAO_Servers
+
+BuildCmds= \
+ ..\..\..\bin\release\tao_idl -Ge 1 -Sc -I ../.. -I ../../orbsvcs/orbsvcs -Wb,export_macro=CIAO_SERVER_Export -Wb,export_include=CIAO_SERVER_export.h -Wb,pre_include="ace/pre.h" -Wb,post_include="ace/post.h" $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "CIAO_Server - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputName)
+InputPath=.\CIAO_Servers.idl
+InputName=CIAO_Servers
+
+BuildCmds= \
+ ..\..\..\bin\tao_idl -Ge 1 -Sc -I ../.. -I ../../orbsvcs/orbsvcs -Wb,export_macro=CIAO_SERVER_Export -Wb,export_include=CIAO_SERVER_export.h -Wb,pre_include="ace/pre.h" -Wb,post_include="ace/post.h" $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i,inl"
+# Begin Source File
+
+SOURCE=.\CCM_DeploymentC.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\CCM_DeploymentS.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\CIAO_ServersC.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\CIAO_ServersS.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\ComponentInstallation_Impl.inl
+# End Source File
+# Begin Source File
+
+SOURCE=.\ComponentServer_Impl.inl
+# End Source File
+# Begin Source File
+
+SOURCE=.\Container_Base.inl
+# End Source File
+# Begin Source File
+
+SOURCE=.\Container_Impl.inl
+# End Source File
+# Begin Source File
+
+SOURCE=.\ServerActivator_Impl.inl
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/CIAO/ciao/CIAO_Server_Export.h b/TAO/CIAO/ciao/CIAO_Server_Export.h new file mode 100644 index 00000000000..2f0145331e9 --- /dev/null +++ b/TAO/CIAO/ciao/CIAO_Server_Export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl CIAO_SERVER +// ------------------------------ +#ifndef CIAO_SERVER_EXPORT_H +#define CIAO_SERVER_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (CIAO_SERVER_HAS_DLL) +# define CIAO_SERVER_HAS_DLL 1 +#endif /* ! CIAO_SERVER_HAS_DLL */ + +#if defined (CIAO_SERVER_HAS_DLL) && (CIAO_SERVER_HAS_DLL == 1) +# if defined (CIAO_SERVER_BUILD_DLL) +# define CIAO_SERVER_Export ACE_Proper_Export_Flag +# define CIAO_SERVER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define CIAO_SERVER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* CIAO_SERVER_BUILD_DLL */ +# define CIAO_SERVER_Export ACE_Proper_Import_Flag +# define CIAO_SERVER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define CIAO_SERVER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* CIAO_SERVER_BUILD_DLL */ +#else /* CIAO_SERVER_HAS_DLL == 1 */ +# define CIAO_SERVER_Export +# define CIAO_SERVER_SINGLETON_DECLARATION(T) +# define CIAO_SERVER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* CIAO_SERVER_HAS_DLL == 1 */ + +// Set CIAO_SERVER_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (CIAO_SERVER_NTRACE) +# if (ACE_NTRACE == 1) +# define CIAO_SERVER_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define CIAO_SERVER_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !CIAO_SERVER_NTRACE */ + +#if (CIAO_SERVER_NTRACE == 1) +# define CIAO_SERVER_TRACE(X) +#else /* (CIAO_SERVER_NTRACE == 1) */ +# define CIAO_SERVER_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (CIAO_SERVER_NTRACE == 1) */ + +#endif /* CIAO_SERVER_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/ciao/CIAO_Servers.idl b/TAO/CIAO/ciao/CIAO_Servers.idl new file mode 100644 index 00000000000..19180649f38 --- /dev/null +++ b/TAO/CIAO/ciao/CIAO_Servers.idl @@ -0,0 +1,19 @@ +// $Id$ + +/** + * @file CIAO_Servers.idl + * + * @brief Some CIAO helper interfaces for implementing various server + * tools. + */ + +#include "CCM_Deployment.idl" + +module CIAO +{ + interface Activator_Callback + { + ::Components::Deployment::ServerActivator + register_component_server (in ::Components::Deployment::ComponentServer svr); + }; +}; diff --git a/TAO/CIAO/ciao/CIAO_Value.idl b/TAO/CIAO/ciao/CIAO_Value.idl new file mode 100644 index 00000000000..41f27ae2cf3 --- /dev/null +++ b/TAO/CIAO/ciao/CIAO_Value.idl @@ -0,0 +1,17 @@ +// $Id$ + +/** + * @file CIAO_Value.idl + * + * @brief Some CIAO valuetype extension for internal use. + */ + +#include "CCM_Base.idl" + +module CIAO +{ + valuetype Cookie : ::Components::Cookie + { + CORBA::OctetSeq get_cookie (); + }; +}; diff --git a/TAO/CIAO/ciao/CIAO_common.h b/TAO/CIAO/ciao/CIAO_common.h new file mode 100644 index 00000000000..9a187410d1c --- /dev/null +++ b/TAO/CIAO/ciao/CIAO_common.h @@ -0,0 +1,31 @@ +// $Id$ + +/** + * @file CIAO_common.h + * + * This file collects common CIAO macro definitions. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#ifndef CIAO_COMMON_H +#define CIAO_COMMON_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined ACE_LACKS_PRAGMA_ONCE +#pragma once +#endif /* ! ACE_LACKS_PRAGMA_ONCE */ + +#define CIAO_REGISTER_VALUE_FACTORY(ORB,FACTORY,VALUETYPE) {\ + CORBA::ValueFactory factory = new FACTORY; \ + CORBA::ValueFactory prev_factory = \ + ORB->register_value_factory \ + (VALUETYPE::_tao_obv_static_repository_id (), \ + factory); \ + if (prev_factory) prev_factory->_remove_ref (); \ + factory->_remove_ref (); } + +#include "ace/post.h" +#endif /* CIAO_COMMON_H */ diff --git a/TAO/CIAO/ciao/Client_init.cpp b/TAO/CIAO/ciao/Client_init.cpp new file mode 100644 index 00000000000..b11d6b96dde --- /dev/null +++ b/TAO/CIAO/ciao/Client_init.cpp @@ -0,0 +1,36 @@ +// $Id$ + +#include "Client_init.h" +#include "CIAO_common.h" +#include "CCM_ComponentC.h" +#include "CIAO_ValueC.h" + +int +CIAO::Client_init (CORBA::ORB_ptr o) +{ + CIAO_REGISTER_VALUE_FACTORY (o, Components::Cookie_init, + Components::Cookie); + CIAO_REGISTER_VALUE_FACTORY (o, Components::Cookie_init, + CIAO::Cookie); + CIAO_REGISTER_VALUE_FACTORY (o, Components::PortDescription_init, + Components::PortDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::FacetDescription_init, + Components::FacetDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::ConnectionDescription_init, + Components::ConnectionDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::ReceptacleDescription_init, + Components::ReceptacleDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::ConsumerDescription_init, + Components::ConsumerDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::EmitterDescription_init, + Components::EmitterDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::SubscriberDescription_init, + Components::SubscriberDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::PublisherDescription_init, + Components::PublisherDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::ConfigValue_init, + Components::ConfigValue); + CIAO_REGISTER_VALUE_FACTORY (o, Components::ComponentPortDescription_init, + Components::ComponentPortDescription); + return 0; +} diff --git a/TAO/CIAO/ciao/Client_init.h b/TAO/CIAO/ciao/Client_init.h new file mode 100644 index 00000000000..eb4d2b8f003 --- /dev/null +++ b/TAO/CIAO/ciao/Client_init.h @@ -0,0 +1,35 @@ +// $Id$ + +/** + * @file Client_init + * + * Initializing CIAO client side ORB, if they need to. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#ifndef CIAO_CLIENT_INIT_H +#define CIAO_CLIENT_INIT_H +#include "ace/pre.h" + +#include "tao/corbafwd.h" +#include "CIAO_Client_Export.h" + +#if !defined ACE_LACKS_PRAGMA_ONCE +#pragma once +#endif /* ! ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO +{ + /** + * The initialize routine for any clients that need to access + * component. This routine now simply registers various valuetype + * factories defined in CIAO_Component.pidl. Currently, this method + * should be call right after ORB initialization but we should try + * to register these stuff automatically. + */ + CIAO_CLIENT_Export int Client_init (CORBA::ORB_ptr o); +} + +#include "ace/post.h" +#endif /* CIAO_CLIENT_INIT_H */ diff --git a/TAO/CIAO/ciao/ComponentInstallation_Impl.cpp b/TAO/CIAO/ciao/ComponentInstallation_Impl.cpp new file mode 100644 index 00000000000..4c8c601316d --- /dev/null +++ b/TAO/CIAO/ciao/ComponentInstallation_Impl.cpp @@ -0,0 +1,191 @@ +// $Id$ + +#include "ComponentInstallation_Impl.h" +#include "ace/Configuration_Import_Export.h" + +#if !defined (__ACE_INLINE__) +# include "ComponentInstallation_Impl.inl" +#endif /* __ACE_INLINE__ */ + +CIAO::ComponentInstallation_Impl::~ComponentInstallation_Impl () +{ + this->fini (); +} + +PortableServer::POA_ptr +CIAO::ComponentInstallation_Impl::_default_POA (void) +{ + return PortableServer::POA::_duplicate (this->poa_.in ()); +} + +int +CIAO::ComponentInstallation_Impl::init (const char *fname, + const char *section + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (fname == 0) + ACE_THROW_RETURN (CORBA::INTERNAL (), -1); + else + this->filename_ = CORBA::string_dup (fname); + + if (section == 0) + section = "ComponentInstallation"; + this->section_name_ = CORBA::string_dup (section); + + ACE_Configuration_Heap *tmp = 0; + ACE_NEW_THROW_EX (tmp, + ACE_Configuration_Heap (), + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (-1); + + auto_ptr<ACE_Configuration_Heap> config (tmp); + + if (config->open () != 0) + { + ACE_DEBUG ((LM_ERROR, "Unable to initilize installation datafile\n")); + ACE_THROW_RETURN (CORBA::INTERNAL (), -1); + } + + ACE_Ini_ImpExp import (*config); + + if (import.import_config (fname) != 0) + ACE_THROW_RETURN (CORBA::INTERNAL (), -1); + + this->installation_ = config.release (); + + return 0; +} + +int +CIAO::ComponentInstallation_Impl::fini () +{ + if (this->installation_ != 0) + { + // @ back up the installation and destroy the + ACE_Ini_ImpExp exp (*this->installation_); + + if (exp.export_config (this->filename_.in ()) != 0) + ACE_DEBUG ((LM_DEBUG, + "CIAO::ComponentInstallation Failed to store the installation information to file: %s\n", + this->filename_.in ())); + delete this->installation_; + this->installation_ = 0; + } + return 0; +} + +void +CIAO::ComponentInstallation_Impl::install (const char * implUUID, + const char * component_loc + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::Deployment::InvalidLocation, + Components::Deployment::InstallationFailure)) +{ + // Only use the root section for now. + const ACE_Configuration_Section_Key &root_section + = this->installation_->root_section (); + ACE_Configuration::VALUETYPE type; + + ACE_Configuration_Section_Key section; + this->installation_->open_section (root_section, + this->section_name_.in (), + 1, + section); + + // Check if implUUID has already been installed. + if (this->installation_->find_value (section, + implUUID, + type) == 0) + ACE_THROW (Components::Deployment::InstallationFailure ()); + + // @@ We may need to do some extra work to provide a more + // comprehensive component installation facility. + + ACE_TString value (component_loc, 0, 0); + if (this->installation_->set_string_value (section, + implUUID, + value) != 0) + ACE_THROW (Components::Deployment::InstallationFailure ()); +} + +void +CIAO::ComponentInstallation_Impl::replace (const char * implUUID, + const char * component_loc + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::Deployment::InvalidLocation, + Components::Deployment::InstallationFailure)) +{ + // Only use the root section for now. + const ACE_Configuration_Section_Key &root_section + = this->installation_->root_section (); + + ACE_Configuration_Section_Key section; + this->installation_->open_section (root_section, + this->section_name_.in (), + 1, + section); + + // @@ We may need to do some extra work to provide a more + // comprehensive component installation facility. + + ACE_TString value (component_loc, 0, 0); + if (this->installation_->set_string_value (section, + implUUID, + value) != 0) + ACE_THROW (Components::Deployment::InstallationFailure ()); +} + +void +CIAO::ComponentInstallation_Impl::remove (const char * implUUID + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::Deployment::UnknownImplId, + Components::RemoveFailure)) +{ + if (implUUID == 0) + ACE_THROW (Components::Deployment::UnknownImplId ()); + + // Only use the root section for now. + const ACE_Configuration_Section_Key &root_section + = this->installation_->root_section (); + + ACE_Configuration_Section_Key section; + this->installation_->open_section (root_section, + this->section_name_.in (), + 1, + section); + + if (this->installation_->remove_value (section, + implUUID) != 0) + // This should very well be UnknownImplId instead. + ACE_THROW (Components::RemoveFailure ()); +} + +char * +CIAO::ComponentInstallation_Impl::get_implementation (const char * implUUID + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::Deployment::UnknownImplId, + Components::Deployment::InstallationFailure)) +{ + const ACE_Configuration_Section_Key &root_section + = this->installation_->root_section (); + ACE_TString retstr; + + ACE_Configuration_Section_Key section; + this->installation_->open_section (root_section, + this->section_name_.in (), + 1, + section); + + // Check if implUUID has already been installed. + if (this->installation_->get_string_value (section, + implUUID, + retstr) != 0) + ACE_THROW (Components::Deployment::UnknownImplId ()); + + return CORBA::string_dup (retstr.fast_rep ()); +} diff --git a/TAO/CIAO/ciao/ComponentInstallation_Impl.h b/TAO/CIAO/ciao/ComponentInstallation_Impl.h new file mode 100644 index 00000000000..3990aa715f4 --- /dev/null +++ b/TAO/CIAO/ciao/ComponentInstallation_Impl.h @@ -0,0 +1,117 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file ComponentInstallation_Impl.h + * + * $Id$ + * + * This file contains implementation for the servant of + * Components::Deployment::ComponentInstallation interface. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + + +#ifndef CIAO_COMPONENTINSTALLATION_IMPL_H +#define CIAO_COMPONENTINSTALLATION_IMPL_H +#include "ace/pre.h" + +#include "CCM_DeploymentS.h" +#include "ace/Configuration.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + + +namespace CIAO +{ + /** + * @class ComponentInstallation_Impl + * + * @brief Servant implementation for Components::Deployment::ComponentInstallation + * + * This class implements the Components::Deployment::ComponentInstallation + * interface as defined by the CCM spcification. As the interface + * implies, this is actually part of the deployment interface and is + * used to manage the lifecycle of containers running on the server. + */ + class CIAO_SERVER_Export ComponentInstallation_Impl + : public virtual POA_Components::Deployment::ComponentInstallation, + public virtual PortableServer::RefCountServantBase + { + public: + /// Constructor + ComponentInstallation_Impl (CORBA::ORB_ptr o, + PortableServer::POA_ptr p); + + /// Destructor + virtual ~ComponentInstallation_Impl (void); + + /// Get the containing POA. This operation does *not* + /// increase the reference count of the POA. + virtual PortableServer::POA_ptr _default_POA (void); + + /// Initialize the ComponentInstallation. + int init (const char *fname, + const char *section + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Initialize the ComponentInstallation. + int fini (); + + /// Components::Deployment::ComponentInstallation defined attributes/operations. + + virtual void install (const char * implUUID, + const char * component_loc + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::Deployment::InvalidLocation, + Components::Deployment::InstallationFailure)); + + virtual void replace (const char * implUUID, + const char * component_loc + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::Deployment::InvalidLocation, + Components::Deployment::InstallationFailure)); + + virtual void remove (const char * implUUID + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::Deployment::UnknownImplId, + Components::RemoveFailure)); + + virtual char * get_implementation (const char * implUUID + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::Deployment::UnknownImplId, + Components::Deployment::InstallationFailure)); + + protected: + /// Keep a pointer to the managing ORB serving this servant. + CORBA::ORB_var orb_; + + /// Keep a pointer to the managing POA. + PortableServer::POA_var poa_; + + /// Persistent store filename for storing the configuration info. + CORBA::String_var filename_; + + /// Section name in Configuration + CORBA::String_var section_name_; + + /// Mapping and persistent + ACE_Configuration *installation_; + }; +} + +#if defined (__ACE_INLINE__) +# include "ComponentInstallation_Impl.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* CIAO_COMPONENTINSTALLATION_IMPL_H */ diff --git a/TAO/CIAO/ciao/ComponentInstallation_Impl.inl b/TAO/CIAO/ciao/ComponentInstallation_Impl.inl new file mode 100644 index 00000000000..856817bf70c --- /dev/null +++ b/TAO/CIAO/ciao/ComponentInstallation_Impl.inl @@ -0,0 +1,11 @@ +/* -*- C++ -*- */ +// $Id$ + +ACE_INLINE +CIAO::ComponentInstallation_Impl::ComponentInstallation_Impl (CORBA::ORB_ptr o, + PortableServer::POA_ptr p) + : orb_ (CORBA::ORB::_duplicate (o)), + poa_ (PortableServer::POA::_duplicate (p)), + installation_ (0) +{ +} diff --git a/TAO/CIAO/ciao/ComponentServer_Impl.cpp b/TAO/CIAO/ciao/ComponentServer_Impl.cpp new file mode 100644 index 00000000000..f5501a71c21 --- /dev/null +++ b/TAO/CIAO/ciao/ComponentServer_Impl.cpp @@ -0,0 +1,182 @@ +// $Id$ + +#include "ComponentServer_Impl.h" +#include "Container_Impl.h" + +#if !defined (__ACE_INLINE__) +# include "ComponentServer_Impl.inl" +#endif /* __ACE_INLINE__ */ + +CIAO::ComponentServer_Impl::~ComponentServer_Impl () +{ + // @@ remove all Containers? +} + +PortableServer::POA_ptr +CIAO::ComponentServer_Impl::_default_POA (void) +{ + return PortableServer::POA::_duplicate (this->poa_.in ()); +} + +int +CIAO::ComponentServer_Impl::init (::Components::ConfigValues &options + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ Initialize ComponentServer and create the internal container + // implementation that actually interacts with installed + // homes/components. + + ACE_NEW_THROW_EX (this->config_, + ::Components::ConfigValues (), + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (-1); + + *this->config_ = options; + + // We will probably need two ORBs in this process. One for the + // deployment framework, and one for the actual components. + return 0; +} + +::Components::ConfigValues * +CIAO::ComponentServer_Impl::configuration (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + Components::ConfigValues *retval; + + ACE_NEW_THROW_EX (retval, + Components::ConfigValues (), + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (0); + + *retval = this->config_; + + return retval; +} + +::Components::Deployment::ServerActivator_ptr +CIAO::ComponentServer_Impl::get_server_activator (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return Components::Deployment::ServerActivator::_duplicate (this->activator_.in ()); +} + +::Components::Deployment::Container_ptr +CIAO::ComponentServer_Impl::create_container (const Components::ConfigValues & config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure, + Components::InvalidConfiguration)) +{ + CIAO::Container_Impl *container_servant = 0; + + ACE_NEW_THROW_EX (container_servant, + CIAO::Container_Impl (this->orb_.in (), + this->poa_.in (), + this->get_objref ()), + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (0); + + PortableServer::ServantBase_var safe_servant (container_servant); + container_servant->init (config, + this->get_component_installation () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + PortableServer::ObjectId_var oid + = this->poa_->activate_object (container_servant + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + CORBA::Object_var obj + = this->poa_->id_to_reference (oid.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + Components::Deployment::Container_var ci + = Components::Deployment::Container::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + // Cached the objref in its servant. + container_servant->set_objref (ci.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); + + this->container_set_.add (ci.in ()); + } + + return ci._retn (); +} + +void +CIAO::ComponentServer_Impl::remove_container (Components::Deployment::Container_ptr cref + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) +{ + ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); + + if (this->container_set_.object_in_set (cref) == 0) + ACE_THROW (Components::RemoveFailure()); + + cref->remove (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + // @@ Deactivate object. + PortableServer::ObjectId_var oid + = this->poa_->reference_to_id (cref + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->poa_->deactivate_object (oid + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + // Should we remove the server still, even if the previous call failed. + + if (this->container_set_.remove (cref) == -1) + ACE_THROW (::Components::RemoveFailure ()); +} + +Components::Deployment::Containers * +CIAO::ComponentServer_Impl::get_containers (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); + + Components::Deployment::Containers_var retval; + + ACE_NEW_THROW_EX (retval.out (), + Components::Deployment::Containers (), + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (0); + + CORBA::ULong len = this->container_set_.size (); + retval->length (len); // resize + +#if 0 + // TAO is broken here. Both <replace>, <get_buffer> and friends are missing. + this->container_set_.copy (len, retval->get_buffer (0)); +#else + for (CORBA::ULong i = 0; i < len; ++i) + { + retval[i] = this->container_set_.at (i); + } +#endif + + return retval._retn (); +} + +void +CIAO::ComponentServer_Impl::remove (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) +{ + // @@ Need to remove all containers/homes/components. + + this->orb_->shutdown (ACE_ENV_ARG_PARAMETER); +} diff --git a/TAO/CIAO/ciao/ComponentServer_Impl.h b/TAO/CIAO/ciao/ComponentServer_Impl.h new file mode 100644 index 00000000000..93d36f89b82 --- /dev/null +++ b/TAO/CIAO/ciao/ComponentServer_Impl.h @@ -0,0 +1,142 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file ComponentServer_Impl.h + * + * $Id$ + * + * This file contains implementation for the servant of + * Components::Deployment::ComponentServer interface. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + + +#ifndef CIAO_COMPONENTSERVER_IMPL_H +#define CIAO_COMPONENTSERVER_IMPL_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "CCM_DeploymentS.h" +#include "Object_Set_T.h" + +namespace CIAO +{ + /** + * @class ComponentServer_Impl + * + * @brief Servant implementation for Components::Deployment::ComponentServer + * + * This class implements the Components::Deployment::ComponentServer + * interface as defined by the CCM spcification. As the interface + * implies, this is actually part of the deployment interface and is + * used to manage the lifecycle of containers running on the server. + */ + class CIAO_SERVER_Export ComponentServer_Impl + : public virtual POA_Components::Deployment::ComponentServer, + public virtual PortableServer::RefCountServantBase + { + public: + /// Constructor + ComponentServer_Impl (CORBA::ORB_ptr o, + PortableServer::POA_ptr p); + + /// Destructor + virtual ~ComponentServer_Impl (void); + + /// Get the containing POA. This operation does *not* + /// increase the reference count of the POA. + virtual PortableServer::POA_ptr _default_POA (void); + + /// Initialize the ComponentServer with a name. + int init (::Components::ConfigValues &options + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Components::Deployment::ComponentServer defined attributes/operations. + + virtual ::Components::ConfigValues * + configuration (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::Deployment::ServerActivator_ptr + get_server_activator (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::Deployment::Container_ptr + create_container (const Components::ConfigValues & config + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure, + Components::InvalidConfiguration)); + + virtual void remove_container (Components::Deployment::Container_ptr cref + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + + virtual ::Components::Deployment::Containers * + get_containers (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + + // ------------ CIAO Internal operations ------------- + /// Set the cached object reference + void set_objref (Components::Deployment::ServerActivator_ptr act, + Components::Deployment::ComponentServer_ptr cs = 0 + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Return the cached object reference of this ComponentServer object. + /// This operation does *NOT* increase the reference count. + Components::Deployment::ComponentServer_ptr + get_objref (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); + + /// Get the cached ComponentInstallation object reference. + /// This operation does *NOT* increase the reference count. + Components::Deployment::ComponentInstallation_ptr + get_component_installation (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); + +protected: + /// Keep a pointer to the managing ORB serving this servant. + CORBA::ORB_var orb_; + + /// Keep a pointer to the managing POA. + PortableServer::POA_var poa_; + + /// Cached ConfigValues. + Components::ConfigValues_var config_; + + /// And a reference to the ServerActivator that created us. + Components::Deployment::ServerActivator_var activator_; + + /// Cache the object reference to ourselves. + Components::Deployment::ComponentServer_var objref_; + + /// And a reference to the ServerActivator that created us. + Components::Deployment::ComponentInstallation_var installation_; + + /// Synchronize access to the object set. + TAO_SYNCH_MUTEX lock_; + + /// Keep a list of managed Container objects. + Object_Set<Components::Deployment::Container, ::Components::Deployment::Container_var> container_set_; + }; +} + +#if defined (__ACE_INLINE__) +# include "ComponentServer_Impl.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* CIAO_COMPONENTSERVER_IMPL_H */ diff --git a/TAO/CIAO/ciao/ComponentServer_Impl.inl b/TAO/CIAO/ciao/ComponentServer_Impl.inl new file mode 100644 index 00000000000..01c3dc84711 --- /dev/null +++ b/TAO/CIAO/ciao/ComponentServer_Impl.inl @@ -0,0 +1,58 @@ +/* -*- C++ -*- */ +// $Id$ + +ACE_INLINE +CIAO::ComponentServer_Impl::ComponentServer_Impl (CORBA::ORB_ptr o, + PortableServer::POA_ptr p) + : orb_ (CORBA::ORB::_duplicate (o)), + poa_ (PortableServer::POA::_duplicate (p)) +{ +} + +ACE_INLINE void +CIAO::ComponentServer_Impl::set_objref (Components::Deployment::ServerActivator_ptr act, + Components::Deployment::ComponentServer_ptr cs + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (!CORBA::is_nil (this->activator_.in ()) || !CORBA::is_nil (this->objref_.in ())) + ACE_THROW (CORBA::BAD_INV_ORDER ()); + + this->activator_ = Components::Deployment::ServerActivator::_duplicate (act); + this->objref_ = Components::Deployment::ComponentServer::_duplicate (cs); +} + +ACE_INLINE Components::Deployment::ComponentServer_ptr +CIAO::ComponentServer_Impl::get_objref (ACE_ENV_SINGLE_ARG_DECL) +{ + if (CORBA::is_nil (this->objref_.in ())) + { + this->objref_ = this->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + } + + return this->objref_.in (); +} + +ACE_INLINE Components::Deployment::ComponentInstallation_ptr +CIAO::ComponentServer_Impl::get_component_installation (ACE_ENV_SINGLE_ARG_DECL) +{ + if (CORBA::is_nil (this->installation_.in ())) + { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); + + CORBA::Object_var tmp = this->orb_->resolve_initial_references ("ComponentInstallation" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + this->installation_ = + Components::Deployment::ComponentInstallation::_narrow (tmp.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (this->installation_.in ())) + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); + } + + return this->installation_.in (); +} diff --git a/TAO/CIAO/ciao/Component_Base.idl b/TAO/CIAO/ciao/Component_Base.idl new file mode 100644 index 00000000000..8b08cc1ece9 --- /dev/null +++ b/TAO/CIAO/ciao/Component_Base.idl @@ -0,0 +1,788 @@ +// $Id$ + +/** + * @@ Compile this file with: + * + * tao_idl -Gv -I W:/ACE_wrappers/TAO -I W:/ACE_wrappers/TAO/orbsvcs/orbsvcs Component_Base.idl + * + * This file has been split into + * CIAO_Base.pidl + * CIAO_Event.pidl + * CIAO_Component.pidl + * CIAO_Transaction.pidl + * CIAO_Container.pidl + * CIAO_Container_Ex.pidl + * CIAO_Deployment.pidl + */ + +// import ::CORBA +// import ::SecurityLevel2 +// import ::CosPersistentState +// import ::PortableServer +// import ::CosNotification +// import ::CosNotifyChannelAdmin + +#include <SecurityLevel2.idl> +#include <CosPersistentState.idl> +#include <tao/IFR_Client/Interface.pidl> +#include <CosNotification.idl> +#include <CosNotifyChannelAdmin.idl> + +/** + * Temporarily fix for lacking of typePrefix keyword. + * Search for the word "typePrefix" when tao_idl starts + * supporting the keyword. + */ +#pragma prefix "omg.org" + +module Components { + + /** + * @@ Commented out temporarily for lack of typePrefix support. + */ + // typePrefix Components "omg.org" + typedef string FeatureName; + typedef sequence<FeatureName> NameList; + + valuetype Cookie + { + private CORBA::OctetSeq cookieValue; + }; + + valuetype PortDescription + { + public FeatureName Name; + public CORBA::RepositoryId type_id; + }; + + valuetype FacetDescription : PortDescription + { + public Object facet_ref; + }; + + typedef sequence<FacetDescription> FacetDescriptions; + + typedef unsigned long FailureReason; + + exception InvalidName {}; + exception InvalidConnection {}; + exception ExceededConnectionLimit {}; + exception AlreadyConnected {}; + exception NoConnection {}; + exception CookieRequired {}; + exception CreateFailure { + FailureReason reason; + }; + exception FinderFailure + { + FailureReason reason; + }; + exception RemoveFailure + { + FailureReason reason; + }; + exception DuplicateKeyValue {}; + exception InvalidKey {}; + exception UnknownKeyValue {}; + exception NoKeyAvailable {}; + exception BadEventType + { + CORBA::RepositoryId expected_event_type; + }; + exception HomeNotFound {}; + exception WrongComponentType {}; + + typedef FailureReason InvalidConfigurationReason; + const InvalidConfigurationReason UnknownConfigValueName = 0; + const InvalidConfigurationReason InvalidConfigValueType = 1; + const InvalidConfigurationReason ConfigValueRequired = 2; + const InvalidConfigurationReason ConfigValueNotExpected = 3; + exception InvalidConfiguration + { + InvalidConfigurationReason reason; + FeatureName name; + }; + exception IllegalState {}; + + interface Navigation + { + Object provide_facet (in FeatureName name) + raises (InvalidName); + FacetDescriptions get_all_facets(); + FacetDescriptions get_named_facets (in NameList names) + raises (InvalidName); + boolean same_component (in Object object_ref); + }; + + valuetype ConnectionDescription + { + public Cookie ck; + public Object objref; + }; + typedef sequence<ConnectionDescription> ConnectionDescriptions; + + valuetype ReceptacleDescription : PortDescription + { + public boolean is_multiple; + public ConnectionDescriptions connections; + }; + typedef sequence<ReceptacleDescription> ReceptacleDescriptions; + + interface Receptacles + { + Cookie connect (in FeatureName name, in Object connection ) + raises (InvalidName, + InvalidConnection, + AlreadyConnected, + ExceededConnectionLimit); + + // @@ Changed to return the previously connected object reference -- basef on RTF 1.1. + Object disconnect (in FeatureName name, in Cookie ck) + raises (InvalidName, + InvalidConnection, + CookieRequired, + NoConnection); + + ConnectionDescriptions get_connections (in FeatureName name) + raises (InvalidName); + + ReceptacleDescriptions get_all_receptacles (); + + ReceptacleDescriptions get_named_receptacles (in NameList names) + raises (InvalidName); + }; + + abstract valuetype EventBase {}; + + interface EventConsumerBase + { + void push_event (in EventBase evt) raises (BadEventType); + }; + + valuetype ConsumerDescription : PortDescription + { + public EventConsumerBase consumer; + }; + typedef sequence<ConsumerDescription> ConsumerDescriptions; + + valuetype EmitterDescription : PortDescription + { + public EventConsumerBase consumer; + }; + typedef sequence<EmitterDescription> EmitterDescriptions; + + valuetype SubscriberDescription + { + public Cookie ck; + public EventConsumerBase consumer; + }; + typedef sequence<SubscriberDescription> SubscriberDescriptions; + + valuetype PublisherDescription : PortDescription + { + public SubscriberDescriptions consumer; + }; + typedef sequence<PublisherDescription> PublisherDescriptions; + + interface Events + { + EventConsumerBase get_consumer (in FeatureName sink_name) + raises (InvalidName); + + Cookie subscribe (in FeatureName publisher_name, + in EventConsumerBase subscriber) + raises (InvalidName, + AlreadyConnected, + InvalidConnection, + ExceededConnectionLimit); + + EventConsumerBase unsubscribe (in FeatureName publisher_name, + in Cookie ck) + raises (InvalidName, + InvalidConnection); + + void connect_consumer (in FeatureName emitter_name, + in EventConsumerBase consumer) + raises (InvalidName, + AlreadyConnected, + InvalidConnection); + + EventConsumerBase disconnect_consumer (in FeatureName source_name) + raises (InvalidName, + NoConnection); + + ConsumerDescriptions get_all_consumers (); + + ConsumerDescriptions get_named_consumers (in NameList names) + raises (InvalidName); + + EmitterDescriptions get_all_emitters (); + + EmitterDescriptions get_named_emitters (in NameList names) + raises (InvalidName); + + PublisherDescriptions get_all_publishers (); + + PublisherDescriptions get_named_publishers (in NameList names) + raises (InvalidName); + }; + + abstract valuetype PrimaryKeyBase {}; + + interface CCMObject; //forward reference + + interface CCMHome + { + CORBA::IRObject get_component_def (); + CORBA::IRObject get_home_def (); + void remove_component ( in CCMObject comp) + raises (RemoveFailure); + }; + typedef sequence<CCMHome> CCMHomes; + + interface KeylessCCMHome + { + CCMObject create_component() + raises (CreateFailure); + }; + + interface HomeFinder + { + CCMHome find_home_by_component_type (in CORBA::RepositoryId comp_repid) + raises (HomeNotFound); + + CCMHome find_home_by_home_type (in CORBA::RepositoryId home_repid) + raises (HomeNotFound); + + CCMHome find_home_by_name (in string home_name) + raises (HomeNotFound); + }; + + interface Configurator + { + void configure (in CCMObject comp) + raises (WrongComponentType); + }; + + valuetype ConfigValue + { + public FeatureName name; + public any value; + }; + + typedef sequence<ConfigValue> ConfigValues; + + interface StandardConfigurator : Configurator + { + void set_configuration (in ConfigValues descr); + }; + + interface HomeConfiguration : CCMHome + { + void set_configurator (in Configurator cfg); + void set_configuration_values (in ConfigValues config); + void complete_component_configuration (in boolean b); + void disable_home_configuration(); + }; + + valuetype ComponentPortDescription + { + public FacetDescriptions facets; + public ReceptacleDescriptions receptacles; + public ConsumerDescriptions consumers; + public EmitterDescriptions emitters; + public PublisherDescriptions publishers; + }; + + interface CCMObject : Navigation, Receptacles, Events + { + CORBA::IRObject get_component_def ( ); + CCMHome get_ccm_home( ); + PrimaryKeyBase get_primary_key( ) + raises (NoKeyAvailable); + void configuration_complete( ) + raises (InvalidConfiguration); + void remove() + raises (RemoveFailure); + ComponentPortDescription get_all_ports (); + }; + + + // @@ Enumeration and DefaultEnumeration are only for EJB to CCM + // mapping? At any rate, we should be able to skip them for now. + abstract valuetype Enumeration + { + boolean has_more_elements(); + CCMObject next_element(); + }; + + typedef sequence<CCMObject> CCMObjectSeq; + + valuetype DefaultEnumeration : Enumeration + { + private CCMObjectSeq objects; + }; + + // @@ Components::Transaction is still there. + module Transaction + { + + typedef sequence<octet> TranToken; + + exception NoTransaction {}; + exception NotSupported {}; + exception SystemError {}; + exception RollbackError {}; + exception HeuristicMixed {}; + exception HeuristicRollback {}; + exception Security {}; + exception InvalidToken {}; + + enum Status + { + ACTIVE, + MARKED_ROLLBACK, + PREPARED, + COMMITTED, + ROLLED_BACK, + NO_TRANSACTION, + PREPARING, + COMMITTING, + ROLLING_BACK + }; + + local interface UserTransaction { + void begin () + raises (NotSupported, + SystemError); + + void commit () + raises (RollbackError, + NoTransaction, + HeuristicMixed, + HeuristicRollback, + Security, + SystemError); + + void rollback () + raises (NoTransaction, + Security, + SystemError); + + void set_rollback_only () + raises (NoTransaction, + SystemError); + + Status get_status() + raises (SystemError); + + void set_timeout (in long to) + raises (SystemError); + + TranToken suspend () + raises (NoTransaction, + SystemError); + + void resume (in TranToken txtoken) + raises (InvalidToken, + SystemError); + }; + }; + + // *************** Basic Container interfaces *************** + + typedef SecurityLevel2::Credentials Principal; + + local interface CCMContext + { + Principal get_caller_principal(); + + CCMHome get_CCM_home(); + + boolean get_rollback_only() + raises (IllegalState); + + Transaction::UserTransaction get_user_transaction() + raises (IllegalState); + + boolean is_caller_in_role (in string role); + + void set_rollback_only() + raises (IllegalState); + }; + + enum CCMExceptionReason + { + SYSTEM_ERROR, + CREATE_ERROR, + REMOVE_ERROR, + DUPLICATE_KEY, + FIND_ERROR, + OBJECT_NOT_FOUND, + NO_SUCH_ENTITY + }; + + exception CCMException + { + CCMExceptionReason reason; + }; + + local interface EnterpriseComponent {}; + + local interface SessionContext : CCMContext + { + Object get_CCM_object() + raises (IllegalState); + }; + + local interface SessionComponent : EnterpriseComponent + { + void set_session_context ( in SessionContext ctx) + raises (CCMException); + + void ccm_activate() + raises (CCMException); + + void ccm_passivate() + raises (CCMException); + + void ccm_remove () + raises (CCMException); + }; + + local interface SessionSynchronization + { + void after_begin () + raises (CCMException); + + void before_completion () + raises (CCMException); + + void after_completion (in boolean committed) + raises (CCMException); + }; + + local interface EntityContext : CCMContext + { + Object get_CCM_object () + raises (IllegalState); + + PrimaryKeyBase get_primary_key () + raises (IllegalState); + }; + + local interface EntityComponent : EnterpriseComponent + { + void set_entity_context (in EntityContext ctx) + raises (CCMException); + + void unset_entity_context () + raises (CCMException); + + void ccm_activate () + raises (CCMException); + + void ccm_load () + raises (CCMException); + + void ccm_store () + raises (CCMException); + + void ccm_passivate () + raises (CCMException); + + void ccm_remove () + raises (CCMException); + }; + + // *************** Extended Container Interfaces *************** + + enum BadComponentReferenceReason + { + NON_LOCAL_REFERENCE, + NON_COMPONENT_REFERENCE, + WRONG_CONTAINER + }; + + typedef CosPersistentState::CatalogBase CatalogBase; + typedef CosPersistentState::_TypeId _TypeId; + + typedef short SegmentId; + const SegmentId COMPONENT_SEGMENT = 0; + + typedef short FacetId; + const FacetId COMPONENT_FACET = 0; + + typedef sequence<octet> IdData; + typedef CosPersistentState::Pid PersistentId; + + typedef short StateIdType; + const StateIdType PERSISTENT_ID = 0; + + exception BadComponentReference + { + BadComponentReferenceReason reason; + }; + exception PolicyMismatch {}; + exception PersistenceNotAvailable {}; + exception UnknownActualHome {}; + exception ProxyHomeNotSupported {}; + exception InvalidStateIdData {}; + + local interface HomeRegistration + { + void register_home (in CCMHome home_ref, + in string home_name); + + void unregister_home (in CCMHome home_ref); + }; + + local interface CCM2Context : CCMContext + { + HomeRegistration get_home_registration (); + + void req_passivate () + raises (PolicyMismatch); + + CatalogBase get_persistence (in _TypeId catalog_type_id) + raises (PersistenceNotAvailable); + }; + + local interface ProxyHomeRegistration : HomeRegistration + { + void register_proxy_home (in CCMHome rhome, + in CCMHome ahome) + raises (UnknownActualHome, + ProxyHomeNotSupported); + }; + + local interface Session2Context : SessionContext, CCM2Context + { + Object create_ref (in CORBA::RepositoryId repid); + + Object create_ref_from_oid (in CORBA::OctetSeq oid, + in CORBA::RepositoryId repid); + + CORBA::OctetSeq get_oid_from_ref (in Object objref) + raises (IllegalState, + BadComponentReference); + }; + + abstract valuetype StateIdValue + { + StateIdType get_sid_type(); + IdData get_sid_data(); + }; + + local interface StateIdFactory + { + StateIdValue create (in IdData data) + raises (InvalidStateIdData); + }; + + valuetype PersistentIdValue : StateIdValue + { + private PersistentId pid; + + PersistentId get_pid(); + factory init (in PersistentId pid); + }; + + valuetype SegmentDescr + { + private StateIdValue sid; + private SegmentId seg; + + StateIdValue get_sid(); + SegmentId get_seg_id(); + factory init (in StateIdValue sid, + in SegmentId seg); + }; + + typedef sequence<SegmentDescr> SegmentDescrSeq; + + local interface ComponentId + { + FacetId get_target_facet(); + + SegmentId get_target_segment(); + + StateIdValue get_target_state_id (in StateIdFactory sid_factory) + raises (InvalidStateIdData); + + StateIdValue get_segment_state_id (in SegmentId seg, + in StateIdFactory sid_factory) + raises (InvalidStateIdData); + + ComponentId create_with_new_target (in FacetId new_target_facet, + in SegmentId new_target_segment); + + SegmentDescrSeq get_segment_descrs (in StateIdFactory sid_factory) + raises (InvalidStateIdData); + }; + + local interface Entity2Context : EntityContext, CCM2Context + { + ComponentId get_component_id () + raises (IllegalState); + + ComponentId create_component_id (in FacetId target_facet, + in SegmentId target_segment, + in SegmentDescrSeq seq_descrs); + + ComponentId create_monolithic_component_id (in FacetId target_facet, + in StateIdValue sid); + + Object create_ref_from_cid (in CORBA::RepositoryId repid, + in ComponentId cid); + + ComponentId get_cid_from_ref (in Object objref) + raises (BadComponentReference); + }; + + local interface ExecutorLocator : EnterpriseComponent + { + Object obtain_executor (in string name) + raises (CCMException); + + void release_executor (in Object exc) + raises (CCMException); + + void configuration_complete() + raises (InvalidConfiguration); + }; + + local interface HomeExecutorBase + { + }; + + // *************** Packaging and Deployment *************** + + module Deployment + { + typedef string UUID; + typedef string Location; + + enum AssemblyState + { + INACTIVE, + INSERVICE + }; + + exception UnknownImplId {}; + exception InvalidLocation {}; + exception InstallationFailure + { + FailureReason reason; + }; + exception InvalidAssembly {}; + + interface ComponentInstallation + { + void install(in UUID implUUID, + in Location component_loc) + raises (InvalidLocation, + InstallationFailure); + + void replace(in UUID implUUID, + in Location component_loc) + raises (InvalidLocation, + InstallationFailure); + + void remove(in UUID implUUID) + raises (UnknownImplId, + RemoveFailure); + + Location get_implementation (in UUID implUUID) + raises (UnknownImplId, + InstallationFailure); + }; + + interface Assembly + { + void build() + raises (CreateFailure); + + void tear_down() + raises (RemoveFailure); + + AssemblyState get_state(); + }; + + interface AssemblyFactory + { + Cookie create_assembly(in Location assembly_loc) + raises (InvalidLocation, + CreateFailure); + + Assembly lookup(in Cookie c) + raises (InvalidAssembly); + + void destroy(in Cookie c) + raises (InvalidAssembly, + RemoveFailure); + }; + + interface ComponentServer; // Forward decl. + typedef sequence<ComponentServer> ComponentServers; + + interface ServerActivator + { + ComponentServer create_component_server (in ConfigValues config) + raises (CreateFailure, + InvalidConfiguration); + + void remove_component_server (in ComponentServer server) + raises (RemoveFailure); + + ComponentServers get_component_servers (); + }; + + interface Container; // Forward decl. + typedef sequence<Container> Containers; + + interface ComponentServer + { + readonly attribute ConfigValues configuration; + + ServerActivator get_server_activator (); + Container create_container (in ConfigValues config) + raises (CreateFailure, + InvalidConfiguration); + + void remove_container (in Container cref) + raises (RemoveFailure); + + Containers get_containers (); + + void remove () + raises (RemoveFailure); + }; + + exception ImplEntryPointNotFound {}; + + interface Container + { + readonly attribute ConfigValues configuration; + + ComponentServer get_component_server (); + + CCMHome install_home (in UUID id, + in string entrypt, + in ConfigValues config) + raises (UnknownImplId, + ImplEntryPointNotFound, + InstallationFailure, + InvalidConfiguration); + + void remove_home (in CCMHome href) + raises (RemoveFailure); + + CCMHomes get_homes (); + void remove () + raises (RemoveFailure); + + }; + + }; +}; diff --git a/TAO/CIAO/ciao/Container_Base.cpp b/TAO/CIAO/ciao/Container_Base.cpp new file mode 100644 index 00000000000..110bbfd0217 --- /dev/null +++ b/TAO/CIAO/ciao/Container_Base.cpp @@ -0,0 +1,246 @@ +// $Id$ + +#include "Container_Base.h" +#include "ace/DLL.h" + +#if !defined (__ACE_INLINE__) +# include "Container_Base.inl" +#endif /* __ACE_INLINE__ */ + +//////////////////////////////////////////////////////////////// + +CIAO::Container::Container (CORBA::ORB_ptr o) + : orb_ (CORBA::ORB::_duplicate (o)) +{ +} + +CIAO::Container::~Container () +{ +} + +PortableServer::POA_ptr +CIAO::Container::the_POA (void) +{ + return this->poa_.in (); +} + +/////////////////////////////////////////////////////////////// + +ACE_Atomic_Op <ACE_Thread_Mutex, long> +CIAO::Session_Container::serial_number_ (0); + +CIAO::Session_Container::Session_Container (CORBA::ORB_ptr o) + : Container (o), + number_ (0) +{ +} + +CIAO::Session_Container::~Session_Container () +{ +} + +int +CIAO::Session_Container::init (const char *name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + char buffer[MAXPATHLEN]; + + if (name == 0) + { + this->number_ = ++CIAO::Session_Container::serial_number_; + ACE_OS::sprintf (buffer, "CIAO::Session_Container-%d", + this->number_); + name = buffer; + } + + CORBA::Object_var poa_object = + this->orb_->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + if (CORBA::is_nil (poa_object.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Unable to initialize the POA.\n"), + -1); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + // Set up proper poa policies here. Default policies seems to be + // fine for session container. + CORBA::PolicyList policies (0); + + this->poa_ = root_poa->create_POA (name, + PortableServer::POAManager::_nil (), + policies + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + PortableServer::POAManager_var poa_manager = + this->poa_->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + return 0; +} + +CORBA::Object_ptr +CIAO::Session_Container::install_servant (PortableServer::Servant p + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + PortableServer::ObjectId_var oid + = this->poa_->activate_object (p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + CORBA::Object_var objref + = this->poa_->id_to_reference (oid + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return objref._retn (); +} + +CORBA::Object_ptr +CIAO::Session_Container::install_component (PortableServer::Servant p, + PortableServer::ObjectId_out oid + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + PortableServer::ObjectId_var id + = this->poa_->activate_object (p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + CORBA::Object_var objref + = this->poa_->id_to_reference (id + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + oid = id._retn (); + + return objref._retn (); +} + +Components::CCMHome_ptr +CIAO::Session_Container::ciao_install_home (const char *exe_dll_name, + const char *exe_entrypt, + const char *sv_dll_name, + const char *sv_entrypt + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::Deployment::UnknownImplId, + Components::Deployment::ImplEntryPointNotFound, + Components::Deployment::InstallationFailure)) +{ + ACE_DLL executor_dll, servant_dll; + + if (exe_dll_name == 0 || sv_dll_name == 0) + ACE_THROW_RETURN (Components::Deployment::UnknownImplId (), 0); + + if (executor_dll.open (exe_dll_name, + ACE_DEFAULT_SHLIB_MODE, + 0) != 0) + ACE_THROW_RETURN (Components::Deployment::UnknownImplId (), 0); + + if (servant_dll.open (sv_dll_name, + ACE_DEFAULT_SHLIB_MODE, + 0) != 0) + { + executor_dll.close (); + ACE_THROW_RETURN (Components::Deployment::UnknownImplId (), 0); + } + + if (exe_entrypt == 0 || sv_entrypt == 0) + ACE_THROW_RETURN (Components::Deployment::ImplEntryPointNotFound (), 0); + + HomeFactory hcreator = (HomeFactory) executor_dll.symbol (exe_entrypt); + ServantFactory screator = (ServantFactory) servant_dll.symbol (sv_entrypt); + + if (hcreator == 0 || screator == 0) + ACE_THROW_RETURN (Components::Deployment::ImplEntryPointNotFound (), 0); + + Components::HomeExecutorBase_var home_executor = hcreator (); + if (CORBA::is_nil (home_executor.in ())) + ACE_THROW_RETURN (Components::Deployment::InstallationFailure (), 0); + + PortableServer::Servant home_servant = screator (home_executor.in (), + this + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (home_servant == 0) + ACE_THROW_RETURN (Components::Deployment::InstallationFailure (), 0); + + PortableServer::ServantBase_var safe (home_servant); + + CORBA::Object_var objref = this->install_servant (home_servant + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + Components::CCMHome_var homeref = Components::CCMHome::_narrow (objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return homeref._retn (); + +} + +void +CIAO::Session_Container::ciao_uninstall_home (Components::CCMHome_ptr homeref + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->uninstall (homeref + ACE_ENV_ARG_PARAMETER); +} + +void +CIAO::Session_Container::uninstall (CORBA::Object_ptr objref + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + PortableServer::ObjectId_var oid + = this->poa_->reference_to_id (objref + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->poa_->deactivate_object (oid + ACE_ENV_ARG_PARAMETER); +} + +void +CIAO::Session_Container::uninstall (PortableServer::Servant svt + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + PortableServer::ObjectId_var oid + = this->poa_->servant_to_id (svt + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->poa_->deactivate_object (oid + ACE_ENV_ARG_PARAMETER); +} + +void +CIAO::Session_Container::uninstall_component (CORBA::Object_ptr objref, + PortableServer::ObjectId_out oid + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + PortableServer::ObjectId_var id + = this->poa_->reference_to_id (objref + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->poa_->deactivate_object (id + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + oid = id._retn (); +} diff --git a/TAO/CIAO/ciao/Container_Base.h b/TAO/CIAO/ciao/Container_Base.h new file mode 100644 index 00000000000..105b5677534 --- /dev/null +++ b/TAO/CIAO/ciao/Container_Base.h @@ -0,0 +1,169 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Container_Base.h + * + * $Id$ + * + * Header file for CIAO's container implementations + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + + +#ifndef CIAO_CONTAINER_BASE_H +#define CIAO_CONTAINER_BASE_H +#include "ace/pre.h" + +#include "tao/ORB.h" +#include "tao/PortableServer/PortableServer.h" +#include "tao/PortableServer/Servant_Base.h" +#include "CCM_ContainerC.h" +#include "CCM_DeploymentC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO +{ + /** + * @class Container + * + * @brief Common container interface definition. + * + * Perhaps we can use local interface to define these interfaces as + * we will also get reference counting automatically. + */ + class CIAO_SERVER_Export Container + { + public: + Container (CORBA::ORB_ptr o); + + virtual ~Container (void) = 0; + + /// Get the containing POA. This operation does *NOT* + /// increase the reference count of the POA. + virtual PortableServer::POA_ptr the_POA (void); + + /// Initialize the container with a name. + virtual int init (const char *name = 0 + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) = 0; + + /// Install a new home + virtual Components::CCMHome_ptr ciao_install_home + (const char *exe_dll_name, + const char *exe_entrypt, + const char *sv_dll_name, + const char *sv_entrypt + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::Deployment::UnknownImplId, + Components::Deployment::ImplEntryPointNotFound, + Components::Deployment::InstallationFailure)) = 0; + + // Uninstall a servant for component or home. + virtual void ciao_uninstall_home (Components::CCMHome_ptr homeref + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) = 0; + + protected: + CORBA::ORB_var orb_; + + PortableServer::POA_var poa_; + }; + + class CIAO_SERVER_Export Session_Container : public Container + { + public: + Session_Container (CORBA::ORB_ptr o); + + virtual ~Session_Container (void); + + /// Initialize the container with a name. + virtual int init (const char *name = 0 + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /** + * @brief Simply installing a home executor into the component. + * + * This operation install a home executor into the component. It + * requires the name of the DLLs to executor and the servant glue + * code, and the entry points to the respective DLLs. Currently, + * we don't try to manage the lifetime of DLL objects, but we + * should at some later point. + * + * @retval Home objref of the installed home. + */ + virtual Components::CCMHome_ptr ciao_install_home + (const char *exe_dll_name, + const char *exe_entrypt, + const char *sv_dll_name, + const char *sv_entrypt + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::Deployment::UnknownImplId, + Components::Deployment::ImplEntryPointNotFound, + Components::Deployment::InstallationFailure)); + + // Uninstall a servant for component or home. + virtual void ciao_uninstall_home (Components::CCMHome_ptr homeref + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Install a servant for component or home. + CORBA::Object_ptr install_servant (PortableServer::Servant p + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Install a component servant. + CORBA::Object_ptr install_component (PortableServer::Servant p, + PortableServer::ObjectId_out oid + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Get an object reference to a component or home from the servant. + CORBA::Object_ptr get_objref (PortableServer::Servant p + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Uninstall a servant for component or home. + void uninstall (CORBA::Object_ptr objref + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Uninstall a servant for component or home. + void uninstall (PortableServer::Servant svt + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Uninstall a servant for component or home. + void uninstall_component (CORBA::Object_ptr objref, + PortableServer::ObjectId_out oid + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + long number_; + + static ACE_Atomic_Op <ACE_Thread_Mutex, long> serial_number_; + }; + + typedef ::Components::HomeExecutorBase_ptr (*HomeFactory) (void); + typedef ::PortableServer::Servant (*ServantFactory) + (::Components::HomeExecutorBase_ptr p, + ::CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); +} + +#if defined (__ACE_INLINE__) +# include "Container_Base.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* CIAO_CONTAINER_BASE_H */ diff --git a/TAO/CIAO/ciao/Container_Base.inl b/TAO/CIAO/ciao/Container_Base.inl new file mode 100644 index 00000000000..f829fa65218 --- /dev/null +++ b/TAO/CIAO/ciao/Container_Base.inl @@ -0,0 +1,10 @@ +// $Id$ -*- C++ -*- + +ACE_INLINE CORBA::Object_ptr +CIAO::Session_Container::get_objref (PortableServer::Servant p + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->the_POA ()->servant_to_reference (p + ACE_ENV_ARG_PARAMETER); +} diff --git a/TAO/CIAO/ciao/Container_Base.pidl b/TAO/CIAO/ciao/Container_Base.pidl new file mode 100644 index 00000000000..e698ea66b45 --- /dev/null +++ b/TAO/CIAO/ciao/Container_Base.pidl @@ -0,0 +1,33 @@ +// $Id$ + +/** + * CIAO's internal container interface definitions. + */ + +//#define CIAO_HAS_IMPORT_KEYWORD + +#if !defined (CONTAINER_BASE_PIDL) +#define CONTAINER_BASE_PIDL + +#include "CIAO_Component.pidl" +#include <SecurityLevel2.idl> +#include "CIAO_Transaction.pidl" + +// *************** Basic Container interfaces *************** + +module CIAO +{ + typeprefix Components "wustl.edu"; + + local interface Container + { + // Return the POA + PortableServer::POA the_POA (); + }; + + local interface SessionContainer + { + + }; +}; +#endif /* CONTAINER_BASE_PIDL */ diff --git a/TAO/CIAO/ciao/Container_Impl.cpp b/TAO/CIAO/ciao/Container_Impl.cpp new file mode 100644 index 00000000000..9559e5ea2d3 --- /dev/null +++ b/TAO/CIAO/ciao/Container_Impl.cpp @@ -0,0 +1,251 @@ +// $Id$ +#include "Container_Impl.h" + +#if !defined (__ACE_INLINE__) +# include "Container_Impl.inl" +#endif /* __ACE_INLINE__ */ + +CIAO::Container_Impl::~Container_Impl () +{ + // @@ remove all home? +} + +PortableServer::POA_ptr +CIAO::Container_Impl::_default_POA (void) +{ + return PortableServer::POA::_duplicate (this->poa_.in ()); +} + +int +CIAO::Container_Impl::init (const ::Components::ConfigValues &options, + Components::Deployment::ComponentInstallation_ptr inst + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_NEW_THROW_EX (this->config_, + Components::ConfigValues (), + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (-1); + + *this->config_ = options; + this->installation_ = + Components::Deployment::ComponentInstallation::_duplicate (inst); + + // @@ Initialize container and create the internal container + // implementation that actually interacts with installed + // homes/components. + + // @@ We will need a container factory here later on when we support + // more kinds of container implementations. + + // @@ Fish out the ComponentServer object reference from <options>. + + ACE_NEW_THROW_EX (this->container_, + CIAO::Session_Container (this->orb_.in ()), + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (-1); + + return this->container_->init (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +::Components::ConfigValues * +CIAO::Container_Impl::configuration (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + Components::ConfigValues *retval; + + ACE_NEW_THROW_EX (retval, + Components::ConfigValues (), + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (0); + + *retval = this->config_; + + return retval; +} + +::Components::Deployment::ComponentServer_ptr +CIAO::Container_Impl::get_component_server (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return Components::Deployment::ComponentServer::_duplicate (this->comserv_.in ()); +} + +::Components::CCMHome_ptr +CIAO::Container_Impl::install_home (const char * id, + const char * entrypt, + const Components::ConfigValues & config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::Deployment::UnknownImplId, + Components::Deployment::ImplEntryPointNotFound, + Components::Deployment::InstallationFailure, + Components::InvalidConfiguration)) +{ + // use id to locate the softpkg from the ComponentInstallation interface. + // depending on where we want to parse the softpkg descriptor, we + // can either use the <entrypt> directly (if we parse the softpkg in + // Assembly), simply verify that is correct, or even discard this + // value. + + // @@ Here we need to resolve paths to both component executors and + // component servants (that matches the container type) for the + // executor and their entry points before we can install the home. + struct home_installation_info config_info; + this->parse_config_values (id, + config, + config_info + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + Components::CCMHome_var newhome + = this->container_->ciao_install_home + (config_info.executor_dll_.in (), + entrypt, + config_info.servant_dll_.in (), + config_info.servant_entrypt_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); + + this->home_set_.add (newhome.in ()); + } + return newhome._retn (); +} + +void +CIAO::Container_Impl::remove_home (Components::CCMHome_ptr href + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) +{ + ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); + + if (this->home_set_.object_in_set (href) == 0) + ACE_THROW (CORBA::BAD_PARAM ()); + + // @@ Finalizing home... how? Removing all the components, but how? + // It looks like the component home will also need to keep a record + // of all the components it creates. + + this->container_->ciao_uninstall_home (href + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + // @@ Still need to remove the home if the previous operation fails? + if (this->home_set_.remove (href) == -1) + ACE_THROW (::Components::RemoveFailure ()); +} + +::Components::CCMHomes * +CIAO::Container_Impl::get_homes (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); + + Components::CCMHomes_var retval; + + ACE_NEW_THROW_EX (retval.out (), + Components::CCMHomes (), + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (0); + + CORBA::ULong len = this->home_set_.size (); + retval->length (len); // resize + +#if 0 + // TAO is broken here. Both <replace>, <get_buffer> and friends are missing. + this->home_set_.copy (len, retval->get_buffer (0)); +#else + for (CORBA::ULong i = 0; i < len; ++i) + { + retval[i] = this->home_set_.at (i); + } +#endif + + return retval._retn (); +} + +void +CIAO::Container_Impl::remove (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) +{ + // @@ Need to remove all CCMHome + + // ACE_THROW (CORBA::NO_IMPLEMENT ()); + + ACE_DEBUG ((LM_DEBUG, "CIAO::Container_Impl::remove\n")); +} + +void +CIAO::Container_Impl::parse_config_values (const char *id, + const Components::ConfigValues &options, + struct home_installation_info &component_install_info + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::Deployment::UnknownImplId, + Components::Deployment::ImplEntryPointNotFound, + Components::InvalidConfiguration)) +{ + CORBA::String_var servant_uuid; + + for (CORBA::ULong i = 0; i < options.length (); ++i) + { + CORBA::String_var *info; + const char *str_in = 0; + + // @@ The following code need cleaning up. + if (ACE_OS::strcmp (options[i]->name (), "CIAO-servant-UUID") == 0) + info = &servant_uuid; + else if (ACE_OS::strcmp (options[i]->name (), "CIAO-servant-entrypt") == 0) + info = &component_install_info.servant_entrypt_; + else + { + Components::InvalidConfiguration exc; + exc.name = CORBA::string_dup (options[i]->name ()); + exc.reason = Components::UnknownConfigValueName; + ACE_THROW (exc); + } + + if (options[i]->value () >>= str_in) + { + *info = CORBA::string_dup (str_in); +#if 0 + ACE_DEBUG ((LM_DEBUG, "*parse_config_values got (%s) = %s\n", + options[i]->name (), + str_in)); +#endif /* 0 */ + } + else + { + Components::InvalidConfiguration exc; + exc.name = CORBA::string_dup (options[i]->name ()); + exc.reason = Components::InvalidConfigValueType; + ACE_THROW (exc); + } + } + + component_install_info.executor_dll_ = + this->installation_->get_implementation (id + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + component_install_info.servant_dll_ = + this->installation_->get_implementation (servant_uuid.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (component_install_info.executor_dll_.in () == 0 || + component_install_info.servant_dll_.in () == 0 || + component_install_info.servant_entrypt_.in () == 0) + { + Components::InvalidConfiguration exc; + // The following should really be the exact missing configvalue name: + exc.name = CORBA::string_dup ("home_installation_info"); + exc.reason = Components::ConfigValueRequired; + ACE_THROW (exc); + } +} diff --git a/TAO/CIAO/ciao/Container_Impl.h b/TAO/CIAO/ciao/Container_Impl.h new file mode 100644 index 00000000000..3d984be2836 --- /dev/null +++ b/TAO/CIAO/ciao/Container_Impl.h @@ -0,0 +1,161 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Container_Impl.h + * + * $Id$ + * + * This file contains implementation for the servant of + * Components::Deployment::Container interface. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + + +#ifndef CIAO_CONTAINER_IMPL_H +#define CIAO_CONTAINER_IMPL_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "CCM_DeploymentS.h" +#include "Container_Base.h" +#include "Object_Set_T.h" + +namespace CIAO +{ + + struct home_installation_info + { + CORBA::String_var executor_dll_; + CORBA::String_var servant_dll_; + CORBA::String_var servant_entrypt_; + }; + + /** + * @class Container_Impl + * + * @brief Servant implementation for Components::Deployment::Container + * + * This class implements the Components::Deployment::Container + * interface as defined by the CCM spcification. As the interface + * implies, this is actually part of the deployment interface and is + * used to manage the lifecycle of the installed components and + * homes. + */ + class CIAO_SERVER_Export Container_Impl + : public virtual POA_Components::Deployment::Container, + public virtual PortableServer::RefCountServantBase + { + public: + /// Constructor + Container_Impl (CORBA::ORB_ptr o, + PortableServer::POA_ptr p, + Components::Deployment::ComponentServer_ptr server); + + /// Destructor + virtual ~Container_Impl (void); + + /// Get the containing POA. This operation does *not* + /// increase the reference count of the POA. + virtual PortableServer::POA_ptr _default_POA (void); + + /// Initialize the container with a name. + int init (const Components::ConfigValues &options, + Components::Deployment::ComponentInstallation_ptr installation + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Components::Deployment::Container defined attributes/operations. + + virtual ::Components::ConfigValues * configuration (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::Deployment::ComponentServer_ptr get_component_server (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::CCMHome_ptr install_home (const char * id, + const char * entrypt, + const Components::ConfigValues & config + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::Deployment::UnknownImplId, + Components::Deployment::ImplEntryPointNotFound, + Components::Deployment::InstallationFailure, + Components::InvalidConfiguration)); + + virtual void remove_home (Components::CCMHome_ptr href + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + + virtual ::Components::CCMHomes * get_homes (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + + // ------------------- CIAO Internal Operations ------------------------ + /// Set the cached object reference. + void set_objref (Components::Deployment::Container_ptr o + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + /// Get the cached object reference. This operation will invoke + /// _this if there's no cached reference available. Notice that + /// this method does *NOT* increase the reference count of the + /// cached reference. + Components::Deployment::Container_ptr get_objref (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); + +protected: + /// parse ConfigValues + void parse_config_values (const char *exe_id, + const Components::ConfigValues &options, + struct home_installation_info &component_install_info + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::Deployment::UnknownImplId, + Components::Deployment::ImplEntryPointNotFound, + Components::InvalidConfiguration)); + + /// Keep a pointer to the managing ORB serving this servant. + CORBA::ORB_var orb_; + + /// Keep a pointer to the managing POA. + PortableServer::POA_var poa_; + + /// Internal container implementation. + CIAO::Container *container_; + + /// Cached ConfigValues. + Components::ConfigValues_var config_; + + /// Cached Container reference (of ourselves.) + Components::Deployment::Container_var objref_; + + /// Cached ComponentServer. + Components::Deployment::ComponentServer_var comserv_; + + /// And a reference to the ServerActivator that created us. + Components::Deployment::ComponentInstallation_var installation_; + + /// Synchronize access to the object set. + TAO_SYNCH_MUTEX lock_; + + /// Keep a list of managed CCMHome. + Object_Set<Components::CCMHome, Components::CCMHome_var> home_set_; + }; +} + +#if defined (__ACE_INLINE__) +# include "Container_Impl.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* CIAO_CONTAINER_IMPL_H */ diff --git a/TAO/CIAO/ciao/Container_Impl.inl b/TAO/CIAO/ciao/Container_Impl.inl new file mode 100644 index 00000000000..004ad4d9876 --- /dev/null +++ b/TAO/CIAO/ciao/Container_Impl.inl @@ -0,0 +1,33 @@ +/* -*- C++ -*- */ +// $Id$ + +ACE_INLINE +CIAO::Container_Impl::Container_Impl (CORBA::ORB_ptr o, + PortableServer::POA_ptr p, + Components::Deployment::ComponentServer_ptr s) + : orb_ (CORBA::ORB::_duplicate (o)), + poa_ (PortableServer::POA::_duplicate (p)), + comserv_ (Components::Deployment::ComponentServer::_duplicate (s)) +{ +} + +ACE_INLINE void +CIAO::Container_Impl::set_objref (Components::Deployment::Container_ptr o + ACE_ENV_ARG_DECL_WITH_DEFAULTS) +{ + if (!CORBA::is_nil (this->objref_.in ())) + ACE_THROW (CORBA::BAD_INV_ORDER ()); + + this->objref_ = Components::Deployment::Container::_duplicate (o); +} + +ACE_INLINE Components::Deployment::Container_ptr +CIAO::Container_Impl::get_objref (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) +{ + if (CORBA::is_nil (this->objref_.in ())) + { + this->objref_ = this->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + } + return this->objref_.in (); +} diff --git a/TAO/CIAO/ciao/Cookies.cpp b/TAO/CIAO/ciao/Cookies.cpp new file mode 100644 index 00000000000..2673151b5cc --- /dev/null +++ b/TAO/CIAO/ciao/Cookies.cpp @@ -0,0 +1,64 @@ +// $Id$ + +#include "Cookies.h" + +#if !defined (__ACE_INLINE__) +#include "Cookies.inl" +#endif /* !defined INLINE */ + + +/// Initialize a @c Cookie with an @c ACE_Active_Map_Manager_Key +CIAO::Map_Key_Cookie::Map_Key_Cookie (const ACE_Active_Map_Manager_Key &key) +{ + this->cookieValue ().length (ACE_Active_Map_Manager_Key::size ()); + key.encode (this->cookieValue ().get_buffer (0)); +} + +// CIAO::Map_Key_Cookie::Map_Key_Cookie (const ::OBV_Components::Cookie &ck) +// { +// this->cookieValue (ACE_reinterpret_cast (CIAO::Map_Key_Cookie, ck).cookieValue ()); +// } + +int +CIAO::Map_Key_Cookie::insert (ACE_Active_Map_Manager_Key &key) +{ + this->cookieValue ().length (ACE_Active_Map_Manager_Key::size ()); + key.encode (this->cookieValue ().get_buffer (0)); + return 0; +} + +int +CIAO::Map_Key_Cookie::extract (::Components::Cookie *ck, + ACE_Active_Map_Manager_Key &key) +{ + CIAO::Cookie *c = CIAO::Cookie::_downcast (ck); + + if (c == 0) + return -1; + + ::CORBA::OctetSeq *x = c->get_cookie (); + + if (x->length () != ACE_Active_Map_Manager_Key::size ()) + return -1; + key.decode (x->get_buffer ()); + return 0; +} + + +CORBA::ValueBase * +CIAO::Map_Key_Cookie_init::create_for_unmarshal (void) +{ + CORBA::ValueBase *ret_val = 0; + ACE_NEW_RETURN ( + ret_val, + CIAO::Map_Key_Cookie, + 0 + ); + return ret_val; +} + +::CORBA::OctetSeq * +CIAO::Map_Key_Cookie::get_cookie (ACE_ENV_SINGLE_ARG_DECL) +{ + return &this->cookieValue (); +} diff --git a/TAO/CIAO/ciao/Cookies.h b/TAO/CIAO/ciao/Cookies.h new file mode 100644 index 00000000000..50d22e08844 --- /dev/null +++ b/TAO/CIAO/ciao/Cookies.h @@ -0,0 +1,76 @@ +// $Id$ + +/** + * @file Coockies.h + * + * A CIAO implementation of Cookie valuetype. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#ifndef CIAO_COOKIES_H +#define CIAO_COOKIES_H +#include "ace/pre.h" + +#include "CCM_BaseC.h" +#include "CIAO_Container_Export.h" +#include "CIAO_ValueC.h" +#include "ace/Active_Map_Manager.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO +{ + /** + * @class Map_Key_Cookie + * + * @brief A CIAO internal Cookie valuetype implementation. + */ + class CIAO_CONTAINER_Export Map_Key_Cookie + : public virtual OBV_CIAO::Cookie + { + public: + /// Default constructor. + Map_Key_Cookie (); + + /// Initialize a @c Cookie with an @c ACE_Active_Map_Manager_Key + Map_Key_Cookie (const ACE_Active_Map_Manager_Key &key); + + virtual ::CORBA::OctetSeq * get_cookie (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); + + /// Initialize a @c Cookie with an @c ACE_Active_Map_Manager_Key + /// This contructor make a copy of the Cookie. Perhaps we can somehow + /// avoid this? + //Map_Key_Cookie (const ::OBV_Components::Cookie &ck); + + /// Destroy the @c Cookie + ~Map_Key_Cookie (void); + + /// Insert the @c ACE_Active_Map_Manager_Key + int insert (ACE_Active_Map_Manager_Key &key); + + /// Extract the @c ACE_Active_Map_Manager_Key + static int extract (::Components::Cookie *c, + ACE_Active_Map_Manager_Key &key); + + protected: + }; + + class CIAO_CONTAINER_Export Map_Key_Cookie_init : public virtual ::Components::Cookie_init + { + public: + Map_Key_Cookie_init (void); + virtual ~Map_Key_Cookie_init (void); + + virtual CORBA::ValueBase *create_for_unmarshal (void); + }; +} + +#if defined (__ACE_INLINE__) +#include "Cookies.inl" +#endif /* !defined INLINE */ + +#include "ace/post.h" +#endif /* CIAO_COOKIES_H */ diff --git a/TAO/CIAO/ciao/Cookies.inl b/TAO/CIAO/ciao/Cookies.inl new file mode 100644 index 00000000000..7983a3b8553 --- /dev/null +++ b/TAO/CIAO/ciao/Cookies.inl @@ -0,0 +1,22 @@ +/* -*- C++ -*- */ +// $Id$ + +ACE_INLINE +CIAO::Map_Key_Cookie::Map_Key_Cookie () +{ +} + +ACE_INLINE +CIAO::Map_Key_Cookie::~Map_Key_Cookie () +{ +} + +ACE_INLINE +CIAO::Map_Key_Cookie_init::Map_Key_Cookie_init () +{ +} + +ACE_INLINE +CIAO::Map_Key_Cookie_init::~Map_Key_Cookie_init () +{ +} diff --git a/TAO/CIAO/ciao/CosPersistentState.idl b/TAO/CIAO/ciao/CosPersistentState.idl new file mode 100644 index 00000000000..64f127539e2 --- /dev/null +++ b/TAO/CIAO/ciao/CosPersistentState.idl @@ -0,0 +1,23 @@ +// $Id$ + +/** + * @@ This is just a temporary file. Since TAO does not have + * CosPersistentState at all, we use this file to define + * types necessary to get ComponentBase.idl to compile. + * + * Compile with + * tao_idl -Gv CosPersistentState.idl + */ + +#if !defined (CIAO_COSPERSISTENTSTATE_PIDL) +#define CIAO_COSPERSISTENTSTATE_PIDL + +module CosPersistentState { + local interface CatalogBase + { + }; + + typedef sequence<octet> _TypeId; + typedef string Pid; +}; +#endif /* CIAO_COSPERSISTENTSTATE_PIDL */ diff --git a/TAO/CIAO/ciao/HomeRegistrar.idl b/TAO/CIAO/ciao/HomeRegistrar.idl new file mode 100644 index 00000000000..42176c1d571 --- /dev/null +++ b/TAO/CIAO/ciao/HomeRegistrar.idl @@ -0,0 +1,38 @@ +// $Id$ + +/** + * @file HomeRegistrar.idl + * + * This file define the interface supported by CIAO's HomeFinder + * service. It is basically an extension of Components::HomeFinder + * interface by supporting CIAO specific home + */ + +#include "CCM_Component.idl" + +module CIAO +{ + exception AlreadyBound + { + // Equivalent to CosNaming::NamingContext::AlreadyBound exception. + }; + + exception InvalidName + { + // Equivalent to CosNaming::NamingContext::InvalidName exception. + }; + + exception HomeRegisterFailure + { + // Equivalent to CosNaming::NamingContext::InvalidName exception. + }; + + interface HomeRegistrar : Components::HomeFinder + { + void register_home (in CORBA::RepositoryId home_repo_id, + in CORBA::RepositoryId comp_repo_id, + in string home_name, + in Object objref) + raises (AlreadyBound, InvalidName, HomeRegisterFailure); + }; +}; diff --git a/TAO/CIAO/ciao/HomeRegistrar_i.cpp b/TAO/CIAO/ciao/HomeRegistrar_i.cpp new file mode 100644 index 00000000000..5fb7b3f0a0c --- /dev/null +++ b/TAO/CIAO/ciao/HomeRegistrar_i.cpp @@ -0,0 +1,98 @@ +// $Id$ + +#include "HomeRegistrar_i.h" + +#if !defined (__ACE_INLINE__) +#include "HomeRegistrar_i.inl" +#endif /* !defined INLINE */ + +CIAO::HomeRegistrar_Impl::HomeRegistrar_Impl (CosNaming::NamingContext_ptr ns) + : ns_ (CosNaming::NamingContext::_duplicate (ns)) +{ +} + +CIAO::HomeRegistrar_Impl::~HomeRegistrar_Impl () +{ +} + +::Components::CCMHome_ptr +CIAO::HomeRegistrar_Impl::find_home_impl (const char *name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::HomeNotFound)) +{ + Components::CCMHome_var ahome; + + ACE_TRY + { + CosNaming::Name aname; + aname.length (1); + aname[0].id = CORBA::string_dup (name); + + CORBA::Object_var obj = this->ns_->resolve (aname + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ahome = Components::CCMHome::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_TRY_THROW (Components::HomeNotFound ()); + } + ACE_ENDTRY; + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (ahome.in ())) + ACE_THROW_RETURN (Components::HomeNotFound (), 0); + return ahome._retn (); +} + +void +CIAO::HomeRegistrar_Impl::register_home (const char * home_repo_id, + const char * comp_repo_id, + const char * home_name, + CORBA::Object_ptr objref + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + CIAO::AlreadyBound, + CIAO::InvalidName, + CIAO::HomeRegisterFailure)) +{ + if (CORBA::is_nil (objref)) + ACE_THROW (CORBA::BAD_PARAM ()); + + ACE_TRY + { + CosNaming::Name aname; + aname.length (1); + aname[0].id = CORBA::string_dup (home_repo_id); + + this->ns_->bind (aname, objref ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + aname[0].id = CORBA::string_dup (comp_repo_id); + + this->ns_->bind (aname, objref ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + aname[0].id = CORBA::string_dup (home_name); + + this->ns_->bind (aname, objref ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCH (CosNaming::NamingContext::AlreadyBound, ex) + { + ACE_TRY_THROW (CIAO::AlreadyBound ()); + } + ACE_CATCH (CosNaming::NamingContext::InvalidName, ex) + { + ACE_TRY_THROW (CIAO::InvalidName ()); + } + ACE_CATCHANY + { + ACE_TRY_THROW (CIAO::HomeRegisterFailure ()); + } + ACE_ENDTRY; +} diff --git a/TAO/CIAO/ciao/HomeRegistrar_i.h b/TAO/CIAO/ciao/HomeRegistrar_i.h new file mode 100644 index 00000000000..34a47ed89da --- /dev/null +++ b/TAO/CIAO/ciao/HomeRegistrar_i.h @@ -0,0 +1,82 @@ +// $Id$ + +/** + * @file HomeRegistrar_i.h + * + * A CIAO HomeFinder implementation that also support CIAO's home + * registration operation. + * + * @sa HomeRegistrar.idl + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#ifndef CIAO_HOMEREGISTRAR_I_H +#define CIAO_HOMEREGISTRAR_I_H +#include "ace/pre.h" + +#include "HomeRegistrarS.h" +#include <CosNamingC.h> + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO +{ + class CIAO_SERVER_Export HomeRegistrar_Impl + : public virtual POA_CIAO::HomeRegistrar, + public virtual PortableServer::RefCountServantBase + { + public: + /** + * @brief We require a NamingContext to hold the names. + */ + HomeRegistrar_Impl (CosNaming::NamingContext_ptr ns); + + /** + * @brief Default destructor. + */ + ~HomeRegistrar_Impl (); + + virtual ::Components::CCMHome_ptr find_home_by_component_type (const char * comp_repid + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::HomeNotFound)); + + virtual ::Components::CCMHome_ptr find_home_by_home_type (const char * home_repid + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::HomeNotFound)); + + virtual ::Components::CCMHome_ptr find_home_by_name (const char * home_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::HomeNotFound)); + + virtual void register_home (const char * home_repo_id, + const char * comp_repo_id, + const char * home_name, + CORBA::Object_ptr objref + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + CIAO::AlreadyBound, + CIAO::InvalidName, + CIAO::HomeRegisterFailure)); + + Components::CCMHome_ptr find_home_impl (const char *name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::HomeNotFound)); + + protected: + CosNaming::NamingContext_var ns_; + }; +} + +#if defined (__ACE_INLINE__) +#include "HomeRegistrar_i.inl" +#endif /* !defined INLINE */ + +#include "ace/post.h" +#endif /* CIAO_HOMEREGISTRAR_I_H */ diff --git a/TAO/CIAO/ciao/HomeRegistrar_i.inl b/TAO/CIAO/ciao/HomeRegistrar_i.inl new file mode 100644 index 00000000000..94b373d29e9 --- /dev/null +++ b/TAO/CIAO/ciao/HomeRegistrar_i.inl @@ -0,0 +1,31 @@ +// $Id$ + +::Components::CCMHome_ptr +CIAO::HomeRegistrar_Impl::find_home_by_component_type (const char * comp_repid + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::HomeNotFound)) +{ + return this->find_home_impl (comp_repid + ACE_ENV_ARG_PARAMETER); +} + +::Components::CCMHome_ptr +CIAO::HomeRegistrar_Impl::find_home_by_home_type (const char * home_repid + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::HomeNotFound)) +{ + return this->find_home_impl (home_repid + ACE_ENV_ARG_PARAMETER); +} + +::Components::CCMHome_ptr +CIAO::HomeRegistrar_Impl::find_home_by_name (const char * home_name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::HomeNotFound)) +{ + return this->find_home_impl (home_name + ACE_ENV_ARG_PARAMETER); +} diff --git a/TAO/CIAO/ciao/Object_Set_T.cpp b/TAO/CIAO/ciao/Object_Set_T.cpp new file mode 100644 index 00000000000..043f2f0e9f0 --- /dev/null +++ b/TAO/CIAO/ciao/Object_Set_T.cpp @@ -0,0 +1,123 @@ +// $Id$ + +#ifndef CIAO_OBJECT_SET_T_C +#define CIAO_OBJECT_SET_T_C + +#include "Object_Set_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (__ACE_INLINE__) +#include "Object_Set_T.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ciao, Object_Set_T, "$Id$") + +template <class T, class T_var> +CIAO::Object_Set<T, T_var>::Object_Set (CORBA::ULong init_capacity, + CORBA::ULong step) + : capacity_ (init_capacity), + size_ (0), + step_ (step) +{ + this->buffer_ = new T_var [this->capacity_]; +} + +template <class T, class T_var> +CIAO::Object_Set<T, T_var>::~Object_Set () +{ + delete[] this->buffer_; +} + +template <class T, class T_var> void +CIAO::Object_Set<T, T_var>::release () +{ + CORBA::ULong i = 0; + + for (; i < this->size_; ++i) + { + this->buffer_[i] = T::_nil (); + } +} + +template <class T, class T_var> CORBA::Long +CIAO::Object_Set<T, T_var>::add (T *objref) +{ + if (this->size_ == this->capacity_) + this->grow (); + + this->buffer_[this->size_] = T::_duplicate (objref); + return this->size_++; +} + +template<class T, class T_var> CORBA::Long +CIAO::Object_Set<T, T_var>::remove (T *objref) +{ + if (CORBA::is_nil (objref)) + return -1; + + CORBA::ULong i = 0; + + for (; i < this->size_; ++i) + if (objref->_is_equivalent (this->buffer_[i].in ())) // _is_equivalent could be unreliable? + { + --this->size_; + if (i != this->size_) + this->buffer_[i] = this->buffer_[this->size_]; + + this->buffer_[this->size_] = T::_nil (); + return 0; + } + return -1; // not found. +} + +template <class T, class T_var> void +CIAO::Object_Set<T, T_var>::grow (void) +{ + this->capacity_ += this->step_; + + T_var *newbuf = new T_var [this->capacity_]; + + CORBA::ULong i = 0; + for (; i < this->size_; ++i) + newbuf[i] = this->buffer_[i]; // this will hijack the object ownership + + delete[] this->buffer_; + + this->buffer_ = newbuf; +} + +template <class T, class T_var> CORBA::ULong +CIAO::Object_Set<T, T_var>::copy (CORBA::ULong len, + T **buf) +{ + if (buf == 0) + return 0; + + if (len > this->size_) + len = this->size_; + + CORBA::ULong i = 0; + for (; i < len; ++i) + buf[i] = T::_duplicate (this->buffer_[i].in ()); + + return len; +} + +template <class T, class T_var> int +CIAO::Object_Set<T, T_var>::object_in_set (T *objref) +{ + if (CORBA::is_nil (objref)) // Don't count nil objref + return 0; + + CORBA::ULong i = 0; + + for (; i < this->size_; ++i) + if (objref->_is_equivalent (this->buffer_[i].in ())) // _is_equivalent could be unreliable? + return -1; + + return 0; +} +#endif /* CIAO_OBJECT_SET_T_C */ diff --git a/TAO/CIAO/ciao/Object_Set_T.h b/TAO/CIAO/ciao/Object_Set_T.h new file mode 100644 index 00000000000..3240758fe7b --- /dev/null +++ b/TAO/CIAO/ciao/Object_Set_T.h @@ -0,0 +1,127 @@ +// $Id$ + +/** + * @file Object_Set_T.h + * + * Helper template classes for maintaining and managing object + * reference sets. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#ifndef CIAO_OBJECT_SET_T_H +#define CIAO_OBJECT_SET_T_H +#include "ace/pre.h" + +#include "tao/corbafwd.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO +{ + /** + * @class Object_Set + * + * @brief A helper template class for maintaining and managing a set + * of object reference. + * + * This class provides a naive implementation of an object reference + * set. It is naive because it simply keeps object references in an + * objref_var array without checking for duplication. More + * importantly, it takes O(n) to to look for an object reference and + * return it. What we really need is a thread-safe hash_set<> like + * class here. Since this is mostly used only during setup/assemble + * time for a CIAO application, i.e., not on critical path, this + * class serves as a place holder for later, more efficient + * implementation. + */ + template <class T, class T_var> + class Object_Set + { + public: + /** + * Default contructor that also allows initializing the initial + * capacity of the set and the increment step. + */ + Object_Set (CORBA::ULong init_capacity = 10, + CORBA::ULong step = 10); + + /// Default destructor. + ~Object_Set (void); + + /// Adding a new object reference to the set. Return -1 if error + /// occurred. + CORBA::Long add (T *objref); + + /// Removing an object from the set. Return -1 if error occurred. + CORBA::Long remove (T *objref); + + /// Access the underlying T_var array directly. This is added to + /// get around a bug in TAO's sequence of object C++ mapping. + T_var &at (CORBA::ULong index); + + /** + * Get a copy of the object reference set into the incoming array + * @c buffer with capacity of @c size. @c buffer is usually + * allocated using a sequence's @c allocbuf method. Notice that + * caller is responsible to release the object references in + * buffer. + * + * @retval actual number of objrefs copied into @c buffer. + */ + CORBA::ULong copy (CORBA::ULong size, + T **buffer); + + /** + * Check if an object is in the set. Return 0 if false. + */ + int object_in_set (T *objref); + + /// Query the current size the set contains. + CORBA::ULong size (void) const; + + /// Query the current capacity the set. + CORBA::ULong capacity (void) const; + + /** + * Release all object references. + */ + void release (void); + + protected: + /// Grow the internal array holding the object references. + void grow (void); + + /// Pointer to the dynamically allocated buffer that holds the + /// object references. + T_var *buffer_; + + /// Maximun capacity of this->buffer_; + CORBA::ULong capacity_; + + /// Current size in the set. + CORBA::ULong size_; + + /// How many more slots to add each time we expand the capacity of + /// this set. + CORBA::ULong step_; + }; + +} + +#if defined (__ACE_INLINE__) +#include "Object_Set_T.inl" +#endif /* !defined INLINE */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "Object_Set_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Object_Set_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include "ace/post.h" +#endif /* CIAO_OBJECT_SET_T_H */ diff --git a/TAO/CIAO/ciao/Object_Set_T.inl b/TAO/CIAO/ciao/Object_Set_T.inl new file mode 100644 index 00000000000..cd9b8e1ab45 --- /dev/null +++ b/TAO/CIAO/ciao/Object_Set_T.inl @@ -0,0 +1,20 @@ +/* -*- C++ -*- */ +// $Id$ + +template <class T, class T_var> ACE_INLINE CORBA::ULong +CIAO::Object_Set<T, T_var>::size (void) const +{ + return this->size_; +} + +template <class T, class T_var> ACE_INLINE CORBA::ULong +CIAO::Object_Set<T, T_var>::capacity (void) const +{ + return this->capacity_; +} + +template <class T, class T_var> ACE_INLINE T_var & +CIAO::Object_Set<T, T_var>::at (CORBA::ULong index) +{ + return this->buffer_[index]; +} diff --git a/TAO/CIAO/ciao/README b/TAO/CIAO/ciao/README new file mode 100644 index 00000000000..b806bbc084c --- /dev/null +++ b/TAO/CIAO/ciao/README @@ -0,0 +1,13 @@ +$Id$ + +This directory contains the Core CCM IDL defintions which get split +into different libraries. + +1. CIAO - CIAO CCM client-side interface library. Component-aware clients + need to link to this library. + +2. CIAO_Container - CIAO CCM container interface definitions. This library + is needed by all compoment implementation. + +3. CIAO_Server - CIAO CCM interface definitions for component servers and + deployment framework. diff --git a/TAO/CIAO/ciao/ServerActivator_Impl.cpp b/TAO/CIAO/ciao/ServerActivator_Impl.cpp new file mode 100644 index 00000000000..f1ff497b4db --- /dev/null +++ b/TAO/CIAO/ciao/ServerActivator_Impl.cpp @@ -0,0 +1,260 @@ +// $Id$ + +#include "ServerActivator_Impl.h" +#include "ace/Process.h" + +#if !defined (__ACE_INLINE__) +# include "ServerActivator_Impl.inl" +#endif /* __ACE_INLINE__ */ + +CIAO::Activator_Callback_Impl::~Activator_Callback_Impl () +{ +} + +PortableServer::POA_ptr +CIAO::Activator_Callback_Impl::_default_POA (void) +{ + return PortableServer::POA::_duplicate (this->poa_.in ()); +} + +::Components::Deployment::ServerActivator_ptr +CIAO::Activator_Callback_Impl::register_component_server (::Components::Deployment::ComponentServer_ptr svr) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->server_ = ::Components::Deployment::ComponentServer::_duplicate (svr); + return ::Components::Deployment::ServerActivator::_duplicate (this->activator_); +} + +::Components::Deployment::ComponentServer_ptr +CIAO::Activator_Callback_Impl::get_server_ref (void) +{ + // Relinquish the ownership of the server reference. This method + // should only be called from the ServerActivator. + return this->server_._retn (); +} + +CIAO::ServerActivator_Impl::~ServerActivator_Impl () +{ + // @@ remove all ComponentServer's? +} + +PortableServer::POA_ptr +CIAO::ServerActivator_Impl::_default_POA (void) +{ + return PortableServer::POA::_duplicate (this->poa_.in ()); +} + +int +CIAO::ServerActivator_Impl::init (const char *server_location, + CORBA::ULong spawn_delay, + const char *installation_ior + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_UNUSED_ARG (spawn_delay); // @@ We need to use this argumetn + // later to determine is a + // ComponentServer has been spawned + // successfully. + + if (server_location == 0) + ACE_THROW_RETURN (CORBA::BAD_PARAM (), -1); + + if (spawn_delay_ == 0) + ACE_THROW_RETURN (CORBA::BAD_PARAM (), -1); + + this->server_path_ = CORBA::string_dup (server_location); + + this->installation_ior_ = CORBA::string_dup (installation_ior); + + PortableServer::POAManager_var mgr + = this->poa_->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + CORBA::PolicyList policies (0); + + // Create a separate POA for callback objects. + this->callback_poa_ = + this->poa_->create_POA ("callback_poa", + mgr.in (), + policies + ACE_ENV_ARG_PARAMETER); + + ACE_CHECK_RETURN (-1); + + // Activate the ServerActivator Object. + PortableServer::ObjectId_var oid + = this->poa_->activate_object (this + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + CORBA::Object_var obj = this->poa_->id_to_reference (oid.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + // And cache the object reference. + this->objref_ = ::Components::Deployment::ServerActivator::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + this->ior_ = this->orb_->object_to_string (this->objref_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + return 0; +} + +::Components::Deployment::ComponentServer_ptr +CIAO::ServerActivator_Impl::create_component_server (const Components::ConfigValues & config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure, + Components::InvalidConfiguration)) +{ + ACE_UNUSED_ARG (config); // This will be used later. + + ACE_DEBUG ((LM_DEBUG, "CIAO::ServerActivator_Impl::create_component_server\n")); + + ::Components::Deployment::ComponentServer_var retval; + + // @@ Need to figure out a way to pass the config data over to the + // ComponentServer. One option will be to convert it (again) into + // an XML document and psss it along in the command line. + + // @@ Create a new callback servant. + CIAO::Activator_Callback_Impl *callback_servant = 0; + ACE_NEW_THROW_EX (callback_servant, + CIAO::Activator_Callback_Impl (this->orb_.in (), + this->callback_poa_.in (), + this->objref_.in ()), + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (0); + + PortableServer::ServantBase_var servant_var (callback_servant); + PortableServer::ObjectId_var cb_id + = this->callback_poa_->activate_object (callback_servant + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ACE_Process component_server; + ACE_Process_Options options; + + ACE_TRY + { + CORBA::Object_var cb_obj = + this->callback_poa_->id_to_reference (cb_id.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CIAO::Activator_Callback_var cb = + CIAO::Activator_Callback::_narrow (cb_obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::String_var cb_ior = + this->orb_->object_to_string (cb.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // spawn the new ComponentServer. + options.command_line ("%s -k %s -ORBInitRef ComponentInstallation=%s", + this->server_path_.in (), + cb_ior.in (), + this->installation_ior_.in ()); + options.avoid_zombies (1); + + if (component_server.spawn (options) == -1) + ACE_TRY_THROW (::Components::CreateFailure ()); + + // wait for server to pass back its object reference. with a timeout value. + // using perform_work and stuff. + + int looping = 1; + + ACE_Time_Value timeout (this->spawn_delay_, 0); + + while (looping) + { + this->orb_->perform_work (timeout + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + retval = callback_servant->get_server_ref (); + + if (timeout == ACE_Time_Value::zero || !CORBA::is_nil (retval.in ())) + looping = 0; + } + + if (CORBA::is_nil (retval.in ())) + ACE_TRY_THROW (::Components::CreateFailure ()); + + { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); + + // Add the server reference to this->cs_set_; + this->cs_set_.add (retval.in ()); + } + } + ACE_CATCHANY + { + this->callback_poa_->deactivate_object (cb_id.in ()); + ACE_TRY_CHECK; + + ACE_RE_THROW; + } + ACE_ENDTRY; + ACE_CHECK_RETURN (0); + + this->callback_poa_->deactivate_object (cb_id.in ()); + ACE_CHECK_RETURN (0); + + return retval._retn (); +} + +void +CIAO::ServerActivator_Impl::remove_component_server (Components::Deployment::ComponentServer_ptr server + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) +{ + ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); + + if (this->cs_set_.object_in_set (server) == 0) + ACE_THROW (::Components::RemoveFailure ()); + + server->remove (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + // Should we remove the server still even if the previous call failed. + + if (this->cs_set_.remove (server) == -1) + ACE_THROW (::Components::RemoveFailure ()); +} + +::Components::Deployment::ComponentServers * +CIAO::ServerActivator_Impl::get_component_servers (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); + + Components::Deployment::ComponentServers_var retval; + + ACE_NEW_THROW_EX (retval.out (), + Components::Deployment::ComponentServers (), + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (0); + + CORBA::ULong len = this->cs_set_.size (); + retval->length (len); // resize + +#if 0 + // TAO is broken here. Both <replace>, <get_buffer> and friends are missing. + this->cs_set_.copy (len, retval->get_buffer (0)); +#else + for (CORBA::ULong i = 0; i < len; ++i) + { + retval[i] = this->cs_set_.at (i); + } +#endif + + return retval._retn (); +} diff --git a/TAO/CIAO/ciao/ServerActivator_Impl.h b/TAO/CIAO/ciao/ServerActivator_Impl.h new file mode 100644 index 00000000000..cdc2abc5ffe --- /dev/null +++ b/TAO/CIAO/ciao/ServerActivator_Impl.h @@ -0,0 +1,182 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file ServerActivator_Impl.h + * + * $Id$ + * + * This file contains implementation for the servant of + * Components::Deployment::ServerActivator interface. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + + +#ifndef CIAO_SERVERACTIVATOR_IMPL_H +#define CIAO_SERVERACTIVATOR_IMPL_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "CCM_DeploymentS.h" +#include "CIAO_ServersS.h" +#include "Object_Set_T.h" + +namespace CIAO +{ + /** + * @class Activator_Callback + * + * @brief A call back interface for ComponentServer. + * + * Notice that this implementation is *NOT* thread-safe. + */ + class CIAO_SERVER_Export Activator_Callback_Impl + : public virtual POA_CIAO::Activator_Callback, + public virtual PortableServer::RefCountServantBase + { + public: + friend class ServerActivator_Impl; + + /// Constructor. + Activator_Callback_Impl (CORBA::ORB_ptr o, + PortableServer::POA_ptr p, + ::Components::Deployment::ServerActivator_ptr s); + + /// Destructor. + ~Activator_Callback_Impl (); + + /// Get the containing POA. This operation does *not* + /// increase the reference count of the POA. + virtual PortableServer::POA_ptr _default_POA (void); + + /// Record the ComponentServer reference returned by the newly + /// spawned ComponentServer and give it back a reference to ServerActivator. + ::Components::Deployment::ServerActivator_ptr + register_component_server (::Components::Deployment::ComponentServer_ptr svr) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::Components::Deployment::ComponentServer_ptr get_server_ref (void); + + CORBA::ORB_var orb_; + + PortableServer::POA_var poa_; + + /// This servant only lives as long as a call to the + /// create_component_server method in ServerActivator, so there's + /// no need to duplicate the object reference here. + ::Components::Deployment::ServerActivator_ptr activator_; + + ::Components::Deployment::ComponentServer_var server_; + }; + + /** + * @class ServerActivator_Impl + * + * @brief Servant implementation for Components::Deployment::ServerActivator + * + * This class implements the Components::Deployment::ServerActivator + * interface as defined by the CCM spcification. As the interface + * implies, this is actually part of the deployment interface and is + * used to manage the lifecycle of containers running on the server. + */ + class CIAO_SERVER_Export ServerActivator_Impl + : public virtual POA_Components::Deployment::ServerActivator, + public virtual PortableServer::RefCountServantBase + { + public: + /// Constructor + ServerActivator_Impl (CORBA::ORB_ptr o, + PortableServer::POA_ptr p); + + /// Destructor + virtual ~ServerActivator_Impl (void); + + /// Get the containing POA. This operation does *not* + /// increase the reference count of the POA. + virtual PortableServer::POA_ptr _default_POA (void); + + /// Initialize the ServerActivator. The currently implementation + /// of ServerActivator can only activate CIAO's own + /// ComponentServer processes. You should specify the location + /// (pathname) of the ComponentServer and the delay + /// ServerActivator should wait (in second) for ComponentServer to + /// call back. + int init (const char *server_location, + CORBA::ULong delay, + const char *installation_ior + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Components::Deployment::ServerActivator defined attributes/operations. + + virtual ::Components::Deployment::ComponentServer_ptr + create_component_server (const Components::ConfigValues & config + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure, + Components::InvalidConfiguration)); + + virtual void remove_component_server (Components::Deployment::ComponentServer_ptr server + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + + virtual ::Components::Deployment::ComponentServers * + get_component_servers (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Return the cached ServerActivator object reference. Do not + /// release this object reference, or put it into an var. + ::Components::Deployment::ServerActivator_ptr + _ciao_get_objref (void); + + const char *_ciao_get_ior (void); + + protected: + /// location of the ComponentServer. + CORBA::String_var server_path_; + + /// Keep a pointer to the managing ORB serving this servant. + CORBA::ORB_var orb_; + + /// Keep a pointer to the managing POA. + PortableServer::POA_var poa_; + + /// Child poa that uses active object map. + PortableServer::POA_var callback_poa_; + + /// Cached the IOR string to ComponentInstallation Interface + CORBA::String_var installation_ior_; + + /// Specify the time in second ServerActivator will wait for a + /// child ComponentServer to callback. Default is 5 second. + CORBA::ULong spawn_delay_; + + /// Cache a object reference to this servant. + ::Components::Deployment::ServerActivator_var objref_; + + /// Cache the ior of the previous reference + CORBA::String_var ior_; + + /// Synchronize access to the object set. + TAO_SYNCH_MUTEX lock_; + + /// Keep a list of managed ComponentServer objects. + Object_Set<Components::Deployment::ComponentServer, Components::Deployment::ComponentServer_var> cs_set_; + }; +} + +#if defined (__ACE_INLINE__) +# include "ServerActivator_Impl.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* CIAO_SERVERACTIVATOR_IMPL_H */ diff --git a/TAO/CIAO/ciao/ServerActivator_Impl.inl b/TAO/CIAO/ciao/ServerActivator_Impl.inl new file mode 100644 index 00000000000..919f5bbab58 --- /dev/null +++ b/TAO/CIAO/ciao/ServerActivator_Impl.inl @@ -0,0 +1,33 @@ +/* -*- C++ -*- */ +// $Id$ + +ACE_INLINE +CIAO::Activator_Callback_Impl::Activator_Callback_Impl (CORBA::ORB_ptr o, + PortableServer::POA_ptr p, + ::Components::Deployment::ServerActivator_ptr s) + : orb_ (CORBA::ORB::_duplicate (o)), + poa_ (PortableServer::POA::_duplicate (p)), + activator_ (s) +{ +} + +ACE_INLINE +CIAO::ServerActivator_Impl::ServerActivator_Impl (CORBA::ORB_ptr o, + PortableServer::POA_ptr p) + : orb_ (CORBA::ORB::_duplicate (o)), + poa_ (PortableServer::POA::_duplicate (p)), + spawn_delay_ (5) +{ +} + +ACE_INLINE ::Components::Deployment::ServerActivator_ptr +CIAO::ServerActivator_Impl::_ciao_get_objref () +{ + return this->objref_.in (); +} + +ACE_INLINE const char * +CIAO::ServerActivator_Impl::_ciao_get_ior () +{ + return this->ior_.in (); +} diff --git a/TAO/CIAO/ciao/Server_init.cpp b/TAO/CIAO/ciao/Server_init.cpp new file mode 100644 index 00000000000..da2c4a27096 --- /dev/null +++ b/TAO/CIAO/ciao/Server_init.cpp @@ -0,0 +1,36 @@ +// $Id$ + +#include "Server_init.h" +#include "CIAO_common.h" +#include "CCM_ComponentC.h" +#include "Cookies.h" + +int +CIAO::Server_init (CORBA::ORB_ptr o) +{ + CIAO_REGISTER_VALUE_FACTORY (o, CIAO::Map_Key_Cookie_init, + Components::Cookie); + CIAO_REGISTER_VALUE_FACTORY (o, CIAO::Map_Key_Cookie_init, + CIAO::Cookie); + CIAO_REGISTER_VALUE_FACTORY (o, Components::PortDescription_init, + Components::PortDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::FacetDescription_init, + Components::FacetDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::ConnectionDescription_init, + Components::ConnectionDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::ReceptacleDescription_init, + Components::ReceptacleDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::ConsumerDescription_init, + Components::ConsumerDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::EmitterDescription_init, + Components::EmitterDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::SubscriberDescription_init, + Components::SubscriberDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::PublisherDescription_init, + Components::PublisherDescription); + CIAO_REGISTER_VALUE_FACTORY (o, Components::ConfigValue_init, + Components::ConfigValue); + CIAO_REGISTER_VALUE_FACTORY (o, Components::ComponentPortDescription_init, + Components::ComponentPortDescription); + return 0; +} diff --git a/TAO/CIAO/ciao/Server_init.h b/TAO/CIAO/ciao/Server_init.h new file mode 100644 index 00000000000..5770be2f44f --- /dev/null +++ b/TAO/CIAO/ciao/Server_init.h @@ -0,0 +1,35 @@ +// $Id$ + +/** + * @file Server_init + * + * Initializing CIAO Server side ORB, if they need to. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#ifndef CIAO_SERVER_INIT_H +#define CIAO_SERVER_INIT_H +#include "ace/pre.h" + +#include "tao/corbafwd.h" +#include "CIAO_Server_Export.h" + +#if !defined ACE_LACKS_PRAGMA_ONCE +#pragma once +#endif /* ! ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO +{ + /** + * The initialize routine for any server that need to access + * component. This routine now simply registers various valuetype + * factories defined in CIAO_Component.pidl. Currently, this method + * should be call right after ORB initialization but we should try + * to register these stuff automatically. + */ + CIAO_SERVER_Export int Server_init (CORBA::ORB_ptr o); +} + +#include "ace/post.h" +#endif /* CIAO_SERVER_INIT_H */ diff --git a/TAO/CIAO/ciao/Version.h b/TAO/CIAO/ciao/Version.h new file mode 100644 index 00000000000..c9675af0755 --- /dev/null +++ b/TAO/CIAO/ciao/Version.h @@ -0,0 +1,7 @@ +// $Id$ +// This is an automatically generated file. + +#define CIAO_MAJOR_VERSION 0 +#define CIAO_MINOR_VERSION 0 +#define CIAO_BETA_VERSION 1 +#define CIAO_VERSION "0.0.1" diff --git a/TAO/CIAO/ciao/ciao.rc b/TAO/CIAO/ciao/ciao.rc new file mode 100644 index 00000000000..2faa5f7ae8a --- /dev/null +++ b/TAO/CIAO/ciao/ciao.rc @@ -0,0 +1,30 @@ +#include "Version.h" + +1 VERSIONINFO + FILEVERSION CIAO_MAJOR_VERSION,CIAO_MINOR_VERSION,CIAO_BETA_VERSION,0 + PRODUCTVERSION CIAO_MAJOR_VERSION,CIAO_MINOR_VERSION,CIAO_BETA_VERSION,0 + FILEFLAGSMASK 0x3fL + FILEFLAGS 0x0L + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "FileDescription", "CIAO\0" + VALUE "FileVersion", CIAO_VERSION "\0" + VALUE "InternalName", "CIAODLL\0" + VALUE "LegalCopyright", "\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "CIAO.DLL\0" + VALUE "ProductName", "CIAO\0" + VALUE "ProductVersion", CIAO_VERSION "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/TAO/CIAO/ciao/ciaofwd.h b/TAO/CIAO/ciao/ciaofwd.h new file mode 100644 index 00000000000..d4dce9a996e --- /dev/null +++ b/TAO/CIAO/ciao/ciaofwd.h @@ -0,0 +1,33 @@ + +// -*- C++ -*- + +//============================================================================= +/** + * @file ciaofwd.h + * + * $Id$ + * + * Forward declare the basic types used in the CCM implementation to + * reduce interdependency. Regular users of CIAO should only include + * ciao/ciao.h. + * + * @author Nanbor Wang + */ +//============================================================================= + + +#ifndef CIAO_CIAOFWD_H +#define CIAO_CIAOFWD_H + +#include "ace/pre.h" +#include "CIAO_Export.h" +#include "tao/corba.h" + +namespace Components +{ + + +}; + +#include "ace/post.h" +#endif /* CIAO_CIAOFWD_H */ diff --git a/TAO/CIAO/ciao/diffs/Component_BaseC.cpp.diff b/TAO/CIAO/ciao/diffs/Component_BaseC.cpp.diff new file mode 100644 index 00000000000..f8b8534d1d2 --- /dev/null +++ b/TAO/CIAO/ciao/diffs/Component_BaseC.cpp.diff @@ -0,0 +1,57 @@ +*** Component_BaseC.cpp Sun Jun 30 16:16:30 2002 +--- Component_BaseC.cpp.mod Sun Jun 30 16:15:32 2002 +*************** +*** 50826,50849 **** + + // accessor to set the member + void +! OBV_Components::ConfigValue::value (CORBA::Any val) // set + { +! ACE_NEW ( +! this->_pd_value, +! CORBA::Any (val) +! ); + } + // retrieve the member +! const CORBA::Any + OBV_Components::ConfigValue::value (void) const + { +! return *this->_pd_value; + } + // retrieve the member +! CORBA::Any + OBV_Components::ConfigValue::value (void) + { +! return *this->_pd_value; + } + + CORBA::Boolean +--- 50826,50846 ---- + + // accessor to set the member + void +! OBV_Components::ConfigValue::value (CORBA::Any &val) // set + { +! this->_pd_value = val; + } + // retrieve the member +! const CORBA::Any & + OBV_Components::ConfigValue::value (void) const + { +! return this->_pd_value; + } + // retrieve the member +! CORBA::Any & + OBV_Components::ConfigValue::value (void) + { +! return this->_pd_value; + } + + CORBA::Boolean +*************** +*** 65403,65406 **** + ACE_ENDTRY; + return 0; + } +- +--- 65400,65402 ---- diff --git a/TAO/CIAO/ciao/diffs/Component_BaseC.h.diff b/TAO/CIAO/ciao/diffs/Component_BaseC.h.diff new file mode 100644 index 00000000000..03cc45483fc --- /dev/null +++ b/TAO/CIAO/ciao/diffs/Component_BaseC.h.diff @@ -0,0 +1,65 @@ +*** Component_BaseC.h Sun Jun 30 16:16:30 2002 +--- Component_BaseC.h.mod Sun Jun 30 16:15:02 2002 +*************** +*** 30,36 **** + + #include "SecurityLevel2C.h" + #include "CosPersistentStateC.h" +! #include "tao/IFR_Client/InterfaceC.h" + #include "CosNotificationC.h" + #include "CosNotifyChannelAdminC.h" + +--- 30,36 ---- + + #include "SecurityLevel2C.h" + #include "CosPersistentStateC.h" +! #include "tao/IFR_Client/IFR_BaseC.h" + #include "CosNotificationC.h" + #include "CosNotifyChannelAdminC.h" + +*************** +*** 6905,6914 **** + virtual void name (const CORBA::String_var&) = 0; // set + virtual const char *name (void) const = 0; // get method + +! virtual void value (CORBA::Any) = 0; // set +! virtual const CORBA::Any value (void) const = 0; // get method + +! virtual CORBA::Any value (void) = 0; // get method + + + protected: +--- 6905,6914 ---- + virtual void name (const CORBA::String_var&) = 0; // set + virtual const char *name (void) const = 0; // get method + +! virtual void value (CORBA::Any&) = 0; // set +! virtual const CORBA::Any &value (void) const = 0; // get method + +! virtual CORBA::Any &value (void) = 0; // get method + + + protected: +*************** +*** 16348,16357 **** + virtual void name (const CORBA::String_var&); // set + virtual const char *name (void) const; // get method + +! virtual void value (CORBA::Any); // set +! virtual const CORBA::Any value (void) const; // get method + +! virtual CORBA::Any value (void); // get method + + + protected: +--- 16348,16357 ---- + virtual void name (const CORBA::String_var&); // set + virtual const char *name (void) const; // get method + +! virtual void value (CORBA::Any&); // set +! virtual const CORBA::Any &value (void) const; // get method + +! virtual CORBA::Any &value (void); // get method + + + protected: diff --git a/TAO/CIAO/ciao/diffs/Component_BaseS.h.diff b/TAO/CIAO/ciao/diffs/Component_BaseS.h.diff new file mode 100644 index 00000000000..bb1a3d4a4c5 --- /dev/null +++ b/TAO/CIAO/ciao/diffs/Component_BaseS.h.diff @@ -0,0 +1,12 @@ +*** Component_BaseS.h Sat Jun 29 22:56:16 2002 +--- Component_BaseS.h.mod Sat Jun 29 22:49:14 2002 +*************** +*** 24,30 **** + + #include "SecurityLevel2S.h" + #include "CosPersistentStateS.h" +- #include "tao/IFR_Client/InterfaceS.h" + #include "CosNotificationS.h" + #include "CosNotifyChannelAdminS.h" + #include "Component_BaseC.h" +--- 24,29 ---- diff --git a/TAO/CIAO/docs/ConfigValues.html b/TAO/CIAO/docs/ConfigValues.html new file mode 100644 index 00000000000..5a45cfe5366 --- /dev/null +++ b/TAO/CIAO/docs/ConfigValues.html @@ -0,0 +1,195 @@ +<!-- $Id$ --> +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> <head> +<title>ConfigValues Index</title> +</head> + +<body> + +<h1>Index of ConfigValues</h1> + +<font size="+1" color="red">This page is currently a placeholder for +all the configuration values we will support when creating various CCM +deployment mechanisms, such as ComponentServers and Containers. The +ConfigValues listed here are currently only partially supported in +CIAO. </font> + +<h2>ComponentServer</h2> +The <code>ConfigValues</code> for a <code>ComponentServer</code> are +passed in via <code>ServerActivator::create_component_server</code> +operation. CIAO accepts the following feature names:<p> + +<table border="3" spacing="2" cellpadding="3"> + <tr> + <th>FeatureName</th> + <th>type</th> + <th>Requirement</th> + <th>Remarks</th> + </tr> + <tr> + <td>CIAO-RTORB</td> + <td>boolean</td> + <td> + Optional + </td> + <td> + Designate whether the component server requires a RT-ORB or + not. By default, a component server uses a non-RT ORB. + </td> + </tr> + <tr> + <td>CIAO-ORB[option]</td> + <td>string</td> + <td> + Optional + </td> + <td> + Specify an ORB option that you want to pass to the + ComponentServer ORB. + </td> + </tr> +</table> + +<h2>Container</h2> +The <code>ConfigValues</code> for a <code>Container</code> are +passed in via <code>ComponentServer::create_container</code> +operation. CIAO accepts the following feature names:<p> + +<table border="3" spacing="2" cellpadding="3"> + <tr> + <th>FeatureName</th> + <th>type</th> + <th>Requirement</th> + <th>Remarks</th> + </tr> + <tr> + <td> + CIAO-Container-Type + </td> + <td> + <code>string</code> + </td> + <td> + Required + </td> + <td> + Possible value: <code>session</code>, <code>rt-session</code>, + <code>unclassified</code>, <code>rt-unclassified</code>. + </td> + </tr> + + <tr> + <td> + CIAO-POAPolicies + </td> + <td> + <code>CORBA::PolicyList</code> + </td> + <td> + Optional + </td> + <td> + Must not conflict with CIAO-Container-Type setting. + (Certain containers assume several POA policies.) + </td> + </tr> + + <tr> + <td> + CIAO-RTPOAPolicies + </td> + <td> + <code>CORBA::PolicyList</code> + </td> + <td> + Optional + </td> + <td> + Must not conflict with both container and regular POA + policies. + </td> + </tr> +</table> + + +<h2>CCMHome</h2> +The <code>ConfigValues</code> for a <code>CCMHome</code> are +passed in via <code>Container::install_home</code> +operation. CIAO accepts the following feature names:<p> + +<table border="3" spacing="2" cellpadding="3"> + <tr> + <th>FeatureName</th> + <th>type</th> + <th>Requirement</th> + <th>Remarks</th> + </tr> + <tr> + <td>CIAO-executor-path</td> + <td><code>string</code></td> + <td> + REQUIRED + </td> + <td> + This string value specifies the location of the executor DLL. + In the future, we should use UUIDs to identify the component + executors and query the ComponentInstallation interface for + the actual location of the DLL. + </td> + </tr> + <tr> + <td>CIAO-executor-entrypt</td> + <td><code>string</code></td> + <td> + REQUIRED + </td> + <td> + This string value specifies the entry point of the executor + DLL. It points to a factory function for the component executor. + </td> + </tr> + <tr> + <td>CIAO-servant-path</td> + <td><code>string</code></td> + <td> + REQUIRED + </td> + <td> + This string value specifies the location of the servant DLL. + In the future, we should use UUIDs to identify the component + servants and query the ComponentInstallation interface for + the actual location of the DLL. <p> + + Servant are part of the Container framework and we can use + type checking to ensure servant and container match with each + other. + </td> + </tr> + <tr> + <td>CIAO-executor-entrypt</td> + <td><code>string</code></td> + <td> + REQUIRED + </td> + <td> + This string value specifies the entry point of the servant + DLL. It points to a factory function for the compnent servant. + </td> + </tr> +</table> + +<!-- + <tr> + <td> + a + </td> + <td> + b + </td> + <td> + c + </td> + </tr> +--> +<!--#include virtual="/~nanbor/signature.html" --> +</body> </html> diff --git a/TAO/CIAO/docs/XML/componentassembly.dtd b/TAO/CIAO/docs/XML/componentassembly.dtd new file mode 100644 index 00000000000..38fdb7e7dc3 --- /dev/null +++ b/TAO/CIAO/docs/XML/componentassembly.dtd @@ -0,0 +1,367 @@ +<!-- DTD for Component Assembly Descriptor. The root element + is <componentassembly>. Elements are listed + alphabetically. + --> + +<!-- Simple xml link attributes based on W3C WD-xlink-19980303. + May change slightly when XLL is finalized. + --> +<!ENTITY % simple-link-attributes " + xml:link CDATA #FIXED 'SIMPLE' + href CDATA #REQUIRED +" > + +<!-- If file not available locally, then download via codebase link --> +<!ELEMENT codebase EMPTY > +<!ATTLIST codebase + filename CDATA #IMPLIED + %simple-link-attributes; > + +<!ELEMENT componentassembly + ( description? + , componentfiles + , partitioning + , connections? + , extension* + ) > +<!ATTLIST componentassembly + id ID #REQUIRED + derivedfrom CDATA #IMPLIED > + +<!ELEMENT componentfile + ( fileinarchive + | codebase + | link + ) > +<!ATTLIST componentfile + id ID #REQUIRED + type CDATA #IMPLIED > + +<!ELEMENT componentfileref EMPTY > +<!ATTLIST componentfileref + idref CDATA #REQUIRED > + +<!ELEMENT componentfiles + ( componentfile+ + ) > + +<!ELEMENT componentimplref EMPTY > +<!ATTLIST componentimplref + idref CDATA #REQUIRED > + +<!ELEMENT componentinstantiation + ( usagename? + , componentproperties? + , registercomponent* + , extension* + ) > +<!ATTLIST componentinstantiation + id ID #REQUIRED > + +<!ELEMENT componentinstantiationref EMPTY > +<!ATTLIST componentinstantiationref + idref CDATA #REQUIRED > + +<!ELEMENT componentproperties + ( fileinarchive + | codebase + ) > + +<!ELEMENT componentsupportedinterface + ( componentinstantiationref + | findby + )> + +<!ELEMENT connectevent + ( ( consumesport + | existinginterface + ) + , ( emitsport + | publishesport + ) + ) > +<!ATTLIST connectevent + id ID #IMPLIED > + +<!ELEMENT connecthomes + ( proxyhome + , destinationhome + ) > +<!ATTLIST connecthomes + id ID #IMPLIED > + +<!ELEMENT connectinterface + ( usesport + , ( providesport + | componentsupportedinterface + | existinginterface + | homeinterface + ) + ) > +<!ATTLIST connectinterface + id ID #IMPLIED > + +<!ELEMENT connections + ( connectinterface + | connectevent + | connecthomes + | extension + )* > + +<!ELEMENT consumesidentifier ( #PCDATA ) > + +<!ELEMENT consumesport + ( consumesidentifier + , ( componentinstantiationref + | findby + ) + )> + +<!ELEMENT description ( #PCDATA ) > + +<!ELEMENT destination ( #PCDATA ) > + +<!ELEMENT destinationhome + ( homeplacementref + | findby + ) > + +<!ELEMENT emitsidentifier ( #PCDATA ) > + +<!ELEMENT emitsport + ( emitsidentifier + , ( componentinstantiationref + | findby + ) + )> + +<!ELEMENT executableplacement + ( usagename? + , componentfileref + , componentimplref ? + , invocation? + , destination? + , extension* + ) > +<!ATTLIST executableplacement + id ID #REQUIRED + cardinality CDATA "1" > + +<!ELEMENT existinginterface + ( findby )> + +<!-- The "extension" element is used for vendor-specific extensions --> +<!ELEMENT extension (#PCDATA) > +<!ATTLIST extension + class CDATA #REQUIRED + origin CDATA #REQUIRED + id ID #IMPLIED + extra CDATA #IMPLIED + html-form CDATA #IMPLIED > + +<!-- The "fileinarchive" element is used to specify a file in the archive. + If the file is independent of an archive then link is used to point to + the archive in which the file may be found. + --> +<!ELEMENT fileinarchive + ( link? ) > +<!ATTLIST fileinarchive + name CDATA #REQUIRED > + +<!ELEMENT findby + ( namingservice + | stringifiedobjectref + | traderquery + | homefinder + | extension + ) > + +<!ELEMENT homefinder EMPTY > +<!ATTLIST homefinder + name CDATA #REQUIRED > + +<!ELEMENT homeinterface + ( homeplacementref + | findby + )> + +<!ELEMENT homeplacement + ( usagename? + , componentfileref + , componentimplref? + , homeproperties? + , componentproperties? + , registerwithhomefinder* + , registerwithnaming* + , registerwithtrader* + , componentinstantiation* + , destination? + , extension* + ) > +<!ATTLIST homeplacement + id ID #REQUIRED + cardinality CDATA "1" > + +<!ELEMENT homeplacementref EMPTY > +<!ATTLIST homeplacementref + idref CDATA #REQUIRED > + +<!ELEMENT homeproperties + ( fileinarchive + | codebase + ) > + +<!ELEMENT hostcollocation + ( usagename? + , impltype? + , ( homeplacement + | executableplacement + | processcollocation + | extension + )+ + , destination? + ) > +<!ATTLIST hostcollocation + id ID #IMPLIED + cardinality CDATA "1" > + +<!ELEMENT impltype EMPTY > +<!ATTLIST impltype + language CDATA #REQUIRED + version CDATA #IMPLIED > + +<!ELEMENT invocation EMPTY > +<!ATTLIST invocation + args CDATA #REQUIRED > + +<!ELEMENT link ( #PCDATA ) > +<!ATTLIST link + %simple-link-attributes; > + +<!ELEMENT namingservice EMPTY > +<!ATTLIST namingservice + name CDATA #REQUIRED > + +<!ELEMENT partitioning + ( homeplacement + | executableplacement + | processcollocation + | hostcollocation + | extension + )* > + +<!ELEMENT processcollocation + ( usagename? + , impltype? + , ( homeplacement + | extension + )+ + , destination? + ) > +<!ATTLIST processcollocation + id ID #IMPLIED + cardinality CDATA "1" > + +<!ELEMENT providesidentifier ( #PCDATA ) > + +<!ELEMENT providesport + ( providesidentifier + , ( componentinstantiationref + | findby + ) + ) > + +<!ELEMENT proxyhome + ( homeplacementref + | findby + ) > + +<!ELEMENT publishesidentifier ( #PCDATA ) > + +<!ELEMENT publishesport + ( publishesidentifier + , ( componentinstantiationref + | findby + ) + ) > + +<!ELEMENT registercomponent + ( ( providesidentifier + | consumesidentifier + )? + , ( registerwithnaming + | registerwithtrader + )+ + ) > + +<!ELEMENT registerwithhomefinder EMPTY > +<!ATTLIST registerwithhomefinder + name CDATA #REQUIRED > + +<!ELEMENT registerwithnaming EMPTY > +<!ATTLIST registerwithnaming + name CDATA #IMPLIED > + +<!ELEMENT registerwithtrader + ( traderexport ) > +<!ATTLIST registerwithtrader + tradername CDATA #IMPLIED > + +<!-- DEVNOTE: is tradername necessary? --> +<!-- DEVNOTE: Should trader properties be specified in component file? + And in assembly file? --> + +<!ELEMENT stringifiedobjectref ( #PCDATA ) > + +<!ELEMENT traderconstraint ( #PCDATA ) > + +<!ELEMENT traderexport + ( traderservicetypename + , traderproperties + ) > + +<!ELEMENT traderpolicy + ( traderpolicyname + , traderpolicyvalue + ) > + +<!ELEMENT traderpolicyname ( #PCDATA ) > + +<!ELEMENT traderpolicyvalue ( #PCDATA ) > + +<!ELEMENT traderpreference ( #PCDATA ) > + +<!ELEMENT traderproperties + ( traderproperty+ ) > + +<!ELEMENT traderproperty + ( traderpropertyname + , traderpropertyvalue + ) > + +<!ELEMENT traderpropertyname ( #PCDATA ) > + +<!ELEMENT traderpropertyvalue ( #PCDATA ) > + +<!ELEMENT traderquery + ( traderservicetypename + , traderconstraint + , traderpreference? + , traderpolicy* + , traderspecifiedprop* + ) > + +<!ELEMENT traderservicetypename ( #PCDATA ) > + +<!ELEMENT traderspecifiedprop ( #PCDATA ) > + +<!ELEMENT usagename ( #PCDATA ) > + +<!ELEMENT usesidentifier ( #PCDATA ) > + +<!ELEMENT usesport + ( usesidentifier + , ( componentinstantiationref + | findby + ) + ) > diff --git a/TAO/CIAO/docs/XML/corbacomponent.dtd b/TAO/CIAO/docs/XML/corbacomponent.dtd new file mode 100644 index 00000000000..fd5ec98f377 --- /dev/null +++ b/TAO/CIAO/docs/XML/corbacomponent.dtd @@ -0,0 +1,316 @@ +<!-- DTD for CORBA Component Descriptor. The root element is + <corbacomponent>. Elements are listed alphabetically. +--> + +<!-- Simple xml link attributes based on W3C WD-xlink-19980303. + May change when XLL is finalized. --> + +<!ENTITY % simple-link-attributes " + xml:link CDATA #FIXED 'SIMPLE' + href CDATA #REQUIRED +"> + +<!ELEMENT accessmode EMPTY> +<!ATTLIST accessmode + mode (READ_ONLY|READ_WRITE) #REQUIRED > + +<!ELEMENT componentfeatures + ( inheritscomponent? + , supportsinterface* + , ports + , operationpolicies? + , extension* + ) > +<!ATTLIST componentfeatures + name CDATA #REQUIRED + repid CDATA #REQUIRED > + +<!ELEMENT componentkind + ( service + | session + | process + | entity + | unclassified + ) > + +<!ELEMENT componentproperties + ( fileinarchive + ) > + +<!ELEMENT componentrepid EMPTY > +<!ATTLIST componentrepid + repid CDATA #IMPLIED > + +<!ELEMENT containermanagedpersistence + ( storagehome + , pssimplementation? + , accessmode + , psstransaction + , params? + ) > + +<!ELEMENT configurationcomplete EMPTY > +<!ATTLIST configurationcomplete + set ( true | false ) #REQUIRED > + +<!ELEMENT consumes + ( eventpolicy + , extension* ) > +<!ATTLIST consumes + consumesname CDATA #REQUIRED + eventtype CDATA #REQUIRED > + +<!ELEMENT corbacomponent + ( corbaversion + , cormponentrepid + , homerepid + , componentkind + , interop? + , transaction? + , security? + , threading + , configurationcomplete + , extendedpoapolicy* + , repository? + , segment* + , componentproperties? + , homeproperties? + , homefeatures+ + , componentfeatures+ + , interface* + , extension* + ) > + +<!ELEMENT corbaversion (#PCDATA) > + +<!ELEMENT description ( #PCDATA ) > + +<!ELEMENT emits + ( eventpolicy + , extension* ) > +<!ATTLIST emits + emitsname CDATA #REQUIRED + eventtype CDATA #REQUIRED > + +<!ELEMENT entity + ( servant ) > + +<!ELEMENT eventpolicy EMPTY> +<!ATTLIST eventpolicy + policy ( normal | default | transaction ) #IMPLIED> + +<!ELEMENT extendedpoapolicy EMPTY> +<!ATTLIST extendedpoapolicy + name CDATA #REQUIRED + value CDATA #REQUIRED > + +<!-- The "extension" element is used for vendor-specific extensions --> +<!ELEMENT extension (#PCDATA) > +<!ATTLIST extension + class CDATA #REQUIRED + origin CDATA #REQUIRED + id ID #IMPLIED + extra CDATA #IMPLIED + html-form CDATA #IMPLIED > + +<!-- The "fileinarchive" element is used to specify a file in the + archive. If the file is in another archive then link is used to + point to the archive in which the file may be found. + --> +<!ELEMENT fileinarchive + ( link? ) > +<!ATTLIST fileinarchive + name CDATA #REQUIRED > + +<!ELEMENT homefeatures + ( inheritshome? + , operationpolicies? + , extension* ) > +<!ATTLIST homefeatures + name CDATA #REQUIRED + repid CDATA #REQUIRED > + +<!ELEMENT homeproperties + ( fileinarchive + ) > + +<!ELEMENT homerepid EMPTY > +<!ATTLIST homerepid + repid CDATA #IMPLIED > + +<!ELEMENT inheritscomponent EMPTY> +<!ATTLIST inheritscomponent + repid CDATA #REQUIRED> + +<!ELEMENT inheritshome EMPTY> +<!ATTLIST inheritshome + repid CDATA #REQUIRED> + +<!ELEMENT inheritsinterface EMPTY> +<!ATTLIST inheritsinterface + repid CDATA #REQUIRED> + +<!ELEMENT ins EMPTY> +<!ATTLIST ins + name CDATA #REQUIRED > + +<!ELEMENT interface + ( inheritsinterface* + , operationpolicies? ) > +<!ATTLIST interface + name CDATA #REQUIRED + repid CDATA #REQUIRED > + +<!ELEMENT interop EMPTY> +<!ATTLIST interop + type CDATA #REQUIRED + direction ( hasview | isview ) #REQUIRED + descriptor CDATA #REQUIRED > + +<!ELEMENT link ( #PCDATA ) > +<!ATTLIST link + %simple-link-attributes; > + +<!ELEMENT objref EMPTY> +<!ATTLIST objref + string CDATA #REQUIRED > + +<!ELEMENT operation + ( transaction? + , requiredrights? ) > +<!ATTLIST operation + name CDATA #REQUIRED > + +<!-- an operation name of "*" specifies all operations in the current +scope --> +<!ELEMENT operationpolicies + ( operation+ ) > + +<!ELEMENT param EMPTY > +<!ATTLIST param + name CDATA #REQUIRED + value CDATA #REQUIRED > + +<!ELEMENT params (param+) > + +<!ELEMENT poapolicies EMPTY> +<!ATTLIST poapolicies + thread (ORB_CTRL_MODEL | SINGLE_THREAD_SAFE ) #REQUIRED + lifespan (TRANSIENT | PERSISTENT ) #REQUIRED + iduniqueness (UNIQUE_ID | MULTIPLE_ID) #REQUIRED + idassignment (USER_ID | SYSTEM_ID) #REQUIRED + servantretention (RETAIN | NON_RETAIN) #REQUIRED + requestprocessing (USE_ACTIVE_OBJECT_MAP_ONLY + |USE_DEFAULT_SERVANT + |USE_SERVANT_MANAGER) #REQUIRED + implicitactivation (IMPLICIT_ACTIVATION + |NON_IMPLICIT_ACTIVATION) #REQUIRED > + +<!ELEMENT ports + ( uses + | provides + | emits + | publishes + | consumes + )* > + +<!ELEMENT process + ( servant ) > + +<!ELEMENT provides + ( operationpolicies? + , extension* ) > +<!ATTLIST provides + providesname CDATA #REQUIRED + repid CDATA #REQUIRED + facettag CDATA #REQUIRED > + +<!ELEMENT pssimplementation EMPTY> +<!ATTLIST pssimplementation + id CDATA #REQUIRED > + +<!ELEMENT psstransaction (psstransactionisolationlevel?) > +<!ATTLIST psstransaction + policy (TRANSACTIONAL|NON_TRANSACTIONAL) #REQUIRED > + +<!ELEMENT psstransactionisolationlevel EMPTY> +<!ATTLIST psstransactionisolationlevel + level (READ_UNCOMMITTED|READ_COMMITTED|REPEATABLE_READ|SERIALIZABLE) + #REQUIRED > + +<!ELEMENT publishes + ( eventpolicy + , extension* ) > +<!ATTLIST publishes + publishesname CDATA #REQUIRED + eventtype CDATA #REQUIRED > + +<!ELEMENT repository + ( ins + | objref + | link + ) > +<!ATTLIST repository + type CDATA #IMPLIED > + +<!ELEMENT requiredrights + ( right* ) > + +<!ELEMENT right + ( description? ) > +<!ATTLIST right + name CDATA #REQUIRED > + +<!ELEMENT security + ( requiredrights? ) > +<!ATTLIST security + rightsfamily CDATA #REQUIRED + rightscombinator (secallrights | secanyrights) #REQUIRED > + +<!ELEMENT segment + ( segmentmember+ + , containermanagedpersistence? + , extension* + ) > +<!ATTLIST segment + name CDATA #REQUIRED + segmenttag CDATA #REQUIRED > + +<!ELEMENT segmentmember EMPTY> +<!ATTLIST segmentmember + facettag CDATA #REQUIRED > + +<!ELEMENT servant EMPTY > +<!ATTLIST servant + lifetime (component|method|transaction|container) #REQUIRED > + +<!ELEMENT service EMPTY > + +<!ELEMENT session + ( servant ) > + +<!ELEMENT storagehome EMPTY> +<!ATTLIST storagehome + id CDATA #REQUIRED > + +<!ELEMENT supportsinterface + ( operationpolicies? + , extension* ) > +<!ATTLIST supportsinterface + repid CDATA #REQUIRED > + +<!ELEMENT threading EMPTY> +<!ATTLIST threading + policy ( serialize | multithread ) #REQUIRED > + +<!ELEMENT transaction EMPTY > +<!ATTLIST transaction + use (self-managed|not-supported|required|supports|requiresnew| + mandatory|never) #REQUIRED > +<!ELEMENT unclassified + ( poapolicies ) > + +<!ELEMENT uses ( extension* ) > +<!ATTLIST uses + usesname CDATA #REQUIRED + repid CDATA #REQUIRED > diff --git a/TAO/CIAO/docs/XML/properties.dtd b/TAO/CIAO/docs/XML/properties.dtd new file mode 100644 index 00000000000..adfe8699fb7 --- /dev/null +++ b/TAO/CIAO/docs/XML/properties.dtd @@ -0,0 +1,87 @@ +<!-- DTD for CORBA Component property file. The root element + is <properties>. Elements are listed alphabetically. +--> + +<!ELEMENT choice ( #PCDATA ) > + +<!ELEMENT choices ( choice | range )+ ) > + +<!ELEMENT defaultvalue ( #PCDATA ) > + +<!ELEMENT description ( #PCDATA ) > + +<!ELEMENT value ( #PCDATA ) > + +<!ELEMENT properties + ( description? + , ( simple + | sequence + | struct + | valuetype + )* + ) > + +<!ELEMENT range (value, value) > + +<!ELEMENT simple + ( description? + , value + , choices? + , defaultvalue? + ) > +<!ATTLIST simple + name CDATA #IMPLIED + type ( boolean + | char + | double + | float + | short + | long + | objref + | octet + | string + | ulong + | ushort + | longlong + | ulonglong + | wchar + | wstring + | fixed + ) #REQUIRED > + +<!ELEMENT sequence + ( description? + , ( simple* + | struct* + | sequence* + | valuetype* + ) + ) > +<!ATTLIST sequence + name CDATA #IMPLIED + type CDATA #REQUIRED > + +<!ELEMENT struct + ( description? + , ( simple + | sequence + | struct + | valuetype + )* + ) > +<!ATTLIST struct + name CDATA #IMPLIED + type CDATA #REQUIRED > + +<!ELEMENT valuetype + ( description? + , ( simple + | sequence + | struct + | valuetype + )* + ) > +<!ATTLIST valuetype + name CDATA #IMPLIED + type CDATA #REQUIRED + primarykey (true | false) "false" > diff --git a/TAO/CIAO/docs/XML/softpkg.dtd b/TAO/CIAO/docs/XML/softpkg.dtd new file mode 100644 index 00000000000..ee87b811cc6 --- /dev/null +++ b/TAO/CIAO/docs/XML/softpkg.dtd @@ -0,0 +1,220 @@ +<!-- DTD for softpkg. Used to describe CORBA Component + implementations. The root element is <softpkg>. + Elements are listed alphabetically. + --> +<!-- Revision $Id$ --> +<!-- Simple xml link attributes based on W3C WD-xlink-19980303. + May change when XLL is finalized. --> + +<!ENTITY % simple-link-attributes " + xml:link CDATA #FIXED 'SIMPLE' + href CDATA #REQUIRED +"> + +<!ELEMENT author + ( name + | company + | webpage + )* > + +<!ELEMENT code + ( ( codebase + | fileinarchive + | link + ) + , entrypoint? + , usage? + ) > +<!ATTLIST code + type CDATA #IMPLIED > + +<!-- If file not available locally, then download via codebase link --> +<!ELEMENT codebase EMPTY > +<!ATTLIST codebase + filename CDATA #IMPLIED + %simple-link-attributes; > + +<!ELEMENT compiler EMPTY > +<!ATTLIST compiler + name CDATA #REQUIRED + version CDATA #IMPLIED > + +<!ELEMENT company ( #PCDATA ) > + +<!ELEMENT dependency + ( softpkgref + | codebase + | fileinarchive + | localfile + | name + | valuetypefactory + ) > +<!ATTLIST dependency + type CDATA #IMPLIED + action (assert | install) "assert"> + +<!ELEMENT description ( #PCDATA ) > + +<!ELEMENT descriptor + ( link + | fileinarchive + ) > +<!ATTLIST descriptor + type CDATA #IMPLIED> + +<!ELEMENT entrypoint ( #PCDATA) > + +<!-- The "extension" element is used for vendor-specific extensions --> +<!ELEMENT extension (#PCDATA) > +<!ATTLIST extension + class CDATA #REQUIRED + origin CDATA #REQUIRED + id ID #IMPLIED + extra CDATA #IMPLIED + html-form CDATA #IMPLIED > + +<!-- The "fileinarchive" element is used to specify a file in the archive. + If the file is in another archive then link is used to point to + the archive in which the file may be found. + --> +<!ELEMENT fileinarchive + ( link? ) > +<!ATTLIST fileinarchive + name CDATA #REQUIRED > + +<!ELEMENT idl + ( link + | fileinarchive + | repository + ) > +<!ATTLIST idl + id CDATA #REQUIRED + homeid CDATA #REQUIRED > + +<!ELEMENT implementation + ( description + | code + | compiler + | dependency + | descriptor + | extension + | programminglanguage + | humanlanguage + | os + | propertyfile + | processor + | runtime + )* > +<!ATTLIST implementation + id ID #IMPLIED + variation CDATA #IMPLIED > + +<!ELEMENT implref EMPTY > +<!ATTLIST implref + idref CDATA #REQUIRED > + +<!ELEMENT ins EMPTY > +<!ATTLIST inc + name CDATA #REQUIRED > + +<!ELEMENT humanlanguage EMPTY > +<!ATTLIST humanlanguage + name CDATA #REQUIRED > + +<!ELEMENT license ( #PCDATA ) > +<!ATTLIST license + %simple-link-attributes; > + +<!ELEMENT link ( #PCDATA ) > +<!ATTLIST link + %simple-link-attributes; > + +<!-- A file that should be available in the local environment --> +<!ELEMENT localfile EMPTY > +<!ATTLIST localfile + name CDATA #REQUIRED > + +<!ELEMENT name ( #PCDATA ) > + +<!ELEMENT objref EMPTY > +<!ATTLIST objref + string CDATA #REQUIRED > + +<!ELEMENT os EMPTY > +<!ATTLIST os + name CDATA #REQUIRED + version CDATA #IMPLIED> + +<!ELEMENT pkgtype ( #PCDATA ) > +<!ATTLIST pkgtype + version CDATA #IMPLIED > + +<!ELEMENT processor EMPTY > +<!ATTLIST processor + name CDATA #REQUIRED > + +<!ELEMENT programminglanguage EMPTY> +<!ATTLIST programminglanguage + name CDATA #REQUIRED + version CDATA #IMPLIED > + +<!ELEMENT propertyfile + ( fileinarchive + | link) > +<!ATTLIST propertyfile + type CDATA #IMPLIED > + +<!ELEMENT repository + ( ins + | objref + | link + ) > +<!ATTLIST repository + type CDATA #IMPLIED > + +<!ELEMENT runtime EMPTY > +<!ATTLIST runtime + name CDATA #REQUIRED + version CDATA #IMPLIED> + +<!ELEMENT softpkg + ( title + | pkgtype + | author + | description? + | license + | idl + | propertyfile + | dependency + | descriptor + | implementation + | extension + )* > +<!ATTLIST softpkg + name ID #REQUIRED + version CDATA #IMPLIED > + +<!ELEMENT softpkgref + ( ( fileinarchive + | link + ) + , implref? + ) > + +<!ELEMENT title ( #PCDATA ) > + +<!ELEMENT usage ( #PCDATA ) > + +<!ELEMENT valuetypefactory + ( codebase + | fileinarchive + | link + ) > +<!ATTLIST valuetypefactory + repid CDATA #REQUIRED + valueentrypoint CDATA #IMPLIED + factoryentrypoint CDATA #IMPLIED > + +<!ELEMENT webpage ( #PCDATA ) > +<!ATTLIST webpage + %simple-link-attributes; > diff --git a/TAO/CIAO/docs/com-impl.html b/TAO/CIAO/docs/com-impl.html new file mode 100644 index 00000000000..d2c4a4bb5dc --- /dev/null +++ b/TAO/CIAO/docs/com-impl.html @@ -0,0 +1,60 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<!-- $Id$ --> +<html> <head> +<title>Implementing a CCM Component</title> +</head> + +<body> +<h1>Implementing a CCM Component</h1> + +This document explains how to implement a single component. At this +moment, CIAO lacks a CIDL compiler, and we depends on manually +generating the servant glue code for containers and local executor +interface. Check out this <a href="new_component.html">page</a> to +find how all files are generate4d in CIAO. +The following figure shows how this is done:<p> + + +<img src="imgs/File-Gen-Existing.png"><p> + +And when we have a working CIDL (or, CCIDL "CIAO's Component +Implementation Definition Language") compiler, the file will be +generated using a CIDL file (which is rather simple.) This figure +depicts the "Right Way" [TM] this should be done:<p> + +<img src="imgs/File-Gen-Future.png"><p> + +Checkout a <a href="../tools/CCIDL/README">list of things to do</a> for implementing CIDL compiler.<p> + +I think it is debatable whether we should merge the "Servant DLL" and +"Component Implementation DLL" into one DLL. Me think not. My +approach, however, creates some complication on requireing a mechanism +to locate the servant code (and DLL) from component implementation. + + +<h2>Libraries Dependencies</h2> Implementing a component creates 3 +DLL's as shown in the above figure. Both "Servant DLL" and "Component +Implementation DLL" depend on the "Client DLL". "Servant DLL" and +"Component Implementation DLL" are not mutually dependent, however. +All the generated DLLs depends on other TAO and CIAO common +libraries. Here's a break down of which libraries depends on which +other libraries: + +<ul> + <li><b>Client DLL</b>: ace.lib tao.lib TAO_IFR_Client.lib + CIAO_Clientd.lib + <li><b>Servant DLL</b>: ace.lib tao.lib <b>Client DLL</b> + TAO_IFR_Client.lib TAO_PortableServer.lib TAO_Security.lib + CIAO_Container.lib CIAO_Client.lib + <li><b>Component Implementation DLL</b>: ace.lib tao.lib + <b>Client DLL</b> TAO_IFR_Client.lib TAO_Security.lib + CIAO_Container.lib +</ul> + + <!--#include virtual="/~nanbor/signature.html" --> +<!-- <hr> --> +<!-- <\!-- hhmts start -\-> --> +<!-- Last modified: Tue Dec 10 22:41:50 Central Standard Time 2002 --> +<!-- <\!-- hhmts end -\-> --> +<!-- <address>Nanbor Wang <nanbor@cs.wustl.edu></address> --> +</body> </html> diff --git a/TAO/CIAO/docs/imgs/CCM-v5.vsd b/TAO/CIAO/docs/imgs/CCM-v5.vsd Binary files differnew file mode 100644 index 00000000000..7f4d7539050 --- /dev/null +++ b/TAO/CIAO/docs/imgs/CCM-v5.vsd diff --git a/TAO/CIAO/docs/imgs/CCM.vsd b/TAO/CIAO/docs/imgs/CCM.vsd Binary files differnew file mode 100644 index 00000000000..7d5b7fef162 --- /dev/null +++ b/TAO/CIAO/docs/imgs/CCM.vsd diff --git a/TAO/CIAO/docs/imgs/File-Gen-Existing.png b/TAO/CIAO/docs/imgs/File-Gen-Existing.png Binary files differnew file mode 100644 index 00000000000..8deb5d32fd3 --- /dev/null +++ b/TAO/CIAO/docs/imgs/File-Gen-Existing.png diff --git a/TAO/CIAO/docs/imgs/File-Gen-Future.png b/TAO/CIAO/docs/imgs/File-Gen-Future.png Binary files differnew file mode 100644 index 00000000000..1daef691bdf --- /dev/null +++ b/TAO/CIAO/docs/imgs/File-Gen-Future.png diff --git a/TAO/CIAO/docs/imgs/File_Generation_Flow.vsd b/TAO/CIAO/docs/imgs/File_Generation_Flow.vsd Binary files differnew file mode 100644 index 00000000000..ef6332d49ac --- /dev/null +++ b/TAO/CIAO/docs/imgs/File_Generation_Flow.vsd diff --git a/TAO/CIAO/docs/imgs/IDL-CIDL-classes.vsd b/TAO/CIAO/docs/imgs/IDL-CIDL-classes.vsd Binary files differnew file mode 100644 index 00000000000..0986aa78d70 --- /dev/null +++ b/TAO/CIAO/docs/imgs/IDL-CIDL-classes.vsd diff --git a/TAO/CIAO/docs/imgs/basic-container.png b/TAO/CIAO/docs/imgs/basic-container.png Binary files differnew file mode 100644 index 00000000000..9df767b45a2 --- /dev/null +++ b/TAO/CIAO/docs/imgs/basic-container.png diff --git a/TAO/CIAO/docs/imgs/component-basic.png b/TAO/CIAO/docs/imgs/component-basic.png Binary files differnew file mode 100644 index 00000000000..6461538c85d --- /dev/null +++ b/TAO/CIAO/docs/imgs/component-basic.png diff --git a/TAO/CIAO/docs/imgs/deployment.png b/TAO/CIAO/docs/imgs/deployment.png Binary files differnew file mode 100644 index 00000000000..4cd8c6be646 --- /dev/null +++ b/TAO/CIAO/docs/imgs/deployment.png diff --git a/TAO/CIAO/docs/imgs/extended-container.png b/TAO/CIAO/docs/imgs/extended-container.png Binary files differnew file mode 100644 index 00000000000..39977e6eb83 --- /dev/null +++ b/TAO/CIAO/docs/imgs/extended-container.png diff --git a/TAO/CIAO/docs/imgs/home-config.png b/TAO/CIAO/docs/imgs/home-config.png Binary files differnew file mode 100644 index 00000000000..aebf5e62751 --- /dev/null +++ b/TAO/CIAO/docs/imgs/home-config.png diff --git a/TAO/CIAO/docs/index.html b/TAO/CIAO/docs/index.html new file mode 100644 index 00000000000..4a6171ffd63 --- /dev/null +++ b/TAO/CIAO/docs/index.html @@ -0,0 +1,75 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<!-- $Id$ --> +<html> <head> +<title>CIAO - Component-Integrated ACE ORB</title> +</head> + +<body> +<h1>CIAO - Component-Integrated ACE ORB</h1> + +<h2>Introduction</h2> +CIAO is TAO's implementation of <a +href="http://cgi.omg.org/cgi-bin/doc?formal/02-06-65"> CORBA Component +Model (CCM)</a> specially optimized for distributed real-time embedded +(DRE) systems. + +This page contains links to other documents and +resources for using <i>CIAO</i>. + +<h2>The CIAO Project</h2> +<ul> + <li>The main + <a href="http://www.cs.wustl.edu/~nanbor/projects/CIAO/"> + CIAO project page</a>.<p> + + <li>Project <a href="releasenotes.html">Status (aka. Release + Notes.)</a><p> + + <li>This <a href="new_components.html">page on implementing new + component</a> explains all the user-defined and tool-generated + files when implementing a component.<p> + + <li>A <a href="todo.html">list of things</a> that we know need to be + done. :) <p> + + <li>The <a href="ConfigValues.html">Configuration Name/Value + lists</a> lists all the configuration values that CIAO will pass + into vaious CCM mechanisms. The information shown in this page + is not visible to CIAO end-users, which include modeling tool + developers. The information that matters for most users is how + these configurations are represented in various XML + descriptors and CIDL specifications.<p> +</ul> + +<h2>CCM-defined Interface Diagrams</h2> + +Here is a set of UML diagrams that we use to figure out the +relationship among all the different interfaces in CCM. You can +browse the related part from the following list: + +<UL> + <li><a href="imgs/component-basic.png"> Basic component interfaces + </a></li> + <li><a href="imgs/home-config.png"> Home and configuration interfaces + </a></li> + <li><a href="imgs/basic-container.png"> Basic container interfaces + </a></li> + <li><a href="imgs/extended-container.png"> Extended container + interfaces </a></li> + <li><a href="img/deployment.png"> Deployment and installation + interfaces </a></li> +</UL> +All these diagrams are generating from the <a href="imgs/CCM.vsd">CCM.vsd +Visio file</a> (The same file in Visio V.5 format is <a href="imgs/CCM-v5.vsd">here</a>.) + + +<!--#include virtual="/~nanbor/signature.html" --> +<!-- <hr> --> +<!-- <\!-- hhmts start -\-> --> +<!-- Last modified: Mon Nov 04 07:55:22 Central Standard Time 2002 --> +<!-- <\!-- hhmts end -\-> --> +<!-- <address>Nanbor Wang <nanbor@cs.wustl.edu></address> --> +</body> </html> + +<!-- LocalWords: CCM UML vsd Visio + --> diff --git a/TAO/CIAO/docs/new_components.html b/TAO/CIAO/docs/new_components.html new file mode 100644 index 00000000000..db10fca2103 --- /dev/null +++ b/TAO/CIAO/docs/new_components.html @@ -0,0 +1,129 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<!-- $Id$ --> +<html> <head> +<title>Procedures to prepare a new component implementation</title> +</head> + +<body> +<h1>Preparing a new component implementation</h1> + +I am documenting the steps required to prepare a component implementation. +Personally, I prefer to set up a directory to contain only <b>one</b> +component implementation. I believe the procedures outlined below +will work if you have multiple component implementation in the same +IDL files. The purpose of this document is to record the procedures +and steps on how these files relate to each others and how they come +about during the development process.<p> + +Assuming we need to create a new component called +<code><b>Orc</b></code>. Below is the list of files you'll need to +deal with. Our goal is to greatly reduce the number of files you need +to deal with manually... + +<ol> + <li><font color="red"><code><b>Orc</b>.idl</code></font> - This is + the IDL file that contains the component and component home + definitions.<p> + + As you will eventually create 3 DLLs (or shared objects), you + will also need 3 sets of different export macros files as + following.<p> + + <li><code><b>Orc</b>_stub_export.h</code> - This file is generated + using the following command:<p> + + <code>generate_export_file.pl <b>ORC</b>_STUB > <b>Orc</b>_stub_export.h</code><p> + + This file makes macros like <code><b>ORC</b>_STUB_Export</code> + and friends available. They are usually controlled by + <code><b>ORC</b>_STUB_BUILD_DLL</code><p> + + <li><code><b>Orc</b>_svnt_export.h</code> - This file is generated + using the following command:<p> + + <code>generate_export_file.pl <b>ORC</b>_SVNT > <b>Orc</b>_svnt_export.h</code><p> + + This file makes macros like <code><b>ORC</b>_SVNT_Export</code> + and friends available. They are usually controlled by + <code><b>ORC</b>_SVNT_BUILD_DLL</code><p> + + <li><code><b>Orc</b>_exec_export.h</code> - This file is generated + using the following command:<p> + + <code>generate_export_file.pl <b>ORC</b>_EXEC > <b>Orc</b>_exec_export.h</code><p> + + This file makes macros like <code><b>ORC</b>_EXEC_Export</code> + and friends available. They are usually controlled by + <code><b>ORC</b>_EXEC_BUILD_DLL</code><p> + + <li><code><b>Orc</b>E.idl</code> - Component Executor equivalent + interface definitions. This file should be generated + automatically by the CIDL compiler as illustrated in this + <a href="com-impl.html">file</a> but we currently are still + working on the implementation of the CIDL compiler. Therefore, + you still need to create this file manually.<p> + + <li><font color="red"><code><b>Orc</b>EI.idl</code></font> - + Optional Component Executor implementation interface + definitions. Often time, when you implement a non-trivial + monolithic component implementation, you are required to define + the monolithic local executor interface which often inherits + from the component monolithic executor interface and all the + provided interfaces. The actually executor implementation will + inherit from this user defined interface instead of the default + executor mapping defined in <code><b>Orc</b>E.idl</code>. You + will need to do the same when you wish to support non-vanilla + component interface, such as + <code>Components::SessionComponent</code>, and/or + <code>Components::SessionSynchronization</code>.<p> + + Ideally, it would be perfect if we can auto-generate this + optional IDL file using CIDL compiler. However, I'm not sure + the plan CIDL language contains enough information that's + required to generate this file.<p> + + <li><font color="red"><code><b>Orc</b>_exec.*</code></font> - These + are files containing the actually component implementation that + you have to write manually. It, however, depends on the + equivalent executor IDL definition (that will be) generated by + the CIDL files.<p> + + <li><code><b>Orb</b>_svnt.*</code> - These are files containing the + servant glue code that bridge a container to the component + executor that you implement. Like the component executor + mapping IDL file, these files should be generated by the CIDL + compiler but are currently generated manually.<p> + + <li><code><b>Orc</b>.csd</code> - Component Softpkg Descriptor. We + need some kind of tool to generate this file automatically. It + is currently being generated manually, however.<p> + + + <li><code><b>Orc</b>.ssd</code> - Servant Softpkg Descriptor. This + is a CIAO extension descriptor file which uses the same softpkg + DTD as described in CCM spec. CIAO requires this file because + CIAO separates the executors into a completely separate DLL. + Like <code><b>Orc</b>.csd</code>, this file should be generated + automatically through some tool, but it is currently manually + crafted.<p> + + <li><code><b>Orc</b>.ccd</code> - CORBA Component Descriptor. This + file is currently being generated manually thou a template + should really be generated by CIAO's CIDL compiler.<p> + + <li><font color="red"><code><b>Orc</b>.mpc</code></font> - Makefile + Project Creator definition file. There is a perl script to + generate a minimal MPC definition at + <code>$(CIAO_ROOT)/bin/generate_component_mpc.pl</code> so + people can use it to implement the simplest component + implementation outlined in this file.<p> + +</ol> + + +<hr> +<address></address> +<!-- hhmts start --> +Last modified: Fri Mar 21 16:06:48 Central Standard Time 2003 +<!-- hhmts end --> +</body> </html> diff --git a/TAO/CIAO/docs/releasenotes.html b/TAO/CIAO/docs/releasenotes.html new file mode 100644 index 00000000000..fc1bb343807 --- /dev/null +++ b/TAO/CIAO/docs/releasenotes.html @@ -0,0 +1,366 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<!-- $Id$ --> +<html> <head> +<title>CIAO Release Information and TODOs</title> +</head> + +<body> +<h1>CIAO Release Information and TODOs</h1> + +<ul> + <li><a href="#status">Current Status</a> + <li><a href="#outlook">Project Outlook</a> + <li>Short-term <a href="todo.html">to-do list</a></p> +</ul> + +<hr> +<h2>Current Status</h2><a name="status"> + +<ol> + <li><h3>Latest News</h3> + <ul> + <li>Thu Apr 16 2003 - The HUDisplay example now also works on + Linux platforms and allows you to remotely setup an + application. <p> + + <li>Sat Apr 5 2003 - Added the support for connection + establishment and finished the multiple-component + <a href="../examples/handcrafted/Display/"> HUDisplay + example</a>. Check out the <a + href="../examples/handcrafted/Display/descriptors/NOTE.txt"> + note </a> to see how to play with it. You need to + have <a href="http://www.trolltech.com/">Qt</a> library + available if you want to play with the GUI based + component. If you don't, no worries. You can still play + with the non-GUI configurations.<p> + + <li>Thu Apr 3 2003 - Added the XML documents handlers for + componentassembly. They build the assembly specification + that the assembly mechanisms use to compose an + application. As with handlers for parsing softpkg + documents, these handlers do not have robust error + handling capability as they assume a validator in ACEXML + parser handles the validity of documents already (which + isn't the case for the time being.)<p> + + <li>Fri Mar 21 2003 - Finished the component implementations + for the multi-component example. Next up, assembling + mechanism. <p> + + <li>Thu Mar 6 2003 - The HelloWorld now uses the new command + Daemon control options to read in the component softpkg + descriptor, spawn a ComponentServer, and instantiate the + component. See the <code> + <a href="../examples/handcrafted/Hello/run_test.pl"> + run_test.pl</a></code> for more details on how this can be + done. <p> + + <li>Sun Feb 16 2003 - A new implementation for the per-host + daemon process is now availabe under <code> + $(CIAO_ROOT)/tools/Daemon/</code>. This application + includes both <code> ComponentInstallation</code> and + <code>ServerActivator</code> interfaces. It also comes + with a command line utility program to interact with the + daemon process. Please see its <a + href="../tools/Daemon/README">README</a> file for more + information.<p> + + Implementation for <code>ComponentInstallation</code> + interface uses ACE_Configuration to maintain persistency + of component intallation data. <p> + + <li>Fri Feb 14 2003 - We now have most of the assembly and + deployment framewok processes available. Next up, + implementing the XML + handlers that actually parses component assemblies and + assembles an application.<p> + + <li>Sun Feb 9 2003 - Started implementing the Deployment and + Assembly framework a week ago. So far, the object + management mechanisms for AssemblyFactory and Assembly is + done, but I still need to fill in the meat where we build an + Assembly by parsing the Assembly descriptor. I'm going to + move on to finish the implementations for the rest of the + Deployment and Assembly interfaces in the next few days.<p> + + <b>It looks like we will have to go straight to our + planned 0.2 release as our first publically available + CIAO. </b><p> + + <li>Mon Jan 13 2003 - Finished the first round effort to + create a meta-code to describe how the CIDL compiler + should generated the container specific glue code. These + templates are available <a href="templates/">here</a>. + These templates can also be used to help handcrafting the + examples I'm working on.<p> + + <li>Mon Jan 6 2003 - Both Jeff and Boris are working on the + CIDL compiler implementation.<p> + + <li>Tue Dec 24 2002 - Started working a multi-component + handcrafted example in <a + href="../examples/handcrafted/Display/">examples/handcrafted/Display/</a><p> + + <li>Sat Dec 21 2002 - Added *nix Makefiles, MPC specifications + and created MPC templates for CIAO clients, component + implementations, and server tools.<p> + + <li>Wed Dec 18 2002 - A perl script fits beautifully with the + HelloWorld example.<p> + + <li>Dec 17 2002 - A NameService based HomeFinder + implementation -- CIAO::HomeRegistrar -- is now + available. The simple component server in CIAO now use + the support the HomeFinder interface so we can install as + many components in the component server as possible.<p> + + <li>Dec 15 2002 - Generic component server that can host + multiple components with a proprietary config file. More + information can be found <a + href="../tools/Simple_Component_Server/README"> here </a> + Next up, a trivial HomeFinder interface that can + simply forward requests to a Naming Service.<p> + + <li>Dec 11 2002 - The server implementation in the HelloWorld + example is now a generic one-component server. It can be + modified easily to host any *one* component easily.<p> + + <li>Dec 10 2002 - <a href="com-impl.html">This document</a> + captures how to "handcraft" a component and how this all + will be automated in the future.<p> + + <li>Nov 22 2002 - Completed the first handcrafted example + <a href="../examples/handcrafted/Hello/README">HelloWorld</a> + component implementation. CIAO now also include a + minimally functioning session container implementation.<p> + </ul> + + <li> <h3>Status of individual modules</h3> +<table valign="top" border="1" width="90%"> + <th> Modules </th> + <th> Status </th> + + <tr> + <td>CCM Core</td> + <td>We are currently working on a prototype that enables remote + component installation using the CCM + <code>ComponentInstallation</code> interface, a component + server implementation. Since we + still don't have a CIDL implementation, we will also write up + an example to show how the code should be generated in both + CCIDL compiler and provide example component + implementations. + + There exists 3 libraries in CCM Core. + <ol> + <li><b>CIAO_Client</b>: contains the client side stubs for + CCMObject. All client programs that use CCMObject must + link to this library. + <li><b>CIAO_Container</b>: contains the interface + definitions and CIAO's container implementation. All + component implementations must link to this library. + <li><b>CIAO_Server</b>: contains the stubs to access + deployment framework. We'll need to use this to + implement the deployment mechanism. + </ol> + </td> + </tr> + + <tr> + <td>TAO_IDL</td> + <td>TAO_IDL has been extended to handle and generate all the + component related keywords but <code>import</code>. We are + currently using the generated mapping, in combination to + manually simulation of CIDL generated code to implement CCM + component. + TAO_IDL Check out <a + href="http://cvs.doc.wustl.edu/ace-latest.cgi/ACE_wrappers/TAO/docs/releasenotes/index.html#idl"> TAO IDL compiler</a> for more details. + </td> + </tr> + + <tr> + <td>CCIDL (CIAO Component Implementation IDL) Compiler</td> + <td> + We still have no solid schedule as to when an implemention of + CCIDL will be available at + this point and we do not have immediate plan to integrate + Persistence State Service into CCIDL. For starter, we will + probably only support a simple construct like the following: +<pre> + import ::some_idl_module; + + module component_composite_name { + composition service component_home_executor { + implements component_home; + manages component_executor; + }; + }; +</pre> + We will also need to generate the operation implementation + inherit from following interfaces: + <ul> + <li><code>Navigation</code> + <li><code>Receptacle</code> + <li><code>Event</code> + <li><code>CCMObject</code> + <li>Component specific context + <li>Executor + </ul> + + For the implementation of the three introspection interfaces, + one way to implement it is to simply(?) generate the code that + build the component meta-data when queried (such as, + <code>get_all_facets</code> method,) or to create a generic + implementation and use an XML file that describe the component + to fill in these meta-data. + </td> + </tr> +</table><p> + +<li><b>TAO Modules required by CIAO:</b> We currently don't have a + target set up in TAO's make system to build CIAO required module + only, so you need to do this yourself. (BTW, we only support the + use of dynamic linked libraries, at least for now.) Here is a list + of necessary TAO modules in order of dependencies: + + <ol> + <li>TAO Main library. + <li>PortableServer + <li>orbsvcs/orbsvcs/Security + <li>IFR_Client + </ol><p> + +</ol> + +<hr> +<a name="outlook"> +<h2>Project Outlook</h2> +This to-do list is currently arranged in chronological order, +<i>i.e.</i>, we group features that are expected to be available in +certain release together. All interfaces and types are under +<CODE>Components</code> module namespace if not specified explicitly. + +<ul> + <li><b>CIAO 0.1 alpha release</b> - (post TAO 1.3, Dec. 2002) + <UL> + <li>Default implementation of <code> + <ul> + <li>Navigations + <li>Receptacles + <li>Events + </ul> + </code> + interfaces and their supporting data types that + <code>CCMObject</code> interface requires. These + interfaces are defined in <code> + <a href="../ciao/CIAO_Base.pidl">CIAO_Base.pidl</a></code> + and <code><a + href="../ciao/CIAO_Event.pidl">CIAO_Event.pidl</a></code>. + <li>Default implementation of <code> + <ul> + <li>CCMObject + <li>CCMHome + <li>KeylessCCMHome + </ul> + </code> and their supporting data types as defined in part + of the <code><a href="../ciao/CIAO_Component.pidl"> + CIAO_Component.pidl </a></code>. + <li>Partial support for basic container/callback interfaces: <code> + <ul> + <li>CCMContext, SessionContext + <li>EnterpriseComponent, SessionComponent + </ul> + </code> + <li>Extension to CORBA Core + <ul> + <li><code>CORBA::LocalObject</code> interface has been + added a long time ago. + <li><code>get_component()</code> method in + <code>CORBA::{Object|LocalObject}</code> + interfaces. + </ul> + <li><code>HomeExecutorBase</code> interface + <li>Support (hand crafted) monolithic executor implementation + <li>Extension to IDL compiler and Typecode factory. IDL + compiler shall recognize all CCM keyword extensions but not + necessarily generate code for these added keywords. + <li>Adaptive configuration of Notification Service/Event Channels + <li>Partial implementation of <code>Deployment</code> module. + <!-- support some descriptors --> + </UL> + AT this stage, we only implement "enough" CCM defined interface + capability to allow manual implementation of components and a + simple framework that offer some remote installation/composition + capability. This will help design how CCIDL generated code + should look like. + + <p> + + <LI><b>CIAO 0.2 beta release</b> - (TAO 1.3.X, Apr. 2003) + <ul> + <li>Support for various RT and QoS Policies + <li>Support for policy-based adaptation mechanism + <li><code>HomeFinder</code> interface + <li><code>HomeRegistration</code> interface + <li>Configuration interfaces <code> + <ul> + <li>Configurator + <li>StandardConfigurator + <li>HomeConfiguration + </ul> + </code> + <li>Other basic container programming interfaces <code> + <ul> + <li>EntityContext + <li>EntityComponent + </ul> + </code> + <li>Extension to Interface Repository. + <li>IDL should generate correct client/server side mapping for + component extension + <li>CCIDL implementation that generates skeleton implementation for + <ul> + <li><code>Navigations</code>, <code>Receptacles</code>, + and <code>Events</code> interfaces of a components + <li>component executor and home_executor templates for + monolithic component implementation + <li>What else??? + </ul> + <li>Complete <code>Deployment</code> implementation, assuming + the revised deployment specification will be available + <!-- Support more descriptors --> + </ul> + + <p> + + <li><b>CIAO 1.0</b> - (TAO 1.4, Oct. 2003) + <ul> + <li>Interface <code>SessionSynchronization</code> and other + interfaces in <code>Transaction</code> module, assuming + time permitting and + <a href="http://xots.sourceforge.net/"> XOTS </a> will be + available in April 2003 timeframe + <li>PSS functionality? + <li><code>CCM2Context, Session2Context, Entity2Context</code> + and <code> + <li>Support for <code>ExecutorLocator</code> based component + implementation + <li><code>ProxyHomeRegistration</code> interface + <!-- support complete descriptors --> + </ul> + + <p> + +</ul> + + <!--#include virtual="/~nanbor/signature.html" --> +<!-- <hr> --> +<!-- <address></address> --> +<!-- <\!-- hhmts start -\-> --> +<!-- Last modified: Wed Dec 18 23:20:37 Central Standard Time 2002 --> +<!-- <\!-- hhmts end -\-> --> +<!-- <address>Nanbor Wang <nanbor@cs.wustl.edu></address> --> +</body> </html> + +<!-- LocalWords: TODOs CCM IDL CCIDL CIDL backend idl + --> diff --git a/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.cpp b/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.cpp new file mode 100644 index 00000000000..96559f34473 --- /dev/null +++ b/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.cpp @@ -0,0 +1,1218 @@ +// $Id$ + +// The generated filename for files using this template shoule be +// [idl-basename]GS.cpp GS --> GlueSession + +// @@ Notice: [ciao module name] can expand to either CIAO_GLUE or +// CIAO_GLUE_[module name] as defined in the header file. + +/// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +/// @@@ Notice that all component and interface names need to be +/// fully qualified as we are creating a new namespace for the CIAO's +/// container glue code. +/// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +#include "[idl-basename]_svnt.h" +#include "Cookies.h" + +#if !defined (__ACE_INLINE__) +# include "[idl-basename]_svnt.inl" +#endif /* __ACE_INLINE__ */ + +////////////////////////////////////////////////////////////////// +// Facet Glue Code implementation +// @@ We are assuming that these facets are declared under the same +// module as the component (thus, we are placing this glue code +// here under the same namespace. If they are not, we will +// either be generating them in separate namespaces, or include +// some other CIDL generated files to get the glue code +// implementation. +////////////////////////////////////////////////////////////////// + +##foreach [facet type] in (all facet interface types in the original IDL) + +// get_component implementation. +CORBA::Object_ptr +[ciao module name]::[facet type]_Servant::_get_component (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::SessionContext_var sc = + ::Components::SessionContext::_narrow (this->ctx_.in ()); + + if (! CORBA::is_nil(sc.in ())) + return sc->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + + ::Components::EntityContext_var ec = + ::Components::EntityContext::_narrow (this->ctx_.in ()); + + if (! CORBA::is_nil(ec.in ())) + return ec->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); +} + +##end foreach [facet type] + + + +////////////////////////////////////////////////////////////////// +// Component specific context implementation +////////////////////////////////////////////////////////////////// + +##foreach [receptacle name] with [uses type] in (list of all 'uses' interfaces) generate: +## if ([receptacle name] is a multiplex ('uses multiple') receptacle) + // [receptacle name]Connections typedef'ed as a sequence of + // struct [receptacle name]Connection. +[receptacle name]Connections * +[ciao module name]::[component name]_Context::get_connections_[receptacle name] (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ Strategized locking here. + + [receptacle name]Connections_var retv = + new [receptacle name]Connections (this->ciao_muses_[receptacle name]_.current_size ()); + + CORBA::ULong i = 0; + ACE_Active_Map_Manager<[uses type]_var>::iterator + end = this->ciso_muses_[receptacle name]_.end (); + for (ACE_Active_Map_Manager<[uses type]_var>::iterator + iter = this->ciso_muses_[receptacle name]_.begin (); + iter != end; + ++iter) + { + ACE_Active_Map_Manager<[uses type]_var>::ENTRY &entry = *iter; + retv[i]->objref = [uses type]::_narrow (entry.int_id_.in ()); + retv[i]->ck = new CIAO::Map_Key_Cookie (entry.ext_id_); + ++i; + } + + return retv._retn (); +} +## endif [receptacle name] +##end foreach [receptacle name] with [uses type] + +##foreach [event name] with [eventtype] in (list of all event sources) generate: +void +[ciao module name]::[component name]_Context::push_[event name] ([eventtype]_ptr ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ +## if [event name] belongs to an 'emits' port + this->ciao_emits_[event name]_consumer_->push_[event name] (ev + ACE_ENV_ARG_PARAMETER); +## else [event name] belongs to a 'publishes' port + ACE_Active_Map_Manager<[eventtype]Consumer_var>::iterator + end = this->ciao_publishes_[event name]_map_.end (); + for (ACE_Active_Map_Manager<[eventtype]Consumer_var>::iterator + iter = this->ciao_publishes_[event name]_map_.begin (); + iter != end; + ++iter) + { + ACE_Active_Map_Manager<[eventtype]Consumer_var>::ENTRY &entry = *iter; + [eventtype]Consumer_var c + = [eventtype]Consumer::_narrow (entry.int_id_.in ()); + c->push_[eventtype] (ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } +## endif [event name] +} + +##end foreach [event name] with [eventtype] + + +// Operations for publishes interfaces. +##foreach [publish name] with [eventtype] in (list of all publishers) generate: +::Components::Cookie_ptr +[ciao module name]::[component name]_Context::subscribe_[publish name] ([eventtype]Consumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::ExceededConnectionLimit)) +{ + if (CORBA::is_nil (c)) + ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + + [eventtype]Consumer_var sub + = [eventtype]Consumer::_duplicate (c); + + ACE_Active_Map_Manager_Key key; + this->ciao_publishes_[publish name]_map_.bind (sub.in (), + key); + + sub._retn (); // Release ownership to map. + + ::Components::Cookie_var retv = new CIAO::Map_Key_Cookie (key); + return retv._retn (); +} + +[eventtype]Consumer_ptr +[ciao module name]::[component name]_Context::unsubscribe_[publish name] (::Components::Cookie_ptr ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::InvalidConnection)) +{ + [eventtype]Consumer_var retv; + + ACE_Active_Map_Manager_Key key; + if (ck == 0 || + CIAO::Map_Key_Cookie::extract (ck, key) == -1) + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + + if (this->ciao_publishes_[publish name]_map_.unbind (key, + retv) != 0) + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + + return retv._retn (); +} + +##end foreach [publish name] with [eventtype] + +##foreach [receptacle name] with [uses type] in (list of all 'uses' interfaces) generate: + +## if [receptacle name] is a simplex receptacle ('uses') + +[uses type]_ptr +[ciao module name]::[component name]_Context::get_connection_[receptacle name] (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return [uses type]::_duplicate (this->ciao_uses_[receptacle name]_.in ()); +} + +// Simplex [receptacle name] connection management operations +void +[ciao module name]::[component name]_Context::connect_[receptacle name] ([uses type]_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)) +{ + if (! CORBA::is_nil (this->ciao_uses_[receptacle name]_.in ())) + ACE_THROW (::Components::AlreadyConnected ()); + + if (CORBA::is_nil (c)) + ACE_THROW (::Components::InvalidConnection ()); + + // When do we throw InvalidConnection exception? + this->ciao_uses_[receptacle name]_ = [uses type]::_duplicate (c); +} + +[uses type]_ptr +[ciao module name]::[component name]_Context::disconnect_[receptacle name] (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::NoConnection)) +{ + if (CORBA::is_nil (this->ciao_uses_[receptacle name]_.in ())) + ACE_THROW (::Components::NoConnection ()); + + return this->ciao_uses_[receptacle name]_._retn (); +} + +## else ([receptacle name] is a multiplex ('uses multiple') receptacle) +// Multiplex [receptacle name] connection management operations +::Components::Cookie_ptr +[ciao module name]::[component name]_Context::connect_[receptacle name] ([uses type]_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::ExceedConnectionLimit, + ::Components::InvalidConnection)) +{ + if (CORBA::is_nil (c)) + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + + [uses type]_var conn + = [uses type]::_duplicate (c); + + ACE_Active_Map_Manager_Key key; + this->ciao_muses_[receptacle name]_.bind (conn.in (), + key); + + conn._retn (); // Releases ownership to the map. + + ::Components::Cookie_var retv = new CIAO::Map_Key_Cookie (key); + return retv._retn (); +} + +[uses type]_ptr +[ciao module name]::[component name]_Context::disconnect_[receptacle name] (::Components::Cookie_ptr ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::InvalidConnection)) +{ + [uses type]_var retv; + + ACE_Active_Map_Manager_Key key; + if (ck == 0 || + CIAO::Map_Key_Cookie::extract (ck, key) == -1) + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + + if (this->ciao_muses_[receptacle name]_.unbind (key, + retv) != 0) + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + + return retv._retn (); +} + +## endif [receptacle name] +##end foreach [receptacle name] with [uses type] + +// Operations for ::Components::SessionContext interface +CORBA::Object_ptr +[ciao module name]::[component name]_Context::get_CCM_object (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ How do I check for IllegalState here? When it's not in a + // callback operation... + // ACE_THROW_RETURN (::Components::IllegalState (), 0); + + if (CORBA::is_nil (this->component_.in ())) + { + CORBA::Object_var obj = this->container_->get_objref (this->servant_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + this->component_ = [component name]::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (this->component_.in ())) + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); // This should not happen... + } + return [component name]::_duplicate (this->component_.in ()); +} + +////////////////////////////////////////////////////////////////// +// Component Servant Glue code implementation +////////////////////////////////////////////////////////////////// + +[ciao module name]::[component name]_Servant::[component name]_Servant (CCM_[component name]_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c) + : executor_ (CCM_[component name]::_duplicate (exe)), + container_ (c) +{ + this->context_ = new [ciao module name]::[component name]_Context (h, c, this); + + ACE_TRY_NEW_ENV + { + Components::SessionComponent_var scom = + Components::SessionComponent::_narrow (exe + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (! CORBA::is_nil (scom.in ())) + scom->set_session_context (this->context_ + ACE_ENV_ARG_PARAMETER); + } + ACE_CATCHANY + { + // @@ Ignore any exceptions? What happens if + // set_session_context throws an CCMException? + } + ACE_ENDTRY; +} + +[ciao module name]::[component name]_Servant::~[component name]_Servant (void) +{ + ACE_TRY_NEW_ENV + { + Components::SessionComponent_var scom = + Components::SessionComponent::_narrow (this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (! CORBA::is_nil (scom.in ())) + scom->ccm_remove (ACE_ENV_SINGLE_ARG_PARAMETER); + } + ACE_CATCHANY + { + // @@ Ignore any exceptions? What happens if + // set_session_context throws an CCMException? + } + ACE_ENDTRY; + this->context_->_remove_ref (); +} + +// Operations for provides interfaces. +##foreach [facet name] with [facet type] in (list of all provided interfaces) generate: + +[facet type]_ptr +[ciao module name]::[component name]_Servant::provide_[facet name] (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (CORBA::is_nil (this->provide_[facet name]_.in ())) + { + CCM_[facet type]_var fexe = this->executor_->get_[facet name] (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (fexe.in ())) + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); + + [ciao module name]::[facet type]_Servant *svt = + new [ciao module name]::[facet type]_Servant (fexe.in (), + this->context_); + PortableServer::ServantBase_var safe_servant (svt); + + CORBA::Object_var obj = this->container_->install_servant (svc.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + [facet type]_var fo = [facet type]::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + this->provide_[facet name]_ = fo; + } + + return [facet type]::_duplicate (this->provide_[facet name]_.in ()); +} +##end foreach [facet name] with [facet type] + +// Operations for consumers interfaces. +##foreach [consumer name] with [eventtype] in (list of all consumers) generate: + +// EventConsumer Glue Code implementation + +// Inherit from ::Compopnents::EventBConsumerBase +void +[ciao module name]::[component name]_Servant::[eventtype]Consumer_[consumer name]_Servant::push_event (EventBase_ptr ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::BadEventType)) +{ + [eventtype]_var ev_type = [eventtype]::_downcast (ev); + if (ev_type != 0) + { + this->push_[eventtype] (ev_type.in () + ACE_ENV_ARG_PARAMETER); + return; + } + + // @@ This include the case when we receive a parent eventtype of [eventtype] + + ACE_THROW (::Components::BadEventType ()); +} + +// get_component implementation. +[eventtype]Consumer_ptr +[ciao module name]::[component name]_Servant::get_consumer_[consumer name] (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (CORBA::is_nil (this->consumes_[consumer name]_.in ())) + { + [ciao module name]::[component name]_Servant::[eventtype]Consumer_[consumer name]_Servant *svt = + new [ciao module name]::[component name]_Servant::[eventtype]Consumer_[consumer name]_Servant (this->executor_.in (), + this->context_); + PortableServer::ServantBase_var safe_servant (svt); + + CORBA::Object_var obj = this->container_->install_servant (svt + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + [eventtype]Consumer_var eco = [eventtype]Consumer::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + this->consumes_[consumer name]_ = eco; + } + + return [eventtype]Consumer::_duplicate (this->consumes_[consumer name]_.in ()); +} + +##end foreach [consumer name] with [eventtype] + +// Operations for Navigation interface +CORBA::Object_ptr +[ciao module name]::[component name]_Servant::provide_facet (const char * name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException , + Components::InvalidName)) +{ + if (name == 0) + ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + + // We simply iterate thru all the facets this component provides + // now. We can also use a hash map along with perfect hashing + // (i.e., gperf) if we need faster performance since all the provided + // interfaces are static to a component definition. + +##foreach [facet name] with [facet type] in (list of all provided interfaces) generate: + if (ACE_OS_String::strcmp (name, "[facet name]") == 0) + return this->provide_[facet name] (ACE_ENV_SINGLE_ARG_PARAMETER); +##end foreach [facet name] with [facet type] + + ACE_THROW_RETURN (::Components::InvalidName (), 0); +} + +::Components::FacetDescriptions * +[ciao module name]::[component name]_Servant::get_all_facets (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::FacetDescriptions_var collection + = new ::Components::FacetDescriptions (#99); // #99 = number of all provided + // facets including those inherited + // from parent component(s). + collection->length (#99); + + ::Components::FacetDescription_var x; + CORBA::ULong i = 0; + +##foreach [facet name] with [facet type] in (list of all provided interfaces) generate: + + x = new ::OBV_Components::FacetDescription; + + x->Name ((const char *)"[facet name]"); + x->type_id ((const char *) "[facet type's repo id]"); // + x->facet_ref (this->provide_[facet name] (ACE_ENV_SINGLE_ARG_PARAMETER)); + + collection[i] = x._retn (); + ++i; +##end foreach [facet name] with [facet type] + + return collection._retn (); + +} + +::Components::FacetDescriptions * +[ciao module name]::[component name]_Servant::get_named_facets (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ::Components::FacetDescriptions_var collection + = new ::Components::FacetDescriptions (names.length ()); + collection->length (names.length ()); + + ::Components::FacetDescription_var x; + CORBA::ULong i = 0; + for (; i < names.length (); ++i) + { + x = new ::OBV_Components::FacetDescription; + + // We probably need a more efficient way, e.g., a hash map, to handle all these. +##foreach [facet name] with [facet type] in (list of all provided interfaces) generate: + (else) if (ACE_OS_String::strcmp (names[i].in (), "[facet name]") == 0) + { + x->Name ((const char *)"[facet name]"); + x->type_id ((const char *) "[facet type's repo id]"); // + x->facet_ref (this->provide_[facet name] (ACE_ENV_SINGLE_ARG_PARAMETER)); + + } +##end foreach [facet name] with [facet type] + else + ACE_THROW_RETURN (::Components::InvalidName (), 0); + + collection[i] = x._retn (); + } + return collection._retn (); +} + +CORBA::Boolean +[ciao module name]::[component name]_Servant::same_component (CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (CORBA::is_nil (object_ref)) + ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + + CORBA::Object_var the_other = object_ref->_get_component (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + CORBA::Object_var me = this->context_->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return me->_is_equivalent (object_ref + ACE_ENV_ARG_PARAMETER); +} + +// Operations for Receptacles interface +::Components::Cookie_ptr +[ciao module name]::[component name]_Servant::connect (const char * name, + CORBA::Object_ptr connection + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::AlreadyConnected, + Components::ExceededConnectionLimit)) +{ + // @@ We can omit this if clause if there's no receptacle in this component. + if (name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + +##foreach [receptacle name] with [uses type] in (list of all 'uses' interfaces) generate: + if (ACE_OS_String::strcmp (name, "[receptacle name]") == 0) + { + [uses type]_var _ciao_conn = + [uses type]::_narrow (connection + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (_ciao_conn.in ())) + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + +## if [receptacle name] is a simplex receptacle ('uses') + this->connect_[receptacle name] (_caio_conn.in () + ACE_ENV_ARG_PARAMETER); + return 0; +## else ([receptacle name] is a multiplex ('uses multiple') receptacle) + return this->connect_[receptacle name] (_ciao_conn.in () + ACE_ENV_ARG_PARAMETER); +## endif [receptacle name] + } +##end foreach [receptacle name] with [uses type] + + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +/* +##foreach [receptacle name] with [uses type] in (list of all 'uses' interfaces) generate: +## if [receptacle name] is a simplex receptacle ('uses') +## else ([receptacle name] is a multiplex ('uses multiple') receptacle) +## endif [receptacle name] +##end foreach [receptacle name] with [uses type] +*/ + +CORBA::Object_ptr +[ciao module name]::[component name]_Servant::disconnect (const char * name, + Components::Cookie_ptr ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::CookieRequired, + Components::NoConnection)) +{ + // @@ We can omit this if clause if there's no receptacle in this component. + if (name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + +##foreach [receptacle name] with [uses type] in (list of all 'uses' interfaces) generate: + if (ACE_OS_String::strcmp (name, "[receptacle name]") == 0) +## if [receptacle name] is a simplex receptacle ('uses') + return this->disconnect_[receptacle name] (ACE_ENV_SINGLE_ARG_PARAMETER); +## else ([receptacle name] is a multiplex ('uses multiple') receptacle) + return this->connect_[receptacle name] (ck + ACE_ENV_ARG_PARAMETER); +## endif [receptacle name] +##end foreach [receptacle name] with [uses type] + + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::ConnectionDescriptions * +[ciao module name]::[component name]_Servant::get_connections (const char * name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + // @@ We can omit this if clause if there's no receptacle in this component. + if (name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + +##foreach [receptacle name] with [uses type] in (list of all 'uses' interfaces) generate: + if (ACE_OS_String::strcmp (name, "[receptacle name]") == 0) + { +## if [receptacle name] is a simplex receptacle ('uses') + ::Components::ConnectionDescriptions_var retv = + new ::Components::ConnectionDescriptions (1); + retv->length (1); + + retv[0] = new OBV_Components::ConnectionDescription; + retv[0]->ck = 0; + retv[0]->objref = this->get_connection_[receptacle name] (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return retv._retn (); +## else ([receptacle name] is a multiplex ('uses multiple') receptacle) + // @@ Return type does not match here. We can not return directly. + return this->get_connections_[receptacle name] (ACE_ENV_SINGLE_ARG_PARAMETER); +## endif [receptacle name] + } +##end foreach [receptacle name] with [uses type] + + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::ReceptacleDescriptions * +[ciao module name]::[component name]_Servant::get_all_receptacles (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::ReceptacleDescriptions_var retv = + new ::Components::ReceptacleDescriptions (#99); // #99 is number of receptacles + // this component has. + retv->length (#99); + CORBA::ULong i = 0; + +##foreach [receptacle name] with [uses type] in (list of all 'uses' interfaces) generate: + retv[i] = new OBV_Components::ReceptacleDescription; + + retv[i]->Name ((const char *) "[receptacle name]"); + retv[i]->type_id ((const char *) "[uses type repo id]"); +## if [receptacle name] is a simplex receptacle ('uses') + retv[i]->is_multiple (0); +## else ([receptacle name] is a multiplex ('uses multiple') receptacle) + retv[i]->is_multiple (1); +## endif [receptacle name] + retv[i]->connections (*this->get_connections ("[receptacle name]" + ACE_ENV_ARG_PARAMETER)); + ++i; +##end foreach [receptacle name] with [uses type] + + return retv._retn (); +} + +::Components::ReceptacleDescriptions * +[ciao module name]::[component name]_Servant::get_named_receptacles (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ::Components::ReceptacleDescriptions_var retv = + new ::Components::ReceptacleDescriptions (names.length ()); + retv->length (names.length ()); + + CORBA::ULong i = 0; + for (; i < names.length (); ++i) + { + retv[i] = new ::OBV_Components::ReceptacleDescription; +##foreach [receptacle name] with [uses type] in (list of all 'uses' interfaces) generate: + (else) if (ACE_OS_String::strcmp (names[i].in (), "[receptacle name]") == 0) + { + retv[i]->Name ((const char *) "[receptacle name]"); + retv[i]->type_id ((const char *) "[uses type repo id]"); +## if [receptacle name] is a simplex receptacle ('uses') + retv[i]->is_multiple (0); +## else ([receptacle name] is a multiplex ('uses multiple') receptacle) + retv[i]->is_multiple (1); +## endif [receptacle name] + retv[i]->connections (*this->get_connections ("[receptacle name]" + ACE_ENV_ARG_PARAMETER)); + } +##end foreach [receptacle name] with [uses type] + else + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + return retv._retn (); +} + +// Operations for Events interface +::Components::EventConsumerBase_ptr +[ciao module name]::[component name]_Servant::get_consumer (const char * sink_name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + // @@ We can omit this if clause if there's no event sinks in this component. + if (sink_name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + +##foreach [consumer name] with [eventtype] in (list of all consumers) generate: + if (ACE_OS_String::strcmp (sink_name, "[consumer name]") == 0) + return this->get_consumer_[consumer name] (ACE_ENV_SINGLE_ARG_PARAMETER); +##end foreach [consumer name] with [eventtype] + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::Cookie_ptr +[ciao module name]::[component name]_Servant::subscribe (const char * publisher_name, + Components::EventConsumerBase_ptr subscriber + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::ExceededConnectionLimit)) +{ + // @@ We can omit this if clause if there's no publisher in this component. + if (publisher_name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + +##foreach [publish name] with [eventtype] in (list of all publishers) generate: + if (ACE_OS_String::strcmp (publisher_name, "[publish name]") == 0) + { + [eventtype]Consumer_var _ciao_consumer = + [eventtype]Consumer::_narrow (subscriber + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (_ciao_consumer.in ())) + ACE_THROW_RETURN (Components::InvalidConnection (), 0); + + return this->subscribe_[publish name] (_ciao_consumer.in () + ACE_ENV_ARG_PARAMETER); + } +##end foreach [publish name] with [eventtype] + + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::EventConsumerBase_ptr +[ciao module name]::[component name]_Servant::unsubscribe (const char * publisher_name, + Components::Cookie_ptr ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)) +{ + // @@ We can omit this if clause if there's no publisher in this component. + if (publisher_name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + +##foreach [publish name] with [eventtype] in (list of all publishers) generate: + if (ACE_OS_String::strcmp (publisher_name, "[publish name]") == 0) + { + return this->unsubscribe_[publish name] (ck + ACE_ENV_ARG_PARAMETER); + } +##end foreach [publish name] with [eventtype] + + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +void +[ciao module name]::[component name]_Servant::connect_consumer (const char * emitter_name, + Components::EventConsumerBase_ptr consumer + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::AlreadyConnected, + Components::InvalidConnection)) +{ + // @@ We can omit this if clause if there's no emitter in this component. + if (emitter_name == 0) + ACE_THROW (Components::InvalidName ()); + +##foreach [emit name] with [eventtype] in (list of all emitters) generate: + if (ACE_OS_String::strcmp (emitter_name, "[emit name]") == 0) + { + [eventtype]Consumer_var _ciao_consumer = + [eventtype]Consumer::_narrow (consumer + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (_ciao_consumer.in ())) + ACE_THROW (Components::InvalidConnection); + + this->connect_[emit name] (_ciao_consumer.in () + ACE_ENV_ARG_PARAMETER); + return; + } +##end foreach [emit name] with [eventtype] + + ACE_THROW (Components::InvalidName ()); +} + +::Components::EventConsumerBase_ptr +[ciao module name]::[component name]_Servant::disconnect_consumer (const char * source_name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::NoConnection)) +{ + // @@ We can omit this if clause if there's no emitter in this component. + if (source_name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + +##foreach [emit name] with [eventtype] in (list of all emitters) generate: + if (ACE_OS_String::strcmp (source_name, "[emit name]") == 0) + { + return this->disconnect_[emit name] (ACE_ENV_SINGLE_ARG_PARAMETER); + } +##end foreach [emit name] with [eventtype] + + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::ConsumerDescriptions * +[ciao module name]::[component name]_Servant::get_all_consumers (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::ConsumerDescriptions_var retv = + new ::Components::ConsumerDescriptions (#99); // #99 is the number of consumers + // this component has. + retv->length (#99); + + CORBA::ULong i = 0; +##foreach [consumer name] with [eventtype] in (list of all consumers) generate: + retv[i] = new OBV_Components::ConsumerDescription; + retv[i]->Name ("[consumer name]"); + retv[i]->type_id ("[eventtype]Consumer repo id"); + [eventtype]Consumer_var c + = this->get_consumer_[consumer name] (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + retv[i]->consumer (c.in ()); + + i++; +##end foreach [consumer name] with [eventtype] + + return retv._retn (); +} + +::Components::ConsumerDescriptions * +[ciao module name]::[component name]_Servant::get_named_consumers (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ::Components::ConsumerDescriptions_var retv = + new ::Components::ConsumerDescriptions (names.length ()); + retv->length (names.length ()); + + CORBA::ULong i = 0; + for (; i < names.length (); ++i) + { + retv[i] = new OBV_Components::ConsumerDescription; + +##foreach [consumer name] with [eventtype] in (list of all consumers) generate: + (else) if (ACE_OS_String::strcmp (names[i].in (), "[consumer name]") == 0) + { + retv[i]->Name ("[consumer name]"); + retv[i]->type_id ("[eventtype]Consumer repo id"); + [eventtype]Consumer_var c = + this->get_consumer_[consumer name] (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + retv[i]->consumer (c.in ()); + } +##end foreach [consumer name] with [eventtype] + else + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + return retv._retn (); +} + +::Components::EmitterDescriptions * +[ciao module name]::[component name]_Servant::get_all_emitters (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::EmitterDescriptions_var retv = + new ::Components::EmitterDescriptions (#99); // #99 is the number of emitters + // this component has. + retv->length (#99); + + CORBA::ULong i = 0; +##foreach [emit name] with [eventtype] in (list of all emitters) generate: + retv[i] = new OBV_Components::EmitterDescription; + retv[i]->Name ("[emit name]"); + retv[i]->type_id ("[eventtype]Consumer repo id"); + retv[i]->consumer ([eventtype]Consumer::_duplicate (this->context_->ciao_emits_[emit name]_consumer_)); + + i++; +##end foreach [emitter name] with [eventtype] + + return retv._retn (); +} + +::Components::EmitterDescriptions * +[ciao module name]::[component name]_Servant::get_named_emitters (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ::Components::EmitterDescriptions_var retv = + new ::Components::EmitterDescriptions (names.length ()); + retv->length (names.length ()); + + CORBA::ULong i = 0; + for (; i < names.length (); ++i) + { + retv[i] = new OBV_Components::EmitterDescription; + +##foreach [emit name] with [eventtype] in (list of all emitters) generate: + (else) if (ACE_OS_String::strcmp (names[i].in (), "[emit name]") == 0) + { + retv[i]->Name ("[emit name]"); + retv[i]->type_id ("[eventtype]Consumer repo id"); + retv[i]->consumer ([eventtype]Consumer::_duplicate (this->context_->ciao_emits_[emit name]_consumer_.in ())); + } +##end foreach [consumer name] with [eventtype] + else + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + return retv._retn (); +} + +::Components::PublisherDescriptions * +[ciao module name]::[component name]_Servant::get_all_publishers (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ to-do + + // Need to add interfaces in the Context class to gather the information. + // Or we can just relay it to the Context object. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +::Components::PublisherDescriptions * +[ciao module name]::[component name]_Servant::get_named_publishers (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + // @@ to-do + + // Need to add interfaces in the Context class to gather the information. + // Or we can just relay it to the Context object. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +// Operations for CCMObject interface +::CORBA::IRObject_ptr +[ciao module name]::[component name]_Servant::get_component_def (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ to-do: Connect to an IfR? + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +::Components::CCMHome_ptr +[ciao module name]::[component name]_Servant::get_ccm_home (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->context_->get_CCM_home (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +::Components::PrimaryKeyBase * +[ciao module name]::[component name]_Servant::get_primary_key (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::NoKeyAvailable)) +{ + // This is a keyless component. + ACE_THROW_RETURN (::Components::NoKeyAvailable (), 0); +} + +void +[ciao module name]::[component name]_Servant::configuration_complete (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidConfiguration)) +{ + // @@ to-do + // No-op. Don't know how to pass this info to monolithic executor. +} + +void +[ciao module name]::[component name]_Servant::remove (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) +{ + // @@ to-do + // Need to figure out what to do here. E.g., tear down the all the connections + // this component has? +} + +::Components::ComponentPortDescription * +[ciao module name]::[component name]_Servant::get_all_ports (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::ComponentPortDescription_var retv = + new OBV_Components::ComponentPortDescription; + + ::Components::FacetDescriptions_var facets_desc + = this->get_all_facets (ACE_ENV_SINGLE_ARG_PARAMETER); + ::Components::ReceptacleDescriptions_var receptacle_desc + = get_all_receptacles (ACE_ENV_SINGLE_ARG_PARAMETER); + ::Components::ConsumerDescriptions_var consumer_desc + = this->get_all_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); + ::Components::EmitterDescriptions_var emitter_desc + = this->get_all_emitters (ACE_ENV_SINGLE_ARG_PARAMETER); + ::Components::PublisherDescriptions_var publisher_desc + = this->get_all_publishers (ACE_ENV_SINGLE_ARG_PARAMETER); + + retv->facets (facets_desc.in()); + retv->receptacles (receptacle_desc.in()); + retv->consumers (consumer_desc.in()); + retv->emitters (emitter_desc.in()); + retv->publishers (publisher_desc.in()); + + return retv._retn(); +} + +// get_component implementation. +CORBA::Object_ptr +[ciao module name]::[component name]_Servant::_get_component (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::SessionContext_var sc = + ::Components::SessionContext::_narrow (this->context_); + + if (! CORBA::is_nil(sc.in ())) + return sc->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + + // @@ Do we need to try the following case here? We are afterall implementing + // a session component here. + ::Components::EntityContext_var ec = + ::Components::EntityContext::_narrow (this->context_); + + if (! CORBA::is_nil(ec.in ())) + return ec->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); +} + +void +[ciao module name]::[component name]_Servant::_ciao_activate (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow (this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! CORBA::is_nil (temp.in ())) + temp->ccm_activate (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +void +[ciao module name]::[component name]_Servant::_ciao_passivate (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow (this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! CORBA::is_nil (temp.in ())) + temp->ccm_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +////////////////////////////////////////////////////////////////// +// Component Home Glue code implementation +////////////////////////////////////////////////////////////////// + +[component name]_ptr +[ciao module name]::[home name]_Servant::_ciao_activate_component (CCM_[component name]_ptr exe + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + CORBA::Object_var hobj + = this->container_->get_objref (this + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::CCMHome_var home + = ::Components::CCMHome::_narrow (hobj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + [ciao module name]::[component name]_Servant *svt = + new [ciao module name]::[component name]_Servant (exe, + home.in (), + this->container_); + PortableServer::ServantBase_var safe (svt); + PortableServer::ObjectId_var oid; + + CORBA::Object_var objref + = this->container_->install_component (svt, + oid.out () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + svt->_ciao_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + [component name]_var ho + = [component name]::_narrow (objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (this->component_map_.bind (oid.in (), svt) == 0) + { + // @@ what should happen if bind fail? + safe._retn (); + } + return ho._retn (); +} + +void +[ciao module name]::[home name]_Servant::_ciao_passivate_component ([component name]_ptr comp + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + PortableServer::ObjectId_var oid; + + this->container_->uninstall_component (comp, + oid.out () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + [ciao module name]::[component name]_Servant *servant = 0; + if (this->component_map_.unbind (oid.in (), servant) == 0) + { + PortableServer::ServantBase_var safe (servant); + servant->_ciao_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } + // What happen if unbind failed? + +} + +// Operations for Implicit Home interface +[component name]_ptr +[ciao module name]::[home name]_Servant::create (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)) +{ + if (this->executor_.in () == 0) + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); + + Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + CCM_[component name]_var _ciao_comp + = CCM_[component name]::_narrow (_ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return this->_ciao_activate_component (_ciao_comp.in () + ACE_ENV_ARG_PARAMETER); +} + +// Operations for CCMHome interface +void +[ciao module name]::[home name]_Servant::remove_component (Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) +{ + [component name]_var _ciao_comp + = [component name]::_narrow (comp + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (_ciao_comp.in ())) + ACE_THROW (CORBA::INTERNAL ()); // What is the right exception to throw here? + + // @@ It seems to me that we need to make sure this is a component + // generated by this home before calling remove on this component. + _ciao_comp->remove (ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + + // Removing the object reference? get the servant from the POA with + // the objref, and call remove() on the component, deactivate the + // component, and then remove-ref the servant? + this->_ciao_passivate_component (_ciao_comp.in () + ACE_ENV_ARG_PARAMETER); +} + +extern "C" [SERVANT]_Export ::PortableServer::Servant +create[home name]_Servant (::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL); +{ + if (p == 0) + return 0; + + CCM_[home name]_var x + = CCM_[home name]::_narrow (p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (x.in ())) + return 0; + + return new [ciao module name]::[home name]_Servant (x.in (), + c); +} diff --git a/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.h b/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.h new file mode 100644 index 00000000000..30a744593c0 --- /dev/null +++ b/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.h @@ -0,0 +1,737 @@ +// $Id$ + +// =========================================================== +// +// @file CIAO_Glue_Session_Template.h +// +// This is a pseudo-meta generic servant implementations template +// for CIAO's CIDL compiler. It demonstrates how a servant +// implementation for a session component should look like. +// +// The generated filename for files using this template shoule be +// [idl-basename]_svnt.h +// +// @author Nanbor Wang <nanbor@cs.wustl.edu> +// +// =========================================================== + +#ifndef CIAO_GLUE_SESSION_[idl-basename]_SVNT_H +#define CIAO_GLUE_SESSION_[idl-basename]_SVNT_H +#include "ace/pre.h" + +#include "[idl-name]S.h" // Source in the skeletons for component + // client-view equivalent interfaces +#include "[idl-name]EC.h" // Source in the executor mapping + // that component implementations use +#include "ciao/Container_Base.h" //Source in the container interface definitions +#include "tao/LocalObject.h" +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Active_Map_Manager_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +/// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +/// @@@ Notice that all component and interface names need to be +/// fully qualified as we are creating a new namespace for the CIAO's +/// container glue code. +/// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +##if component is defined withing a [module name] +namespace CIAO_GLUE_[module_name] +##else +namespace CIAO_GLUE +##endif +{ + + ////////////////////////////////////////////////////////////////// + // Facet Glue Code implementation + // @@ We are assuming that these facets are declared under the same + // module as the component (thus, we are placing this glue code + // here under the same namespace. If they are not, we will + // either be generating them in separate namespaces, or include + // some other CIDL generated files to get the glue code + // implementation. + +##foreach [facet type] in (all facet interface types in the original IDL) + class [SERVANT]_Export [facet type]_Servant : + : public virtual POA_[facet type], // full skeleton name here + public virtual PortableServer::RefCountServantBase + { + public: + // Constructor and destructor. + [facet type]_Servant (CCM_[facet type]_ptr executor, + ::Components::CCMContext_ptr ctx); + ~[facet tyep]_Servant (); + +## foreach [operation] in (all facet operations) + // Generate operation decls. +## end foreach [operation] + + // get_component implementation. + virtual CORBA::Object_ptr + _get_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + // Facet executor. + CCM_[facet type]_var executor_; + + // Context object. + ::Components::CCMContext_var ctx_; + }; +##end foreach [facet type] + + + ////////////////////////////////////////////////////////////////// + // Component specific context implementation + class [SERVANT]_Export [component name]_Context : + public virtual CCM_[component name]_Context, + public virtual TAO_Local_RefCounted_Object + { + public: + // We will allow the the servant glue code we generate to access + // our states. + friend class [component name]_Servant; + + // Ctor. + [component name]_Context (::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + [component name]_Servant *sv); + + // Dtor. + virtual ~[component name]_Context (); + + // Operations for [component name] event source, and + // receptacles defined in CCM_[component name]_Context. + +##foreach [receptacle name] with [uses type] in (list of all 'uses' interfaces) generate: +## if [receptacle name] is a simplex receptacle ('uses') + [uses type]_ptr + get_connection_[receptacle name] (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); +## else ([receptacle name] is a multiplex ('uses multiple') receptacle) + // [receptacle name]Connections typedef'ed as a sequence of + // struct [receptacle name]Connection. + [receptacle name]Connections * + get_connections_[receptacle name] (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); + ACE_THROW_SPEC ((CORBA::SystemException)); +## endif [receptacle name] +##end foreach [receptacle name] with [uses type] + +##foreach [event name] with [eventtype] in (list of all event sources) generate: + void push_[event name] ([eventtype]_ptr ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); +##end foreach [event name] with [eventtype] + + // Operations for ::Components::CCMContext + virtual ::Components::Principal_ptr + get_caller_principal (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::CCMHome_ptr + get_CCM_home (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Boolean + get_rollback_only (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + + virtual ::Components::Transaction::UserTransaction_ptr + get_user_transaction (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + + virtual CORBA::Boolean + is_caller_in_role (const char * role + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + set_rollback_only (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + + // Operations for ::Components::SessionContext interface + virtual CORBA::Object_ptr + get_CCM_object (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + protected: + // We need to generate, in protected section, stuff that manage + // connections and consumers of this component. + +##foreach [receptacle name] with [uses type] in (list of all 'uses' interfaces) generate: +## if [receptacle name] is a simplex receptacle ('uses') + // Simplex [receptacle name] connection management operations + void + connect_[receptacle name] ([uses type]_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)); + + [uses type]_ptr + disconnect_[receptacle name] (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::NoConnection)); + + // Simplex [receptacle name] connection + [uses type]_var ciao_uses_[receptacle name]_; + +## else ([receptacle name] is a multiplex ('uses multiple') receptacle) + // Multiplex [receptacle name] connection management operations + ::Components::Cookie_ptr + connect_[receptacle name] ([uses type]_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::ExceedConnectionLimit, + ::Components::InvalidConnection)); + + [uses type]_ptr + disconnect_[receptacle name] (::Components::Cookie_ptr ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::InvalidConnection)); + + // Multiplex [receptacle name] connections + + ACE_Active_Map_Manager<[uses type]_var> ciao_muses_[receptacle name]_; +## endif [receptacle name] +##end foreach [receptacle name] with [uses type] + + // Operations for emits interfaces. +##foreach [emit name] with [eventtype] in (list of all emitters) generate: + void + connect_[emit name] ([eventtype]Consumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::AlreadyConnected)); + + [eventtype]Consumer_ptr + disconnect_[emit name] (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::NoConnection)); + + [eventtype]Consumer_var ciao_emits_[emit name]_consumer_; +##end foreach [emit name] with [eventtype] + + // Operations for publishes interfaces. +##foreach [publish name] with [eventtype] in (list of all publishers) generate: + ::Components::Cookie_ptr + subscribe_[publish name] ([eventtype]Consumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + [eventtype]Consumer_ptr + unsubscribe_[publish name] (::Components::Cookie_ptr ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::InvalidConnection)); + + ACE_Active_Map_Manager<[eventtype]Consumer_var> ciao_publishes_[publish name]_map_; +##end foreach [publish name] with [eventtype] + + protected: + /// Cached component home reference. + ::Components::CCMHome_var home_; + + /// session container + ::CIAO::Session_Container *container_; + + /// Reference back to owner. + [component name]_Servant *servant_; + + /// @@ Cached component reference. + [component name]_var component_; + + }; + + ////////////////////////////////////////////////////////////////// + // Component Servant Glue code implementation + class [SERVANT]_Export [component name]_Servant + : public virtual POA_[component name], // full skeleton name here + public virtual PortableServer::RefCountServantBase + { + public: + // Ctor. + [component name]_Servant (CCM_[component name]_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c); + + // Dtor. + ~[component name]_Servant (void); + +##foreach [operation] in all supported interfaces of own component and all inherited components and attribute accessors/mutators + + // Generate the [operation] here. + +##end + + // Operations for provides interfaces. +##foreach [facet name] with [facet type] in (list of all provided interfaces) generate: + virtual [facet type]_ptr + provide_[facet name] (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); +##end foreach [facet name] with [facet type] + + // Operations for receptacles interfaces. + +##foreach [receptacle name] with [uses type] in (list of all 'uses' interfaces) generate: +## if [receptacle name] is a simplex receptacle ('uses') + // Simplex [receptacle name] connection management operations + virtual void + connect_[receptacle name] ([uses type]_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)); + + virtual [uses type]_ptr + disconnect_[receptacle name] (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::NoConnection)); + + virtual [uses type]_ptr + get_connection_[receptacle name] (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); +## else ([receptacle name] is a multiplex ('uses multiple') receptacle) + // Multiplex [receptacle name] connection management operations + virtual ::Components::Cookie_ptr + connect_[receptacle name] ([uses type]_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::ExceedConnectionLimit, + ::Components::InvalidConnection)); + + virtual [uses type]_ptr + disconnect_[receptacle name] (::Components::Cookie_ptr ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::InvalidConnection)); + + virtual [receptacle name]Connections * + get_connections_[receptacle name] (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); +## endif [receptacle name] +##end foreach [receptacle name] with [uses type] + + // Operations for consumers interfaces. +##foreach [consumer name] with [eventtype] in (list of all consumers) generate: + + // First we need to generate the event sink specific servant + class [SERVANT]_Export [eventtype]Consumer_[consumer name]_Servant + : public virtual POA_[eventtype]Consumer, // full skeleton name here + public virtual PortableServer::RefCountServantBase + { + public: + // Constructor and destructor. + [event type]Consumer_[consumer name]_Servant (CCM_[component name]_ptr executor, + CCM_[component name]_Context_ptr c); + + ~[event type]Consumer_[consumer name]_Servant (); + +## foreach [type] in ([eventtype] and all its parent eventtype, if any) + virtual void push_[type] ([type]_ptr evt + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); +## end [type] + + // Inherit from ::Compopnents::EventBConsumerBase + virtual void push_event (::Components::EventBase_ptr ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::BadEventType)); + + // get_component implementation. + virtual CORBA::Object_ptr + _get_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + // Executor + CCM_[component name]_var executor_; + + // Context object. + CCM_[component name]_Context_var ctx_; + }; + + virtual [eventtype]Consumer_ptr + get_consumer_[consumer name] (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); +##end foreach [consumer name] with [eventtype] + + // Operations for emits interfaces. +##foreach [emit name] with [eventtype] in (list of all emitters) generate: + virtual void + connect_[emit name] ([eventtype]Consumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException + ::Components::AlreadyConnected)); + + virtual [eventtype]Consumer_ptr + disconnect_[emit name] (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::NoConnection)); +##end foreach [emit name] with [eventtype] + + // Operations for publishes interfaces. +##foreach [publish name] with [eventtype] in (list of all publishers) generate: + virtual ::Components::Cookie_ptr + subscribe_[publish name] ([eventtype]Consumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual [eventtype]Consumer_ptr + unsubscribe_[publish name] (::Components::Cookie_ptr ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::InvalidConnection)); +##end foreach [publish name] with [eventtype] + + // Operations for Navigation interface + virtual CORBA::Object_ptr + provide_facet (const char * name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException , + Components::InvalidName)) ; + + virtual ::Components::FacetDescriptions * + get_all_facets (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::FacetDescriptions * + get_named_facets (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException , + Components::InvalidName)); + + virtual CORBA::Boolean + same_component (CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for Receptacles interface + virtual ::Components::Cookie_ptr + connect (const char * name, + CORBA::Object_ptr connection + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::AlreadyConnected, + Components::ExceededConnectionLimit)); + + virtual CORBA::Object_ptr + disconnect (const char * name, + Components::Cookie_ptr ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::CookieRequired, + Components::NoConnection)); + + virtual ::Components::ConnectionDescriptions * + get_connections (const char * name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::ReceptacleDescriptions * + get_all_receptacles (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::ReceptacleDescriptions * + get_named_receptacles (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + // Operations for Events interface + virtual ::Components::EventConsumerBase_ptr + get_consumer (const char * sink_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::Cookie_ptr + subscribe (const char * publisher_name, + Components::EventConsumerBase_ptr subscriber + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::ExceededConnectionLimit)); + + virtual ::Components::EventConsumerBase_ptr + unsubscribe (const char * publisher_name, + Components::Cookie_ptr ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)); + + virtual void + connect_consumer (const char * emitter_name, + Components::EventConsumerBase_ptr consumer + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::AlreadyConnected, + Components::InvalidConnection)); + + virtual ::Components::EventConsumerBase_ptr + disconnect_consumer (const char * source_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::NoConnection)); + + virtual ::Components::ConsumerDescriptions * + get_all_consumers (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::ConsumerDescriptions * + get_named_consumers (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::EmitterDescriptions * + get_all_emitters (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::EmitterDescriptions * + get_named_emitters (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::PublisherDescriptions * + get_all_publishers (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::PublisherDescriptions * + get_named_publishers (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + // Operations for CCMObject interface + virtual ::CORBA::IRObject_ptr + get_component_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::CCMHome_ptr + get_ccm_home (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::PrimaryKeyBase * + get_primary_key (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::NoKeyAvailable)); + + virtual void + configuration_complete (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidConfiguration)); + + virtual void + remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + + virtual ::Components::ComponentPortDescription * + get_all_ports (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // get_component implementation. + virtual CORBA::Object_ptr + _get_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // CIAO specific operations. + + // Activate the object in the container_ + void + _ciao_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + // My Executor. + CCM_[component name]_var executor_; + + // My Run-time Context. + [component name]_Context *context_; + + // Managing container. + ::CIAO::Session_Container *container_; + + // Cached provided interfaces. +##foreach [facet name] with [facet type] in (list of all provided interfaces) generate: + [facet type]_var provide_[facet name]_; +##end foreach [facet name] with [facet type] + +##foreach [consumer name] with [eventtype] in (list of all consumers) generate: + [eventtype]Consumer_var consumes_[consumer name]_; +##end foreach [consumer name] with [eventtype] + + }; + + + ////////////////////////////////////////////////////////////////// + // Component Home Glue code implementation + + // Foreach component home + class [SERVANT]_Export [home name]_Servant : + public virtual POA_[home name], // full skeleton name here + public virtual PortableServer::RefCountServantBase + { + public: + // Ctor. + [home name]_Servant (CCM_[home name]_ptr exe, + CIAO::Session_Container *c); + + // Dtor. + ~[home name]_Servant (void); + + // User defined and inherited operations +##foreach [operation] in (all explicit operations in [home basename] including its parents) + + // The operation decl here. + +## end foreach opeartion + + // Factory operations +##foreach [factory name] in (all factory operations in [home basename] including its parents) + // for factory operations inherit from parent home(s), they should return + // the corresponding component types their homes manage + virtual [component name]_ptr + [factory name] (.... ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::CreateFailure, + ....)); +##end foreach [factory name] + + // Finder operations +##foreach [finder name] in (all finder operations in [home basename] including its parents) + // for finder operations inherit from parent home(s), they should return + // the corresponding component types their homes manage + virtual [component name]_ptr + [finder name] (.... ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::FinderFailure, + ....)); +##end foreach [finder name] + +## if [home name] is a keyless home + + // Operations for KeylessHome interface + virtual ::Components::CCMObject_ptr + create_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)); + +## else [home basename] is keyed home with [key type] + + // We do not support key'ed home at the moment but we might + // as well generate the mapping. + virtual [component name]_ptr create ([key type]_ptr key + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::CreationFailure, + ::Components::DuplicateKeyValue, + ::Components::InvalidKey)); + + virtual [component name]_ptr + find_by_primary_key ([key type]_ptr key + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::FinderFailure, + ::Components::UnknownKeyValue, + ::Components::InvalidKey)); + + virtual void remove ([key type]_ptr key + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::RemoveFailure, + ::Components::UnknownKeyValue, + ::Components::InvalidKey)); + + virtual [key type]_ptr + get_primary_key ([component name]_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + +## endif (keyed or keyless home) + + // Operations for Implicit Home interface + virtual [component name]_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)); + + // Operations for CCMHome interface + virtual ::CORBA::IRObject_ptr + get_component_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::CORBA::IRObject_ptr + get_home_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void remove_component (Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + + protected: + // Helper method for factory operations. + [component name]_ptr + _ciao_activate_component (CCM_[component name]_ptr exe + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate_component ([component name]_ptr comp + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // My Executor. + CCM_[home name]_var executor_; + + // My Container + CIAO::Session_Container *container_; + + // Components this home manages. + ACE_Hash_Map_Manager_Ex <PortableServer::ObjectId, + [component name]_Servant*, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> component_map_; + }; + +} + +extern "C" [SERVANT]_Export ::PortableServer::Servant +create[home name]_Servant (::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + +#if defined (__ACE_INLINE__) +# include "[idl-name]_svnt.inl" +#endif /* __ACE_INLINE__ */ + + +#include "ace/post.h" +#endif /* CIAO_GLUE_SESSION_[idl-basename]_SVNT_H */ diff --git a/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.inl b/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.inl new file mode 100644 index 00000000000..0df2a043875 --- /dev/null +++ b/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.inl @@ -0,0 +1,494 @@ +// $Id$ -*- C++ -*- + +// The generated filename for files using this template shoule be +// [idl-basename]GS.i GS --> GlueSession + +// @@ Notice: [ciao module name] can expand to either CIAO_GLUE or +// CIAO_GLUE_[module name] as defined in the header file. + +/// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +/// @@@ Notice that all component and interface names need to be +/// fully qualified as we are creating a new namespace for the CIAO's +/// container glue code. +/// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +////////////////////////////////////////////////////////////////// +// Facet Glue Code implementation +// @@ We are assuming that these facets are declared under the same +// module as the component (thus, we are placing this glue code +// here under the same namespace. If they are not, we will +// either be generating them in separate namespaces, or include +// some other CIDL generated files to get the glue code +// implementation. +////////////////////////////////////////////////////////////////// + +##foreach [facet type] in (all facet interface types in the original IDL) +// Constructor and destructor. +ACE_INLINE +[ciao module name]::[facet type]_Servant::[facet type]_Servant (CCM_[facet type]_ptr executor, + ::Components::CCMContext_ptr c) + : executor_ (CCM_[facet type]::_duplicate (executor)), + ctx_ (Components::CCMContext::_duplicate (c)) +{ +} + +ACE_INLINE +[ciao module name]::[facet type]_Servant::~[facet tyep]_Servant () +{ +} + + +## foreach [operation] in (all facet operations) + +// This is only a guideline... we always relay the operation to underlying +// executor. + +ACE_INLINE [operation return_type] +[ciao module name]::[facet type]_Servant::[operation] ([operation args]) +{ + // Simply relay to executor. May not need to return the result... + return this->executor_->operation ([operation args]); +} +## end foreach [operation] + +##end foreach [facet type] + + +////////////////////////////////////////////////////////////////// +// Component specific context implementation +////////////////////////////////////////////////////////////////// + +ACE_INLINE +[ciao module name]::[component name]_Context::[component name]_Context (::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + [ciao module name]::[component name]_Servant *sv) + : home_ (::Components::CCMHome::_duplicate (home)), + container_ (c), + servant_ (sv) +{ + +} + +ACE_INLINE +[ciao module name]::[component name]_Context::~[component name]_Context () +{ +} + +// Operations for emits interfaces. +##foreach [emit name] with [eventtype] in (list of all emitters) generate: + +ACE_INLINE void +[ciao module name]::[component name]_Context::connect_[emit name] ([eventtype]Consumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::AlreadyConnected)) +{ + if (CORBA::is_nil (c)) + ACE_THROW (CORBA::BAD_PARAM ()); + + if (! CORBA::is_nil (this->ciao_emits_[emit name]_consumer_.in ())) + ACE_THROW (::Components::AlreadyConnected ()); + + this->ciao_emits_[emit name]_consumer_ = c; +} + +ACE_INLINE [eventtype]Consumer_ptr +[ciao module name]::[component name]_Context::disconnect_[emit name] (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::NoConnection)) +{ + if (CORBA::is_nil (this->ciao_emits_[emit name]_consumer_.in ())) + ACE_THROW (::Components::NoConnection ()); + + return this->ciao_emits_[emit name]_consumer_._retn (); +} + +##end foreach [emit name] with [eventtype] + +// Operations for ::Components::CCMContext +ACE_INLINE ::Components::Principal_ptr +[ciao module name]::[component name]_Context::get_caller_principal (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ We don't support Security in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +ACE_INLINE ::Components::CCMHome_ptr +[ciao module name]::[component name]_Context::get_CCM_home (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return ::Components::CCMHome::_duplicate (this->home_.in ()); +} + +ACE_INLINE CORBA::Boolean +[ciao module name]::[component name]_Context::get_rollback_only (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ We don't support Transaction in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +ACE_INLINE ::Components::Transaction::UserTransaction_ptr +[ciao module name]::[component name]_Context::get_user_transaction (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ We don't support Transaction in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +ACE_INLINE CORBA::Boolean +[ciao module name]::[component name]_Context::is_caller_in_role (const char * role + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_UNUSED_ARG (role); + + // @@ We don't support Transaction in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +ACE_INLINE void +[ciao module name]::[component name]_Context::set_rollback_only (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ We don't support Transaction in CIAO yet. + ACE_THROW (CORBA::NO_IMPLEMENT ()); +} + +////////////////////////////////////////////////////////////////// +// Component Servant Glue code implementation +////////////////////////////////////////////////////////////////// + +##foreach [operation] in all supported interfaces of own component and all inherited components and attribute accessors/mutators + +// This is only a guideline... we always relay the operation to underlying +// executor. + +ACE_INLINE [operation return_type] +[ciao module name]::[component name]_Servant::[operation] ([operation args]) +{ + // Simply relay to executor. May not need to return the result... + return this->executor_->operation ([operation args]); +} + +##end + +##foreach [receptacle name] with [uses type] in (list of all 'uses' interfaces) generate: +## if [receptacle name] is a simplex receptacle ('uses') +// Simplex [receptacle name] connection management operations +ACE_INLINE void +[ciao module name]::[component name]_Servant::connect_[receptacle name] ([uses type]_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)) +{ + this->context_->connect_[receptacle name] (c + ACE_ENV_ARG_PARAMETER); +} + +ACE_INLINE [uses type]_ptr +[ciao module name]::[component name]_Servant::disconnect_[receptacle name] (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::NoConnection)) +{ + return this->context_->disconnect_[receptacle name] (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +ACE_INLINE [uses type]_ptr +[ciao module name]::[component name]_Servant::get_connection_[receptacle name] (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->context_->get_connection_[receptacle name] (ACE_ENV_SINGLE_ARG_PARAMETER); +} +## else ([receptacle name] is a multiplex ('uses multiple') receptacle) + +// Multiplex [receptacle name] connection management operations +ACE_INLINE ::Components::Cookie_ptr +[ciao module name]::[component name]_Servant::connect_[receptacle name] ([uses type]_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::ExceedConnectionLimit, + ::Components::InvalidConnection)) +{ + return this->context_->connect_[receptacle name] (c + ACE_ENV_ARG_PARAMETER); +} + +ACE_INLINE [uses type]_ptr +[ciao module name]::[component name]_Servant::disconnect_[receptacle name] (::Components::Cookie_ptr ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::InvalidConnection)) +{ + return this->context_->disconnect_[receptacle name] (ck + ACE_ENV_ARG_PARAMETER); +} + +ACE_INLINE [receptacle name]Connections * +[ciao module name]::[component name]_Servant::get_connections_[receptacle name] (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->context_->get_connections_[receptacle name] (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +## endif [receptacle name] +##end foreach [receptacle name] with [uses type] + +////////////////////////////////////////////////////////////////// +// EventConsumer Glue Code implementation +// @@ We are assuming that these consumers are declared under the same +// module as the component (thus, we are placing this glue code +// here under the same namespace. If they are not, we will +// either be generating them in separate namespaces, or include +// some other CIDL generated files to get the glue code +// implementation. +////////////////////////////////////////////////////////////////// + +##foreach [consumer name] with [eventtype] in (list of all consumers) generate: + +// Constructor and destructor. +ACE_INLINE +[ciao module name]::[component name]_Servant::[eventtype]Consumer_[consumer name]_Servant::[eventtype]Consumer_[consumer name]_Servant + (CCM_[component name]_ptr executor, + CCM_[component name]_Context_ptr c) + : executor_ (CCM_[component name]::_duplicate (executor)), + ctx_ (CCM_[component name]_Context::_duplicate (c)) +{ +} + +ACE_INLINE +[ciao module name]::[component name]_Servant::[eventtype]Consumer_[consumer name]_Servant::~[eventtype]Consumer_[consumer name]_Servant () +{ +} + +ACE_INLINE CORBA::Object_ptr +[ciao module name]::[component name]_Servant::[eventtype]Consumer_[consumer name]_Servant::_get_component (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->ctx_->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +ACE_INLINE void +[ciao module name]::[component name]_Servant::[eventtype]Consumer_[consumer name]_Servant::push_[eventtype] + ([eventtype]_ptr evt + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->executor_->push_[consumer name] (evt + ACE_ENV_ARG_PARAMETER); +} + +## foreach [type] in (all parents of eventtype, if any, not including EventConsumerBase) +ACE_INLINE void +[ciao module name]::[component name]_Servant::[eventtype]Consumer_[consumer name]_Servant::push_[type] + ([type]_ptr evt + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ Problem, there's no way to handle this case. + + // this->executor_->push_[consumer name] (evt ACE_ENV_ARG); + ACE_THROW (::CORBA::BAD_PARAM ()); +} +## end [type] + +##end foreach [consumer name] + +// Operations for emits interfaces. +##foreach [emit name] with [eventtype] in (list of all emitters) generate: +ACE_INLINE void +[ciao module name]::[component name]_Servant::connect_[emit name] ([eventtype]Consumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException + ::Components::AlreadyConnected)) +{ + this->context_->connect_[emit name] (c + ACE_ENV_ARG_PARAMETER); +} + +ACE_INLINE [eventtype]Consumer_ptr +[ciao module name]::[component name]_Servant::disconnect_[emit name] (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::NoConnection)) +{ + return this->context_->disconnect_[emit name] (ACE_ENV_SINGLE_ARG_PARAMETER); +} +##end foreach [emit name] with [eventtype] + +// Operations for publishes interfaces. +##foreach [publish name] with [eventtype] in (list of all publishers) generate: +ACE_INLINE ::Components::Cookie_ptr +[ciao module name]::[component name]_Servant::subscribe_[publish name] ([eventtype]Consumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::ExceededConnectionLimit)) +{ + return this->context_->subscribe_[publish name] (c + ACE_ENV_ARG_PARAMETER); +} + +ACE_INLINE [eventtype]Consumer_ptr +[ciao module name]::[component name]_Servant::unsubscribe_[publish name] (::Components::Cookie_ptr ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::InvalidConnection)) +{ + return this->context_->unsubscribe_[publish name] (ck + ACE_ENV_ARG_PARAMETER); +} +##end foreach [publish name] with [eventtype] + +////////////////////////////////////////////////////////////////// +// Component Home Glue code implementation +////////////////////////////////////////////////////////////////// + +ACE_INLINE +[ciao module name]::[home name]_Servant::[home name]_Servant (CCM_[home name]_ptr exe, + CIAO::Session_Container *c) + : executor_ (CCM_[home name]::_duplicate (exe)), + container_ (c) +{ +} + +ACE_INLINE +[ciao module name]::[home name]_Servant::~[home name]_Servant (void) +{ +} + +##foreach [operation] in (all explicit operations in [home basename] including its parents) + +// The operation impl here. This can simply be relayed to the underlying executor... + +## end foreach opeartion + +##foreach [factory name] in (all factory operations in [home basename] including its parents) +// for factory operations inherit from parent home(s), they should return +// the corresponding component types their homes manage +ACE_INLINE [component name]_ptr +[ciao module name]::[home name]_Servant::[factory name] (.... ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::CreateFailure, + ....)) +{ + Components::EnterpriseComponent_var _ciao_ec = + this->executor_->[factory name] (.... ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + CCM_[component name]_var _ciao_comp + = CCM_[component name]::_narrow (_ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return this->_ciao_activate_component (_ciao_comp.in () + ACE_ENV_ARG_PARAMETER); +} +##end foreach [factory name] + +##foreach [finder name] in (all finder operations in [home basename] including its parents) +// for finder operations inherit from parent home(s), they should return +// the corresponding component types their homes manage +ACE_INLINE [component name]_ptr +[ciao module name]::[home name]_Servant::[finder name] (.... ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::FinderFailure, + ....)) +{ + Components::EnterpriseComponent_var com = + this->executor_->[finder name] (.... ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + // Do we create a new object reference referring to the same object, + // or do we try to create a different objref referring to the same object? + return this->_ciao_create_helper (com + ACE_ENV_ARG_PARAMETER); +} +##end foreach [finder name] + +## if [home name] is a keyless home + +// Operations for KeylessHome interface +ACE_INLINE ::Components::CCMObject_ptr +[ciao module name]::[home name]_Servant::create_component (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)) +{ + // Simply forward to the create method. + return this->create (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +## else [home basename] is keyed home with [key type] + +// We do not support key'ed home at the moment but we might +// as well generate the mapping. +ACE_INLINE [component name]_ptr +[ciao module name]::[home name]_Servant::create ([key type]_ptr key) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::CreationFailure, + ::Components::DuplicateKeyValue, + ::Components::InvalidKey)) +{ + // @@ TO-DO when we suppor keyed home. + + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +ACE_INLINE [component name]_ptr +[ciao module name]::[home name]_Servant::find_by_primary_key ([key type]_ptr key) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::FinderFailure, + ::Components::UnknownKeyValue, + ::Components::InvalidKey)) +{ + // @@ TO-DO when we suppor keyed home. + + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + + +ACE_INLINE void +[ciao module name]::[home name]_Servant::remove ([key type]_ptr key) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::RemoveFailure, + ::Components::UnknownKeyValue, + ::Components::InvalidKey)) +{ + // @@ TO-DO when we suppor keyed home. + + ACE_THROW (CORBA::NO_IMPLEMENT ()); +} + +ACE_INLINE [key type]_ptr +[ciao module name]::[home name]_Servant::get_primary_key ([component name]_ptr comp) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ TO-DO when we suppor keyed home. + + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +## endif (keyed or keyless home) + + +// Operations for CCMHome interface +ACE_INLINE ::CORBA::IRObject_ptr +[ciao module name]::[home name]_Servant::get_component_def (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ TO-DO. Contact IfR? + + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +ACE_INLINE CORBA::IRObject_ptr +[ciao module name]::[home name]_Servant::get_home_def (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ TO-DO. Contact IfR? + + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} diff --git a/TAO/CIAO/docs/templates/Executor.idl b/TAO/CIAO/docs/templates/Executor.idl new file mode 100644 index 00000000000..259bffac0df --- /dev/null +++ b/TAO/CIAO/docs/templates/Executor.idl @@ -0,0 +1,246 @@ +// $Id$ + +// =========================================================== +// +// @file Executor.idl +// +// The purpose of this IDL file is to serve as a template for the CIDL +// generated equivalent executor file. The CIDL will generate this +// file directly which, in turn, gets compiled by the TAO IDL compiler +// to generate the C++ mappings for the stuff defined in this file +// into a set of [idl-name]EC.{h,inl,cpp} files. +// +// This intermediate step is necessary because component implemenetors +// will need to extend these executor definitions (thru inheritance) +// to implemenet more complex executor implementations, such as those +// that support session component interface. (This is necessary to +// properly support C++ mapping for features such as interface +// narrowing.) +// +// What are missing in the template for executor mappings are the +// exception specifications for most operations. +// +// @author Nanbor Wang <nanbor@cs.wustl.edu> +// +// =========================================================== + +#ifndef [component_idl]E_IDL +#define [component_idl]E_IDL + +#include "CCM_Container.idl" // Found in $(CIAO_ROOT)/ciao + // For various definitions of container + // internal/callback interfaces +#include "[component_idl].idl" // Original component IDL definition +// @@ We may need to include other *E.idl here.... Can't figure out +// if we can do this automagically or not. + +##if there are module definitions, preserve them all +module [module_name] { +##endif + +//////////////////////////////////////////////////////////////////// +//// * Iterate thru all supported interface types +//// It's possible that we need to put some of the common supported +//// interface definitions into a separate compilation unit. How do we +//// specify that in CCIDL? I haven't figured that out. Perhaps +//// allowing CCIDL to compile files that contain no component +//// definition? +##foreach [interface_type] in (types of all supported interface) generate: + + local interface CCM_[interface_type] : [interface_type] + { + }; + +##end foreach [interface_type] + +//////////////////////////////////////////////////////////////////// +//// * Iterate thru all facet ('provides' interface) interface types +//// It's possible that we need to put some of the common facet +//// definitions into a separate compilation unit. How do we +//// specify that in CCIDL? I haven't figured that out. Perhaps +//// allowing CCIDL to compile files that contain no component +//// definition? +##foreach [facet_interface_type] in (types of all facets) generate: + + local interface CCM_[facet_interface_type] : [facet_interface_type] + { + }; + +##end foreach [facet_interface_type] + +//////////////////////////////////////////////////////////////////// +//// * Iterate thru all event ('emits', "publishes', or 'consumes') types +//// It's possible that we need to put some of the EventConsumer +//// definitions into a separate compilation unit. Like in the case +//// of facets interface mappings, how do we +//// specify that in CCIDL? I haven't figured that out. Perhaps +//// allowing CCIDL to compile files that contain no component +//// definition? + +##foreach [eventtype] in (all eventtypes) generate: + + local interface CCM_[eventtype]Consumer + { + void push (in [eventtype] ev); + }; + +##end foreach [eventtype] + + +//////////////////////////////////////////////////////////////////// +//// * Iterate thru all component definitions in the IDL files. +//// Notice that there's no distinction between entity and session +//// components in executor mappings. + +##foreach [component basename] in (all component definitions) generate: + + // Component Main Executor Interface. We currently do not + // support Executor-based implementation. + + local interface CCM_[component basename]_Executor + : +## if [component basename] inherits from [parent component name] + CCM_[parent component name]_Executor +## else + ::Components::EnterpriseComponent +## endif +## foreach [interface name] in (all component supported interfaces) generate: + , [interface name] +## end foreach [interface name] + + { +## foreach [attribute definition] in (attributes defined in [component basename]) generate: + [attribute definition]; +## end foreach [attribute definition] + + }; + + // Monolithic component executor. + // For implementing monolithic component call back interface. + + local interface CCM_[component basename] + : +## if [component basename] inherits from [parent component name] + CCM_[parent component name] +## else + ::Components::EnterpriseComponent +## endif +## foreach [interface name] in (all component supported interfaces) generate: + , [interface name] +## end foreach [interface name] + + { +## foreach [attribute definition] in (attributes defined in [component basename]) generate: + [attribute definition]; +## end foreach [attribute definition] + +## foreach [facet name] with [facet type] in (list of all provided interfaces) generate: + CCM_[facet type] get_[facet name] (); +## end foreach [facet name] with [facet type] + +## foreach [event name] with [eventtype] in (list of all event sinks) generate: + void push_[event name] (in [eventtype] ev); +## end foreach [event name] with [eventtype] + + }; + + /** + * Component Context Interface + * + * Notice that we are taking a shortcut here to inherit the + * component-specific context from SessionContext directly instead + * of CCMContext. + */ + local interface CCM_[component basename]_Context + : +## if [component basename] inherits from [parent component name] + CCM_[parent component name]_Context +## else + ::Components::SessionContext +## endif + { + +## foreach [receptacle name] with [uses type] in (list of all 'uses' interfaces) generate: +## if [receptacle name] is a simplex receptacle ('uses') + [uses type] get_connection_[receptacle name] (); +## else ([receptacle name] is a multiplex ('uses multiple') receptacle) + // [receptacle name]Connections typedef'ed as a sequence of + // struct [receptacle name]Connection. + [receptacle name]Connections get_connections_[receptacle name] (); +## endif [receptacle name] +## end foreach [receptacle name] with [uses type] + +## foreach [event name] with [eventtype] in (list of all event sources) generate: + void push_[event name] (in [eventtype] ev); +## end foreach [event name] with [eventtype] + + }; + +##end foreach [component basename] + + +//////////////////////////////////////////////////////////////////// +//// * Iterate thru all home definitions in the IDL files. + +##foreach [home basename] in (all home definitions) generate: + + local interface CCM_[home basename]Explicit + : +## if [home basename] inherits from [parent home name] + CCM_[parent home name]Explicit +## else + ::Components::HomeExecutorBase +## endif +## foreach [interface name] in (all home supported interfaces) generate: + , [interface name] +## end foreach [interface name] + { +##foreach [operation] in (all explicit operations defined in [home basename]) + + // The operation decl here. + +## end foreach opeartion + +##foreach [factory name] in (all factory operations defined in [home basename]) + ::Components::EnterpriseComponent [factory name] (....) + raise (Components::CreateFailure, ....); +##end foreach [factory name] + +##foreach [finder name] in (all finder operations defined in [home basename]) + ::Components::EnterpriseComponent [finder name] (....) + raise (Components::FinderFailure, ....); +##end foreach [finder name] + }; + + local interface CCM_[home basename]Implicit + { +## if [home basename] is a keyless home + ::Components::EnterpriseComponent create () + raises (::Components::CCMException); +## else [home basename] is key'ed home with [key type] + // We do not support key'ed home at the moment but we might + // as well generate the mapping. + ::Components::EnterpriseComponent create (in [key type] key) + raises (::Components::CCMException); + + ::Components::EnterpriseComponent find_by_primary_key (in [key type] key) + raises (::Components::CCMException); + + void remove (in [key type] key) + raises (::Components::CCMException); +## endif (key'ed or keyless home) + }; + + local interface CCM_[home basename] + : CCM_[home basename]Explicit, + CCM_[home basename]Implicit + { + }; + +##end foreach [home basename] + +##if there are module definitions, preserve them all +}; +##endif + +#endif /* [component_idl]E_IDL */ diff --git a/TAO/CIAO/docs/templates/cidl_template.cidl b/TAO/CIAO/docs/templates/cidl_template.cidl new file mode 100644 index 00000000000..3d359708f32 --- /dev/null +++ b/TAO/CIAO/docs/templates/cidl_template.cidl @@ -0,0 +1,31 @@ +// $Id$ -*- C++ -*- + +/** + * @file cidl_template.cidl + * + * This file show an example cidl file. + */ + +// @@ We do not support import (yet). +//import [component module]; + +// [idl-basename] contains the IDL3 definitions for component(s) and +// home(s) and the interfaces that they need. + +#include "[idl-basename].idl" + +// We only support a simple session implementation definition, for +// now. @@ What is the relation of various names here and the +// generated names we used in the glue code? +composition session [composition name] +{ + home executor [home executor name] + { + implement [home name]; + manages [component executor name]; + }; +}; + + +// @@ We should also generate somet sort of implementaion template for +// users. E.g., a set of [idl-basename]_impl.* and the MPC files(?). diff --git a/TAO/CIAO/examples/handcrafted/Display/Configuration-0.png b/TAO/CIAO/examples/handcrafted/Display/Configuration-0.png Binary files differnew file mode 100644 index 00000000000..1a52e073df1 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/Configuration-0.png diff --git a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS.idl b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS.idl new file mode 100644 index 00000000000..8a2f2f50361 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS.idl @@ -0,0 +1,25 @@ +// $Id$ + +/** + * @file GPS.idl + * + * Definition of the GPS component. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#include "../HUDisplay.idl" + +module HUDisplay +{ + component GPS + { + provides position MyLocation; + publishes tick Ready; + consumes tick Refresh; + }; + + home GPSHome manages GPS + { + }; +}; diff --git a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS.mpc b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS.mpc new file mode 100644 index 00000000000..43d6dd6d847 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS.mpc @@ -0,0 +1,74 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -l .. -p HUDisplay -i GPS" +// This file has been manually modified to add a second component implementation. + +project(GPS_stub): ciao_client { + depends += HUDisplay_stub + sharedname = GPS_stub + idlflags += -Wb,stub_export_macro=GPS_STUB_Export -Wb,stub_export_include=GPS_stub_export.h -Wb,skel_export_macro=GPS_SVNT_Export -Wb,skel_export_include=GPS_svnt_export.h + dllflags = GPS_STUB_BUILD_DLL + + IDL_Files { + GPS.idl + } + + Source_Files { + GPSC.cpp + } +} + +project(GPS_svnt) : ciao_server { + depends += HUDisplay_svnt GPS_stub + sharedname = GPS_svnt + libs += GPS_stub HUDisplay_stub HUDisplay_svnt + libpaths += .. + idlflags += -Wb,export_macro=GPS_SVNT_Export -Wb,export_include=GPS_svnt_export.h + dllflags = GPS_SVNT_BUILD_DLL + + IDL_Files { + GPSE.idl + } + + Source_Files { + GPSEC.cpp + GPSS.cpp + GPS_svnt.cpp + } +} + + +project(GPS_exec) : ciao_server { + depends += GPS_svnt + sharedname = GPS_exec + libs += GPS_stub GPS_svnt HUDisplay_stub HUDisplay_svnt + libpaths += .. + idlflags += -Wb,export_macro=GPS_EXEC_Export -Wb,export_include=GPS_exec_export.h + dllflags = GPS_EXEC_BUILD_DLL + + IDL_Files { + GPSEI.idl + } + + Source_Files { + GPSEIC.cpp + GPS_exec.cpp + } +} + +project(GPS_tracing_exec) : ciao_server { + depends += GPS_svnt + sharedname = GPS_tracing_exec + libs += GPS_stub GPS_svnt HUDisplay_stub HUDisplay_svnt + libpaths += .. + idlflags += -Wb,export_macro=GPS_EXEC_Export -Wb,export_include=GPS_exec_export.h + dllflags = GPS_EXEC_BUILD_DLL + + IDL_Files { + GPSEI.idl + } + + Source_Files { + GPSEIC.cpp + GPS_tracing_exec.cpp + } +} diff --git a/TAO/CIAO/examples/handcrafted/Display/GPS/GPSE.idl b/TAO/CIAO/examples/handcrafted/Display/GPS/GPSE.idl new file mode 100644 index 00000000000..44b08652d0e --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/GPS/GPSE.idl @@ -0,0 +1,75 @@ +// $Id$ + +// =========================================================== +// +// @file GPSE.idl +// +// Generated based on $(CIAO_ROOT)/docs/templates/Executor.idl +// +// @author Nanbor Wang <nanbor@cs.wustl.edu> +// +// =========================================================== + +#ifndef GPSE_IDL +#define GPSE_IDL + +#include "CCM_Container.idl" // Found in $(CIAO_ROOT)/ciao + // For various definitions of container + // internal/callback interfaces +#include "GPS.idl" // Original component IDL definition +#include "../HUDisplayE.idl" + +module HUDisplay { + + // Component Main Executor Interface. We currently do not + // support Executor-based implementation. + + local interface CCM_GPS_Executor + : ::Components::EnterpriseComponent + { + }; + + // Monolithic component executor. + // For implementing monolithic component call back interface. + + local interface CCM_GPS + : ::Components::EnterpriseComponent + { + CCM_position get_MyLocation (); + + void push_Refresh (in tick ev); + }; + + /** + * Component Context Interface + * + * Notice that we are taking a shortcut here to inherit the + * component-specific context from SessionContext directly instead + * of CCMContext. + */ + local interface CCM_GPS_Context + : Components::SessionContext + { + void push_Ready (in tick ev); + }; + + local interface CCM_GPSHomeExplicit + : ::Components::HomeExecutorBase + { + }; + + local interface CCM_GPSHomeImplicit + { + ::Components::EnterpriseComponent create () + raises (::Components::CCMException); + }; + + local interface CCM_GPSHome + : CCM_GPSHomeExplicit, + CCM_GPSHomeImplicit + { + }; + +}; + +#endif /* GPSE_IDL */ diff --git a/TAO/CIAO/examples/handcrafted/Display/GPS/GPSEI.idl b/TAO/CIAO/examples/handcrafted/Display/GPS/GPSEI.idl new file mode 100644 index 00000000000..d7604931f58 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/GPS/GPSEI.idl @@ -0,0 +1,33 @@ +// $Id$ + +/** + * @file GPSEI.idl + * + * Definition of the GPS component implementation. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#ifndef GPSEI_IDL +#define GPSEI_IDL + +#include "GPSE.idl" + +module HUDisplay +{ + /** + * @interface GPS_Exec + * + * The actually GPS executor inherits from both CCM_GPS and + * CCM_position interfaces as a monolithic implementation. + */ + local interface GPS_Exec : + CCM_GPS, + CCM_position, + Components::SessionComponent + { + }; + +}; + +#endif /* GPSEI_IDL */ diff --git a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_exec.cpp b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_exec.cpp new file mode 100644 index 00000000000..595fb77390f --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_exec.cpp @@ -0,0 +1,131 @@ +// $Id$ + +#include "GPS_exec.h" + +#define DISPLACEMENT 256 + +/// Default constructor. +MyImpl::GPS_exec_i::GPS_exec_i () +{ + ACE_OS::srand ((u_int) ACE_OS::time ()); + this->positionx_ = ACE_OS::rand (); + this->positiony_ = ACE_OS::rand (); +} + +/// Default destructor. +MyImpl::GPS_exec_i::~GPS_exec_i () +{ +} + +// Operations from HUDisplay::GPS + +HUDisplay::CCM_position_ptr +MyImpl::GPS_exec_i::get_MyLocation (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return HUDisplay::CCM_position::_duplicate (this); +} + +void +MyImpl::GPS_exec_i::push_Refresh (HUDisplay::tick_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // Refresh position + this->positionx_ += ACE_OS::rand () % DISPLACEMENT - (DISPLACEMENT/2); + this->positiony_ += ACE_OS::rand () % DISPLACEMENT - (DISPLACEMENT/2); + + // Nitify others + HUDisplay::tick_var event = new OBV_HUDisplay::tick; + + this->context_->push_Ready (event + ACE_ENV_ARG_PARAMETER); +} + +// Operations from HUDisplay::position + +CORBA::Long +MyImpl::GPS_exec_i::posx (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->positionx_; +} + +CORBA::Long +MyImpl::GPS_exec_i::posy (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->positiony_; +} + +// Operations from Components::SessionComponent +void +MyImpl::GPS_exec_i::set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_exec_i::set_session_context\n")); + + this->context_ = + HUDisplay::CCM_GPS_Context::_narrow (ctx + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (this->context_.in ())) + ACE_THROW (CORBA::INTERNAL ()); + // Urm, we actually discard exceptions thown from this operation. +} + +void +MyImpl::GPS_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_exec_i::ccm_activate\n")); +} + +void +MyImpl::GPS_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_exec_i::ccm_passivate\n")); +} + +void +MyImpl::GPS_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_exec_i::ccm_remove\n")); +} + +/// Default ctor. +MyImpl::GPSHome_exec_i::GPSHome_exec_i () +{ +} + +/// Default dtor. +MyImpl::GPSHome_exec_i::~GPSHome_exec_i () +{ +} + +// Explicit home operations. + +// Implicit home operations. + +::Components::EnterpriseComponent_ptr +MyImpl::GPSHome_exec_i::create (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + return new MyImpl::GPS_exec_i; +} + + +extern "C" GPS_EXEC_Export ::Components::HomeExecutorBase_ptr +createGPSHome_Impl (void) +{ + return new MyImpl::GPSHome_exec_i; +} diff --git a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_exec.h b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_exec.h new file mode 100644 index 00000000000..6bd314e7e3b --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_exec.h @@ -0,0 +1,127 @@ +// $Id$ + +/** + * @file GPS_exec.h + * + * Header file for the actual GPS and GPSHome component + * implementations. These classes are the implementations of local + * interfaces defined in GPSEI.idl. + * + * @author Nanbor Wang <nanbor@cse.wustl.edu> + */ + +#ifndef GPS_EXEC_H +#define GPS_EXEC_H + +#include "GPSEIC.h" +#include "tao/LocalObject.h" + +// The namespace name for the actual implementation classes doesn't +// really matter. Since there may be several different +// implementations for a component, they can very well be in different +// namespaces. +namespace MyImpl +{ + /** + * @class GPS_exec_i + * + * An example RateGen executor implementation class. + */ + class GPS_EXEC_Export GPS_exec_i : + public virtual HUDisplay::GPS_Exec, + // CIAO container implementation depends on correct reference + // counting of local interfaces, so we take a short cut to + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default constructor. + GPS_exec_i (); + + /// Default destructor. + ~GPS_exec_i (); + + // Operations from HUDisplay::GPS + + virtual HUDisplay::CCM_position_ptr + get_MyLocation (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + push_Refresh (HUDisplay::tick_ptr ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations from HUDisplay::position + + virtual CORBA::Long + posx (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Long + posy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations from Components::SessionComponent + + virtual void + set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + protected: + CORBA::Long positionx_; + CORBA::Long positiony_; + + /// Copmponent specific context + HUDisplay::CCM_GPS_Context_var context_; + }; + + /** + * @class GPSHome_exec_i + * + * GPS home executor implementation class. + */ + class GPS_EXEC_Export GPSHome_exec_i : + public virtual HUDisplay::CCM_GPSHome, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default ctor. + GPSHome_exec_i (); + + /// Default dtor. + ~GPSHome_exec_i (); + + // Explicit home operations. + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + }; + +} + +// Executor DLL entry point. CIAO's deployment and assembly framework +// invokes this function on the resulting DLL to get the home executor. +extern "C" GPS_EXEC_Export ::Components::HomeExecutorBase_ptr +createGPSHome_Impl (void); + +#endif /* GPS_EXEC_H */ diff --git a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_exec_export.h b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_exec_export.h new file mode 100644 index 00000000000..a4fec34a45d --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_exec_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl GPS_EXEC +// ------------------------------ +#ifndef GPS_EXEC_EXPORT_H +#define GPS_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (GPS_EXEC_HAS_DLL) +# define GPS_EXEC_HAS_DLL 1 +#endif /* ! GPS_EXEC_HAS_DLL */ + +#if defined (GPS_EXEC_HAS_DLL) && (GPS_EXEC_HAS_DLL == 1) +# if defined (GPS_EXEC_BUILD_DLL) +# define GPS_EXEC_Export ACE_Proper_Export_Flag +# define GPS_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define GPS_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* GPS_EXEC_BUILD_DLL */ +# define GPS_EXEC_Export ACE_Proper_Import_Flag +# define GPS_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define GPS_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* GPS_EXEC_BUILD_DLL */ +#else /* GPS_EXEC_HAS_DLL == 1 */ +# define GPS_EXEC_Export +# define GPS_EXEC_SINGLETON_DECLARATION(T) +# define GPS_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* GPS_EXEC_HAS_DLL == 1 */ + +// Set GPS_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (GPS_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define GPS_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define GPS_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !GPS_EXEC_NTRACE */ + +#if (GPS_EXEC_NTRACE == 1) +# define GPS_EXEC_TRACE(X) +#else /* (GPS_EXEC_NTRACE == 1) */ +# define GPS_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (GPS_EXEC_NTRACE == 1) */ + +#endif /* GPS_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_stub_export.h b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_stub_export.h new file mode 100644 index 00000000000..cce11e5fdc7 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_stub_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl GPS_STUB +// ------------------------------ +#ifndef GPS_STUB_EXPORT_H +#define GPS_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (GPS_STUB_HAS_DLL) +# define GPS_STUB_HAS_DLL 1 +#endif /* ! GPS_STUB_HAS_DLL */ + +#if defined (GPS_STUB_HAS_DLL) && (GPS_STUB_HAS_DLL == 1) +# if defined (GPS_STUB_BUILD_DLL) +# define GPS_STUB_Export ACE_Proper_Export_Flag +# define GPS_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define GPS_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* GPS_STUB_BUILD_DLL */ +# define GPS_STUB_Export ACE_Proper_Import_Flag +# define GPS_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define GPS_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* GPS_STUB_BUILD_DLL */ +#else /* GPS_STUB_HAS_DLL == 1 */ +# define GPS_STUB_Export +# define GPS_STUB_SINGLETON_DECLARATION(T) +# define GPS_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* GPS_STUB_HAS_DLL == 1 */ + +// Set GPS_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (GPS_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define GPS_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define GPS_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !GPS_STUB_NTRACE */ + +#if (GPS_STUB_NTRACE == 1) +# define GPS_STUB_TRACE(X) +#else /* (GPS_STUB_NTRACE == 1) */ +# define GPS_STUB_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (GPS_STUB_NTRACE == 1) */ + +#endif /* GPS_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_svnt.cpp b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_svnt.cpp new file mode 100644 index 00000000000..190e32ea4b0 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_svnt.cpp @@ -0,0 +1,857 @@ +// $Id$ + +// The generated filename for files using this template shoule be +// GPSGS.cpp GS --> GlueSession + + +#include "GPS_svnt.h" +#include "../HUDisplay_svnt.h" +#include "Cookies.h" + +#if !defined (__ACE_INLINE__) +# include "GPS_svnt.inl" +#endif /* __ACE_INLINE__ */ + +void +CIAO_GLUE_HUDisplay::GPS_Context::push_Ready (HUDisplay::tick_ptr ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_Active_Map_Manager<HUDisplay::tickConsumer_var>::iterator + end = this->ciao_publishes_Ready_map_.end (); + for (ACE_Active_Map_Manager<HUDisplay::tickConsumer_var>::iterator + iter = this->ciao_publishes_Ready_map_.begin (); + iter != end; + ++iter) + { + ACE_Active_Map_Manager<HUDisplay::tickConsumer_var>::ENTRY &entry = *iter; + HUDisplay::tickConsumer_var c + = HUDisplay::tickConsumer::_narrow (entry.int_id_.in ()); + c->push_tick (ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } +} + +// Operations for publishes interfaces. +::Components::Cookie_ptr +CIAO_GLUE_HUDisplay::GPS_Context::subscribe_Ready (HUDisplay::tickConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::ExceededConnectionLimit)) +{ + if (CORBA::is_nil (c)) + ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + + HUDisplay::tickConsumer_var sub + = HUDisplay::tickConsumer::_duplicate (c); + + ACE_Active_Map_Manager_Key key; + this->ciao_publishes_Ready_map_.bind (sub.in (), + key); + + sub._retn (); // Release ownership. + + ::Components::Cookie_var retv = new CIAO::Map_Key_Cookie (key); + return retv._retn (); +} + +HUDisplay::tickConsumer_ptr +CIAO_GLUE_HUDisplay::GPS_Context::unsubscribe_Ready (::Components::Cookie_ptr ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::InvalidConnection)) +{ + HUDisplay::tickConsumer_var retv; + + ACE_Active_Map_Manager_Key key; + if (ck == 0 || + CIAO::Map_Key_Cookie::extract (ck, key) == -1) + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + + if (this->ciao_publishes_Ready_map_.unbind (key, + retv) != 0) + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + + return retv._retn (); +} + +// Operations for ::Components::SessionContext interface +CORBA::Object_ptr +CIAO_GLUE_HUDisplay::GPS_Context::get_CCM_object (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ How do I check for IllegalState here? When it's not in a + // callback operation... + // ACE_THROW_RETURN (::Components::IllegalState (), 0); + + if (CORBA::is_nil (this->component_.in ())) + { + CORBA::Object_var obj = this->container_->get_objref (this->servant_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + this->component_ = HUDisplay::GPS::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (this->component_.in ())) + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); // This should not happen... + } + return HUDisplay::GPS::_duplicate (this->component_.in ()); +} + +////////////////////////////////////////////////////////////////// +// Component Servant Glue code implementation +////////////////////////////////////////////////////////////////// + +CIAO_GLUE_HUDisplay::GPS_Servant::GPS_Servant (HUDisplay::CCM_GPS_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c) + : executor_ (HUDisplay::CCM_GPS::_duplicate (exe)), + container_ (c) +{ + this->context_ = new CIAO_GLUE_HUDisplay::GPS_Context (h, c, this); + + ACE_TRY_NEW_ENV + { + Components::SessionComponent_var scom = + Components::SessionComponent::_narrow (exe + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (! CORBA::is_nil (scom.in ())) + scom->set_session_context (this->context_ + ACE_ENV_ARG_PARAMETER); + } + ACE_CATCHANY + { + // @@ Ignore any exceptions? What happens if + // set_session_context throws an CCMException? + } + ACE_ENDTRY; +} + +CIAO_GLUE_HUDisplay::GPS_Servant::~GPS_Servant (void) +{ + ACE_TRY_NEW_ENV + { + Components::SessionComponent_var scom = + Components::SessionComponent::_narrow (this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (! CORBA::is_nil (scom.in ())) + scom->ccm_remove (ACE_ENV_SINGLE_ARG_PARAMETER); + } + ACE_CATCHANY + { + // @@ Ignore any exceptions? What happens if + // set_session_context throws an CCMException? + } + ACE_ENDTRY; + this->context_->_remove_ref (); +} + +// Operations for provides interfaces. +HUDisplay::position_ptr +CIAO_GLUE_HUDisplay::GPS_Servant::provide_MyLocation (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (CORBA::is_nil (this->provide_MyLocation_.in ())) + { + HUDisplay::CCM_position_var fexe + = this->executor_->get_MyLocation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (fexe.in ())) + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); + + CIAO_GLUE_HUDisplay::position_Servant *svt = + new CIAO_GLUE_HUDisplay::position_Servant (fexe.in (), + this->context_); + PortableServer::ServantBase_var safe_servant (svt); + + CORBA::Object_var obj = this->container_->install_servant (svt + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + HUDisplay::position_var fo + = HUDisplay::position::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + this->provide_MyLocation_ = fo; + } + + return HUDisplay::position::_duplicate (this->provide_MyLocation_.in ()); +} + +// Operations for consumers interfaces. +// EventConsumer Glue Code implementation + +// Inherit from ::Compopnents::EventConsumerBase +void +CIAO_GLUE_HUDisplay::GPS_Servant::tickConsumer_Refresh_Servant::push_event (Components::EventBase_ptr ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::BadEventType)) +{ + HUDisplay::tick_var ev_type = HUDisplay::tick::_downcast (ev); + if (ev_type != 0) + { + this->push_tick (ev_type.in () + ACE_ENV_ARG_PARAMETER); + return; + } + + // @@ This include the case when we receive a parent eventtype of [eventtype] + ACE_THROW (::Components::BadEventType ()); +} + +// get_component implementation. +HUDisplay::tickConsumer_ptr +CIAO_GLUE_HUDisplay::GPS_Servant::get_consumer_Refresh (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (CORBA::is_nil (this->consumes_Refresh_.in ())) + { + CIAO_GLUE_HUDisplay::GPS_Servant::tickConsumer_Refresh_Servant *svt = + new CIAO_GLUE_HUDisplay::GPS_Servant::tickConsumer_Refresh_Servant (this->executor_.in (), + this->context_); + PortableServer::ServantBase_var safe_servant (svt); + + CORBA::Object_var obj = this->container_->install_servant (svt + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + HUDisplay::tickConsumer_var eco + = HUDisplay::tickConsumer::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + this->consumes_Refresh_ = eco; + } + + return HUDisplay::tickConsumer::_duplicate (this->consumes_Refresh_.in ()); +} + +// Operations for Navigation interface +CORBA::Object_ptr +CIAO_GLUE_HUDisplay::GPS_Servant::provide_facet (const char * name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException , + Components::InvalidName)) +{ + if (name == 0) + ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + + // We simply iterate thru all the facets this component provides + // now. We can also use a hash map along with perfect hashing + // (i.e., gperf) if we need faster performance since all the provided + // interfaces are static to a component definition. + + if (ACE_OS_String::strcmp (name, "MyLocation") == 0) + return this->provide_MyLocation (ACE_ENV_SINGLE_ARG_PARAMETER); + + ACE_THROW_RETURN (::Components::InvalidName (), 0); +} + +::Components::FacetDescriptions * +CIAO_GLUE_HUDisplay::GPS_Servant::get_all_facets (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::FacetDescriptions_var collection + = new ::Components::FacetDescriptions (1); // #99 = number of all provided + // facets including those inherited + // from parent component(s). + + collection->length (1); + + ::Components::FacetDescription_var x; + CORBA::ULong i = 0; + + x = new ::OBV_Components::FacetDescription; + + x->Name ((const char *)"MyLocation"); + x->type_id ((const char *) "IDL:HUDisplay/position:1.0"); // + x->facet_ref (this->provide_MyLocation (ACE_ENV_SINGLE_ARG_PARAMETER)); + + collection[i] = x._retn (); + ++i; + + return collection._retn (); + +} + +::Components::FacetDescriptions * +CIAO_GLUE_HUDisplay::GPS_Servant::get_named_facets (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ::Components::FacetDescriptions_var collection + = new ::Components::FacetDescriptions (names.length ()); + collection->length (names.length ()); + + ::Components::FacetDescription_var x; + CORBA::ULong i = 0; + + for (; i < names.length (); ++i) + { + x = new ::OBV_Components::FacetDescription; + + // We probably need a more efficient way, e.g., a hash map, to handle all these. + if (ACE_OS_String::strcmp (names[i].in (), "MyLocation") == 0) + { + x->Name ((const char *)"MyLocation"); + x->type_id ((const char *) "IDL:HUDisplay/position:1.0"); // + x->facet_ref (this->provide_MyLocation (ACE_ENV_SINGLE_ARG_PARAMETER)); + } + else + ACE_THROW_RETURN (::Components::InvalidName (), 0); + + collection[i] = x._retn(); + } + return collection._retn (); +} + +CORBA::Boolean +CIAO_GLUE_HUDisplay::GPS_Servant::same_component (CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (CORBA::is_nil (object_ref)) + ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + + CORBA::Object_var the_other = object_ref->_get_component (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + CORBA::Object_var me = this->context_->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return me->_is_equivalent (object_ref + ACE_ENV_ARG_PARAMETER); +} + +// Operations for Receptacles interface +::Components::Cookie_ptr +CIAO_GLUE_HUDisplay::GPS_Servant::connect (const char *, + CORBA::Object_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::AlreadyConnected, + Components::ExceededConnectionLimit)) +{ + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +CORBA::Object_ptr +CIAO_GLUE_HUDisplay::GPS_Servant::disconnect (const char *, + Components::Cookie_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::CookieRequired, + Components::NoConnection)) +{ + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::ConnectionDescriptions * +CIAO_GLUE_HUDisplay::GPS_Servant::get_connections (const char * + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::ReceptacleDescriptions * +CIAO_GLUE_HUDisplay::GPS_Servant::get_all_receptacles (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::ReceptacleDescriptions_var retv = + new ::Components::ReceptacleDescriptions (0); // #99 is number of receptacles + // this component has. + return retv._retn (); +} + +::Components::ReceptacleDescriptions * +CIAO_GLUE_HUDisplay::GPS_Servant::get_named_receptacles (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ::Components::ReceptacleDescriptions_var retv = + new ::Components::ReceptacleDescriptions (names.length ()); + retv->length (names.length ()); + + CORBA::ULong i = 0; + for (; i < names.length (); ++i) + { + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + return retv._retn (); +} + +// Operations for Events interface +::Components::EventConsumerBase_ptr +CIAO_GLUE_HUDisplay::GPS_Servant::get_consumer (const char * sink_name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + // @@ We can omit this if clause if there's no event sinks in this component. + if (sink_name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + + if (ACE_OS_String::strcmp (sink_name, "Refresh") == 0) + return this->get_consumer_Refresh (ACE_ENV_SINGLE_ARG_PARAMETER); + + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::Cookie_ptr +CIAO_GLUE_HUDisplay::GPS_Servant::subscribe (const char * publisher_name, + Components::EventConsumerBase_ptr subscriber + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::ExceededConnectionLimit)) +{ + // @@ We can omit this if clause if there's no publisher in this component. + if (publisher_name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + + if (ACE_OS_String::strcmp (publisher_name, "Ready") == 0) + { + HUDisplay::tickConsumer_var _ciao_consumer = + HUDisplay::tickConsumer::_narrow (subscriber + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (_ciao_consumer.in ())) + ACE_THROW_RETURN (Components::InvalidConnection (), 0); + + return this->subscribe_Ready (_ciao_consumer.in () + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::EventConsumerBase_ptr +CIAO_GLUE_HUDisplay::GPS_Servant::unsubscribe (const char * publisher_name, + Components::Cookie_ptr ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)) +{ + // @@ We can omit this if clause if there's no publisher in this component. + if (publisher_name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + + if (ACE_OS_String::strcmp (publisher_name, "Ready") == 0) + { + return this->unsubscribe_Ready (ck + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +void +CIAO_GLUE_HUDisplay::GPS_Servant::connect_consumer (const char *, + Components::EventConsumerBase_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::AlreadyConnected, + Components::InvalidConnection)) +{ + ACE_THROW (Components::InvalidName ()); +} + +::Components::EventConsumerBase_ptr +CIAO_GLUE_HUDisplay::GPS_Servant::disconnect_consumer (const char * + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::NoConnection)) +{ + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::ConsumerDescriptions * +CIAO_GLUE_HUDisplay::GPS_Servant::get_all_consumers (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::ConsumerDescriptions_var retv = + new ::Components::ConsumerDescriptions (1); // #99 is the number of consumers + // this component has. + retv->length (1); + + CORBA::ULong i = 0; + + retv[i] = new OBV_Components::ConsumerDescription; + retv[i]->Name ("Refresh"); + retv[i]->type_id ("IDL:HUDisplay/tickConsumer:1.0"); + HUDisplay::tickConsumer_var c + = this->get_consumer_Refresh (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + retv[i]->consumer (c.in ()); + + return retv._retn (); +} + +::Components::ConsumerDescriptions * +CIAO_GLUE_HUDisplay::GPS_Servant::get_named_consumers (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ::Components::ConsumerDescriptions_var retv = + new ::Components::ConsumerDescriptions (names.length ()); + + retv->length (names.length ()); + + CORBA::ULong i = 0; + for (; i < names.length (); ++i) + { + retv[i] = new OBV_Components::ConsumerDescription; + + if (ACE_OS_String::strcmp (names[i].in (), "Refresh") == 0) + { + retv[i]->Name ("Refresh"); + retv[i]->type_id ("IDL:HUDisplay/tickConsumer:1.0"); + HUDisplay::tickConsumer_var c = + this->get_consumer_Refresh (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + retv[i]->consumer (c.in ()); + } + else + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + return retv._retn (); +} + +::Components::EmitterDescriptions * +CIAO_GLUE_HUDisplay::GPS_Servant::get_all_emitters (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::EmitterDescriptions_var retv = + new ::Components::EmitterDescriptions (0); // #99 is the number of emitters + // this component has. + return retv._retn (); +} + +::Components::EmitterDescriptions * +CIAO_GLUE_HUDisplay::GPS_Servant::get_named_emitters (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ::Components::EmitterDescriptions_var retv = + new ::Components::EmitterDescriptions (names.length ()); + retv->length (names.length ()); + + CORBA::ULong i = 0; + for (; i < names.length (); ++i) + { + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + return retv._retn (); +} + +::Components::PublisherDescriptions * +CIAO_GLUE_HUDisplay::GPS_Servant::get_all_publishers (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ to-do + + // Need to add interfaces in the Context class to gather the information. + // Or we can just relay it to the Context object. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +::Components::PublisherDescriptions * +CIAO_GLUE_HUDisplay::GPS_Servant::get_named_publishers (const Components::NameList & + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + // @@ to-do + + // Need to add interfaces in the Context class to gather the information. + // Or we can just relay it to the Context object. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +// Operations for CCMObject interface +::CORBA::IRObject_ptr +CIAO_GLUE_HUDisplay::GPS_Servant::get_component_def (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ to-do: Connect to an IfR? + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +::Components::CCMHome_ptr +CIAO_GLUE_HUDisplay::GPS_Servant::get_ccm_home (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->context_->get_CCM_home (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +::Components::PrimaryKeyBase * +CIAO_GLUE_HUDisplay::GPS_Servant::get_primary_key (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::NoKeyAvailable)) +{ + // This is a keyless component. + ACE_THROW_RETURN (::Components::NoKeyAvailable (), 0); +} + +void +CIAO_GLUE_HUDisplay::GPS_Servant::configuration_complete (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidConfiguration)) +{ + // @@ to-do + // No-op. Don't know how to pass this info to monolithic executor. +} + +void +CIAO_GLUE_HUDisplay::GPS_Servant::remove (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) +{ + // @@ to-do + // Need to figure out what to do here. E.g., tear down the all the connections + // this component has? +} + +::Components::ComponentPortDescription * +CIAO_GLUE_HUDisplay::GPS_Servant::get_all_ports (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::ComponentPortDescription_var retv = + new OBV_Components::ComponentPortDescription; + + ::Components::FacetDescriptions_var facets_desc + = this->get_all_facets (ACE_ENV_SINGLE_ARG_PARAMETER); + ::Components::ReceptacleDescriptions_var receptacle_desc + = get_all_receptacles (ACE_ENV_SINGLE_ARG_PARAMETER); + ::Components::ConsumerDescriptions_var consumer_desc + = this->get_all_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); + ::Components::EmitterDescriptions_var emitter_desc + = this->get_all_emitters (ACE_ENV_SINGLE_ARG_PARAMETER); + ::Components::PublisherDescriptions_var publisher_desc + = this->get_all_publishers (ACE_ENV_SINGLE_ARG_PARAMETER); + + retv->facets (facets_desc.in()); + retv->receptacles (receptacle_desc.in()); + retv->consumers (consumer_desc.in()); + retv->emitters (emitter_desc.in()); + retv->publishers (publisher_desc.in()); + + return retv._retn(); +} + +// get_component implementation. +CORBA::Object_ptr +CIAO_GLUE_HUDisplay::GPS_Servant::_get_component (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::SessionContext_var sc = + ::Components::SessionContext::_narrow (this->context_); + + if (! CORBA::is_nil(sc.in ())) + return sc->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + + // @@ Do we need to try the following case here? We are afterall implementing + // a session component here. + ::Components::EntityContext_var ec = + ::Components::EntityContext::_narrow (this->context_); + + if (! CORBA::is_nil(ec.in ())) + return ec->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); +} + +void +CIAO_GLUE_HUDisplay::GPS_Servant::_ciao_activate (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow (this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! CORBA::is_nil (temp.in ())) + temp->ccm_activate (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +void +CIAO_GLUE_HUDisplay::GPS_Servant::_ciao_passivate (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow (this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! CORBA::is_nil (temp.in ())) + temp->ccm_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +////////////////////////////////////////////////////////////////// +// Component Home Glue code implementation +////////////////////////////////////////////////////////////////// + +HUDisplay::GPS_ptr +CIAO_GLUE_HUDisplay::GPSHome_Servant::_ciao_activate_component (HUDisplay::CCM_GPS_ptr exe + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + CORBA::Object_var hobj + = this->container_->get_objref (this + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::CCMHome_var home + = ::Components::CCMHome::_narrow (hobj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + CIAO_GLUE_HUDisplay::GPS_Servant *svt = + new CIAO_GLUE_HUDisplay::GPS_Servant (exe, + home.in (), + this->container_); + PortableServer::ServantBase_var safe (svt); + PortableServer::ObjectId_var oid; + + CORBA::Object_var objref + = this->container_->install_component (svt, + oid.out () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + svt->_ciao_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + HUDisplay::GPS_var ho + = HUDisplay::GPS::_narrow (objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (this->component_map_.bind (oid.in (), svt) == 0) + { + // @@ what should happen if bind fail? + safe._retn (); + } + return ho._retn (); +} + +void +CIAO_GLUE_HUDisplay::GPSHome_Servant::_ciao_passivate_component (HUDisplay::GPS_ptr comp + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + PortableServer::ObjectId_var oid; + + this->container_->uninstall_component (comp, + oid.out () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + CIAO_GLUE_HUDisplay::GPS_Servant *servant = 0; + if (this->component_map_.unbind (oid.in (), servant) == 0) + { + PortableServer::ServantBase_var safe (servant); + servant->_ciao_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } + // What happen if unbind failed? + +} + +// Operations for Implicit Home interface +HUDisplay::GPS_ptr +CIAO_GLUE_HUDisplay::GPSHome_Servant::create (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)) +{ + if (this->executor_.in () == 0) + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); + + Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + HUDisplay::CCM_GPS_var _ciao_comp + = HUDisplay::CCM_GPS::_narrow (_ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return this->_ciao_activate_component (_ciao_comp.in () + ACE_ENV_ARG_PARAMETER); +} + +// Operations for CCMHome interface +void +CIAO_GLUE_HUDisplay::GPSHome_Servant::remove_component (Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) +{ + HUDisplay::GPS_var _ciao_comp + = HUDisplay::GPS::_narrow (comp + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (_ciao_comp.in ())) + ACE_THROW (CORBA::INTERNAL ()); // What is the right exception to throw here? + + // @@ It seems to me that we need to make sure this is a component + // generated by this home before calling remove on this component. + _ciao_comp->remove (ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + + // Removing the object reference? get the servant from the POA with + // the objref, and call remove() on the component, deactivate the + // component, and then remove-ref the servant? + this->_ciao_passivate_component (_ciao_comp.in () + ACE_ENV_ARG_PARAMETER); +} + +extern "C" GPS_SVNT_Export ::PortableServer::Servant +createGPSHome_Servant (::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL) +{ + if (p == 0) + return 0; + + HUDisplay::CCM_GPSHome_var x + = HUDisplay::CCM_GPSHome::_narrow (p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (x.in ())) + return 0; + + return new CIAO_GLUE_HUDisplay::GPSHome_Servant (x.in (), + c); +} diff --git a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_svnt.h b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_svnt.h new file mode 100644 index 00000000000..fccf79fc191 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_svnt.h @@ -0,0 +1,482 @@ +// $Id$ + +// =========================================================== +// +// @file GPS_svnt.h +// +// Servant Glue code (supposedly should be) generated using CIAO'S +// CIDL compiler. This file implement the servants that bridge the +// executor and the container. +// +// This file is "generated" using the template code under +// $(CIAO_ROOT)/docs/templates/ +// +// Remember to refect any changes back to the code templates. +// +// @author Nanbor Wang <nanbor@cs.wustl.edu> +// +// =========================================================== + +#ifndef CIAO_GLUE_SESSION_GPS_SVNT_H +#define CIAO_GLUE_SESSION_GPS_SVNT_H +#include "ace/pre.h" + +#include "GPSS.h" // Source in the skeletons for component + // client-view equivalent interfaces +#include "GPSEC.h" // Source in the executor mapping + // that component implementations use +#include "ciao/Container_Base.h" //Source in the container interface definitions +#include "tao/LocalObject.h" +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Active_Map_Manager_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO_GLUE_HUDisplay +{ + // Facet glue code has already been defined in ../HUDisplay_svnt.* + + + ////////////////////////////////////////////////////////////////// + // Component specific context implementation + class GPS_SVNT_Export GPS_Context : + public virtual HUDisplay::CCM_GPS_Context, + public virtual TAO_Local_RefCounted_Object + { + public: + // We will allow the the servant glue code we generate to access + // our states. + friend class GPS_Servant; + + // Ctor. + GPS_Context (::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + GPS_Servant *sv); + + // Dtor. + virtual ~GPS_Context (); + + // Operations for [component name] event source, and + // receptacles defined in CCM_[component name]_Context. + + void push_Ready (HUDisplay::tick_ptr ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for ::Components::CCMContext + virtual ::Components::Principal_ptr + get_caller_principal (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::CCMHome_ptr + get_CCM_home (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Boolean + get_rollback_only (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + + virtual ::Components::Transaction::UserTransaction_ptr + get_user_transaction (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + + virtual CORBA::Boolean + is_caller_in_role (const char * role + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + set_rollback_only (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + + // Operations for ::Components::SessionContext interface + virtual CORBA::Object_ptr + get_CCM_object (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + protected: + // We need to generate, in protected section, stuff that manage + // connections and consumers of this component. + + // Operations for emits interfaces. + + // Operations for publishes interfaces. + ::Components::Cookie_ptr + subscribe_Ready (HUDisplay::tickConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + HUDisplay::tickConsumer_ptr + unsubscribe_Ready (::Components::Cookie_ptr ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::InvalidConnection)); + + ACE_Active_Map_Manager<HUDisplay::tickConsumer_var> ciao_publishes_Ready_map_; + + protected: + /// Cached component home reference. + ::Components::CCMHome_var home_; + + /// session container + ::CIAO::Session_Container *container_; + + /// Reference back to owner. + GPS_Servant *servant_; + + /// @@ Cached component reference. + HUDisplay::GPS_var component_; + }; + + ////////////////////////////////////////////////////////////////// + // Component Servant Glue code implementation + class GPS_SVNT_Export GPS_Servant + : public virtual POA_HUDisplay::GPS, // full skeleton name here + public virtual PortableServer::RefCountServantBase + { + public: + // Ctor. + GPS_Servant (HUDisplay::CCM_GPS_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c); + + // Dtor. + ~GPS_Servant (void); + + // Operations for provides interfaces. + virtual HUDisplay::position_ptr + provide_MyLocation (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for receptacles interfaces. + + // Operations for consumers interfaces. + + // First we need to generate the event sink specific servant + class GPS_SVNT_Export tickConsumer_Refresh_Servant + : public virtual POA_HUDisplay::tickConsumer, // full skeleton name here + public virtual PortableServer::RefCountServantBase + { + public: + // Constructor and destructor. + tickConsumer_Refresh_Servant (HUDisplay::CCM_GPS_ptr executor, + HUDisplay::CCM_GPS_Context_ptr c); + ~tickConsumer_Refresh_Servant (); + + virtual void push_tick (HUDisplay::tick_ptr evt + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Inherit from ::Compopnents::EventBConsumerBase + virtual void push_event (Components::EventBase_ptr ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::BadEventType)); + + // get_component implementation. + virtual CORBA::Object_ptr + _get_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + // Consumer Executor + HUDisplay::CCM_GPS_var executor_; + + // Context object. + HUDisplay::CCM_GPS_Context_var ctx_; + }; + + virtual HUDisplay::tickConsumer_ptr + get_consumer_Refresh (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for emits interfaces. + + // Operations for publishes interfaces. + virtual ::Components::Cookie_ptr + subscribe_Ready (HUDisplay::tickConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual HUDisplay::tickConsumer_ptr + unsubscribe_Ready (::Components::Cookie_ptr ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::InvalidConnection)); + + // Operations for Navigation interface + virtual CORBA::Object_ptr provide_facet (const char * name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException , + Components::InvalidName)) ; + + virtual ::Components::FacetDescriptions * + get_all_facets (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::FacetDescriptions * + get_named_facets (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException , + Components::InvalidName)); + + virtual CORBA::Boolean same_component (CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for Receptacles interface + virtual ::Components::Cookie_ptr connect (const char * name, + CORBA::Object_ptr connection + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::AlreadyConnected, + Components::ExceededConnectionLimit)); + + virtual CORBA::Object_ptr disconnect (const char * name, + Components::Cookie_ptr ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::CookieRequired, + Components::NoConnection)); + + virtual ::Components::ConnectionDescriptions * + get_connections (const char * name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::ReceptacleDescriptions * + get_all_receptacles (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::ReceptacleDescriptions * + get_named_receptacles (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + // Operations for Events interface + virtual ::Components::EventConsumerBase_ptr + get_consumer (const char * sink_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::Cookie_ptr + subscribe (const char * publisher_name, + Components::EventConsumerBase_ptr subscriber + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::ExceededConnectionLimit)); + + virtual ::Components::EventConsumerBase_ptr + unsubscribe (const char * publisher_name, + Components::Cookie_ptr ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)); + + virtual void connect_consumer (const char * emitter_name, + Components::EventConsumerBase_ptr consumer + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::AlreadyConnected, + Components::InvalidConnection)); + + virtual ::Components::EventConsumerBase_ptr + disconnect_consumer (const char * source_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::NoConnection)); + + virtual ::Components::ConsumerDescriptions * + get_all_consumers (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::ConsumerDescriptions * + get_named_consumers (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::EmitterDescriptions * + get_all_emitters (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::EmitterDescriptions * + get_named_emitters (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::PublisherDescriptions * + get_all_publishers (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::PublisherDescriptions * + get_named_publishers (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + // Operations for CCMObject interface + virtual ::CORBA::IRObject_ptr + get_component_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::CCMHome_ptr + get_ccm_home (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::PrimaryKeyBase * + get_primary_key (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::NoKeyAvailable)); + + virtual void configuration_complete (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidConfiguration)); + + virtual void remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + + virtual ::Components::ComponentPortDescription * + get_all_ports (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // get_component implementation. + virtual CORBA::Object_ptr + _get_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // CIAO specific operations. + // Activate the object in the container_ + void + _ciao_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + // My Executor. + HUDisplay::CCM_GPS_var executor_; + + // My Run-time Context. + GPS_Context *context_; + + // Managing container. + ::CIAO::Session_Container *container_; + + // Cached provided interfaces. + HUDisplay::position_var provide_MyLocation_; + + HUDisplay::tickConsumer_var consumes_Refresh_; + }; + + + ////////////////////////////////////////////////////////////////// + // Component Home Glue code implementation + + // Foreach component home + class GPS_SVNT_Export GPSHome_Servant : + public virtual POA_HUDisplay::GPSHome, // full skeleton name here + public virtual PortableServer::RefCountServantBase + { + public: + // Ctor. + GPSHome_Servant (HUDisplay::CCM_GPSHome_ptr exe, + CIAO::Session_Container *c); + + // Dtor. + ~GPSHome_Servant (void); + + // User defined and inherited operations + + // Factory operations + + // Finder operations + + // Operations for KeylessHome interface + virtual ::Components::CCMObject_ptr + create_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)); + + // Operations for Implicit Home interface + virtual HUDisplay::GPS_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)); + + // Operations for CCMHome interface + virtual ::CORBA::IRObject_ptr + get_component_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::CORBA::IRObject_ptr + get_home_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void remove_component (Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + + protected: + // Helper method for factory operations. + HUDisplay::GPS_ptr + _ciao_activate_component (HUDisplay::CCM_GPS_ptr exe + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate_component (HUDisplay::GPS_ptr comp + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // My Executor. + HUDisplay::CCM_GPSHome_var executor_; + + // My Container + CIAO::Session_Container *container_; + + // Components this home manages. + ACE_Hash_Map_Manager_Ex <PortableServer::ObjectId, + GPS_Servant*, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> component_map_; + }; + + extern "C" GPS_SVNT_Export ::PortableServer::Servant + createGPSHome_Servant (::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); +} + +#if defined (__ACE_INLINE__) +# include "GPS_svnt.inl" +#endif /* __ACE_INLINE__ */ + + +#include "ace/post.h" +#endif /* CIAO_GLUE_SESSION_GPS_SVNT_H */ diff --git a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_svnt.inl b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_svnt.inl new file mode 100644 index 00000000000..3b666decea6 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_svnt.inl @@ -0,0 +1,197 @@ +// $Id$ -*- C++ -*- + +// The generated filename for files using this template shoule be +// [idl-basename]GS.i GS --> GlueSession + +// @@ Notice: [ciao module name] can expand to either CIAO_GLUE or +// CIAO_GLUE_[module name] as defined in the header file. + +////////////////////////////////////////////////////////////////// +// Component specific context implementation +////////////////////////////////////////////////////////////////// + +ACE_INLINE +CIAO_GLUE_HUDisplay::GPS_Context::GPS_Context (::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + CIAO_GLUE_HUDisplay::GPS_Servant *sv) + : home_ (::Components::CCMHome::_duplicate (home)), + container_ (c), + servant_ (sv) +{ +} + +ACE_INLINE +CIAO_GLUE_HUDisplay::GPS_Context::~GPS_Context () +{ +} + +// Operations for emits interfaces. + +// Operations for ::Components::CCMContext +ACE_INLINE ::Components::Principal_ptr +CIAO_GLUE_HUDisplay::GPS_Context::get_caller_principal (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ We don't support Security in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +ACE_INLINE ::Components::CCMHome_ptr +CIAO_GLUE_HUDisplay::GPS_Context::get_CCM_home (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return ::Components::CCMHome::_duplicate (this->home_.in ()); +} + +ACE_INLINE CORBA::Boolean +CIAO_GLUE_HUDisplay::GPS_Context::get_rollback_only (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ We don't support Transaction in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +ACE_INLINE ::Components::Transaction::UserTransaction_ptr +CIAO_GLUE_HUDisplay::GPS_Context::get_user_transaction (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ We don't support Transaction in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +ACE_INLINE CORBA::Boolean +CIAO_GLUE_HUDisplay::GPS_Context::is_caller_in_role (const char * role + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_UNUSED_ARG (role); + + // @@ We don't support Transaction in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +ACE_INLINE void +CIAO_GLUE_HUDisplay::GPS_Context::set_rollback_only (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ We don't support Transaction in CIAO yet. + ACE_THROW (CORBA::NO_IMPLEMENT ()); +} + +////////////////////////////////////////////////////////////////// +// Component Servant Glue code implementation +////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////// +// EventConsumer Glue Code implementation +// @@ We are assuming that these consumers are declared under the same +// module as the component (thus, we are placing this glue code +// here under the same namespace. If they are not, we will +// either be generating them in separate namespaces, or include +// some other CIDL generated files to get the glue code +// implementation. +////////////////////////////////////////////////////////////////// + +// Constructor and destructor. +ACE_INLINE +CIAO_GLUE_HUDisplay::GPS_Servant::tickConsumer_Refresh_Servant::tickConsumer_Refresh_Servant + (HUDisplay::CCM_GPS_ptr executor, + HUDisplay::CCM_GPS_Context_ptr c) + : executor_ (HUDisplay::CCM_GPS::_duplicate (executor)), + ctx_ (HUDisplay::CCM_GPS_Context::_duplicate (c)) +{ +} + +ACE_INLINE +CIAO_GLUE_HUDisplay::GPS_Servant::tickConsumer_Refresh_Servant::~tickConsumer_Refresh_Servant () +{ +} + +ACE_INLINE CORBA::Object_ptr +CIAO_GLUE_HUDisplay::GPS_Servant::tickConsumer_Refresh_Servant::_get_component (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->ctx_->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +ACE_INLINE void +CIAO_GLUE_HUDisplay::GPS_Servant::tickConsumer_Refresh_Servant::push_tick + (HUDisplay::tick_ptr evt + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->executor_->push_Refresh (evt + ACE_ENV_ARG_PARAMETER); +} + +// Operations for emits interfaces. + +// Operations for publishes interfaces. +ACE_INLINE ::Components::Cookie_ptr +CIAO_GLUE_HUDisplay::GPS_Servant::subscribe_Ready (HUDisplay::tickConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::ExceededConnectionLimit)) +{ + return this->context_->subscribe_Ready (c + ACE_ENV_ARG_PARAMETER); +} + +ACE_INLINE HUDisplay::tickConsumer_ptr +CIAO_GLUE_HUDisplay::GPS_Servant::unsubscribe_Ready (::Components::Cookie_ptr ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::InvalidConnection)) +{ + return this->context_->unsubscribe_Ready (ck + ACE_ENV_ARG_PARAMETER); +} + +////////////////////////////////////////////////////////////////// +// Component Home Glue code implementation +////////////////////////////////////////////////////////////////// + +ACE_INLINE +CIAO_GLUE_HUDisplay::GPSHome_Servant::GPSHome_Servant (HUDisplay::CCM_GPSHome_ptr exe, + CIAO::Session_Container *c) + : executor_ (HUDisplay::CCM_GPSHome::_duplicate (exe)), + container_ (c) +{ +} + +ACE_INLINE +CIAO_GLUE_HUDisplay::GPSHome_Servant::~GPSHome_Servant (void) +{ +} + +// Operations for KeylessHome interface +ACE_INLINE ::Components::CCMObject_ptr +CIAO_GLUE_HUDisplay::GPSHome_Servant::create_component (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)) +{ + // Simply forward to the create method. + return this->create (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +// Operations for CCMHome interface +ACE_INLINE ::CORBA::IRObject_ptr +CIAO_GLUE_HUDisplay::GPSHome_Servant::get_component_def (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ TO-DO. Contact IfR? + + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +ACE_INLINE CORBA::IRObject_ptr +CIAO_GLUE_HUDisplay::GPSHome_Servant::get_home_def (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ TO-DO. Contact IfR? + + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} diff --git a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_svnt_export.h b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_svnt_export.h new file mode 100644 index 00000000000..8ddf3049093 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_svnt_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl GPS_SVNT +// ------------------------------ +#ifndef GPS_SVNT_EXPORT_H +#define GPS_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (GPS_SVNT_HAS_DLL) +# define GPS_SVNT_HAS_DLL 1 +#endif /* ! GPS_SVNT_HAS_DLL */ + +#if defined (GPS_SVNT_HAS_DLL) && (GPS_SVNT_HAS_DLL == 1) +# if defined (GPS_SVNT_BUILD_DLL) +# define GPS_SVNT_Export ACE_Proper_Export_Flag +# define GPS_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define GPS_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* GPS_SVNT_BUILD_DLL */ +# define GPS_SVNT_Export ACE_Proper_Import_Flag +# define GPS_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define GPS_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* GPS_SVNT_BUILD_DLL */ +#else /* GPS_SVNT_HAS_DLL == 1 */ +# define GPS_SVNT_Export +# define GPS_SVNT_SINGLETON_DECLARATION(T) +# define GPS_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* GPS_SVNT_HAS_DLL == 1 */ + +// Set GPS_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (GPS_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define GPS_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define GPS_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !GPS_SVNT_NTRACE */ + +#if (GPS_SVNT_NTRACE == 1) +# define GPS_SVNT_TRACE(X) +#else /* (GPS_SVNT_NTRACE == 1) */ +# define GPS_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (GPS_SVNT_NTRACE == 1) */ + +#endif /* GPS_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_tracing_exec.cpp b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_tracing_exec.cpp new file mode 100644 index 00000000000..eae33e8d742 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_tracing_exec.cpp @@ -0,0 +1,137 @@ +// $Id$ + +#include "GPS_tracing_exec.h" + +#define DISPLACEMENT 256 + +/// Default constructor. +MyImpl::GPS_tracing_exec_i::GPS_tracing_exec_i () : dx_(1), dy_(1) +{ + ACE_OS::srand ((u_int) ACE_OS::time ()); + + this->positionx_ = 20; + this->positiony_ = 25; +} + +/// Default destructor. +MyImpl::GPS_tracing_exec_i::~GPS_tracing_exec_i () +{ +} + +// Operations from HUDisplay::GPS + +HUDisplay::CCM_position_ptr +MyImpl::GPS_tracing_exec_i::get_MyLocation (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return HUDisplay::CCM_position::_duplicate (this); +} + +void +MyImpl::GPS_tracing_exec_i::push_Refresh (HUDisplay::tick_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // Refresh position + if(this->positionx_ > 500) this->dx_ = -1; + if(this->positionx_ < 10) this->dx_ = 1; + if(this->positiony_ > 300) this->dy_ = -1; + if(this->positiony_ < 10) this->dy_ = 1; + + this->positionx_ += this->dx_; + this->positiony_ += this->dy_; + + // Nitify others + HUDisplay::tick_var event = new OBV_HUDisplay::tick; + + this->context_->push_Ready (event + ACE_ENV_ARG_PARAMETER); +} + +// Operations from HUDisplay::position + +CORBA::Long +MyImpl::GPS_tracing_exec_i::posx (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->positionx_; +} + +CORBA::Long +MyImpl::GPS_tracing_exec_i::posy (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->positiony_; +} + +// Operations from Components::SessionComponent +void +MyImpl::GPS_tracing_exec_i::set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_tracing_exec_i::set_session_context\n")); + + this->context_ = + HUDisplay::CCM_GPS_Context::_narrow (ctx + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (this->context_.in ())) + ACE_THROW (CORBA::INTERNAL ()); + // Urm, we actually discard exceptions thown from this operation. +} + +void +MyImpl::GPS_tracing_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_tracing_exec_i::ccm_activate\n")); +} + +void +MyImpl::GPS_tracing_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_tracing_exec_i::ccm_passivate\n")); +} + +void +MyImpl::GPS_tracing_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_tracing_exec_i::ccm_remove\n")); +} + +/// Default ctor. +MyImpl::GPSHome_tracing_exec_i::GPSHome_tracing_exec_i () +{ +} + +/// Default dtor. +MyImpl::GPSHome_tracing_exec_i::~GPSHome_tracing_exec_i () +{ +} + +// Explicit home operations. + +// Implicit home operations. + +::Components::EnterpriseComponent_ptr +MyImpl::GPSHome_tracing_exec_i::create (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + return new MyImpl::GPS_tracing_exec_i; +} + + +extern "C" GPS_EXEC_Export ::Components::HomeExecutorBase_ptr +createGPSHome_Tracing_Impl (void) +{ + return new MyImpl::GPSHome_tracing_exec_i; +} diff --git a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_tracing_exec.h b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_tracing_exec.h new file mode 100644 index 00000000000..5da08ff017a --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_tracing_exec.h @@ -0,0 +1,125 @@ +// $Id$ + +/** + * @file GPS_tracing_exec.h + * + * Header file for the actual GPS and GPSHome component + * implementations. + * + * @author Nanbor Wang <nanbor@cse.wustl.edu> + */ + +#ifndef GPS_TRACING_EXEC_H +#define GPS_TRACING_EXEC_H + +#include "GPSEIC.h" +#include "tao/LocalObject.h" + +namespace MyImpl +{ + /** + * @class GPS_tracing_exec_i + * + * RateGen executor implementation class. + */ + class GPS_EXEC_Export GPS_tracing_exec_i : + public virtual HUDisplay::GPS_Exec, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default constructor. + GPS_tracing_exec_i (); + + /// Default destructor. + ~GPS_tracing_exec_i (); + + // Operations from HUDisplay::GPS + + virtual HUDisplay::CCM_position_ptr + get_MyLocation (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + push_Refresh (HUDisplay::tick_ptr ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations from HUDisplay::position + + virtual CORBA::Long + posx (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Long + posy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations from Components::SessionComponent + + virtual void + set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + protected: + /// Current GPS reading. + CORBA::Long positionx_; + CORBA::Long positiony_; + + /// Delta amounts to emulate the position shift of each reading. + int dx_; + int dy_; + + /// Copmponent specific context + HUDisplay::CCM_GPS_Context_var context_; + }; + + /** + * @class GPSHome_tracing_exec_i + * + * GPS home executor implementation class. + */ + class GPS_EXEC_Export GPSHome_tracing_exec_i : + public virtual HUDisplay::CCM_GPSHome, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default ctor. + GPSHome_tracing_exec_i (); + + /// Default dtor. + ~GPSHome_tracing_exec_i (); + + // Explicit home operations. + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + }; + +} + +// Executor DLL entry point. CIAO's deployment and assembly framework +// invokes this function on the resulting DLL to get the home executor. +extern "C" GPS_EXEC_Export ::Components::HomeExecutorBase_ptr +createGPSHome_Tracing_Impl (void); + +#endif /* GPS_TRACING_EXEC_H */ diff --git a/TAO/CIAO/examples/handcrafted/Display/HUDisplay.idl b/TAO/CIAO/examples/handcrafted/Display/HUDisplay.idl new file mode 100644 index 00000000000..d26076beb39 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/HUDisplay.idl @@ -0,0 +1,48 @@ +// $Id$ + +/** + * @file HUDisplay.idl + * + * Definition of events, and common interfaces used in HUDisplay module. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#ifndef HUDISPLAY_IDL +#define HUDISPLAY_IDL + +#include "ciao/CCM_Component.idl" + +module HUDisplay +{ + /** + * @brief interface opmode defines the "operation mode" interface. + */ + interface opmode + { + void start (); + + void stop (); + + boolean active (); + }; + + /** + * @brief a timed event that happens at some fix rate. + */ + eventtype tick + { + // We could put a timestamp here if desired. + }; + + /** + * @brief interface position allows querying of a coordination. + */ + interface position + { + long posx (); + long posy (); + }; +}; + +#endif /* HUDISPLAY_IDL */ diff --git a/TAO/CIAO/examples/handcrafted/Display/HUDisplay.mpc b/TAO/CIAO/examples/handcrafted/Display/HUDisplay.mpc new file mode 100644 index 00000000000..b1d448a57ef --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/HUDisplay.mpc @@ -0,0 +1,36 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -n HUDisplay" + +project(HUDisplay_stub): ciao_client { + + sharedname = HUDisplay_stub + idlflags += -Wb,stub_export_macro=HUDISPLAY_STUB_Export -Wb,stub_export_include=HUDisplay_stub_export.h -Wb,skel_export_macro=HUDISPLAY_SVNT_Export -Wb,skel_export_include=HUDisplay_svnt_export.h + dllflags = HUDISPLAY_STUB_BUILD_DLL + + IDL_Files { + HUDisplay.idl + } + + Source_Files { + HUDisplayC.cpp + } +} + +project(HUDisplay_svnt) : ciao_server { + depends += HUDisplay_stub + sharedname = HUDisplay_svnt + libs += HUDisplay_stub + + idlflags += -Wb,export_macro=HUDISPLAY_SVNT_Export -Wb,export_include=HUDisplay_svnt_export.h + dllflags = HUDISPLAY_SVNT_BUILD_DLL + + IDL_Files { + HUDisplayE.idl + } + + Source_Files { + HUDisplayEC.cpp + HUDisplayS.cpp + HUDisplay_svnt.cpp + } +} diff --git a/TAO/CIAO/examples/handcrafted/Display/HUDisplayE.idl b/TAO/CIAO/examples/handcrafted/Display/HUDisplayE.idl new file mode 100644 index 00000000000..cc3b97a73e4 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/HUDisplayE.idl @@ -0,0 +1,47 @@ +// $Id$ + +/** + * @file HUDisplayE.idl + * + * Executor definitions of events, and common interfaces used in + * HUDisplay module. This file should eventually be generated by the + * CCIDL compiler automatically when it becomes available. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#ifndef HUDISPLAYE_IDL +#define HUDISPLAYE_IDL + + +#include "HUDisplay.idl" + +module HUDisplay +{ + /** + * Executor interface mapping for supported interfaces. + */ + local interface CCM_opmode : opmode + { + }; + + /** + * Executor interface for tick event comsumers. This interface is + * only needed if a component implementation uses the + * ExecutorLocator strategy. + */ + local interface CCM_tickConsumer + { + void push (in tick evt); + }; + + /** + * Executor interface for position facet interface that allows + * querying of a coordination. + */ + local interface CCM_position : position + { + }; +}; + +#endif /* HUDISPLAYE_IDL */ diff --git a/TAO/CIAO/examples/handcrafted/Display/HUDisplay_stub_export.h b/TAO/CIAO/examples/handcrafted/Display/HUDisplay_stub_export.h new file mode 100644 index 00000000000..3c92ba87bd8 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/HUDisplay_stub_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl HUDISPLAY_STUB +// ------------------------------ +#ifndef HUDISPLAY_STUB_EXPORT_H +#define HUDISPLAY_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (HUDISPLAY_STUB_HAS_DLL) +# define HUDISPLAY_STUB_HAS_DLL 1 +#endif /* ! HUDISPLAY_STUB_HAS_DLL */ + +#if defined (HUDISPLAY_STUB_HAS_DLL) && (HUDISPLAY_STUB_HAS_DLL == 1) +# if defined (HUDISPLAY_STUB_BUILD_DLL) +# define HUDISPLAY_STUB_Export ACE_Proper_Export_Flag +# define HUDISPLAY_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define HUDISPLAY_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* HUDISPLAY_STUB_BUILD_DLL */ +# define HUDISPLAY_STUB_Export ACE_Proper_Import_Flag +# define HUDISPLAY_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define HUDISPLAY_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* HUDISPLAY_STUB_BUILD_DLL */ +#else /* HUDISPLAY_STUB_HAS_DLL == 1 */ +# define HUDISPLAY_STUB_Export +# define HUDISPLAY_STUB_SINGLETON_DECLARATION(T) +# define HUDISPLAY_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* HUDISPLAY_STUB_HAS_DLL == 1 */ + +// Set HUDISPLAY_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (HUDISPLAY_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define HUDISPLAY_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define HUDISPLAY_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !HUDISPLAY_STUB_NTRACE */ + +#if (HUDISPLAY_STUB_NTRACE == 1) +# define HUDISPLAY_STUB_TRACE(X) +#else /* (HUDISPLAY_STUB_NTRACE == 1) */ +# define HUDISPLAY_STUB_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (HUDISPLAY_STUB_NTRACE == 1) */ + +#endif /* HUDISPLAY_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt.cpp b/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt.cpp new file mode 100644 index 00000000000..7a01b737b67 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt.cpp @@ -0,0 +1,35 @@ +// $Id$ + +// The generated filename for files using this template shoule be +// [idl-basename]GS.cpp GS --> GlueSession + +// @@ Notice: [ciao module name] can expand to either CIAO_GLUE or +// CIAO_GLUE_[module name] as defined in the header file. + +#include "HUDisplay_svnt.h" + +#if !defined (__ACE_INLINE__) +# include "HUDisplay_svnt.inl" +#endif /* __ACE_INLINE__ */ + +// get_component implementation. +// get_component is a standard CORBA::Object operations that returns +// the component reference that an object interface associates to. +CORBA::Object_ptr +CIAO_GLUE_HUDisplay::position_Servant::_get_component (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + Components::SessionContext_var sc = + Components::SessionContext::_narrow (this->ctx_.in ()); + + if (! CORBA::is_nil(sc.in ())) + return sc->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + + ::Components::EntityContext_var ec = + ::Components::EntityContext::_narrow (this->ctx_.in ()); + + if (! CORBA::is_nil(ec.in ())) + return ec->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); +} diff --git a/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt.h b/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt.h new file mode 100644 index 00000000000..f5b4b6e416c --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt.h @@ -0,0 +1,75 @@ +// $Id$ + +// =========================================================== +// +// @file HUDisplay_svnt.h +// +// Servant Glue code (supposedly should be) generated using CIAO'S +// CIDL compiler. This file implement the servants that bridge the +// executor and the container. +// +// This file is "generated" using the template code under +// $(CIAO_ROOT)/docs/templates/ +// +// Remember to refect any changes back to the code templates. +// +// @author Nanbor Wang <nanbor@cs.wustl.edu> +// +// =========================================================== + +#ifndef CIAO_GLUE_SESSION_HUDISPLAYGS_H +#define CIAO_GLUE_SESSION_HUDISPLAYGS_H +#include "ace/pre.h" + +#include "HUDisplayS.h" // Source in the skeletons for component + // client-view equivalent interfaces +#include "HUDisplayEC.h" // Source in the executor mapping + // that component implementations use +#include "ciao/Container_Base.h" //Source in the container interface definitions + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +/// @@@ Notice that all component and interface names may need to be +/// fully qualified as we are creating a new namespace for the CIAO's +/// container glue code. + +namespace CIAO_GLUE_HUDisplay +{ + class HUDISPLAY_SVNT_Export position_Servant : + public virtual POA_HUDisplay::position, + public virtual PortableServer::RefCountServantBase + { + public: + position_Servant (HUDisplay::CCM_position_ptr executor, + Components::CCMContext_ptr ctx_); + + ~position_Servant (); + + virtual CORBA::Long posx (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Long posy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // get_component implementation. + virtual CORBA::Object_ptr _get_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + // Facet executor. + HUDisplay::CCM_position_var executor_; + + // Context object. + Components::CCMContext_var ctx_; + }; +} + +#if defined (__ACE_INLINE__) +# include "HUDisplay_svnt.inl" +#endif /* __ACE_INLINE__ */ + + +#include "ace/post.h" +#endif /* CIAO_GLUE_SESSION_HUDISPLAYGS_H */ diff --git a/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt.inl b/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt.inl new file mode 100644 index 00000000000..e4ea00247cc --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt.inl @@ -0,0 +1,41 @@ +// $Id$ -*- C++ -*- + +// The generated filename for files using this template shoule be +// [idl-basename]GS.i GS --> GlueSession + +// @@ Notice: [ciao module name] can expand to either CIAO_GLUE or +// CIAO_GLUE_[module name] as defined in the header file. + +// Constructor and destructor. +ACE_INLINE +CIAO_GLUE_HUDisplay::position_Servant::position_Servant (HUDisplay::CCM_position_ptr executor, + Components::CCMContext_ptr c) + : executor_ (HUDisplay::CCM_position::_duplicate (executor)), + ctx_ (Components::CCMContext::_duplicate (c)) +{ +} + +ACE_INLINE +CIAO_GLUE_HUDisplay::position_Servant::~position_Servant () +{ +} + + +// This is only a guideline... we always relay the operation to underlying +// executor. + +ACE_INLINE CORBA::Long +CIAO_GLUE_HUDisplay::position_Servant::posx (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // Simply relay to executor. May not need to return the result... + return this->executor_->posx (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +ACE_INLINE CORBA::Long +CIAO_GLUE_HUDisplay::position_Servant::posy (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // Simply relay to executor. May not need to return the result... + return this->executor_->posy (ACE_ENV_SINGLE_ARG_PARAMETER); +} diff --git a/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt_export.h b/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt_export.h new file mode 100644 index 00000000000..842152afa02 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl HUDISPLAY_SVNT +// ------------------------------ +#ifndef HUDISPLAY_SVNT_EXPORT_H +#define HUDISPLAY_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (HUDISPLAY_SVNT_HAS_DLL) +# define HUDISPLAY_SVNT_HAS_DLL 1 +#endif /* ! HUDISPLAY_SVNT_HAS_DLL */ + +#if defined (HUDISPLAY_SVNT_HAS_DLL) && (HUDISPLAY_SVNT_HAS_DLL == 1) +# if defined (HUDISPLAY_SVNT_BUILD_DLL) +# define HUDISPLAY_SVNT_Export ACE_Proper_Export_Flag +# define HUDISPLAY_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define HUDISPLAY_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* HUDISPLAY_SVNT_BUILD_DLL */ +# define HUDISPLAY_SVNT_Export ACE_Proper_Import_Flag +# define HUDISPLAY_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define HUDISPLAY_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* HUDISPLAY_SVNT_BUILD_DLL */ +#else /* HUDISPLAY_SVNT_HAS_DLL == 1 */ +# define HUDISPLAY_SVNT_Export +# define HUDISPLAY_SVNT_SINGLETON_DECLARATION(T) +# define HUDISPLAY_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* HUDISPLAY_SVNT_HAS_DLL == 1 */ + +// Set HUDISPLAY_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (HUDISPLAY_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define HUDISPLAY_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define HUDISPLAY_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !HUDISPLAY_SVNT_NTRACE */ + +#if (HUDISPLAY_SVNT_NTRACE == 1) +# define HUDISPLAY_SVNT_TRACE(X) +#else /* (HUDISPLAY_SVNT_NTRACE == 1) */ +# define HUDISPLAY_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (HUDISPLAY_SVNT_NTRACE == 1) */ + +#endif /* HUDISPLAY_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/Display/NOTE b/TAO/CIAO/examples/handcrafted/Display/NOTE new file mode 100644 index 00000000000..dae5515157f --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NOTE @@ -0,0 +1,54 @@ +$Id$ -*- Text -*- + +The root directory of this example (the directory this note resides) +contains only facets and eventtype that are shared by all components +under various subdirectories. Therefore, there's no actualy executor +implementations for these interfaces instead, the example stop at the +servant glue code library which can be used by the actualy component +implementation. + +I'm not sure, at this point, how we can handle this (where neither +actualy component definition nor cidl definition are available) +situation with CIDL compiler. It looks like we should be able to pass +a bunch of IDL definitions thru CIDL compiler and get the equivalent +executor interfaces automatically. But we'll have to see. + +To try out this example, read the following document taken from a +short note I wrote for a snapshot release: + + This is a multiple-component example. RateGen component + subdirectory contains a run_test.pl that you can use to + instantiate a component instance, like you would do with the + Hello example. The other components require collaboration with + other components and I don't have client programs to test them + out individually. + + This example also lets you compose all the components into a + distributed application using the Assembly_Deployer. Change + directory to + + $CIAO_ROOT/examples/handcrafted/Display/descriptors + + and take a look at the file: NOTE.txt. This file describes the + steps to compose the application using various different + configurations and composition specs. + +* There are MSVC 6 workspaces and projects available in the workspace. + Some of them also contain UNIX makefiles. If you can not find the + Makefiles for unix platform you are using, you can use mwc to create + them. For examples, to compile the multi-component example, use the + following: + + $ cd $CIAO_ROOT/examples/handcrafted/Display + $ $(ACE_ROOT)/bin/mwc.pl + $ make + + To regenerate VC6 dsp files, do: + + > cd $CIAO_ROOT/examples/handcrafted/Display + > $(ACE_ROOT)/bin/mwc.pl -type vc6 + + Likewise, to regenerate VC7.NET project files, do: + + > cd $CIAO_ROOT/examples/handcrafted/Display + > $(ACE_ROOT)/bin/mwc.pl -type vc7 diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay.idl b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay.idl new file mode 100644 index 00000000000..2a5dc51e201 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay.idl @@ -0,0 +1,29 @@ +// $Id$ + +/** + * @file navDisplay.idl + * + * Definition of the navigation display component. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#ifndef NAVDISPLAY_IDL +#define NAVDISPLAY_IDL + +#include "../HUDisplay.idl" + +module HUDisplay +{ + component NavDisplay + { + consumes tick Refresh; + uses position GPSLocation; + }; + + home NavDisplayHome manages NavDisplay + { + }; +}; + +#endif /* NAVDISPLAY_IDL */ diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay.mpc b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay.mpc new file mode 100644 index 00000000000..a538a173ca2 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay.mpc @@ -0,0 +1,58 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -l .. -p HUDisplay -i NavDisplay" + +project(NavDisplay_stub): ciao_client { + depends += HUDisplay_stub + sharedname = NavDisplay_stub + idlflags += -Wb,stub_export_macro=NAVDISPLAY_STUB_Export -Wb,stub_export_include=NavDisplay_stub_export.h -Wb,skel_export_macro=NAVDISPLAY_SVNT_Export -Wb,skel_export_include=NavDisplay_svnt_export.h + dllflags = NAVDISPLAY_STUB_BUILD_DLL + + IDL_Files { + NavDisplay.idl + } + + Source_Files { + NavDisplayC.cpp + } +} + +project(NavDisplay_svnt) : ciao_server { + depends += HUDisplay_svnt NavDisplay_stub + sharedname = NavDisplay_svnt + libs += NavDisplay_stub HUDisplay_stub HUDisplay_svnt + libpaths += .. + idlflags += -Wb,export_macro=NAVDISPLAY_SVNT_Export -Wb,export_include=NavDisplay_svnt_export.h + dllflags = NAVDISPLAY_SVNT_BUILD_DLL + + IDL_Files { + NavDisplayE.idl + } + + Source_Files { + NavDisplayEC.cpp + NavDisplayS.cpp + NavDisplay_svnt.cpp + } +} + + +project(NavDisplay_exec) : ciao_server { + depends += NavDisplay_svnt + sharedname = NavDisplay_exec + libs += NavDisplay_stub NavDisplay_svnt HUDisplay_stub HUDisplay_svnt + libpaths += .. + idlflags += -Wb,export_macro=NAVDISPLAY_EXEC_Export -Wb,export_include=NavDisplay_exec_export.h + dllflags = NAVDISPLAY_EXEC_BUILD_DLL + + IDL_Files { + NavDisplayEI.idl + } + + Source_Files { + NavDisplayEIC.cpp + NavDisplay_exec.cpp + } +} + + + diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplayE.idl b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplayE.idl new file mode 100644 index 00000000000..ff687126873 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplayE.idl @@ -0,0 +1,72 @@ +// $Id$ + +// =========================================================== +// +// @file Executor.idl +// +// Handlecrafted "generated" code. :) +// +// @author Nanbor Wang <nanbor@cs.wustl.edu> +// +// =========================================================== + +#ifndef NAVDISPLAYE_IDL +#define NAVDISPLAYE_IDL + +#include "CCM_Container.idl" // Found in $(CIAO_ROOT)/ciao + // For various definitions of container + // internal/callback interfaces +#include "NavDisplay.idl" // Original component IDL definition +#include "../HUDisplayE.idl" + +module HUDisplay { + // Component Main Executor Interface. We currently do not + // support Executor-based implementation. + + local interface CCM_NavDisplay_Executor + : Components::EnterpriseComponent + { + }; + + // Monolithic component executor. + // For implementing monolithic component call back interface. + + local interface CCM_NavDisplay + : Components::EnterpriseComponent + { + void push_Refresh (in tick ev); + }; + + /** + * Component Context Interface + * + * Notice that we are taking a shortcut here to inherit the + * component-specific context from SessionContext directly instead + * of CCMContext. + */ + local interface CCM_NavDisplay_Context + : Components::SessionContext + { + position get_connection_GPSLocation (); + }; + + + local interface CCM_NavDisplayHomeExplicit + : Components::HomeExecutorBase + { + }; + + local interface CCM_NavDisplayHomeImplicit + { + ::Components::EnterpriseComponent create () + raises (::Components::CCMException); + }; + + local interface CCM_NavDisplayHome + : CCM_NavDisplayHomeExplicit, + CCM_NavDisplayHomeImplicit + { + }; +}; + +#endif /* NAVDISPLAYE_IDL */ diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplayEI.idl b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplayEI.idl new file mode 100644 index 00000000000..e82e48244cd --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplayEI.idl @@ -0,0 +1,32 @@ +// $Id$ + +/** + * @file NavDisplayEI.idl + * + * Definition of the NavDisplay (navigation display) component implementation. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#ifndef NAVDISPLAYEI_IDL +#define NAVDISPLAYEI_IDL + +#include "NavDisplayE.idl" + +module HUDisplay +{ + /** + * @interface NavDisplay_Exec + * + * The actually GPS executor inherits from both CCM_GPS and + * CCM_position interfaces as a monolithic implementation. + */ + local interface NavDisplay_Exec : + CCM_NavDisplay, + Components::SessionComponent + { + }; + +}; + +#endif /* NAVDISPLAYEI_IDL */ diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_exec.cpp b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_exec.cpp new file mode 100644 index 00000000000..93c6b117294 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_exec.cpp @@ -0,0 +1,128 @@ +// $Id$ + +#include "CIAO_common.h" +#include "NavDisplay_exec.h" + +/// Default constructor. +MyImpl::NavDisplay_exec_impl::NavDisplay_exec_impl () +{ +} + +/// Default destructor. +MyImpl::NavDisplay_exec_impl::~NavDisplay_exec_impl () +{ +} + +// Operations from HUDisplay::NavDisplay + +void +MyImpl::NavDisplay_exec_impl::push_Refresh (HUDisplay::tick_ptr ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_UNUSED_ARG (ev); + + // Refresh position + HUDisplay::position_var loc + = this->context_->get_connection_GPSLocation (ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (loc.in ())) + ACE_THROW (CORBA::BAD_INV_ORDER ()); + + CORBA::Long x = loc->posx (ACE_ENV_ARG_PARAMETER) % 500; + ACE_CHECK; + CORBA::Long y = loc->posy (ACE_ENV_ARG_PARAMETER) % 300; + ACE_CHECK; + + ACE_DEBUG ((LM_DEBUG, "DISPLAY: Current Location is: (%d, %d)\n", + x, + y)); +} + +// Operations from Components::SessionComponent +void +MyImpl::NavDisplay_exec_impl::set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::NavDisplay_exec_impl::set_session_context\n")); + + this->context_ = + HUDisplay::CCM_NavDisplay_Context::_narrow (ctx + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (this->context_.in ())) + ACE_THROW (CORBA::INTERNAL ()); + // Urm, we actually discard exceptions thown from this operation. +} + +void +MyImpl::NavDisplay_exec_impl::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::NavDisplay_exec_impl::ccm_activate\n")); + + // @@ This hack work around a missing feature in CIAO's assembly + // mechanism where a Softpkg descriptor can specify it's dependency + // to a valuetype factory and instruct the deployment framework to + // initialize and register the corresponding valuefactory in the + // component server. Here, we are registering the valuefactory + // explicitly to work around this problem. + + char *argv[1] = { "NavDisplay_exec"}; + + int argc = sizeof(argv)/sizeof(argv[0]); + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv ACE_ENV_ARG_PARAMETER); + + CIAO_REGISTER_VALUE_FACTORY (orb.in(), HUDisplay::tick_init, + HUDisplay::tick); +} + +void +MyImpl::NavDisplay_exec_impl::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::NavDisplay_exec_impl::ccm_passivate\n")); +} + +void +MyImpl::NavDisplay_exec_impl::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::NavDisplay_exec_impl::ccm_remove\n")); +} + +/// Default ctor. +MyImpl::NavDisplayHome_exec_impl::NavDisplayHome_exec_impl () +{ +} + +/// Default dtor. +MyImpl::NavDisplayHome_exec_impl::~NavDisplayHome_exec_impl () +{ +} + +// Explicit home operations. + +// Implicit home operations. + +::Components::EnterpriseComponent_ptr +MyImpl::NavDisplayHome_exec_impl::create (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + return new MyImpl::NavDisplay_exec_impl; +} + + +extern "C" NAVDISPLAY_EXEC_Export ::Components::HomeExecutorBase_ptr +createNavDisplayHome_Impl (void) +{ + return new MyImpl::NavDisplayHome_exec_impl; +} diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_exec.h b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_exec.h new file mode 100644 index 00000000000..149ee5b9520 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_exec.h @@ -0,0 +1,101 @@ +// $Id$ + +/** + * @file NavDisplay_exec.h + * + * Header file for the actual NavDisplay and NavDisplayHome component + * implementations. + * + * @author Nanbor Wang <nanbor@cse.wustl.edu> + */ + +#ifndef NAVDISPLAY_EXEC_H +#define NAVDISPLAY_EXEC_H + +#include "NavDisplayEIC.h" +#include "tao/LocalObject.h" + +namespace MyImpl +{ + /** + * @class NavDisplay_exec_impl + * + * RateGen executor implementation class. + */ + class NAVDISPLAY_EXEC_Export NavDisplay_exec_impl : + public virtual HUDisplay::NavDisplay_Exec, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default constructor. + NavDisplay_exec_impl (); + + /// Default destructor. + ~NavDisplay_exec_impl (); + + // Operations from HUDisplay::NavDisplay + + virtual void + push_Refresh (HUDisplay::tick_ptr ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations from Components::SessionComponent + + virtual void + set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + protected: + /// Copmponent specific context + HUDisplay::CCM_NavDisplay_Context_var context_; + }; + + /** + * @class NavDisplayHome_exec_impl + * + * NavDisplay home executor implementation class. + */ + class NAVDISPLAY_EXEC_Export NavDisplayHome_exec_impl : + public virtual HUDisplay::CCM_NavDisplayHome, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default ctor. + NavDisplayHome_exec_impl (); + + /// Default dtor. + ~NavDisplayHome_exec_impl (); + + // Explicit home operations. + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + }; + +} + +extern "C" NAVDISPLAY_EXEC_Export ::Components::HomeExecutorBase_ptr +createNavDisplayHome_Impl (void); + +#endif /* NAVDISPLAY_EXEC_H */ diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_exec_export.h b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_exec_export.h new file mode 100644 index 00000000000..81b8dae8a88 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_exec_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl NAVDISPLAY_EXEC +// ------------------------------ +#ifndef NAVDISPLAY_EXEC_EXPORT_H +#define NAVDISPLAY_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (NAVDISPLAY_EXEC_HAS_DLL) +# define NAVDISPLAY_EXEC_HAS_DLL 1 +#endif /* ! NAVDISPLAY_EXEC_HAS_DLL */ + +#if defined (NAVDISPLAY_EXEC_HAS_DLL) && (NAVDISPLAY_EXEC_HAS_DLL == 1) +# if defined (NAVDISPLAY_EXEC_BUILD_DLL) +# define NAVDISPLAY_EXEC_Export ACE_Proper_Export_Flag +# define NAVDISPLAY_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define NAVDISPLAY_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* NAVDISPLAY_EXEC_BUILD_DLL */ +# define NAVDISPLAY_EXEC_Export ACE_Proper_Import_Flag +# define NAVDISPLAY_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define NAVDISPLAY_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* NAVDISPLAY_EXEC_BUILD_DLL */ +#else /* NAVDISPLAY_EXEC_HAS_DLL == 1 */ +# define NAVDISPLAY_EXEC_Export +# define NAVDISPLAY_EXEC_SINGLETON_DECLARATION(T) +# define NAVDISPLAY_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* NAVDISPLAY_EXEC_HAS_DLL == 1 */ + +// Set NAVDISPLAY_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (NAVDISPLAY_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define NAVDISPLAY_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define NAVDISPLAY_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !NAVDISPLAY_EXEC_NTRACE */ + +#if (NAVDISPLAY_EXEC_NTRACE == 1) +# define NAVDISPLAY_EXEC_TRACE(X) +#else /* (NAVDISPLAY_EXEC_NTRACE == 1) */ +# define NAVDISPLAY_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (NAVDISPLAY_EXEC_NTRACE == 1) */ + +#endif /* NAVDISPLAY_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_stub_export.h b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_stub_export.h new file mode 100644 index 00000000000..27e2ffaa3c3 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_stub_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl NAVDISPLAY_STUB +// ------------------------------ +#ifndef NAVDISPLAY_STUB_EXPORT_H +#define NAVDISPLAY_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (NAVDISPLAY_STUB_HAS_DLL) +# define NAVDISPLAY_STUB_HAS_DLL 1 +#endif /* ! NAVDISPLAY_STUB_HAS_DLL */ + +#if defined (NAVDISPLAY_STUB_HAS_DLL) && (NAVDISPLAY_STUB_HAS_DLL == 1) +# if defined (NAVDISPLAY_STUB_BUILD_DLL) +# define NAVDISPLAY_STUB_Export ACE_Proper_Export_Flag +# define NAVDISPLAY_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define NAVDISPLAY_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* NAVDISPLAY_STUB_BUILD_DLL */ +# define NAVDISPLAY_STUB_Export ACE_Proper_Import_Flag +# define NAVDISPLAY_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define NAVDISPLAY_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* NAVDISPLAY_STUB_BUILD_DLL */ +#else /* NAVDISPLAY_STUB_HAS_DLL == 1 */ +# define NAVDISPLAY_STUB_Export +# define NAVDISPLAY_STUB_SINGLETON_DECLARATION(T) +# define NAVDISPLAY_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* NAVDISPLAY_STUB_HAS_DLL == 1 */ + +// Set NAVDISPLAY_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (NAVDISPLAY_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define NAVDISPLAY_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define NAVDISPLAY_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !NAVDISPLAY_STUB_NTRACE */ + +#if (NAVDISPLAY_STUB_NTRACE == 1) +# define NAVDISPLAY_STUB_TRACE(X) +#else /* (NAVDISPLAY_STUB_NTRACE == 1) */ +# define NAVDISPLAY_STUB_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (NAVDISPLAY_STUB_NTRACE == 1) */ + +#endif /* NAVDISPLAY_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.cpp b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.cpp new file mode 100644 index 00000000000..e290ebba108 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.cpp @@ -0,0 +1,797 @@ +// $Id$ + +// The generated filename for files using this template shoule be +// [idl-basename]GS.cpp GS --> GlueSession + +// @@ Notice: [ciao module name] can expand to either CIAO_GLUE or +// CIAO_GLUE_[module name] as defined in the header file. + +/// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +/// @@@ Notice that all component and interface names need to be +/// fully qualified as we are creating a new namespace for the CIAO's +/// container glue code. +/// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +#include "NavDisplay_svnt.h" +#include "Cookies.h" + +#if !defined (__ACE_INLINE__) +# include "NavDisplay_svnt.inl" +#endif /* __ACE_INLINE__ */ + +HUDisplay::position_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Context::get_connection_GPSLocation (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return HUDisplay::position::_duplicate (this->ciao_uses_GPSLocation_.in ()); +} + +// Simplex [receptacle name] connection management operations +void +CIAO_GLUE_HUDisplay::NavDisplay_Context::connect_GPSLocation (HUDisplay::position_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)) +{ + if (! CORBA::is_nil (this->ciao_uses_GPSLocation_.in ())) + ACE_THROW (::Components::AlreadyConnected ()); + + if (CORBA::is_nil (c)) + ACE_THROW (::Components::InvalidConnection ()); + + // When do we throw InvalidConnection exception? + this->ciao_uses_GPSLocation_ = HUDisplay::position::_duplicate (c); +} + +HUDisplay::position_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Context::disconnect_GPSLocation (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::NoConnection)) +{ + if (CORBA::is_nil (this->ciao_uses_GPSLocation_.in ())) + ACE_THROW (::Components::NoConnection ()); + + return this->ciao_uses_GPSLocation_._retn (); +} + +// Operations for ::Components::SessionContext interface +CORBA::Object_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Context::get_CCM_object (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ How do I check for IllegalState here? When it's not in a + // callback operation... + // ACE_THROW_RETURN (::Components::IllegalState (), 0); + + if (CORBA::is_nil (this->component_.in ())) + { + CORBA::Object_var obj = this->container_->get_objref (this->servant_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + this->component_ = HUDisplay::NavDisplay::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (this->component_.in ())) + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); // This should not happen... + } + return HUDisplay::NavDisplay::_duplicate (this->component_.in ()); +} + +////////////////////////////////////////////////////////////////// +// Component Servant Glue code implementation +////////////////////////////////////////////////////////////////// + +CIAO_GLUE_HUDisplay::NavDisplay_Servant::NavDisplay_Servant (HUDisplay::CCM_NavDisplay_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c) + : executor_ (HUDisplay::CCM_NavDisplay::_duplicate (exe)), + container_ (c) +{ + this->context_ = new CIAO_GLUE_HUDisplay::NavDisplay_Context (h, c, this); + + ACE_TRY_NEW_ENV + { + Components::SessionComponent_var scom = + Components::SessionComponent::_narrow (exe + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (! CORBA::is_nil (scom.in ())) + scom->set_session_context (this->context_ + ACE_ENV_ARG_PARAMETER); + } + ACE_CATCHANY + { + // @@ Ignore any exceptions? What happens if + // set_session_context throws an CCMException? + } + ACE_ENDTRY; +} + +CIAO_GLUE_HUDisplay::NavDisplay_Servant::~NavDisplay_Servant (void) +{ + ACE_TRY_NEW_ENV + { + Components::SessionComponent_var scom = + Components::SessionComponent::_narrow (this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (! CORBA::is_nil (scom.in ())) + scom->ccm_remove (ACE_ENV_SINGLE_ARG_PARAMETER); + } + ACE_CATCHANY + { + // @@ Ignore any exceptions? What happens if + // set_session_context throws an CCMException? + } + ACE_ENDTRY; + this->context_->_remove_ref (); +} + +// Operations for provides interfaces. + +// Operations for consumers interfaces. + +// EventConsumer Glue Code implementation +// Inherit from ::Compopnents::EventBConsumerBase +void +CIAO_GLUE_HUDisplay::NavDisplay_Servant::tickConsumer_Refresh_Servant::push_event (::Components::EventBase_ptr ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::BadEventType)) +{ + HUDisplay::tick_var ev_type = HUDisplay::tick::_downcast (ev); + if (ev_type != 0) + { + this->push_tick (ev_type.in () + ACE_ENV_ARG_PARAMETER); + return; + } + + // @@ This include the case when we receive a parent eventtype of [eventtype] + + ACE_THROW (::Components::BadEventType ()); +} + +// get_component implementation. +HUDisplay::tickConsumer_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_consumer_Refresh (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (CORBA::is_nil (this->consumes_Refresh_.in ())) + { + CIAO_GLUE_HUDisplay::NavDisplay_Servant::tickConsumer_Refresh_Servant *svt = + new CIAO_GLUE_HUDisplay::NavDisplay_Servant::tickConsumer_Refresh_Servant (this->executor_.in (), + this->context_); + PortableServer::ServantBase_var safe_servant (svt); + + CORBA::Object_var obj = this->container_->install_servant (svt + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + HUDisplay::tickConsumer_var eco + = HUDisplay::tickConsumer::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + this->consumes_Refresh_ = eco; + } + + return HUDisplay::tickConsumer::_duplicate (this->consumes_Refresh_.in ()); +} + +// Operations for Navigation interface +CORBA::Object_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Servant::provide_facet (const char * name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException , + Components::InvalidName)) +{ + ACE_UNUSED_ARG (name); + ACE_THROW_RETURN (::Components::InvalidName (), 0); +} + +::Components::FacetDescriptions * +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_all_facets (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::FacetDescriptions_var collection + = new ::Components::FacetDescriptions (0); // #99 = number of all provided + // facets including those inherited + // from parent component(s). + return collection._retn (); + +} + +::Components::FacetDescriptions * +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_named_facets (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ACE_UNUSED_ARG (names); + ACE_THROW_RETURN (::Components::InvalidName (), 0); +} + +CORBA::Boolean +CIAO_GLUE_HUDisplay::NavDisplay_Servant::same_component (CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (CORBA::is_nil (object_ref)) + ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + + CORBA::Object_var the_other = object_ref->_get_component (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + CORBA::Object_var me = this->context_->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return me->_is_equivalent (object_ref + ACE_ENV_ARG_PARAMETER); +} + +// Operations for Receptacles interface +::Components::Cookie_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Servant::connect (const char * name, + CORBA::Object_ptr connection + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::AlreadyConnected, + Components::ExceededConnectionLimit)) +{ + // @@ We can omit this if clause if there's no receptacle in this component. + if (name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + + if (ACE_OS_String::strcmp (name, "GPSLocation") == 0) + { + HUDisplay::position_var _ciao_conn = + HUDisplay::position::_narrow (connection + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (_ciao_conn.in ())) + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + + this->connect_GPSLocation (_ciao_conn.in () + ACE_ENV_ARG_PARAMETER); + return 0; + } + + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +CORBA::Object_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Servant::disconnect (const char * name, + Components::Cookie_ptr ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::CookieRequired, + Components::NoConnection)) +{ + ACE_UNUSED_ARG (ck); + // @@ We can omit this if clause if there's no receptacle in this component. + if (name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + + if (ACE_OS_String::strcmp (name, "GPSLocation") == 0) + return this->disconnect_GPSLocation (ACE_ENV_SINGLE_ARG_PARAMETER); + + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::ConnectionDescriptions * +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_connections (const char * name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + // @@ We can omit this if clause if there's no receptacle in this component. + if (name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + + if (ACE_OS_String::strcmp (name, "GPSLocation") == 0) + { + ::Components::ConnectionDescriptions_var retv + = new ::Components::ConnectionDescriptions; + retv->length (1); + + ::Components::ConnectionDescription_var x + = new OBV_Components::ConnectionDescription; + x ->ck (0); + x ->objref (this->get_connection_GPSLocation (ACE_ENV_SINGLE_ARG_PARAMETER)); + ACE_CHECK_RETURN (0); + + // retv[0] = x._retn (); + + return retv._retn (); + } + + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::ReceptacleDescriptions * +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_all_receptacles (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::ReceptacleDescriptions_var retv = + new ::Components::ReceptacleDescriptions (1); // #99 is number of receptacles + // this component has. + retv->length (1); + CORBA::ULong i = 0; + + retv[i] = new OBV_Components::ReceptacleDescription; + + retv[i]->Name ((const char *) "GPSLocation"); + retv[i]->type_id ((const char *) "IDL:HUDisplay/position:1.0"); + retv[i]->is_multiple (0); + retv[i]->connections (*this->get_connections ("GPSLocation" + ACE_ENV_ARG_PARAMETER)); + return retv._retn (); +} + +::Components::ReceptacleDescriptions * +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_named_receptacles (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ::Components::ReceptacleDescriptions_var retv = + new ::Components::ReceptacleDescriptions (names.length ()); + retv->length (names.length ()); + + CORBA::ULong i = 0; + for (; i < names.length (); ++i) + { + retv[i] = new ::OBV_Components::ReceptacleDescription; + if (ACE_OS_String::strcmp (names[i].in (), "GPSLocation") == 0) + { + retv[i]->Name ((const char *) "GPSLocation"); + retv[i]->type_id ((const char *) "IDL:HUDisplay/position:1.0"); + retv[i]->is_multiple (0); + retv[i]->connections (*this->get_connections ("GPSLocation" + ACE_ENV_ARG_PARAMETER)); + } + else + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + return retv._retn (); +} + +// Operations for Events interface +::Components::EventConsumerBase_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_consumer (const char * sink_name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + // @@ We can omit this if clause if there's no event sinks in this component. + if (sink_name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + + if (ACE_OS_String::strcmp (sink_name, "Refresh") == 0) + return this->get_consumer_Refresh (ACE_ENV_SINGLE_ARG_PARAMETER); + + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::Cookie_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Servant::subscribe (const char * , + Components::EventConsumerBase_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::ExceededConnectionLimit)) +{ + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::EventConsumerBase_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Servant::unsubscribe (const char * , + Components::Cookie_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)) +{ + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +void +CIAO_GLUE_HUDisplay::NavDisplay_Servant::connect_consumer (const char * , + Components::EventConsumerBase_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::AlreadyConnected, + Components::InvalidConnection)) +{ + ACE_THROW (Components::InvalidName ()); +} + +::Components::EventConsumerBase_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Servant::disconnect_consumer (const char * + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::NoConnection)) +{ + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::ConsumerDescriptions * +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_all_consumers (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::ConsumerDescriptions_var retv = + new ::Components::ConsumerDescriptions (1); // #99 is the number of consumers + // this component has. + retv->length (1); + + CORBA::ULong i = 0; + retv[i] = new OBV_Components::ConsumerDescription; + retv[i]->Name ("Refresh"); + retv[i]->type_id ("IDL:HUDisplay/tickConsumer:1.0"); + HUDisplay::tickConsumer_var c + = this->get_consumer_Refresh (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + retv[i]->consumer (c.in ()); + + return retv._retn (); +} + +::Components::ConsumerDescriptions * +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_named_consumers (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ::Components::ConsumerDescriptions_var retv = + new ::Components::ConsumerDescriptions (names.length ()); + retv->length (names.length ()); + + CORBA::ULong i = 0; + for (; i < names.length (); ++i) + { + retv[i] = new OBV_Components::ConsumerDescription; + + if (ACE_OS_String::strcmp (names[i].in (), "Refresh") == 0) + { + retv[i]->Name ("Refresh"); + retv[i]->type_id ("IDL:HUDisplay/tickConsumer:1.0"); + HUDisplay::tickConsumer_var c = + this->get_consumer_Refresh (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + retv[i]->consumer (c.in ()); + } + else + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + return retv._retn (); +} + +::Components::EmitterDescriptions * +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_all_emitters (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::EmitterDescriptions_var retv = + new ::Components::EmitterDescriptions (0); // #99 is the number of emitters + // this component has. + return retv._retn (); +} + +::Components::EmitterDescriptions * +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_named_emitters (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ::Components::EmitterDescriptions_var retv = + new ::Components::EmitterDescriptions (names.length ()); + retv->length (names.length ()); + + CORBA::ULong i = 0; + for (; i < names.length (); ++i) + { + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + return retv._retn (); +} + +::Components::PublisherDescriptions * +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_all_publishers (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ to-do + + // Need to add interfaces in the Context class to gather the information. + // Or we can just relay it to the Context object. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +::Components::PublisherDescriptions * +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_named_publishers (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ACE_UNUSED_ARG (names); + // @@ to-do + + // Need to add interfaces in the Context class to gather the information. + // Or we can just relay it to the Context object. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +// Operations for CCMObject interface +::CORBA::IRObject_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_component_def (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ to-do: Connect to an IfR? + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +::Components::CCMHome_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_ccm_home (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->context_->get_CCM_home (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +::Components::PrimaryKeyBase * +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_primary_key (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::NoKeyAvailable)) +{ + // This is a keyless component. + ACE_THROW_RETURN (::Components::NoKeyAvailable (), 0); +} + +void +CIAO_GLUE_HUDisplay::NavDisplay_Servant::configuration_complete (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidConfiguration)) +{ + // @@ to-do + // No-op. Don't know how to pass this info to monolithic executor. +} + +void +CIAO_GLUE_HUDisplay::NavDisplay_Servant::remove (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) +{ + // @@ to-do + // Need to figure out what to do here. E.g., tear down the all the connections + // this component has? +} + +::Components::ComponentPortDescription * +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_all_ports (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::ComponentPortDescription_var retv = + new OBV_Components::ComponentPortDescription; + + ::Components::FacetDescriptions_var facets_desc + = this->get_all_facets (ACE_ENV_SINGLE_ARG_PARAMETER); + ::Components::ReceptacleDescriptions_var receptacle_desc + = get_all_receptacles (ACE_ENV_SINGLE_ARG_PARAMETER); + ::Components::ConsumerDescriptions_var consumer_desc + = this->get_all_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); + ::Components::EmitterDescriptions_var emitter_desc + = this->get_all_emitters (ACE_ENV_SINGLE_ARG_PARAMETER); + ::Components::PublisherDescriptions_var publisher_desc + = this->get_all_publishers (ACE_ENV_SINGLE_ARG_PARAMETER); + + retv->facets (facets_desc.in()); + retv->receptacles (receptacle_desc.in()); + retv->consumers (consumer_desc.in()); + retv->emitters (emitter_desc.in()); + retv->publishers (publisher_desc.in()); + + return retv._retn(); +} + +// get_component implementation. +CORBA::Object_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Servant::_get_component (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::SessionContext_var sc = + ::Components::SessionContext::_narrow (this->context_); + + if (! CORBA::is_nil(sc.in ())) + return sc->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + + // @@ Do we need to try the following case here? We are afterall implementing + // a session component here. + ::Components::EntityContext_var ec = + ::Components::EntityContext::_narrow (this->context_); + + if (! CORBA::is_nil(ec.in ())) + return ec->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); +} + +void +CIAO_GLUE_HUDisplay::NavDisplay_Servant::_ciao_activate (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow (this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! CORBA::is_nil (temp.in ())) + temp->ccm_activate (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +void +CIAO_GLUE_HUDisplay::NavDisplay_Servant::_ciao_passivate (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow (this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! CORBA::is_nil (temp.in ())) + temp->ccm_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +////////////////////////////////////////////////////////////////// +// Component Home Glue code implementation +////////////////////////////////////////////////////////////////// + +HUDisplay::NavDisplay_ptr +CIAO_GLUE_HUDisplay::NavDisplayHome_Servant::_ciao_activate_component (HUDisplay::CCM_NavDisplay_ptr exe + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + CORBA::Object_var hobj + = this->container_->get_objref (this + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::CCMHome_var home + = ::Components::CCMHome::_narrow (hobj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + CIAO_GLUE_HUDisplay::NavDisplay_Servant *svt = + new CIAO_GLUE_HUDisplay::NavDisplay_Servant (exe, + home.in (), + this->container_); + PortableServer::ServantBase_var safe (svt); + PortableServer::ObjectId_var oid; + + CORBA::Object_var objref + = this->container_->install_component (svt, + oid.out () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + svt->_ciao_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + HUDisplay::NavDisplay_var ho + = HUDisplay::NavDisplay::_narrow (objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (this->component_map_.bind (oid.in (), svt) == 0) + { + // @@ what should happen if bind fail? + safe._retn (); + } + return ho._retn (); +} + +void +CIAO_GLUE_HUDisplay::NavDisplayHome_Servant::_ciao_passivate_component (HUDisplay::NavDisplay_ptr comp + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + PortableServer::ObjectId_var oid; + + this->container_->uninstall_component (comp, + oid.out () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + CIAO_GLUE_HUDisplay::NavDisplay_Servant *servant = 0; + if (this->component_map_.unbind (oid.in (), servant) == 0) + { + PortableServer::ServantBase_var safe (servant); + servant->_ciao_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } + // What happen if unbind failed? + +} + +// Operations for Implicit Home interface +HUDisplay::NavDisplay_ptr +CIAO_GLUE_HUDisplay::NavDisplayHome_Servant::create (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)) +{ + if (this->executor_.in () == 0) + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); + + Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + HUDisplay::CCM_NavDisplay_var _ciao_comp + = HUDisplay::CCM_NavDisplay::_narrow (_ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return this->_ciao_activate_component (_ciao_comp.in () + ACE_ENV_ARG_PARAMETER); +} + +// Operations for CCMHome interface +void +CIAO_GLUE_HUDisplay::NavDisplayHome_Servant::remove_component (Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) +{ + HUDisplay::NavDisplay_var _ciao_comp + = HUDisplay::NavDisplay::_narrow (comp + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (_ciao_comp.in ())) + ACE_THROW (CORBA::INTERNAL ()); // What is the right exception to throw here? + + // @@ It seems to me that we need to make sure this is a component + // generated by this home before calling remove on this component. + _ciao_comp->remove (ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + + // Removing the object reference? get the servant from the POA with + // the objref, and call remove() on the component, deactivate the + // component, and then remove-ref the servant? + this->_ciao_passivate_component (_ciao_comp.in () + ACE_ENV_ARG_PARAMETER); +} + +extern "C" NAVDISPLAY_SVNT_Export ::PortableServer::Servant +createNavDisplayHome_Servant (::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL) +{ + if (p == 0) + return 0; + + HUDisplay::CCM_NavDisplayHome_var x + = HUDisplay::CCM_NavDisplayHome::_narrow (p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (x.in ())) + return 0; + + return new CIAO_GLUE_HUDisplay::NavDisplayHome_Servant (x.in (), + c); +} diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.h b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.h new file mode 100644 index 00000000000..db60be1bbe8 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.h @@ -0,0 +1,485 @@ +// $Id$ + +// =========================================================== +// +// @file CIAO_Glue_Session_Template.h +// +// This is a pseudo-meta generic servant implementations template +// for CIAO's CIDL compiler. It demonstrates how a servant +// implementation for a session component should look like. +// +// The generated filename for files using this template shoule be +// [idl-basename]_svnt.h +// +// @author Nanbor Wang <nanbor@cs.wustl.edu> +// +// =========================================================== + +#ifndef CIAO_GLUE_SESSION_NAVDISPLAY_SVNT_H +#define CIAO_GLUE_SESSION_NAVDISPLAY_SVNT_H +#include "ace/pre.h" + +#include "NavDisplayS.h" // Source in the skeletons for component + // client-view equivalent interfaces +#include "NavDisplayEC.h" // Source in the executor mapping + // that component implementations use +#include "ciao/Container_Base.h" //Source in the container interface definitions +#include "tao/LocalObject.h" +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Active_Map_Manager_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO_GLUE_HUDisplay +{ + + ////////////////////////////////////////////////////////////////// + // Component specific context implementation + class NAVDISPLAY_SVNT_Export NavDisplay_Context : + public virtual HUDisplay::CCM_NavDisplay_Context, + public virtual TAO_Local_RefCounted_Object + { + public: + // We will allow the the servant glue code we generate to access + // our states. + friend class NavDisplay_Servant; + + // Ctor. + NavDisplay_Context (::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + NavDisplay_Servant *sv); + + // Dtor. + virtual ~NavDisplay_Context (); + + // Operations for [component name] event source, and + // receptacles defined in CCM_[component name]_Context. + + HUDisplay::position_ptr + get_connection_GPSLocation (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for ::Components::CCMContext + virtual ::Components::Principal_ptr + get_caller_principal (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::CCMHome_ptr + get_CCM_home (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Boolean + get_rollback_only (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + + virtual ::Components::Transaction::UserTransaction_ptr + get_user_transaction (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + + virtual CORBA::Boolean + is_caller_in_role (const char * role + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + set_rollback_only (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + + // Operations for ::Components::SessionContext interface + virtual CORBA::Object_ptr + get_CCM_object (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + protected: + // We need to generate, in protected section, stuff that manage + // connections and consumers of this component. + + // Simplex [receptacle name] connection management operations + void + connect_GPSLocation (HUDisplay::position_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)); + + HUDisplay::position_ptr + disconnect_GPSLocation (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::NoConnection)); + + // Simplex [receptacle name] connection + HUDisplay::position_var ciao_uses_GPSLocation_; + + protected: + /// Cached component home reference. + ::Components::CCMHome_var home_; + + /// session container + ::CIAO::Session_Container *container_; + + /// Reference back to owner. + NavDisplay_Servant *servant_; + + /// @@ Cached component reference. + HUDisplay::NavDisplay_var component_; + + }; + + ////////////////////////////////////////////////////////////////// + // Component Servant Glue code implementation + class NAVDISPLAY_SVNT_Export NavDisplay_Servant + : public virtual POA_HUDisplay::NavDisplay, // full skeleton name here + public virtual PortableServer::RefCountServantBase + { + public: + // Ctor. + NavDisplay_Servant (HUDisplay::CCM_NavDisplay_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c); + + // Dtor. + ~NavDisplay_Servant (void); + + // Operations for provides interfaces. + + // Operations for receptacles interfaces. + + // Simplex [receptacle name] connection management operations + virtual void + connect_GPSLocation (HUDisplay::position_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)); + + virtual HUDisplay::position_ptr + disconnect_GPSLocation (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::NoConnection)); + + virtual HUDisplay::position_ptr + get_connection_GPSLocation (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for consumers interfaces. + // First we need to generate the event sink specific servant + class NAVDISPLAY_SVNT_Export tickConsumer_Refresh_Servant + : public virtual POA_HUDisplay::tickConsumer, // full skeleton name here + public virtual PortableServer::RefCountServantBase + { + public: + // Constructor and destructor. + tickConsumer_Refresh_Servant (HUDisplay::CCM_NavDisplay_ptr executor, + HUDisplay::CCM_NavDisplay_Context_ptr c); + + ~tickConsumer_Refresh_Servant (); + + virtual void push_tick (HUDisplay::tick_ptr evt + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Inherit from ::Compopnents::EventBConsumerBase + virtual void push_event (::Components::EventBase_ptr ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::BadEventType)); + + // get_component implementation. + virtual CORBA::Object_ptr + _get_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + // Executor + HUDisplay::CCM_NavDisplay_var executor_; + + // Context object. + HUDisplay::CCM_NavDisplay_Context_var ctx_; + }; + + virtual HUDisplay::tickConsumer_ptr + get_consumer_Refresh (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for emits interfaces. + + // Operations for publishes interfaces. + + // Operations for Navigation interface + virtual CORBA::Object_ptr + provide_facet (const char * name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException , + Components::InvalidName)) ; + + virtual ::Components::FacetDescriptions * + get_all_facets (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::FacetDescriptions * + get_named_facets (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException , + Components::InvalidName)); + + virtual CORBA::Boolean + same_component (CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for Receptacles interface + virtual ::Components::Cookie_ptr + connect (const char * name, + CORBA::Object_ptr connection + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::AlreadyConnected, + Components::ExceededConnectionLimit)); + + virtual CORBA::Object_ptr + disconnect (const char * name, + Components::Cookie_ptr ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::CookieRequired, + Components::NoConnection)); + + virtual ::Components::ConnectionDescriptions * + get_connections (const char * name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::ReceptacleDescriptions * + get_all_receptacles (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::ReceptacleDescriptions * + get_named_receptacles (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + // Operations for Events interface + virtual ::Components::EventConsumerBase_ptr + get_consumer (const char * sink_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::Cookie_ptr + subscribe (const char * publisher_name, + Components::EventConsumerBase_ptr subscriber + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::ExceededConnectionLimit)); + + virtual ::Components::EventConsumerBase_ptr + unsubscribe (const char * publisher_name, + Components::Cookie_ptr ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)); + + virtual void + connect_consumer (const char * emitter_name, + Components::EventConsumerBase_ptr consumer + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::AlreadyConnected, + Components::InvalidConnection)); + + virtual ::Components::EventConsumerBase_ptr + disconnect_consumer (const char * source_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::NoConnection)); + + virtual ::Components::ConsumerDescriptions * + get_all_consumers (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::ConsumerDescriptions * + get_named_consumers (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::EmitterDescriptions * + get_all_emitters (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::EmitterDescriptions * + get_named_emitters (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::PublisherDescriptions * + get_all_publishers (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::PublisherDescriptions * + get_named_publishers (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + // Operations for CCMObject interface + virtual ::CORBA::IRObject_ptr + get_component_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::CCMHome_ptr + get_ccm_home (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::PrimaryKeyBase * + get_primary_key (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::NoKeyAvailable)); + + virtual void + configuration_complete (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidConfiguration)); + + virtual void + remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + + virtual ::Components::ComponentPortDescription * + get_all_ports (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // get_component implementation. + virtual CORBA::Object_ptr + _get_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // CIAO specific operations. + + // Activate the object in the container_ + void + _ciao_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + // My Executor. + HUDisplay::CCM_NavDisplay_var executor_; + + // My Run-time Context. + NavDisplay_Context *context_; + + // Managing container. + ::CIAO::Session_Container *container_; + + // Cached provided interfaces. + HUDisplay::tickConsumer_var consumes_Refresh_; + }; + + + ////////////////////////////////////////////////////////////////// + // Component Home Glue code implementation + + // Foreach component home + class NAVDISPLAY_SVNT_Export NavDisplayHome_Servant : + public virtual POA_HUDisplay::NavDisplayHome, // full skeleton name here + public virtual PortableServer::RefCountServantBase + { + public: + // Ctor. + NavDisplayHome_Servant (HUDisplay::CCM_NavDisplayHome_ptr exe, + CIAO::Session_Container *c); + + // Dtor. + ~NavDisplayHome_Servant (void); + + // Factory operations + + // Finder operations + + // Operations for KeylessHome interface + virtual ::Components::CCMObject_ptr + create_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)); + + // Operations for Implicit Home interface + virtual HUDisplay::NavDisplay_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)); + + // Operations for CCMHome interface + virtual ::CORBA::IRObject_ptr + get_component_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::CORBA::IRObject_ptr + get_home_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void remove_component (Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + + protected: + // Helper method for factory operations. + HUDisplay::NavDisplay_ptr + _ciao_activate_component (HUDisplay::CCM_NavDisplay_ptr exe + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate_component (HUDisplay::NavDisplay_ptr comp + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // My Executor. + HUDisplay::CCM_NavDisplayHome_var executor_; + + // My Container + CIAO::Session_Container *container_; + + // Components this home manages. + ACE_Hash_Map_Manager_Ex <PortableServer::ObjectId, + NavDisplay_Servant*, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> component_map_; + }; + + extern "C" NAVDISPLAY_SVNT_Export ::PortableServer::Servant + createNavDisplayHome_Servant (::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); +} + +#if defined (__ACE_INLINE__) +# include "NavDisplay_svnt.inl" +#endif /* __ACE_INLINE__ */ + + +#include "ace/post.h" +#endif /* CIAO_GLUE_SESSION_NAVDISPLAY_SVNT_H */ diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.inl b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.inl new file mode 100644 index 00000000000..5596f1675f2 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.inl @@ -0,0 +1,202 @@ +// $Id$ + +// The generated filename for files using this template shoule be +// [idl-basename]GS.i GS --> GlueSession + +// @@ Notice: [ciao module name] can expand to either CIAO_GLUE or +// CIAO_GLUE_[module name] as defined in the header file. + +/// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +/// @@@ Notice that all component and interface names need to be +/// fully qualified as we are creating a new namespace for the CIAO's +/// container glue code. +/// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +////////////////////////////////////////////////////////////////// +// Component specific context implementation +////////////////////////////////////////////////////////////////// + +ACE_INLINE +CIAO_GLUE_HUDisplay::NavDisplay_Context::NavDisplay_Context (::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + CIAO_GLUE_HUDisplay::NavDisplay_Servant *sv) + : home_ (::Components::CCMHome::_duplicate (home)), + container_ (c), + servant_ (sv) +{ + +} + +ACE_INLINE +CIAO_GLUE_HUDisplay::NavDisplay_Context::~NavDisplay_Context () +{ +} + +// Operations for emits interfaces. + +// Operations for ::Components::CCMContext +ACE_INLINE ::Components::Principal_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Context::get_caller_principal (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ We don't support Security in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +ACE_INLINE ::Components::CCMHome_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Context::get_CCM_home (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return ::Components::CCMHome::_duplicate (this->home_.in ()); +} + +ACE_INLINE CORBA::Boolean +CIAO_GLUE_HUDisplay::NavDisplay_Context::get_rollback_only (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ We don't support Transaction in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +ACE_INLINE ::Components::Transaction::UserTransaction_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Context::get_user_transaction (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ We don't support Transaction in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +ACE_INLINE CORBA::Boolean +CIAO_GLUE_HUDisplay::NavDisplay_Context::is_caller_in_role (const char * role + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_UNUSED_ARG (role); + + // @@ We don't support Transaction in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +ACE_INLINE void +CIAO_GLUE_HUDisplay::NavDisplay_Context::set_rollback_only (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ We don't support Transaction in CIAO yet. + ACE_THROW (CORBA::NO_IMPLEMENT ()); +} + +////////////////////////////////////////////////////////////////// +// Component Servant Glue code implementation +////////////////////////////////////////////////////////////////// + +// Simplex [receptacle name] connection management operations +ACE_INLINE void +CIAO_GLUE_HUDisplay::NavDisplay_Servant::connect_GPSLocation (HUDisplay::position_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)) +{ + this->context_->connect_GPSLocation (c + ACE_ENV_ARG_PARAMETER); +} + +ACE_INLINE HUDisplay::position_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Servant::disconnect_GPSLocation (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::NoConnection)) +{ + return this->context_->disconnect_GPSLocation (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +ACE_INLINE HUDisplay::position_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_connection_GPSLocation (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->context_->get_connection_GPSLocation (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +// Constructor and destructor. +ACE_INLINE +CIAO_GLUE_HUDisplay::NavDisplay_Servant::tickConsumer_Refresh_Servant::tickConsumer_Refresh_Servant +(HUDisplay::CCM_NavDisplay_ptr executor, + HUDisplay::CCM_NavDisplay_Context_ptr c) + : executor_ (HUDisplay::CCM_NavDisplay::_duplicate (executor)), + ctx_ (HUDisplay::CCM_NavDisplay_Context::_duplicate (c)) +{ +} + +ACE_INLINE +CIAO_GLUE_HUDisplay::NavDisplay_Servant::tickConsumer_Refresh_Servant::~tickConsumer_Refresh_Servant () +{ +} + +ACE_INLINE CORBA::Object_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Servant::tickConsumer_Refresh_Servant::_get_component (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->ctx_->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +ACE_INLINE void +CIAO_GLUE_HUDisplay::NavDisplay_Servant::tickConsumer_Refresh_Servant::push_tick +(HUDisplay::tick_ptr evt + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->executor_->push_Refresh (evt + ACE_ENV_ARG_PARAMETER); +} + +// Operations for emits interfaces. + +// Operations for publishes interfaces. + +////////////////////////////////////////////////////////////////// +// Component Home Glue code implementation +////////////////////////////////////////////////////////////////// + +ACE_INLINE +CIAO_GLUE_HUDisplay::NavDisplayHome_Servant::NavDisplayHome_Servant (HUDisplay::CCM_NavDisplayHome_ptr exe, + CIAO::Session_Container *c) + : executor_ (HUDisplay::CCM_NavDisplayHome::_duplicate (exe)), + container_ (c) +{ +} + +ACE_INLINE +CIAO_GLUE_HUDisplay::NavDisplayHome_Servant::~NavDisplayHome_Servant (void) +{ +} + +// Operations for KeylessHome interface +ACE_INLINE ::Components::CCMObject_ptr +CIAO_GLUE_HUDisplay::NavDisplayHome_Servant::create_component (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)) +{ + // Simply forward to the create method. + return this->create (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +// Operations for CCMHome interface +ACE_INLINE ::CORBA::IRObject_ptr +CIAO_GLUE_HUDisplay::NavDisplayHome_Servant::get_component_def (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ TO-DO. Contact IfR? + + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +ACE_INLINE CORBA::IRObject_ptr +CIAO_GLUE_HUDisplay::NavDisplayHome_Servant::get_home_def (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ TO-DO. Contact IfR? + + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_svnt_export.h b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_svnt_export.h new file mode 100644 index 00000000000..6fdaae1163f --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_svnt_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl NAVDISPLAY_SVNT +// ------------------------------ +#ifndef NAVDISPLAY_SVNT_EXPORT_H +#define NAVDISPLAY_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (NAVDISPLAY_SVNT_HAS_DLL) +# define NAVDISPLAY_SVNT_HAS_DLL 1 +#endif /* ! NAVDISPLAY_SVNT_HAS_DLL */ + +#if defined (NAVDISPLAY_SVNT_HAS_DLL) && (NAVDISPLAY_SVNT_HAS_DLL == 1) +# if defined (NAVDISPLAY_SVNT_BUILD_DLL) +# define NAVDISPLAY_SVNT_Export ACE_Proper_Export_Flag +# define NAVDISPLAY_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define NAVDISPLAY_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* NAVDISPLAY_SVNT_BUILD_DLL */ +# define NAVDISPLAY_SVNT_Export ACE_Proper_Import_Flag +# define NAVDISPLAY_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define NAVDISPLAY_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* NAVDISPLAY_SVNT_BUILD_DLL */ +#else /* NAVDISPLAY_SVNT_HAS_DLL == 1 */ +# define NAVDISPLAY_SVNT_Export +# define NAVDISPLAY_SVNT_SINGLETON_DECLARATION(T) +# define NAVDISPLAY_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* NAVDISPLAY_SVNT_HAS_DLL == 1 */ + +// Set NAVDISPLAY_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (NAVDISPLAY_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define NAVDISPLAY_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define NAVDISPLAY_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !NAVDISPLAY_SVNT_NTRACE */ + +#if (NAVDISPLAY_SVNT_NTRACE == 1) +# define NAVDISPLAY_SVNT_TRACE(X) +#else /* (NAVDISPLAY_SVNT_NTRACE == 1) */ +# define NAVDISPLAY_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (NAVDISPLAY_SVNT_NTRACE == 1) */ + +#endif /* NAVDISPLAY_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplay/run_test.pl b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/run_test.pl new file mode 100644 index 00000000000..78bf1f98e49 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/run_test.pl @@ -0,0 +1,108 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "../../../../../../bin"; +use PerlACE::Run_Test; + +$status = 0; +$daemon_ior = PerlACE::LocalFile ("daemon.ior"); +$svr_ior = PerlACE::LocalFile ("server.ior"); +$home_ior = PerlACE::LocalFile ("NavDisplayHome.ior"); + +unlink $daemon_ior; +unlink $svr_ior; +unlink $home_ior; + +# CIAO Daemon command line arguments +$daemon_args = "-o $daemon_ior -i ../CIAO_Installation_Data.ini -n ../../../../tools/ComponentServer/ComponentServer"; + +# CIAO Daemon Controller location: +$controller = "../../../../tools/Daemon/DaemonController"; + +# Daemon controller common command line arguments +$common_args = "-ORBInitRef CIAODaemon=file://$daemon_ior"; + +# Daemon controller start_home command +$start_args = "start_home -s NavDisplay.csd -m $home_ior -c $svr_ior"; + +# Daemon controller end_home command +$end_args = "end_home -c file://$svr_ior"; + +# Daemon controller shutdown command +$shutdown_args = "shutdown"; + +# Client program command line arguments +$cl_args = ""; + +# Naming_Service process definition +$DS = new PerlACE::Process ("../../../../tools/Daemon/CIAO_Daemon", + "$daemon_args"); + +# Client process definition +$CL = new PerlACE::Process ("client", + "$cl_args"); + +## Starting up the CIAO daemon +$DS->Spawn (); +if (PerlACE::waitforfile_timed ($daemon_ior, 15) == -1) { + print STDERR "ERROR: Could not find daemon ior file <$daemon_ior>\n"; + $DS->Kill (); + exit 1; +} + +## Starting up a ComponentServer running the RateGen home. +$DC = new PerlACE::Process ("$controller", + "$common_args $start_args"); + +$DC->SpawnWaitKill (60); +if (PerlACE::waitforfile_timed ($home_ior, 15) == -1) { + print STDERR "ERROR: Could not find home ior file <$home_ior>\n"; + $DS->Kill (); + exit 1; +} + +$client = $CL->SpawnWaitKill (60); + +if ($client != 0) { + print STDERR "ERROR: client returned $client\n"; + $status = 1; +} + +## Terminating the ComponentServer running the RateGen home. +$DC = new PerlACE::Process ("$controller", + "$common_args $end_args"); + +$ctrl = $DC->SpawnWaitKill (60); +if ($ctrl != 0) { + print STDERR "ERROR: Fail to end component server\n"; + $DS->Kill (); + exit 1; +} + +## Terminating the ComponentServer running the RateGen home. +$DC = new PerlACE::Process ("$controller", + "$common_args $shutdown_args"); + +$ctrl = $DC->SpawnWaitKill (60); +if ($ctrl != 0) { + print STDERR "ERROR: Fail to shutdown CIAODaemon\n"; + $DS->Kill (); + exit 1; +} + +$ctrl = $DS->WaitKill (60); +if ($ctrl != 0) { + print STDERR "ERROR: CIAODaemon didn't shutdown gracefully $ctrl\n"; + $DS->Kill (); + exit 1; +} + +unlink $daemon_ior; +unlink $svr_ior; +unlink $home_ior; + +exit $status; diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/AddNavUnitCmd.cpp b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/AddNavUnitCmd.cpp new file mode 100644 index 00000000000..32572eaf742 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/AddNavUnitCmd.cpp @@ -0,0 +1,28 @@ +// $Id$ + +#include "AddNavUnitCmd.h" +#include "RootPanel.h" +#include "NavUnit.h" + + +AddNavUnitCmd::AddNavUnitCmd() +{ +} + + +AddNavUnitCmd * +AddNavUnitCmd::create(RootPanel *form, NavUnit *unit) +{ + AddNavUnitCmd *cmd = new AddNavUnitCmd(); + cmd->form_ = form; + cmd->unit_ = unit; + return cmd; +} + + +int +AddNavUnitCmd::execute(void *context) +{ + this->form_->addUnit(this->unit_); + return 0; +} diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/AddNavUnitCmd.h b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/AddNavUnitCmd.h new file mode 100644 index 00000000000..d156a8008ed --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/AddNavUnitCmd.h @@ -0,0 +1,27 @@ +// $Id$ + +#ifndef __ADDNAVUNITCMD_H +#define __ADDNAVUNITCMD_H + +#include "Command.h" + +class RootPanel; +class NavUnit; + +class AddNavUnitCmd : public CommandBase +{ +public: + static AddNavUnitCmd *create(RootPanel *form, NavUnit *unit); + +public: + virtual int execute(void *context = NULL); + +protected: + AddNavUnitCmd(); + + RootPanel *form_; + NavUnit *unit_; +}; + + +#endif // __ADDNAVUNITCMD_H diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/Command.h b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/Command.h new file mode 100644 index 00000000000..3c1e9ef6cdd --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/Command.h @@ -0,0 +1,20 @@ +// $Id$ + +#ifndef __COMMAND_H +#define __COMMAND_H + +#include <qdatetime.h> + +class CommandBase +{ +public: + CommandBase() {timestamp_ = QTime::currentTime();} + virtual ~CommandBase() {} + +public: + virtual int execute(void *context = NULL) = 0; + QTime timestamp_; +}; + + +#endif // __COMMAND_H diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/DetailView.cpp b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/DetailView.cpp new file mode 100644 index 00000000000..8a5c61d3c2f --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/DetailView.cpp @@ -0,0 +1,165 @@ +// $Id$ + +#include "DetailView.h" +#include <qlayout.h> +#include <qpushbutton.h> +#include <qtabwidget.h> +#include <qtable.h> +#include <qlabel.h> +#include <qlineedit.h> +#include <qspinbox.h> + + +DetailView::DetailView(QWidget *parent, const char *name) +: QWidget(parent, name), current_unit(NULL) +{ + QGridLayout *grid = new QGridLayout(this, 8, 10); + + // Create a label containing a QMovie + separatorlabel = new QLabel(this, "label0" ); + + grid->addMultiCellWidget(separatorlabel, 0, 0, 0, 9); + + QLabel *sem_id_label = new QLabel("FDN:", this); + grid->addWidget(sem_id_label, 1, 0); + sem_id_val = new QLineEdit(this); + sem_id_val->setReadOnly(1); + grid->addMultiCellWidget(sem_id_val, 1, 1, 1, 7); + + QLabel *descr_label = new QLabel("Description:", this); + grid->addWidget(descr_label, 2, 0); + descr_edit = new QLineEdit(this); + grid->addMultiCellWidget(descr_edit, 2, 2, 1, 7); + + QLabel *x_label = new QLabel("X coordinate:", this); + grid->addWidget(x_label, 3, 0); + x_edit = new QSpinBox(this); + x_edit->setMinValue(0); + x_edit->setMaxValue(65535); + grid->addWidget(x_edit, 3, 1); + + QLabel *y_label = new QLabel("Y coordinate:", this); + grid->addWidget(y_label, 3, 3); + y_edit = new QSpinBox(this); + y_edit->setMinValue(0); + y_edit->setMaxValue(65535); + grid->addWidget(y_edit, 3, 4); + + QLabel *z_label = new QLabel("Z coordinate:", this); + grid->addWidget(z_label, 3, 6); + z_edit = new QSpinBox(this); + z_edit->setMinValue(0); + z_edit->setMaxValue(65535); + grid->addWidget(z_edit, 3, 7); + + // Create a label containing a QMovie + QString path_to_movie; + char *ace_root = getenv("ACE_ROOT"); + if(ace_root) + { + path_to_movie += ace_root; + path_to_movie += "/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/trolltech.gif"; + } + else + { + path_to_movie = "../NavDisplayGUI_exec/trolltech.gif"; + } + movie = QMovie(path_to_movie); + movielabel = new QLabel(this, "label1" ); + movie.connectStatus(this, SLOT(movieStatus(int))); + movie.connectUpdate(this, SLOT(movieUpdate(const QRect&))); + movielabel->setFrameStyle( QFrame::Box | QFrame::Plain ); + movielabel->setMovie(movie); + movielabel->setFixedSize( 128+movielabel->frameWidth()*2, + 64+movielabel->frameWidth()*2 ); + grid->addMultiCellWidget(new QLabel("", this), 1, 4, 8, 8); + grid->addMultiCellWidget(movielabel, 1, 4, 9, 9); + + + QPushButton *apply = new QPushButton("Apply", this); + apply->setDefault(1); + grid->addWidget(apply, 7, 9); + + connect(apply, SIGNAL(clicked()), this, SLOT(apply())); + + QTabWidget *tabs = new QTabWidget(this); + + + child_list = new QTable(0, 6, tabs); + child_list->setSelectionMode(QTable::Single); + child_list->horizontalHeader()->setLabel(0, "FDN"); + child_list->horizontalHeader()->setLabel(1, "Description"); + child_list->horizontalHeader()->setLabel(2, "X Coordinate"); + child_list->horizontalHeader()->setLabel(3, "Y Coordinate"); + child_list->horizontalHeader()->setLabel(4, "Z Coordinate"); + child_list->horizontalHeader()->setLabel(5, "Color"); + + parent_list = new QTable(0, 6, tabs); + parent_list->setSelectionMode(QTable::Single); + parent_list->horizontalHeader()->setLabel(0, "FDN"); + parent_list->horizontalHeader()->setLabel(1, "Description"); + parent_list->horizontalHeader()->setLabel(2, "X Coordinate"); + parent_list->horizontalHeader()->setLabel(3, "Y Coordinate"); + parent_list->horizontalHeader()->setLabel(4, "Z Coordinate"); + parent_list->horizontalHeader()->setLabel(5, "Color"); + + tabs->addTab(child_list, "Property set &1"); + tabs->addTab(parent_list, "Property set &2"); + + grid->addMultiCellWidget(new QLabel(this), 4, 4, 0, 9); + grid->addMultiCellWidget(tabs, 5, 5, 0, 9); +} + + +DetailView::~DetailView() +{ +} + + +void +DetailView::currentNode(NavUnit *unit) +{ + UnitLocation loc = unit->getLocation(); + descr_edit->setText(unit->getShortDescr()); + this->updateLocation(loc); +} + +void +DetailView::updateLocation(const UnitLocation &loc) +{ + x_edit->setValue(loc.x_); + y_edit->setValue(loc.y_); + z_edit->setValue(loc.z_); +} + +void +DetailView::apply() +{ +} + + +void +DetailView::movieUpdate( const QRect& ) +{ + // Uncomment this to test animated icons on your window manager + //setIcon( movie.framePixmap() ); +} + + +void +DetailView::movieStatus( int s ) +{ + switch ( s ) { + case QMovie::SourceEmpty: + case QMovie::UnrecognizedFormat: + { + QPixmap pm("tt-logo.png"); + movielabel->setPixmap(pm); + movielabel->setFixedSize(pm.size()); + } + break; + default: + if ( movielabel->movie() ) // for flicker-free animation: + movielabel->setBackgroundMode( NoBackground ); + } +} diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/DetailView.h b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/DetailView.h new file mode 100644 index 00000000000..ef9e0070884 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/DetailView.h @@ -0,0 +1,51 @@ +// $Id$ + +#ifndef __DETAILVIEW_H +#define __DETAILVIEW_H + + +#include "NavUnit.h" +#include <qwidget.h> +#include <qmovie.h> + + +class QLabel; +class QLineEdit; +class QSpinBox; +class QTable; + + +class DetailView : public QWidget +{ + Q_OBJECT + +public: + DetailView(QWidget *parent, const char *name = 0); + virtual ~DetailView(); + +public slots: + void movieStatus(int); + void movieUpdate(const QRect&); + void currentNode(NavUnit *unit); + void updateLocation(const UnitLocation &loc); + void apply(); + +private: + QLineEdit *sem_id_val; + QLineEdit *descr_edit; + QSpinBox *x_edit; + QSpinBox *y_edit; + QSpinBox *z_edit; + QTable *child_list; + QTable *parent_list; + QLabel *movielabel; + QMovie movie; + QLabel *separatorlabel; + QMovie separator; + + + NavUnit *current_unit; +}; + + +#endif // __DETAILVIEW_H diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/MapView.cpp b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/MapView.cpp new file mode 100644 index 00000000000..19f444e281e --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/MapView.cpp @@ -0,0 +1,48 @@ +// $Id$ + +#include "MapView.h" +#include <stdlib.h> + +MapView::MapView( + QCanvas& c, + QWidget* parent, + const char* name, + WFlags f) + : + QCanvasView(&c, parent, name, f) +{ + QString path_to_movie; + char *ace_root = getenv("ACE_ROOT"); + if(ace_root) + { + path_to_movie += ace_root; + path_to_movie += "/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/worldmap1.gif"; + } + else + { + path_to_movie = "../NavDisplayGUI_exec/worldmap1.gif"; + } + bg_pixmap_.load(path_to_movie); + viewport()->setBackgroundMode(NoBackground); + enableClipper(TRUE); + if(!bg_pixmap_.isNull()) + { + resizeContents(bg_pixmap_.width(), bg_pixmap_.height()); + } + else + resizeContents(100, 100); + + canvas()->setBackgroundPixmap(bg_pixmap_); +} + + +void +MapView::clear() +{ + /*QCanvasItemList list = canvas()->allItems(); + for(QCanvasItemList::Iterator it = list.begin(); it != list.end(); ++it) + { + if(*it) + delete *it; + }*/ +} diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/MapView.h b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/MapView.h new file mode 100644 index 00000000000..e640a63c985 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/MapView.h @@ -0,0 +1,23 @@ +// $Id$ + +#ifndef __MAPVIEW_H +#define __MAPVIEW_H + +#include <qcanvas.h> +#include <qpixmap.h> + +class MapView : public QCanvasView +{ + Q_OBJECT + +public: + MapView(QCanvas&, QWidget* parent=0, const char* name=0, WFlags f=0); + void clear(); + +protected: + QPixmap bg_pixmap_; +}; + + + +#endif // __MAPVIEW_H diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayEIC.cpp b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayEIC.cpp new file mode 100644 index 00000000000..e937f2a8125 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayEIC.cpp @@ -0,0 +1,541 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +// TAO_IDL - Generated from +// be\be_codegen.cpp:314 + + +#include "NavDisplayEIC.h" +#include "tao/Stub.h" +#include "tao/Invocation.h" +#include "tao/PortableInterceptor.h" + +#if TAO_HAS_INTERCEPTORS == 1 +#include "tao/RequestInfo_Util.h" +#include "tao/ClientRequestInfo_i.h" +#include "tao/ClientInterceptorAdapter.h" +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + + +#if defined (__BORLANDC__) +#pragma option -w-rvl -w-rch -w-ccc -w-aus -w-sig +#endif /* __BORLANDC__ */ + +#if !defined (__ACE_INLINE__) +#include "NavDisplayEIC.i" +#endif /* !defined INLINE */ + +// TAO_IDL - Generated from +// c:\usr\src\ace_wrappers\tao\tao_idl\be\be_visitor_interface/interface_cs.cpp:61 + +int HUDisplay::NavDisplay_Exec::_tao_class_id = 0; + +HUDisplay::NavDisplay_Exec_ptr +tao_HUDisplay_NavDisplay_Exec_duplicate ( + HUDisplay::NavDisplay_Exec_ptr p + ) +{ + return HUDisplay::NavDisplay_Exec::_duplicate (p); +} + +void +tao_HUDisplay_NavDisplay_Exec_release ( + HUDisplay::NavDisplay_Exec_ptr p + ) +{ + CORBA::release (p); +} + +HUDisplay::NavDisplay_Exec_ptr +tao_HUDisplay_NavDisplay_Exec_nil ( + void + ) +{ + return HUDisplay::NavDisplay_Exec::_nil (); +} + +HUDisplay::NavDisplay_Exec_ptr +tao_HUDisplay_NavDisplay_Exec_narrow ( + CORBA::Object *p + ACE_ENV_ARG_DECL + ) +{ + return HUDisplay::NavDisplay_Exec::_narrow (p ACE_ENV_ARG_PARAMETER); +} + +CORBA::Object * +tao_HUDisplay_NavDisplay_Exec_upcast ( + void *src + ) +{ + HUDisplay::NavDisplay_Exec **tmp = + ACE_static_cast (HUDisplay::NavDisplay_Exec **, src); + return *tmp; +} + +// TAO_IDL - Generated from +// be\be_interface.cpp:715 + +// ************************************************************* +// HUDisplay::NavDisplay_Exec_var +// ************************************************************* + +HUDisplay::NavDisplay_Exec_var::NavDisplay_Exec_var (void) + : ptr_ (NavDisplay_Exec::_nil ()) +{} + +::HUDisplay::NavDisplay_Exec_ptr +HUDisplay::NavDisplay_Exec_var::ptr (void) const +{ + return this->ptr_; +} + +HUDisplay::NavDisplay_Exec_var::NavDisplay_Exec_var (const ::HUDisplay::NavDisplay_Exec_var &p) + : TAO_Base_var (), + ptr_ (NavDisplay_Exec::_duplicate (p.ptr ())) +{} + +HUDisplay::NavDisplay_Exec_var::~NavDisplay_Exec_var (void) +{ + CORBA::release (this->ptr_); +} + +HUDisplay::NavDisplay_Exec_var & +HUDisplay::NavDisplay_Exec_var::operator= (NavDisplay_Exec_ptr p) +{ + CORBA::release (this->ptr_); + this->ptr_ = p; + return *this; +} + +HUDisplay::NavDisplay_Exec_var & +HUDisplay::NavDisplay_Exec_var::operator= (const ::HUDisplay::NavDisplay_Exec_var &p) +{ + if (this != &p) + { + CORBA::release (this->ptr_); + this->ptr_ = ::HUDisplay::NavDisplay_Exec::_duplicate (p.ptr ()); + } + return *this; +} + +HUDisplay::NavDisplay_Exec_var::operator const ::HUDisplay::NavDisplay_Exec_ptr &() const // cast +{ + return this->ptr_; +} + +HUDisplay::NavDisplay_Exec_var::operator ::HUDisplay::NavDisplay_Exec_ptr &() // cast +{ + return this->ptr_; +} + +::HUDisplay::NavDisplay_Exec_ptr +HUDisplay::NavDisplay_Exec_var::operator-> (void) const +{ + return this->ptr_; +} + +::HUDisplay::NavDisplay_Exec_ptr +HUDisplay::NavDisplay_Exec_var::in (void) const +{ + return this->ptr_; +} + +::HUDisplay::NavDisplay_Exec_ptr & +HUDisplay::NavDisplay_Exec_var::inout (void) +{ + return this->ptr_; +} + +::HUDisplay::NavDisplay_Exec_ptr & +HUDisplay::NavDisplay_Exec_var::out (void) +{ + CORBA::release (this->ptr_); + this->ptr_ = ::HUDisplay::NavDisplay_Exec::_nil (); + return this->ptr_; +} + +::HUDisplay::NavDisplay_Exec_ptr +HUDisplay::NavDisplay_Exec_var::_retn (void) +{ + // yield ownership of managed obj reference + ::HUDisplay::NavDisplay_Exec_ptr val = this->ptr_; + this->ptr_ = ::HUDisplay::NavDisplay_Exec::_nil (); + return val; +} + +::HUDisplay::NavDisplay_Exec_ptr +HUDisplay::NavDisplay_Exec_var::tao_duplicate (NavDisplay_Exec_ptr p) +{ + return ::HUDisplay::NavDisplay_Exec::_duplicate (p); +} + +void +HUDisplay::NavDisplay_Exec_var::tao_release (NavDisplay_Exec_ptr p) +{ + CORBA::release (p); +} + +::HUDisplay::NavDisplay_Exec_ptr +HUDisplay::NavDisplay_Exec_var::tao_nil (void) +{ + return ::HUDisplay::NavDisplay_Exec::_nil (); +} + +::HUDisplay::NavDisplay_Exec_ptr +HUDisplay::NavDisplay_Exec_var::tao_narrow ( + CORBA::Object *p + ACE_ENV_ARG_DECL + ) +{ + return ::HUDisplay::NavDisplay_Exec::_narrow (p ACE_ENV_ARG_PARAMETER); +} + +CORBA::Object * +HUDisplay::NavDisplay_Exec_var::tao_upcast (void *src) +{ + NavDisplay_Exec **tmp = + ACE_static_cast (NavDisplay_Exec **, src); + return *tmp; +} + +// TAO_IDL - Generated from +// be\be_interface.cpp:1024 + +// ************************************************************* +// HUDisplay::NavDisplay_Exec_out +// ************************************************************* + +HUDisplay::NavDisplay_Exec_out::NavDisplay_Exec_out (NavDisplay_Exec_ptr &p) + : ptr_ (p) +{ + this->ptr_ = ::HUDisplay::NavDisplay_Exec::_nil (); +} + +HUDisplay::NavDisplay_Exec_out::NavDisplay_Exec_out (NavDisplay_Exec_var &p) + : ptr_ (p.out ()) +{ + CORBA::release (this->ptr_); + this->ptr_ = ::HUDisplay::NavDisplay_Exec::_nil (); +} + +HUDisplay::NavDisplay_Exec_out::NavDisplay_Exec_out (const ::HUDisplay::NavDisplay_Exec_out &p) + : ptr_ (ACE_const_cast (NavDisplay_Exec_out &, p).ptr_) +{} + +::HUDisplay::NavDisplay_Exec_out & +HUDisplay::NavDisplay_Exec_out::operator= (const ::HUDisplay::NavDisplay_Exec_out &p) +{ + this->ptr_ = ACE_const_cast (NavDisplay_Exec_out&, p).ptr_; + return *this; +} + +HUDisplay::NavDisplay_Exec_out & +HUDisplay::NavDisplay_Exec_out::operator= (const ::HUDisplay::NavDisplay_Exec_var &p) +{ + this->ptr_ = ::HUDisplay::NavDisplay_Exec::_duplicate (p.ptr ()); + return *this; +} + +HUDisplay::NavDisplay_Exec_out & +HUDisplay::NavDisplay_Exec_out::operator= (NavDisplay_Exec_ptr p) +{ + this->ptr_ = p; + return *this; +} + +HUDisplay::NavDisplay_Exec_out::operator ::HUDisplay::NavDisplay_Exec_ptr &() // cast +{ + return this->ptr_; +} + +::HUDisplay::NavDisplay_Exec_ptr & +HUDisplay::NavDisplay_Exec_out::ptr (void) +{ + return this->ptr_; +} + +::HUDisplay::NavDisplay_Exec_ptr +HUDisplay::NavDisplay_Exec_out::operator-> (void) +{ + return this->ptr_; +} + +// TAO_IDL - Generated from +// c:\usr\src\ace_wrappers\tao\tao_idl\be\be_visitor_interface/interface_cs.cpp:225 + +HUDisplay::NavDisplay_Exec::NavDisplay_Exec (void) +{} + +HUDisplay::NavDisplay_Exec::~NavDisplay_Exec (void) +{} + +void +HUDisplay::NavDisplay_Exec::_tao_any_destructor (void *_tao_void_pointer) +{ + NavDisplay_Exec *tmp = ACE_static_cast (NavDisplay_Exec *, _tao_void_pointer); + CORBA::release (tmp); +} + +HUDisplay::NavDisplay_Exec_ptr +HUDisplay::NavDisplay_Exec::_narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL + ) +{ + return NavDisplay_Exec::_unchecked_narrow (obj ACE_ENV_ARG_PARAMETER); +} + +HUDisplay::NavDisplay_Exec_ptr +HUDisplay::NavDisplay_Exec::_unchecked_narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_NOT_USED + ) +{ + if (CORBA::is_nil (obj)) + { + return NavDisplay_Exec::_nil (); + } + + return + ACE_reinterpret_cast ( + NavDisplay_Exec_ptr, + obj->_tao_QueryInterface ( + ACE_reinterpret_cast ( + ptr_arith_t, + &NavDisplay_Exec::_tao_class_id + ) + ) + ); +} + +HUDisplay::NavDisplay_Exec_ptr +HUDisplay::NavDisplay_Exec::_duplicate (NavDisplay_Exec_ptr obj) +{ + if (! CORBA::is_nil (obj)) + { + obj->_add_ref (); + } + + return obj; +} + +void *HUDisplay::NavDisplay_Exec::_tao_QueryInterface (ptr_arith_t type) +{ + void *retv = 0; + + if (type == ACE_reinterpret_cast ( + ptr_arith_t, + &ACE_NESTED_CLASS (::HUDisplay, NavDisplay_Exec)::_tao_class_id) + ) + { + retv = ACE_reinterpret_cast (void*, this); + } + else if (type == ACE_reinterpret_cast ( + ptr_arith_t, + &::HUDisplay::CCM_NavDisplay::_tao_class_id) + ) + { + retv = + ACE_reinterpret_cast ( + void *, + ACE_static_cast ( + HUDisplay::CCM_NavDisplay_ptr, + this + ) + ); + } + else if (type == ACE_reinterpret_cast ( + ptr_arith_t, + &::Components::SessionComponent::_tao_class_id) + ) + { + retv = + ACE_reinterpret_cast ( + void *, + ACE_static_cast ( + Components::SessionComponent_ptr, + this + ) + ); + } + else if (type == ACE_reinterpret_cast ( + ptr_arith_t, + &::Components::EnterpriseComponent::_tao_class_id) + ) + { + retv = + ACE_reinterpret_cast ( + void *, + ACE_static_cast ( + Components::EnterpriseComponent_ptr, + this + ) + ); + } + else if (type == ACE_reinterpret_cast ( + ptr_arith_t, + &CORBA::Object::_tao_class_id) + ) + { + retv = + ACE_reinterpret_cast ( + void *, + ACE_static_cast (CORBA::Object_ptr, this) + ); + } + + if (retv != 0) + { + this->_add_ref (); + } + + return retv; +} + +const char* HUDisplay::NavDisplay_Exec::_interface_repository_id (void) const +{ + return "IDL:HUDisplay/NavDisplay_Exec:1.0"; +} + +// TAO_IDL - Generated from +// c:\usr\src\ace_wrappers\tao\tao_idl\be\be_visitor_typecode/typecode_defn.cpp:284 + +static const CORBA::Long _oc_HUDisplay_NavDisplay_Exec[] = +{ + TAO_ENCAP_BYTE_ORDER, // byte order + 34, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x48554469), + ACE_NTOHL (0x73706c61), + ACE_NTOHL (0x792f4e61), + ACE_NTOHL (0x76446973), + ACE_NTOHL (0x706c6179), + ACE_NTOHL (0x5f457865), + ACE_NTOHL (0x633a312e), + ACE_NTOHL (0x30000000), // repository ID = IDL:HUDisplay/NavDisplay_Exec:1.0 + 16, + ACE_NTOHL (0x4e617644), + ACE_NTOHL (0x6973706c), + ACE_NTOHL (0x61795f45), + ACE_NTOHL (0x78656300), // name = NavDisplay_Exec +}; + +static CORBA::TypeCode _tc_TAO_tc_HUDisplay_NavDisplay_Exec ( + CORBA::tk_objref, + sizeof (_oc_HUDisplay_NavDisplay_Exec), + (char *) &_oc_HUDisplay_NavDisplay_Exec, + 0, + sizeof (HUDisplay::NavDisplay_Exec) + ); + +TAO_NAMESPACE_TYPE (CORBA::TypeCode_ptr) +TAO_NAMESPACE_BEGIN (HUDisplay) +TAO_NAMESPACE_DEFINE ( + ::CORBA::TypeCode_ptr, + _tc_NavDisplay_Exec, + &_tc_TAO_tc_HUDisplay_NavDisplay_Exec + ) +TAO_NAMESPACE_END + +// TAO_IDL - Generated from +// c:\usr\src\ace_wrappers\tao\tao_idl\be\be_visitor_interface/any_op_cs.cpp:52 + +// Copying version. +void +operator<<= ( + CORBA::Any &_tao_any, + HUDisplay::NavDisplay_Exec_ptr _tao_elem + ) +{ + _tao_any._tao_replace ( + HUDisplay::_tc_NavDisplay_Exec, + 1, + HUDisplay::NavDisplay_Exec::_duplicate (_tao_elem), + HUDisplay::NavDisplay_Exec::_tao_any_destructor + ); + + _tao_any.contains_local (1); +} + +// Non-copying version. +void +operator<<= ( + CORBA::Any &_tao_any, + HUDisplay::NavDisplay_Exec_ptr *_tao_elem + ) +{ + _tao_any._tao_replace ( + HUDisplay::_tc_NavDisplay_Exec, + 1, + *_tao_elem, + HUDisplay::NavDisplay_Exec::_tao_any_destructor + ); + + _tao_any.contains_local (1); +} + +CORBA::Boolean +operator>>= ( + const CORBA::Any &_tao_any, + HUDisplay::NavDisplay_Exec_ptr &_tao_elem + ) +{ + ACE_TRY_NEW_ENV + { + _tao_elem = HUDisplay::NavDisplay_Exec::_nil (); + CORBA::TypeCode_var type = _tao_any.type (); + + CORBA::Boolean _tao_result = + type->equivalent ( + HUDisplay::_tc_NavDisplay_Exec + ACE_ENV_ARG_PARAMETER + ); + ACE_TRY_CHECK; + + if (!_tao_result) + { + return 0; // not equivalent + } + + _tao_elem = + ACE_reinterpret_cast ( + HUDisplay::NavDisplay_Exec_ptr, + ACE_const_cast (void *, _tao_any.value ()) + ); + + return 1; + } + ACE_CATCHANY + { + } + ACE_ENDTRY; + + _tao_elem = HUDisplay::NavDisplay_Exec::_nil (); + return 0; +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) || \ + defined (ACE_HAS_GNU_REPO) + template class TAO_Object_Manager<HUDisplay::NavDisplay_Exec,HUDisplay::NavDisplay_Exec_var>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +# pragma instantiate TAO_Object_Manager<HUDisplay::NavDisplay_Exec,HUDisplay::NavDisplay_Exec_var> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI.mpc b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI.mpc new file mode 100644 index 00000000000..61350c1e70e --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI.mpc @@ -0,0 +1,31 @@ +// $Id$ +project(NavDisplayGUI_exec) : ciao_server { + depends += NavDisplay_exec + sharedname = NavDisplayGUI_exec + lit_libs += qtmain qt-mt230nc + libs += NavDisplay_stub NavDisplay_svnt HUDisplay_stub HUDisplay_svnt + libpaths += .. ../NavDisplay $(QTDIR)/lib + dllflags = NAVDISPLAY_EXEC_BUILD_DLL QT_DLL QT_THREAD_SUPPORT + includes += ../NavDisplay $(QTDIR)/include + + IDL_Files { + } + + Source_Files { + ../NavDisplay/NavDisplayEIC.cpp + AddNavUnitCmd.cpp + DetailView.cpp + MapView.cpp + moc_DetailView.cpp + moc_MapView.cpp + moc_NodeItem.cpp + moc_RootPanel.cpp + NavUnit.cpp + NodeItem.cpp + QuitCmd.cpp + RootPanel.cpp + UpdatePositionCmd.cpp + Worker.cpp + NavDisplayGUI_exec.cpp + } +} diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.cpp b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.cpp new file mode 100644 index 00000000000..46f31e5fb5e --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.cpp @@ -0,0 +1,184 @@ +// $Id$ + +#include "NavDisplayGUI_exec.h" +#include "CIAO/CIAO_common.h" +#include <qapplication.h> +#include <qevent.h> + +#include "UpdatePositionCmd.h" +#include "QuitCmd.h" +#include "AddNavUnitCmd.h" +#include "Worker.h" + +static char *argv[] = +{ + "NavDisplayGUI" +}; + +/// Default constructor. +MyImpl::NavDisplayGUI_exec_impl::NavDisplayGUI_exec_impl () +: unit_(1, "Model T3+"), loc_(50, 20, 0) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::NavDisplayGUI_exec_impl::NavDisplayGUI_exec_impl ()\n")); +} + +/// Default destructor. +MyImpl::NavDisplayGUI_exec_impl::~NavDisplayGUI_exec_impl () +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::NavDisplayGUI_exec_impl::~NavDisplayGUI_exec_impl ()\n")); +} + +// Operations from HUDisplay::NavDisplay + +void +MyImpl::NavDisplayGUI_exec_impl::push_Refresh (HUDisplay::tick_ptr ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + //ACE_DEBUG ((LM_DEBUG, "ENTER: MyImpl::NavDisplayGUI_exec_impl::push_Refresh()\n")); + + // Refresh position + HUDisplay::position_var loc + = this->context_->get_connection_GPSLocation (ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + CORBA::Long lx = loc->posx (ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + CORBA::Long ly = loc->posy (ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + mutex_.acquire(); + + loc_.x_ = lx % 500; + loc_.y_ = ly % 300; + + this->unit_.setLocation(loc_); + + mutex_.release(); + + //ACE_DEBUG ((LM_DEBUG, "DISPLAY: Current Location is: %d %d\n", int(attrs.x_), int(attrs.y_))); + + RootPanel *root_pane = worker_->getMainWindow(); + if(root_pane) + { + UpdatePositionCmd *cmd = UpdatePositionCmd::create( + root_pane, &(this->unit_)); + QCustomEvent *evt = new QCustomEvent(QEvent::User, cmd); + QApplication::postEvent(root_pane, evt); + } + + //ACE_DEBUG ((LM_DEBUG, "LEAVE: MyImpl::NavDisplayGUI_exec_impl::push_Refresh()\n")); +} + +// Operations from Components::SessionComponent +void +MyImpl::NavDisplayGUI_exec_impl::set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::NavDisplayGUI_exec_impl::set_session_context\n")); + + this->context_ = + HUDisplay::CCM_NavDisplay_Context::_narrow (ctx + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (this->context_.in ())) + ACE_THROW (CORBA::INTERNAL ()); + // Urm, we actually discard exceptions thown from this operation. +} + +void +MyImpl::NavDisplayGUI_exec_impl::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "ENTER: MyImpl::NavDisplayGUI_exec_impl::ccm_activate\n")); + + int argc = sizeof(argv)/sizeof(argv[0]); + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv ACE_ENV_ARG_PARAMETER); + + CIAO_REGISTER_VALUE_FACTORY (orb.in(), HUDisplay::tick_init, + HUDisplay::tick); + + worker_ = new Worker(sizeof(argv)/sizeof(argv[0]), argv); + + if (worker_->activate(THR_NEW_LWP | THR_JOINABLE, 1) != 0) + { + ACE_DEBUG((LM_ERROR, + "Cannot activate client threads\n")); + ACE_THROW(Components::CCMException()); + } + + worker_->waitUntillInitialized(); + + AddNavUnitCmd *cmd = AddNavUnitCmd::create( + worker_->getMainWindow(), &(this->unit_)); + QCustomEvent *evt = new QCustomEvent(QEvent::User, cmd); + QApplication::postEvent(worker_->getMainWindow(), evt); + + + ACE_DEBUG ((LM_DEBUG, "LEAVE: MyImpl::NavDisplayGUI_exec_impl::ccm_activate\n")); +} + +void +MyImpl::NavDisplayGUI_exec_impl::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::NavDisplayGUI_exec_impl::ccm_passivate\n")); + + RootPanel *target = worker_->getMainWindow(); + if(target) + { + QuitCmd *cmd = QuitCmd::create(target); + QCustomEvent *evt = new QCustomEvent(QEvent::User, cmd); + QApplication::postEvent(target, evt); + worker_->thr_mgr()->wait(); + } + + delete worker_; +} + +void +MyImpl::NavDisplayGUI_exec_impl::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::NavDisplayGUI_exec_impl::ccm_remove\n")); +} + +/// Default ctor. +MyImpl::NavDisplayGUIHome_exec_impl::NavDisplayGUIHome_exec_impl () +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::NavDisplayGUI_exec_impl::NavDisplayGUIHome_exec_impl ()\n")); +} + +/// Default dtor. +MyImpl::NavDisplayGUIHome_exec_impl::~NavDisplayGUIHome_exec_impl () +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::NavDisplayGUI_exec_impl::~NavDisplayGUIHome_exec_impl ()\n")); +} + +// Explicit home operations. + +// Implicit home operations. + +::Components::EnterpriseComponent_ptr +MyImpl::NavDisplayGUIHome_exec_impl::create (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::NavDisplayGUIHome_exec_impl::create()\n")); + return new MyImpl::NavDisplayGUI_exec_impl; +} + + +extern "C" NAVDISPLAY_EXEC_Export ::Components::HomeExecutorBase_ptr +createNavDisplayHome_Impl (void) +{ + ACE_DEBUG ((LM_DEBUG, "createNavDisplayHome_Impl()\n")); + return new MyImpl::NavDisplayGUIHome_exec_impl; +} diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.h b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.h new file mode 100644 index 00000000000..242c46b3b79 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.h @@ -0,0 +1,110 @@ +// $Id$ + +/** + * @file NavDisplay_exec.h + * + * Header file for the actual NavDisplay and NavDisplayHome component + * implementations. + * + * @author Nanbor Wang <nanbor@cse.wustl.edu> + */ + +#ifndef NAVDISPLAY_EXEC_H +#define NAVDISPLAY_EXEC_H + +#include "NavDisplayEIC.h" +#include "ace/Synch.h" +#include "tao/LocalObject.h" +#include "NavUnit.h" + +class Worker; + + +namespace MyImpl +{ + /** + * @class NavDisplayGUI_exec_impl + * + * RateGen executor implementation class. + */ + class NAVDISPLAY_EXEC_Export NavDisplayGUI_exec_impl : + public virtual HUDisplay::NavDisplay_Exec, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default constructor. + NavDisplayGUI_exec_impl (); + + /// Default destructor. + ~NavDisplayGUI_exec_impl (); + + // Operations from HUDisplay::NavDisplay + + virtual void + push_Refresh (HUDisplay::tick_ptr ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations from Components::SessionComponent + + virtual void + set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + protected: + /// Copmponent specific context + HUDisplay::CCM_NavDisplay_Context_var context_; + Worker *worker_; + NavUnit unit_; + UnitLocation loc_; + ACE_Thread_Mutex mutex_; + }; + + /** + * @class NavDisplayGUIHome_exec_impl + * + * NavDisplay home executor implementation class. + */ + class NAVDISPLAY_EXEC_Export NavDisplayGUIHome_exec_impl : + public virtual HUDisplay::CCM_NavDisplayHome, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default ctor. + NavDisplayGUIHome_exec_impl (); + + /// Default dtor. + ~NavDisplayGUIHome_exec_impl (); + + // Explicit home operations. + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + }; + +} + +extern "C" NAVDISPLAY_EXEC_Export ::Components::HomeExecutorBase_ptr +createNavDisplayHome_Impl (void); + +#endif /* NAVDISPLAY_EXEC_H */ diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NavUnit.cpp b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NavUnit.cpp new file mode 100644 index 00000000000..809117728f6 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NavUnit.cpp @@ -0,0 +1,9 @@ +// $Id$ + +#include "NavUnit.h" + + +NavUnit::NavUnit(const UnitID &id, const char *short_descr) +: id_(id), short_descr_(short_descr) +{ +} diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NavUnit.h b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NavUnit.h new file mode 100644 index 00000000000..86dd2cccbd7 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NavUnit.h @@ -0,0 +1,57 @@ +// $Id$ + +#ifndef __NAVUNIT_H +#define __NAVUNIT_H + +#include "ace/SString.h" + + +class UnitLocation +{ +public: + UnitLocation() {x_ = y_ = z_ = 0.0;} + UnitLocation( + double x, + double y, + double z) : + x_(x), y_(y), z_(z) {} + + UnitLocation(const UnitLocation &ul) { operator = (ul); } + +public: + UnitLocation & operator = (const UnitLocation &ul) + { + x_ = ul.x_; + y_ = ul.y_; + z_ = ul.z_; + return *this; + } + +public: + double x_, y_, z_; +}; + +typedef unsigned long UnitID; + +class NavUnit +{ +public: + NavUnit(const UnitID &id, const char *short_descr); + virtual ~NavUnit() {} + +public: + UnitID getID() const {return id_;} + + const char *getShortDescr() const {return short_descr_.c_str();} + void setShortDescr(const char *short_descr) {short_descr_ = short_descr;} + + UnitLocation getLocation() const {return loc_;} + void setLocation(const UnitLocation &loc) {loc_ = loc;} + +protected: + UnitID id_; + ACE_CString short_descr_; + UnitLocation loc_; +}; + +#endif // __NAVUNIT_H diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NodeItem.cpp b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NodeItem.cpp new file mode 100644 index 00000000000..e6fb43b7eab --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NodeItem.cpp @@ -0,0 +1,63 @@ +// $Id$ + +#include "NodeItem.h" +#include <qbrush.h> + + +QBrush *NodeItem::normal = new QBrush(red); +QBrush *NodeItem::highlighted = new QBrush(green); + + +NodeItem::NodeItem(QCanvas *canvas, NavUnit &unit) + : QCanvasEllipse(8, 8, canvas), + unit_(unit), + blink_timer(canvas), + is_selected_(0) +{ + setBrush(*normal); + setZ(128); +} + + +void NodeItem::moveBy(double dx, double dy, double dz) +{ + QCanvasEllipse::moveBy(dx, dy); +} + + +void +NodeItem::timerDone() +{ + if(selected()) + { + if(brush() == *normal) + setBrush(*highlighted); + else + setBrush(*normal); + + canvas()->update(); + } +} + + +void +NodeItem::setSelected(bool yes) +{ + is_selected_ = yes; + + if(yes) + { + connect(&blink_timer, SIGNAL(timeout()), + SLOT(timerDone())); + + blink_timer.start(500); + } + else + { + blink_timer.stop(); + disconnect(SIGNAL(timeout()), this, + SLOT(timerDone())); + setBrush(*normal); + canvas()->update(); + } +} diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NodeItem.h b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NodeItem.h new file mode 100644 index 00000000000..4ccc5599359 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/NodeItem.h @@ -0,0 +1,49 @@ +// $Id$ + +#ifndef __NODEITEM_H +#define __NODEITEM_H + +#include "NavUnit.h" +#include <qcanvas.h> +#include <qlist.h> +#include <qtimer.h> +#include <qbrush.h> +#include <qobject.h> + + + +class NodeItem: public QObject, public QCanvasEllipse +{ + Q_OBJECT + +public: + NodeItem(QCanvas *canvas, NavUnit &unit); + + ~NodeItem() {} + + enum { + nodeRTTI = 1 + }; + + void moveBy(double dx, double dy, double dz); + + virtual int rtti() const {return nodeRTTI;} + + virtual void setSelected(bool yes); + virtual bool selected() const {return is_selected_;} + +public slots: + void timerDone(); + +private: + NavUnit &unit_; + QTimer blink_timer; + bool is_selected_; + + static QBrush *normal; + static QBrush *highlighted; +}; + + + +#endif // __NODEITEM_H diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/QuitCmd.cpp b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/QuitCmd.cpp new file mode 100644 index 00000000000..b8495973ead --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/QuitCmd.cpp @@ -0,0 +1,25 @@ +// $Id$ + +#include "QuitCmd.h" +#include "RootPanel.h" + + +QuitCmd::QuitCmd() +{ +} + + +QuitCmd * +QuitCmd::create(RootPanel *form) +{ + QuitCmd *cmd = new QuitCmd(); + cmd->form_ = form; + return cmd; +} + + +int +QuitCmd::execute(void *context) +{ + return form_->close(); +} diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/QuitCmd.h b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/QuitCmd.h new file mode 100644 index 00000000000..a80d749640e --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/QuitCmd.h @@ -0,0 +1,25 @@ +// $Id$ + +#ifndef __QUITCMD_H +#define __QUITCMD_H + +#include "Command.h" + +class RootPanel; + +class QuitCmd : public CommandBase +{ +public: + static QuitCmd *create(RootPanel *form); + +public: + virtual int execute(void *context = NULL); + +protected: + QuitCmd(); + + RootPanel *form_; +}; + + +#endif // __QUITCMD_H diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/README b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/README new file mode 100644 index 00000000000..cb10cbe5cd2 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/README @@ -0,0 +1,7 @@ +This example is the Qt-based GUI implementation of NavDisplay component. + +It is NOT necessary to compile ACE/TAO/CIAO with Qt support, +i.e. ACE_HAS_QT since this example does not relyes on Qt Reactor and +communicates with GUI part using QApplication::postMessage() and +simple Command Pattern based framework. But be sure that QTDIR +environment variable is pointed to your Qt instalation directory. diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/RootPanel.cpp b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/RootPanel.cpp new file mode 100644 index 00000000000..c6737ee96c0 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/RootPanel.cpp @@ -0,0 +1,90 @@ +// $Id$ + +#include "RootPanel.h" +#include <qmenubar.h> +#include <qapplication.h> +#include <qprogressdialog.h> +#include <stdlib.h> +#include <qsplitter.h> +#include "NodeItem.h" +#include "Command.h" + + +RootPanel::RootPanel(QCanvas &c, QWidget *parent, const char *name) +: QMainWindow(parent, name), canvas(c) +{ + QSplitter *s1 = new QSplitter( QSplitter::Vertical, this , "main" ); + + + navview = new MapView(canvas, s1); + s1->moveToFirst(navview); + + details = new DetailView(s1); + + QMenuBar* menu = menuBar(); + + QPopupMenu* file = new QPopupMenu; + //file->insertItem("&Fill canvas", this, SLOT(init()), CTRL+Key_F); + //file->insertItem("&Erase canvas", this, SLOT(clear()), CTRL+Key_E); + //file->insertItem("&New view", this, SLOT(newView()), CTRL+Key_N); + file->insertSeparator(); + file->insertItem("E&xit", qApp, SLOT(quit()), CTRL+Key_Q); + menu->insertItem("&File", file); + + setCentralWidget(s1); +} + + +RootPanel::~RootPanel() +{ + clear(); +} + + +void +RootPanel::addUnit(NavUnit *unit) +{ + NodeItem *el = new NodeItem(&canvas, *unit); + nodeMap.bind(unit->getID(), el); + UnitLocation loc = unit->getLocation(); + el->move(loc.x_, loc.y_); + el->show(); + this->details->currentNode(unit); +} + +void +RootPanel::updateUnit(NavUnit *unit) +{ + NodeItem *el = NULL; + nodeMap.find(unit->getID(), el); + UnitLocation loc = unit->getLocation(); + el->move(loc.x_, loc.y_); + //canvas.update(); + + this->details->updateLocation(loc); +} + + +void +RootPanel::clear() +{ + navview->clear(); +} + +void +RootPanel::customEvent(QCustomEvent *e) +{ + CommandBase *cmd = (CommandBase*)(e->data()); + cmd->execute(); + delete cmd; +/* + int elapsed = time.restart(); + int fps = (elapsed == 0 ? 1000 : 1000 / elapsed); + + if(prev_fps != fps) + { + prev_fps = fps; + ups->setNum(prev_fps); + } +*/ +} diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/RootPanel.h b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/RootPanel.h new file mode 100644 index 00000000000..e3b9b0c11a9 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/RootPanel.h @@ -0,0 +1,45 @@ +// $Id$ + +#ifndef __ROOTPANEL_H +#define __ROOTPANEL_H + +#include "MapView.h" +#include "DetailView.h" +#include <qmainwindow.h> +#include "ace/Hash_Map_Manager.h" + + +class NodeItem; +class QMouseEvent; + +class RootPanel : public QMainWindow +{ + Q_OBJECT + +typedef ACE_Hash_Map_Manager_Ex<ACE_UINT64, + NodeItem*, + ACE_Hash<ACE_UINT64>, + ACE_Equal_To<ACE_UINT64>, + ACE_Null_Mutex> NodeItemMap; + +public: + RootPanel(QCanvas&, QWidget *parent = 0, const char *name = 0); + ~RootPanel(); + +public: + void addUnit(NavUnit* unit); + void updateUnit(NavUnit *unit); + +protected: + void clear(); + virtual void customEvent(QCustomEvent *e); + + QCanvas& canvas; + MapView *navview; + DetailView *details; + + QPopupMenu* options; + NodeItemMap nodeMap; +}; + +#endif // __ROOTPANEL_H diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/UpdatePositionCmd.cpp b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/UpdatePositionCmd.cpp new file mode 100644 index 00000000000..65bc87e26bb --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/UpdatePositionCmd.cpp @@ -0,0 +1,30 @@ +// $Id$ + +#include "UpdatePositionCmd.h" +#include <qlcdnumber.h> +#include "RootPanel.h" +#include "NavUnit.h" + + +UpdatePositionCmd::UpdatePositionCmd() +{ +} + + +UpdatePositionCmd * +UpdatePositionCmd::create( + RootPanel *form, NavUnit *unit) +{ + UpdatePositionCmd *cmd = new UpdatePositionCmd(); + cmd->form_ = form; + cmd->unit_ = unit; + return cmd; +} + + +int +UpdatePositionCmd::execute(void *context) +{ + this->form_->updateUnit(this->unit_); + return 0; +} diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/UpdatePositionCmd.h b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/UpdatePositionCmd.h new file mode 100644 index 00000000000..4ba20755c3e --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/UpdatePositionCmd.h @@ -0,0 +1,28 @@ +// $Id$ + +#ifndef __UPDATEPOSITIONCM_H +#define __UPDATEPOSITIONCM_H + +#include "Command.h" + +class RootPanel; +class NavUnit; + +class UpdatePositionCmd : public CommandBase +{ +public: + static UpdatePositionCmd *create( + RootPanel *form, NavUnit *unit); + +public: + virtual int execute(void *context = NULL); + +protected: + UpdatePositionCmd(); + + RootPanel *form_; + NavUnit *unit_; +}; + + +#endif // __UPDATEPOSITIONCM_H diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/Worker.cpp b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/Worker.cpp new file mode 100644 index 00000000000..4257dd69f46 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/Worker.cpp @@ -0,0 +1,48 @@ +// $Id$ + +#include "Worker.h" +#include <qapplication.h> +#include <qmotifstyle.h> +#include <qcdestyle.h> +#include <qwindowsstyle.h> +#include <qplatinumstyle.h> +#include <qsgistyle.h> + + +int +Worker::svc (void) +{ + ACE_DEBUG((LM_DEBUG, "ENTER: Worker::svc()\n")); + + QApplication a(argc_, argv_); + a.setStyle(new QPlatinumStyle); + QCanvas canvas(600, 387); + //QCanvas canvas(566, 679); + //QCanvas canvas(550, 723); + canvas.setAdvancePeriod(30); + RootPanel root_panel(canvas); + root_panel.resize(root_panel.sizeHint()); + + root_panel.resize(600, 650); + root_panel.setCaption("NavDisplay"); + + a.setMainWidget(&root_panel); + + QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) ); + + if(QApplication::desktop()->width() > 550 + && QApplication::desktop()->height() > 366) + root_panel.show(); + else + root_panel.showMaximized(); + + main_wnd_ = &root_panel; + init_complete_.signal(); + + int retval = a.exec(); + + main_wnd_ = NULL; + + ACE_DEBUG((LM_DEBUG, "LEAVE: Worker::svc()\n")); + return retval; +} diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/Worker.h b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/Worker.h new file mode 100644 index 00000000000..6005b88e775 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/Worker.h @@ -0,0 +1,35 @@ +// $Id$ + +#ifndef __WORKER_H +#define __WORKER_H + +#include "ace/Task.h" +#include "tao/CORBA.h" +#include "ace/Synch.h" +#include "RootPanel.h" + +class Worker : public ACE_Task_Base +{ +public: + Worker (int argc, char *argv[]) + : argc_(argc), argv_(argv) {} + // ctor + + virtual int svc (void); + // The thread entry point. + + void waitUntillInitialized() {init_complete_.wait();} + // blocks the calling thread until the GUI is initialized + + RootPanel* getMainWindow() const {return main_wnd_;} + // Returns the pointer to main application window + +private: + RootPanel *main_wnd_; + int argc_; + char **argv_; + + ACE_Manual_Event init_complete_; +}; + +#endif // __WORKER_H diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/moc_DetailView.cpp b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/moc_DetailView.cpp new file mode 100644 index 00000000000..f11389116e0 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/moc_DetailView.cpp @@ -0,0 +1,98 @@ +/**************************************************************************** +** DetailView meta object code from reading C++ file 'DetailView.h' +** +** Created: Thu Mar 27 11:59:11 2003 +** by: The Qt MOC ($Id$) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#define Q_MOC_DetailView +#if !defined(Q_MOC_OUTPUT_REVISION) +#define Q_MOC_OUTPUT_REVISION 8 +#elif Q_MOC_OUTPUT_REVISION != 8 +#error "Moc format conflict - please regenerate all moc files" +#endif + +#include "DetailView.h" +#include <qmetaobject.h> +#include <qapplication.h> + +#if defined(Q_SPARCWORKS_FUNCP_BUG) +#define Q_AMPERSAND +#else +#define Q_AMPERSAND & +#endif + + +const char *DetailView::className() const +{ + return "DetailView"; +} + +QMetaObject *DetailView::metaObj = 0; + +void DetailView::initMetaObject() +{ + if ( metaObj ) + return; + if ( strcmp(QWidget::className(), "QWidget") != 0 ) + badSuperclassWarning("DetailView","QWidget"); + (void) staticMetaObject(); +} + +#ifndef QT_NO_TRANSLATION +QString DetailView::tr(const char* s) +{ + return ((QNonBaseApplication*)qApp)->translate("DetailView",s); +} + +#endif // QT_NO_TRANSLATION +QMetaObject* DetailView::staticMetaObject() +{ + if ( metaObj ) + return metaObj; + (void) QWidget::staticMetaObject(); +#ifndef QT_NO_PROPERTIES +#endif // QT_NO_PROPERTIES + typedef void(DetailView::*m1_t0)(int); + typedef void(DetailView::*m1_t1)(const QRect&); + typedef void(DetailView::*m1_t2)(NavUnit*); + typedef void(DetailView::*m1_t3)(const UnitLocation&); + typedef void(DetailView::*m1_t4)(); + m1_t0 v1_0 = Q_AMPERSAND DetailView::movieStatus; + m1_t1 v1_1 = Q_AMPERSAND DetailView::movieUpdate; + m1_t2 v1_2 = Q_AMPERSAND DetailView::currentNode; + m1_t3 v1_3 = Q_AMPERSAND DetailView::updateLocation; + m1_t4 v1_4 = Q_AMPERSAND DetailView::apply; + QMetaData *slot_tbl = QMetaObject::new_metadata(5); + QMetaData::Access *slot_tbl_access = QMetaObject::new_metaaccess(5); + slot_tbl[0].name = "movieStatus(int)"; + slot_tbl[0].ptr = *((QMember*)&v1_0); + slot_tbl_access[0] = QMetaData::Public; + slot_tbl[1].name = "movieUpdate(const QRect&)"; + slot_tbl[1].ptr = *((QMember*)&v1_1); + slot_tbl_access[1] = QMetaData::Public; + slot_tbl[2].name = "currentNode(NavUnit*)"; + slot_tbl[2].ptr = *((QMember*)&v1_2); + slot_tbl_access[2] = QMetaData::Public; + slot_tbl[3].name = "updateLocation(const UnitLocation&)"; + slot_tbl[3].ptr = *((QMember*)&v1_3); + slot_tbl_access[3] = QMetaData::Public; + slot_tbl[4].name = "apply()"; + slot_tbl[4].ptr = *((QMember*)&v1_4); + slot_tbl_access[4] = QMetaData::Public; + metaObj = QMetaObject::new_metaobject( + "DetailView", "QWidget", + slot_tbl, 5, + 0, 0, +#ifndef QT_NO_PROPERTIES + 0, 0, + 0, 0, +#endif // QT_NO_PROPERTIES + 0, 0 ); + metaObj->set_slot_access( slot_tbl_access ); +#ifndef QT_NO_PROPERTIES +#endif // QT_NO_PROPERTIES + return metaObj; +} diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/moc_MapView.cpp b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/moc_MapView.cpp new file mode 100644 index 00000000000..f1f9b2c977c --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/moc_MapView.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** +** MapView meta object code from reading C++ file 'MapView.h' +** +** Created: Thu Mar 27 10:41:52 2003 +** by: The Qt MOC ($Id$) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#define Q_MOC_MapView +#if !defined(Q_MOC_OUTPUT_REVISION) +#define Q_MOC_OUTPUT_REVISION 8 +#elif Q_MOC_OUTPUT_REVISION != 8 +#error "Moc format conflict - please regenerate all moc files" +#endif + +#include "MapView.h" +#include <qmetaobject.h> +#include <qapplication.h> + +#if defined(Q_SPARCWORKS_FUNCP_BUG) +#define Q_AMPERSAND +#else +#define Q_AMPERSAND & +#endif + + +const char *MapView::className() const +{ + return "MapView"; +} + +QMetaObject *MapView::metaObj = 0; + +void MapView::initMetaObject() +{ + if ( metaObj ) + return; + if ( strcmp(QCanvasView::className(), "QCanvasView") != 0 ) + badSuperclassWarning("MapView","QCanvasView"); + (void) staticMetaObject(); +} + +#ifndef QT_NO_TRANSLATION +QString MapView::tr(const char* s) +{ + return ((QNonBaseApplication*)qApp)->translate("MapView",s); +} + +#endif // QT_NO_TRANSLATION +QMetaObject* MapView::staticMetaObject() +{ + if ( metaObj ) + return metaObj; + (void) QCanvasView::staticMetaObject(); +#ifndef QT_NO_PROPERTIES +#endif // QT_NO_PROPERTIES + QMetaData::Access *slot_tbl_access = 0; + metaObj = QMetaObject::new_metaobject( + "MapView", "QCanvasView", + 0, 0, + 0, 0, +#ifndef QT_NO_PROPERTIES + 0, 0, + 0, 0, +#endif // QT_NO_PROPERTIES + 0, 0 ); + metaObj->set_slot_access( slot_tbl_access ); +#ifndef QT_NO_PROPERTIES +#endif // QT_NO_PROPERTIES + return metaObj; +} diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/moc_NodeItem.cpp b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/moc_NodeItem.cpp new file mode 100644 index 00000000000..7a038d98075 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/moc_NodeItem.cpp @@ -0,0 +1,78 @@ +/**************************************************************************** +** NodeItem meta object code from reading C++ file 'NodeItem.h' +** +** Created: Thu Mar 27 10:37:28 2003 +** by: The Qt MOC ($Id$) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#define Q_MOC_NodeItem +#if !defined(Q_MOC_OUTPUT_REVISION) +#define Q_MOC_OUTPUT_REVISION 8 +#elif Q_MOC_OUTPUT_REVISION != 8 +#error "Moc format conflict - please regenerate all moc files" +#endif + +#include "NodeItem.h" +#include <qmetaobject.h> +#include <qapplication.h> + +#if defined(Q_SPARCWORKS_FUNCP_BUG) +#define Q_AMPERSAND +#else +#define Q_AMPERSAND & +#endif + + +const char *NodeItem::className() const +{ + return "NodeItem"; +} + +QMetaObject *NodeItem::metaObj = 0; + +void NodeItem::initMetaObject() +{ + if ( metaObj ) + return; + if ( strcmp(QObject::className(), "QObject") != 0 ) + badSuperclassWarning("NodeItem","QObject"); + (void) staticMetaObject(); +} + +#ifndef QT_NO_TRANSLATION +QString NodeItem::tr(const char* s) +{ + return ((QNonBaseApplication*)qApp)->translate("NodeItem",s); +} + +#endif // QT_NO_TRANSLATION +QMetaObject* NodeItem::staticMetaObject() +{ + if ( metaObj ) + return metaObj; + (void) QObject::staticMetaObject(); +#ifndef QT_NO_PROPERTIES +#endif // QT_NO_PROPERTIES + typedef void(NodeItem::*m1_t0)(); + m1_t0 v1_0 = Q_AMPERSAND NodeItem::timerDone; + QMetaData *slot_tbl = QMetaObject::new_metadata(1); + QMetaData::Access *slot_tbl_access = QMetaObject::new_metaaccess(1); + slot_tbl[0].name = "timerDone()"; + slot_tbl[0].ptr = *((QMember*)&v1_0); + slot_tbl_access[0] = QMetaData::Public; + metaObj = QMetaObject::new_metaobject( + "NodeItem", "QObject", + slot_tbl, 1, + 0, 0, +#ifndef QT_NO_PROPERTIES + 0, 0, + 0, 0, +#endif // QT_NO_PROPERTIES + 0, 0 ); + metaObj->set_slot_access( slot_tbl_access ); +#ifndef QT_NO_PROPERTIES +#endif // QT_NO_PROPERTIES + return metaObj; +} diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/moc_RootPanel.cpp b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/moc_RootPanel.cpp new file mode 100644 index 00000000000..bb3a9bb98fd --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/moc_RootPanel.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** +** RootPanel meta object code from reading C++ file 'RootPanel.h' +** +** Created: Thu Mar 27 10:37:28 2003 +** by: The Qt MOC ($Id$) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#define Q_MOC_RootPanel +#if !defined(Q_MOC_OUTPUT_REVISION) +#define Q_MOC_OUTPUT_REVISION 8 +#elif Q_MOC_OUTPUT_REVISION != 8 +#error "Moc format conflict - please regenerate all moc files" +#endif + +#include "RootPanel.h" +#include <qmetaobject.h> +#include <qapplication.h> + +#if defined(Q_SPARCWORKS_FUNCP_BUG) +#define Q_AMPERSAND +#else +#define Q_AMPERSAND & +#endif + + +const char *RootPanel::className() const +{ + return "RootPanel"; +} + +QMetaObject *RootPanel::metaObj = 0; + +void RootPanel::initMetaObject() +{ + if ( metaObj ) + return; + if ( strcmp(QMainWindow::className(), "QMainWindow") != 0 ) + badSuperclassWarning("RootPanel","QMainWindow"); + (void) staticMetaObject(); +} + +#ifndef QT_NO_TRANSLATION +QString RootPanel::tr(const char* s) +{ + return ((QNonBaseApplication*)qApp)->translate("RootPanel",s); +} + +#endif // QT_NO_TRANSLATION +QMetaObject* RootPanel::staticMetaObject() +{ + if ( metaObj ) + return metaObj; + (void) QMainWindow::staticMetaObject(); +#ifndef QT_NO_PROPERTIES +#endif // QT_NO_PROPERTIES + QMetaData::Access *slot_tbl_access = 0; + metaObj = QMetaObject::new_metaobject( + "RootPanel", "QMainWindow", + 0, 0, + 0, 0, +#ifndef QT_NO_PROPERTIES + 0, 0, + 0, 0, +#endif // QT_NO_PROPERTIES + 0, 0 ); + metaObj->set_slot_access( slot_tbl_access ); +#ifndef QT_NO_PROPERTIES +#endif // QT_NO_PROPERTIES + return metaObj; +} diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/trolltech.gif b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/trolltech.gif Binary files differnew file mode 100644 index 00000000000..f674369efc4 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/trolltech.gif diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/worldmap1.gif b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/worldmap1.gif Binary files differnew file mode 100644 index 00000000000..99fe78a7673 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/worldmap1.gif diff --git a/TAO/CIAO/examples/handcrafted/Display/README b/TAO/CIAO/examples/handcrafted/Display/README new file mode 100644 index 00000000000..b6421aeeac4 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/README @@ -0,0 +1,30 @@ + $Id$ + +This directory contains a multi-component examples. We will likely +evolve this example in the future to show case how easy it is to +configure and assemble a new application using component. + +The starting example is an imaginary car (software) instrument +assembly which updates the display of current coordination of the car +periodically. It consists of 3 components as shown in +<Configuration-0.png>. + +These components are all placed under their own subdirectories: + +* RateGen - A component that allows it's client to start/stop the rate + generating event. + +* GPS - A component that interact with GPS hardware. When this + component receives an event from the Refresh port, it will + query the GPS hardware and updates the internal cached + coordinations (so that the current location can be read by + accessing the MyLocation interface,) and generates an event on + its Ready port to inform the event consumers that a new GPS + reading is available. + +* NavDisplay - A navigation display component that projects the + current location of the vehicle on the windshield. + When a navDisplay receives an event notifying the + availability of new data on its Refresh port, it will + acquire the current location of the vehicle by querying + the interface connected to the GetLocation receptacle. diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.idl b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.idl new file mode 100644 index 00000000000..e5ec2552762 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.idl @@ -0,0 +1,34 @@ +// $Id$ + +/** + * @file RateGen.idl + * + * Definition of the RateGen (a rate generator) component. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#ifndef RATEGEN_IDL +#define RATEGEN_IDL + +#include "../HUDisplay.idl" + +module HUDisplay +{ + component RateGen supports opmode + { + publishes tick Pulse; + + /// The attribute can be configured via the home or the + /// component property file. + attribute long hertz; + }; + + home RateGenHome manages RateGen + { + // Explicit operations + factory new_RateGen (in long hertz); + }; +}; + +#endif /* RATEGEN_IDL */ diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.mpc b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.mpc new file mode 100644 index 00000000000..5449f3f3e5b --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.mpc @@ -0,0 +1,84 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -l .. -p HUDisplay -i -c RateGen" + +project(RateGen_stub): ciao_client { + depends += HUDisplay_stub + sharedname = RateGen_stub + idlflags += -Wb,stub_export_macro=RATEGEN_STUB_Export -Wb,stub_export_include=RateGen_stub_export.h -Wb,skel_export_macro=RATEGEN_SVNT_Export -Wb,skel_export_include=RateGen_svnt_export.h + dllflags = RATEGEN_STUB_BUILD_DLL + + IDL_Files { + RateGen.idl + } + + Source_Files { + RateGenC.cpp + } +} + +project(RateGen_svnt) : ciao_server { + depends += HUDisplay_svnt RateGen_stub + sharedname = RateGen_svnt + libs += RateGen_stub HUDisplay_stub HUDisplay_svnt + libpaths += .. + idlflags += -Wb,export_macro=RATEGEN_SVNT_Export -Wb,export_include=RateGen_svnt_export.h + dllflags = RATEGEN_SVNT_BUILD_DLL + + IDL_Files { + RateGenE.idl + } + + Source_Files { + RateGenEC.cpp + RateGenS.cpp + RateGen_svnt.cpp + } +} + + +project(RateGen_exec) : ciao_server { + depends += RateGen_svnt + sharedname = RateGen_exec + libs += RateGen_stub HUDisplay_stub RateGen_svnt + libpaths += .. + idlflags += -Wb,export_macro=RATEGEN_EXEC_Export -Wb,export_include=RateGen_exec_export.h + dllflags = RATEGEN_EXEC_BUILD_DLL + + IDL_Files { + RateGenEI.idl + } + + Source_Files { + RateGenEIC.cpp + RateGen_exec.cpp + } +} + + + +project (RateGen_client) : ciao_client { + exename = client + depends += RateGen_stub + libs += RateGen_stub HUDisplay_stub + + IDL_Files { + } + + Source_Files { + client.cpp + } +} + + +project (controller) : ciao_client { + exename = controller + depends += RateGen_stub + libs += RateGen_stub HUDisplay_stub + + IDL_Files { + } + + Source_Files { + controller.cpp + } +} diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGenE.idl b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGenE.idl new file mode 100644 index 00000000000..dacd2f25c33 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGenE.idl @@ -0,0 +1,68 @@ +// $Id$ + +/** + * @file RateGenE.idl + * + * Executor definition of the RateGen (a rate generator) component. + * This file should be auto-generated by the CCIDL compiler when it + * becomes available. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#ifndef RATEGENE_IDL +#define RATEGENE_IDL + +#include "CCM_Container.idl" +#include "RateGen.idl" +#include "../HUDisplayE.idl" + +module HUDisplay +{ + local interface CCM_RateGen_Executor + : Components::EnterpriseComponent, opmode + { + attribute long hertz; + }; + + local interface CCM_RateGen + : Components::EnterpriseComponent, opmode + { + attribute long hertz; + }; + + /** + * Context interface. This interface defines the mapping. The + * container framework provides the implmentation. + * + * Notice that we are taking a shortcut here to inherit the + * component-specific context from SessionContext directly instead + * of CCMContext. + */ + local interface CCM_RateGen_Context + : Components::SessionContext + { + void push_Pulse (in tick ev); + }; + + local interface CCM_RateGenHomeExplicit + : Components::HomeExecutorBase + { + Components::EnterpriseComponent new_RateGen (in long hertz) + raises (Components::CCMException); + }; + + local interface CCM_RateGenHomeImplicit + { + Components::EnterpriseComponent create () + raises (Components::CCMException); + }; + + local interface CCM_RateGenHome + : CCM_RateGenHomeExplicit, + CCM_RateGenHomeImplicit + { + }; +}; + +#endif /* RATEGENE_IDL */ diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGenEI.idl b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGenEI.idl new file mode 100644 index 00000000000..00c01bbb39e --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGenEI.idl @@ -0,0 +1,31 @@ +// $Id$ + +/** + * @file RateGenEI.idl + * + * Definition of the RateGen (a rate generator) component implementation. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#ifndef RATEGENEI_IDL +#define RATEGENEI_IDL + +#include "RateGenE.idl" + +module HUDisplay +{ + /** + * @interface RateGen_Exec + * + * The actually RateGen executor need to support + * Components::SessionComponent interface. Therefore, we need to + * define the component executor interface explicitly here. + */ + local interface RateGen_Exec : CCM_RateGen, Components::SessionComponent + { + }; + +}; + +#endif /* RATEGENEI_IDL */ diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_comp.idl b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_comp.idl new file mode 100644 index 00000000000..fcdfdf61c1a --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_comp.idl @@ -0,0 +1,14 @@ +// $Id$ + +/** + * @file RateGen.idl + * + * Definition of the RateGen (a rate generator) component. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#ifndef RATEGEN_IDL +#define RATEGEN_IDL + +Component implementation diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.cpp b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.cpp new file mode 100644 index 00000000000..235618b410f --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.cpp @@ -0,0 +1,279 @@ +// $Id$ + +#include "RateGen_exec.h" +#include "ace/Timer_Queue.h" +#include "ace/Reactor.h" + +//================================================================= + +MyImpl::Pulse_Handler::Pulse_Handler (MyImpl::RateGen_exec_i *cb) + : active_ (0), + done_ (0), + tid_ (0), + pulse_callback_ (cb) +{ + // Nothing + this->reactor (new ACE_Reactor); +} + +MyImpl::Pulse_Handler::~Pulse_Handler () +{ + delete this->reactor (); + this->reactor (0); +} + +int +MyImpl::Pulse_Handler::open () +{ + return this->activate (); +} + +int +MyImpl::Pulse_Handler::close () +{ + this->done_ = 1; + this->reactor ()->notify (); + + ACE_DEBUG ((LM_DEBUG, "Waiting\n")); + return this->wait (); +} + +int +MyImpl::Pulse_Handler::start (CORBA::Long hertz) +{ + if (hertz == 0 || this->active_ != 0) // Not valid + return -1; + + long usec = 1000000 / hertz; + + this->tid_ = this->reactor ()->schedule_timer (this, + 0, + ACE_Time_Value (0, usec), + ACE_Time_Value (0, usec)); + + this->active_ = 1; + return 0; +} + +int +MyImpl::Pulse_Handler::stop (void) +{ + if (this->active_ == 0) // Not valid. + return -1; + + this->reactor ()->cancel_timer (this); + + this->active_ = 0; + return 0; +} + +int +MyImpl::Pulse_Handler::active (void) +{ + return this->active_; +} + +int +MyImpl::Pulse_Handler::handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask close_mask) +{ + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("[%x] handle = %d, close_mask = %d\n"), + this, + handle, + close_mask)); + + return 0; +} + +int +MyImpl::Pulse_Handler::handle_timeout (const ACE_Time_Value &, + const void *) +{ + this->pulse_callback_->pulse (); + +// ACE_DEBUG ((LM_DEBUG, +// ACE_TEXT ("[%x] with count #%05d timed out at %d.%d!\n"), +// this, +// tv.sec (), +// tv.usec ())); + + return 0; +} + +int +MyImpl::Pulse_Handler::svc (void) +{ + this->reactor ()->owner (ACE_OS::thr_self ()); + + while (!this->done_) + this->reactor ()->handle_events (); + + return 0; +} + +//================================================================= + +MyImpl::RateGen_exec_i::RateGen_exec_i () + : hertz_ (0), + pulser_ (this) +{ + +} + +MyImpl::RateGen_exec_i::RateGen_exec_i (CORBA::Long hz) + : hertz_ (hz), + pulser_ (this) +{ +} + +MyImpl::RateGen_exec_i::~RateGen_exec_i () +{ +} + +CORBA::Long +MyImpl::RateGen_exec_i::hertz (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->hertz_; +} + +void +MyImpl::RateGen_exec_i::hertz (CORBA::Long hertz + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->hertz_ = hertz; +} + +// Operations from supported interface(s) + +void +MyImpl::RateGen_exec_i::start (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (this->hertz_ == 0 || this->pulser_.active()) + ACE_THROW (CORBA::BAD_INV_ORDER ()); + + // @@ Start the rate generator + this->pulser_.start (this->hertz_); +} + +void +MyImpl::RateGen_exec_i::stop (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (! this->pulser_.active ()) + ACE_THROW (CORBA::BAD_INV_ORDER ()); + + // @@ stop the rate generator + this->pulser_.stop (); +} + +CORBA::Boolean +MyImpl::RateGen_exec_i::active (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->pulser_.active (); +} + +// Operations from Components::SessionComponent + +void +MyImpl::RateGen_exec_i::set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::RateGen_exec_i::set_session_context\n")); + + this->context_ = + HUDisplay::CCM_RateGen_Context::_narrow (ctx + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (this->context_.in ())) + ACE_THROW (CORBA::INTERNAL ()); + // Urm, we actually discard exceptions thown from this operation. + +} + +void +MyImpl::RateGen_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::RateGen_exec_i::ccm_activate\n")); + + this->pulser_.open (); +} + +void +MyImpl::RateGen_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::RateGen_exec_i::ccm_passivate\n")); + this->pulser_.close (); +} + +void +MyImpl::RateGen_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::RateGen_exec_i::ccm_remove\n")); +} + +void +MyImpl::RateGen_exec_i::pulse (void) +{ + ACE_TRY_NEW_ENV + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Pushing HUDisplay::tick event!\n"))); + + HUDisplay::tick_var ev = new OBV_HUDisplay::tick (); + + this->context_->push_Pulse (ev.in () + ACE_ENV_ARG_PARAMETER); + } + ACE_CATCHANY + { + // @@ do nothing? + } + ACE_ENDTRY; + +} + +MyImpl::RateGenHome_exec_i::RateGenHome_exec_i () +{ +} + +MyImpl::RateGenHome_exec_i::~RateGenHome_exec_i () +{ +} + +::Components::EnterpriseComponent_ptr +MyImpl::RateGenHome_exec_i::new_RateGen (CORBA::Long hertz + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + return new MyImpl::RateGen_exec_i (hertz); +} + +::Components::EnterpriseComponent_ptr +MyImpl::RateGenHome_exec_i::create (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + return new MyImpl::RateGen_exec_i (); +} + + +extern "C" RATEGEN_EXEC_Export ::Components::HomeExecutorBase_ptr +createRateGenHome_Impl (void) +{ + return new MyImpl::RateGenHome_exec_i (); +} diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.h b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.h new file mode 100644 index 00000000000..24e11a795e3 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.h @@ -0,0 +1,180 @@ +// $Id$ + +/** + * @file RateGen_exec.h + * + * Header file for the actualy RateGen and RateGenHome component + * implementation. + * + * @author Nanbor Wang <nanbor@cse.wustl.edu> + */ + +#ifndef RATEGEN_EXEC_H +#define RATEGEN_EXEC_H + +#include "RateGenEIC.h" +#include "tao/LocalObject.h" +#include "ace/Thread_Manager.h" +#include "ace/Task.h" + +namespace MyImpl +{ + // Forward decl. + class RateGen_exec_i; + + /** + * @brief Active pulse generater + */ + class Pulse_Handler : public ACE_Task_Base + { + public: + // Default constructor + Pulse_Handler (RateGen_exec_i *cb); + ~Pulse_Handler (); + + int open (void); + + int close (void); + + int start (CORBA::Long hertz); + + int stop (void); + + int active (void); + + // Handle the timeout. + virtual int handle_timeout (const ACE_Time_Value &tv, + const void *arg); + + // Called when <Time_Handler> is removed. + virtual int handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask close_mask); + + virtual int svc (void); + + private: + /// Tracking whether we are actively generating pulse or not. + long active_; + + /// Flag to indicate completion of this active object. + int done_; + + /// The timer id we are waiting. + int tid_; + + RateGen_exec_i *pulse_callback_; + + ACE_Thread_Manager thr_mgr_; + }; + + /** + * @class RateGen_exec_i + * + * RateGen executor implementation class. + */ + class RATEGEN_EXEC_Export RateGen_exec_i : + public virtual HUDisplay::RateGen_Exec, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default constructor. + RateGen_exec_i (); + + /// Initialize with a default frequency. + RateGen_exec_i (CORBA::Long hz); + + /// Default destructor. + ~RateGen_exec_i (); + + // Attribute operations. + + virtual CORBA::Long hertz (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void hertz (CORBA::Long hertz + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations from supported interface(s) + + virtual void start (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void stop (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Boolean active (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations from Components::SessionComponent + + virtual void set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ccm_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ccm_remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + /// Helper function to be called back by Pulse_Handler + void pulse (void); + + protected: + /// Frequency + CORBA::Long hertz_; + + /// Copmponent specific context + HUDisplay::CCM_RateGen_Context_var context_; + + /// An active object that actually trigger the generation of + /// periodic events. + Pulse_Handler pulser_; + }; + + /** + * @class RateGenHome_exec_i + * + * RateGen home executor implementation class. + */ + class RATEGEN_EXEC_Export RateGenHome_exec_i : + public virtual HUDisplay::CCM_RateGenHome, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default ctor. + RateGenHome_exec_i (); + + /// Default dtor. + ~RateGenHome_exec_i (); + + // Explicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + new_RateGen (CORBA::Long hertz + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + }; + +} + +extern "C" RATEGEN_EXEC_Export ::Components::HomeExecutorBase_ptr +createRateGenHome_Impl (void); + +#endif /* RATEGEN_EXEC_H */ diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec_export.h b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec_export.h new file mode 100644 index 00000000000..3893178879b --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl RATEGEN_EXEC +// ------------------------------ +#ifndef RATEGEN_EXEC_EXPORT_H +#define RATEGEN_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (RATEGEN_EXEC_HAS_DLL) +# define RATEGEN_EXEC_HAS_DLL 1 +#endif /* ! RATEGEN_EXEC_HAS_DLL */ + +#if defined (RATEGEN_EXEC_HAS_DLL) && (RATEGEN_EXEC_HAS_DLL == 1) +# if defined (RATEGEN_EXEC_BUILD_DLL) +# define RATEGEN_EXEC_Export ACE_Proper_Export_Flag +# define RATEGEN_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define RATEGEN_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* RATEGEN_EXEC_BUILD_DLL */ +# define RATEGEN_EXEC_Export ACE_Proper_Import_Flag +# define RATEGEN_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define RATEGEN_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* RATEGEN_EXEC_BUILD_DLL */ +#else /* RATEGEN_EXEC_HAS_DLL == 1 */ +# define RATEGEN_EXEC_Export +# define RATEGEN_EXEC_SINGLETON_DECLARATION(T) +# define RATEGEN_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* RATEGEN_EXEC_HAS_DLL == 1 */ + +// Set RATEGEN_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (RATEGEN_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define RATEGEN_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define RATEGEN_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !RATEGEN_EXEC_NTRACE */ + +#if (RATEGEN_EXEC_NTRACE == 1) +# define RATEGEN_EXEC_TRACE(X) +#else /* (RATEGEN_EXEC_NTRACE == 1) */ +# define RATEGEN_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (RATEGEN_EXEC_NTRACE == 1) */ + +#endif /* RATEGEN_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_stub_export.h b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_stub_export.h new file mode 100644 index 00000000000..d1cc20aa005 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_stub_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl RATEGEN_STUB +// ------------------------------ +#ifndef RATEGEN_STUB_EXPORT_H +#define RATEGEN_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (RATEGEN_STUB_HAS_DLL) +# define RATEGEN_STUB_HAS_DLL 1 +#endif /* ! RATEGEN_STUB_HAS_DLL */ + +#if defined (RATEGEN_STUB_HAS_DLL) && (RATEGEN_STUB_HAS_DLL == 1) +# if defined (RATEGEN_STUB_BUILD_DLL) +# define RATEGEN_STUB_Export ACE_Proper_Export_Flag +# define RATEGEN_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define RATEGEN_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* RATEGEN_STUB_BUILD_DLL */ +# define RATEGEN_STUB_Export ACE_Proper_Import_Flag +# define RATEGEN_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define RATEGEN_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* RATEGEN_STUB_BUILD_DLL */ +#else /* RATEGEN_STUB_HAS_DLL == 1 */ +# define RATEGEN_STUB_Export +# define RATEGEN_STUB_SINGLETON_DECLARATION(T) +# define RATEGEN_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* RATEGEN_STUB_HAS_DLL == 1 */ + +// Set RATEGEN_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (RATEGEN_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define RATEGEN_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define RATEGEN_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !RATEGEN_STUB_NTRACE */ + +#if (RATEGEN_STUB_NTRACE == 1) +# define RATEGEN_STUB_TRACE(X) +#else /* (RATEGEN_STUB_NTRACE == 1) */ +# define RATEGEN_STUB_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (RATEGEN_STUB_NTRACE == 1) */ + +#endif /* RATEGEN_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.cpp b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.cpp new file mode 100644 index 00000000000..536bc66ba64 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.cpp @@ -0,0 +1,725 @@ +// $Id$ + +// The generated filename for files using this template shoule be +// [idl-basename]GS.cpp GS --> GlueSession + +// @@ Notice: [ciao module name] can expand to either CIAO_GLUE or +// CIAO_GLUE_[module name] as defined in the header file. + +/// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +/// @@@ Notice that all component and interface names need to be +/// fully qualified as we are creating a new namespace for the CIAO's +/// container glue code. +/// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +#include "RateGen_svnt.h" +#include "Cookies.h" + +#if !defined (__ACE_INLINE__) +# include "RateGen_svnt.inl" +#endif /* __ACE_INLINE__ */ + +////////////////////////////////////////////////////////////////// +// Component specific context implementation +////////////////////////////////////////////////////////////////// + +void +CIAO_GLUE_HUDisplay::RateGen_Context::push_Pulse (HUDisplay::tick_ptr ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_Active_Map_Manager<HUDisplay::tickConsumer_var>::iterator + end = this->ciao_publishes_Pulse_map_.end (); + for (ACE_Active_Map_Manager<HUDisplay::tickConsumer_var>::iterator + iter = this->ciao_publishes_Pulse_map_.begin (); + iter != end; + ++iter) + { + ACE_Active_Map_Manager<HUDisplay::tickConsumer_var>::ENTRY &entry = *iter; + entry.int_id_->push_tick (ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } +} + +// Operations for publishes interfaces. +::Components::Cookie_ptr +CIAO_GLUE_HUDisplay::RateGen_Context::subscribe_Pulse (HUDisplay::tickConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::ExceededConnectionLimit)) +{ + if (CORBA::is_nil (c)) + ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + + HUDisplay::tickConsumer_var sub = HUDisplay::tickConsumer::_duplicate (c); + + ACE_Active_Map_Manager_Key key; + this->ciao_publishes_Pulse_map_.bind (sub.in (), + key); + + sub._retn (); // Release ownership. + + ::Components::Cookie_var retv = new CIAO::Map_Key_Cookie (key); + return retv._retn (); +} + +HUDisplay::tickConsumer_ptr +CIAO_GLUE_HUDisplay::RateGen_Context::unsubscribe_Pulse (::Components::Cookie_ptr ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::InvalidConnection)) +{ + HUDisplay::tickConsumer_var retv; + + ACE_Active_Map_Manager_Key key; + if (ck == 0 || + CIAO::Map_Key_Cookie::extract (ck, key) == -1) + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + + if (this->ciao_publishes_Pulse_map_.unbind (key, + retv) != 0) + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + + return retv._retn (); +} + +// Operations for ::Components::SessionContext interface +CORBA::Object_ptr +CIAO_GLUE_HUDisplay::RateGen_Context::get_CCM_object (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ How do I check for IllegalState here? When it's not in a + // callback operation... + // ACE_THROW_RETURN (::Components::IllegalState (), 0); + + if (CORBA::is_nil (this->component_.in ())) + { + CORBA::Object_var obj = this->container_->get_objref (this->servant_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + this->component_ = HUDisplay::RateGen::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (this->component_.in ())) + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); // This should not happen... + } + return HUDisplay::RateGen::_duplicate (this->component_.in ()); +} + +////////////////////////////////////////////////////////////////// +// Component Servant Glue code implementation +////////////////////////////////////////////////////////////////// + +CIAO_GLUE_HUDisplay::RateGen_Servant::RateGen_Servant (HUDisplay::CCM_RateGen_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c) + : executor_ (HUDisplay::CCM_RateGen::_duplicate (exe)), + container_ (c) +{ + this->context_ = new CIAO_GLUE_HUDisplay::RateGen_Context (h, c, this); + + ACE_TRY_NEW_ENV + { + Components::SessionComponent_var scom = + Components::SessionComponent::_narrow (exe + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (! CORBA::is_nil (scom.in ())) + scom->set_session_context (this->context_ + ACE_ENV_ARG_PARAMETER); + } + ACE_CATCHANY + { + // @@ Ignore any exceptions? What happens if + // set_session_context throws an CCMException? + } + ACE_ENDTRY; +} + +CIAO_GLUE_HUDisplay::RateGen_Servant::~RateGen_Servant (void) +{ + ACE_TRY_NEW_ENV; + { + Components::SessionComponent_var temp = + Components::SessionComponent::_narrow (this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (! CORBA::is_nil (temp.in ())) + temp->ccm_remove (ACE_ENV_SINGLE_ARG_PARAMETER); + } + ACE_CATCHANY + { + // @@ Ignore any exceptions? What happens if + // set_session_context throws an CCMException? + } + ACE_ENDTRY; + this->context_->_remove_ref (); +} + +// Operations for provides interfaces. + +// Operations for consumers interfaces. + +// Operations for Navigation interface +CORBA::Object_ptr +CIAO_GLUE_HUDisplay::RateGen_Servant::provide_facet (const char * name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException , + Components::InvalidName)) +{ + if (name == 0) + ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + + // We simply iterate thru all the facets this component provides + // now. We can also use a hash map along with perfect hashing + // (i.e., gperf) if we need faster performance since all the provided + // interfaces are static to a component definition. + + ACE_THROW_RETURN (::Components::InvalidName (), 0); +} + +::Components::FacetDescriptions * +CIAO_GLUE_HUDisplay::RateGen_Servant::get_all_facets (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::FacetDescriptions_var collection + = new ::Components::FacetDescriptions; // #99 = number of all provided + // facets including those inherited + // from parent component(s). + + return collection._retn (); + +} + +::Components::FacetDescriptions * +CIAO_GLUE_HUDisplay::RateGen_Servant::get_named_facets (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ::Components::FacetDescriptions_var collection + = new ::Components::FacetDescriptions (names.length ()); + + CORBA::ULong i = 0; + for (; i < names.length (); ++i) + { + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + return collection._retn (); +} + +CORBA::Boolean +CIAO_GLUE_HUDisplay::RateGen_Servant::same_component (CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (CORBA::is_nil (object_ref)) + ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + + CORBA::Object_var the_other + = object_ref->_get_component (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + CORBA::Object_var me + = this->context_->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return me->_is_equivalent (object_ref + ACE_ENV_ARG_PARAMETER); +} + +// Operations for Receptacles interface +::Components::Cookie_ptr +CIAO_GLUE_HUDisplay::RateGen_Servant::connect (const char *, + CORBA::Object_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::AlreadyConnected, + Components::ExceededConnectionLimit)) +{ + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +/* +##foreach [receptacle name] with [uses type] in (list of all 'uses' interfaces) generate: +## if [receptacle name] is a simplex receptacle ('uses') +## else ([receptacle name] is a multiplex ('uses multiple') receptacle) +## endif [receptacle name] +##end foreach [receptacle name] with [uses type] +*/ + +CORBA::Object_ptr +CIAO_GLUE_HUDisplay::RateGen_Servant::disconnect (const char *, + Components::Cookie_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::CookieRequired, + Components::NoConnection)) +{ + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::ConnectionDescriptions * +CIAO_GLUE_HUDisplay::RateGen_Servant::get_connections (const char * + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::ReceptacleDescriptions * +CIAO_GLUE_HUDisplay::RateGen_Servant::get_all_receptacles (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::ReceptacleDescriptions_var retv = + new ::Components::ReceptacleDescriptions; // #99 is number of receptacles + // this component has. + return retv._retn (); +} + +::Components::ReceptacleDescriptions * +CIAO_GLUE_HUDisplay::RateGen_Servant::get_named_receptacles (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ::Components::ReceptacleDescriptions_var retv = + new ::Components::ReceptacleDescriptions (names.length ()); + + CORBA::ULong i = 0; + for (; i < names.length (); ++i) + { + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + return retv._retn (); +} + +// Operations for Events interface +::Components::EventConsumerBase_ptr +CIAO_GLUE_HUDisplay::RateGen_Servant::get_consumer (const char * + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::Cookie_ptr +CIAO_GLUE_HUDisplay::RateGen_Servant::subscribe (const char * publisher_name, + Components::EventConsumerBase_ptr subscriber + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::ExceededConnectionLimit)) +{ + // @@ We can omit this if clause if there's no publisher in this component. + if (publisher_name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + + if (ACE_OS_String::strcmp (publisher_name, "Pulse") == 0) + { + HUDisplay::tickConsumer_var _ciao_consumer = + HUDisplay::tickConsumer::_narrow (subscriber + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (_ciao_consumer.in ())) + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + + return this->subscribe_Pulse (_ciao_consumer.in () + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::EventConsumerBase_ptr +CIAO_GLUE_HUDisplay::RateGen_Servant::unsubscribe (const char * publisher_name, + Components::Cookie_ptr ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)) +{ + // @@ We can omit this if clause if there's no publisher in this component. + if (publisher_name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + + if (ACE_OS_String::strcmp (publisher_name, "Pulse") == 0) + { + return this->unsubscribe_Pulse (ck + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +void +CIAO_GLUE_HUDisplay::RateGen_Servant::connect_consumer (const char *, + Components::EventConsumerBase_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::AlreadyConnected, + Components::InvalidConnection)) +{ + ACE_THROW (Components::InvalidName ()); +} + +::Components::EventConsumerBase_ptr +CIAO_GLUE_HUDisplay::RateGen_Servant::disconnect_consumer (const char * + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::NoConnection)) +{ + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::ConsumerDescriptions * +CIAO_GLUE_HUDisplay::RateGen_Servant::get_all_consumers (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::ConsumerDescriptions_var retv = + new ::Components::ConsumerDescriptions; // #99 is the number of consumers + // this component has. + return retv._retn (); +} + +::Components::ConsumerDescriptions * +CIAO_GLUE_HUDisplay::RateGen_Servant::get_named_consumers (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ::Components::ConsumerDescriptions_var retv = + new ::Components::ConsumerDescriptions (names.length ()); + + CORBA::ULong i = 0; + for (; i < names.length (); ++i) + { + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + return retv._retn (); +} + +::Components::EmitterDescriptions * +CIAO_GLUE_HUDisplay::RateGen_Servant::get_all_emitters (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::EmitterDescriptions_var retv = + new ::Components::EmitterDescriptions; // #99 is the number of emitters + // this component has. + return retv._retn (); +} + +::Components::EmitterDescriptions * +CIAO_GLUE_HUDisplay::RateGen_Servant::get_named_emitters (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ::Components::EmitterDescriptions_var retv = + new ::Components::EmitterDescriptions (names.length ()); + + CORBA::ULong i = 0; + for (; i < names.length (); ++i) + { + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + return retv._retn (); +} + +::Components::PublisherDescriptions * +CIAO_GLUE_HUDisplay::RateGen_Servant::get_all_publishers (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ to-do + + // Need to add interfaces in the Context class to gather the information. + // Or we can just relay it to the Context object. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +::Components::PublisherDescriptions * +CIAO_GLUE_HUDisplay::RateGen_Servant::get_named_publishers (const Components::NameList & + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + // @@ to-do + + // Need to add interfaces in the Context class to gather the information. + // Or we can just relay it to the Context object. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +// Operations for CCMObject interface +::CORBA::IRObject_ptr +CIAO_GLUE_HUDisplay::RateGen_Servant::get_component_def (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ to-do: Connect to an IfR? + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +::Components::CCMHome_ptr +CIAO_GLUE_HUDisplay::RateGen_Servant::get_ccm_home (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->context_->get_CCM_home (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +::Components::PrimaryKeyBase * +CIAO_GLUE_HUDisplay::RateGen_Servant::get_primary_key (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::NoKeyAvailable)) +{ + // This is a keyless component. + ACE_THROW_RETURN (::Components::NoKeyAvailable (), 0); +} + +void +CIAO_GLUE_HUDisplay::RateGen_Servant::configuration_complete (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidConfiguration)) +{ + // @@ to-do + // No-op. Don't know how to pass this info to monolithic executor. +} + +void +CIAO_GLUE_HUDisplay::RateGen_Servant::remove (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) +{ + // @@ to-do + // Need to figure out what to do here. E.g., tear down the all the connections + // this component has? +} + +::Components::ComponentPortDescription * +CIAO_GLUE_HUDisplay::RateGen_Servant::get_all_ports (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::ComponentPortDescription_var retv = + new OBV_Components::ComponentPortDescription; + + ::Components::FacetDescriptions_var facets_desc + = this->get_all_facets (ACE_ENV_SINGLE_ARG_PARAMETER); + ::Components::ReceptacleDescriptions_var receptacle_desc + = get_all_receptacles (ACE_ENV_SINGLE_ARG_PARAMETER); + ::Components::ConsumerDescriptions_var consumer_desc + = this->get_all_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); + ::Components::EmitterDescriptions_var emitter_desc + = this->get_all_emitters (ACE_ENV_SINGLE_ARG_PARAMETER); + ::Components::PublisherDescriptions_var publisher_desc + = this->get_all_publishers (ACE_ENV_SINGLE_ARG_PARAMETER); + + retv->facets (facets_desc.in()); + retv->receptacles (receptacle_desc.in()); + retv->consumers (consumer_desc.in()); + retv->emitters (emitter_desc.in()); + retv->publishers (publisher_desc.in()); + + return retv._retn(); +} + +// get_component implementation. +CORBA::Object_ptr +CIAO_GLUE_HUDisplay::RateGen_Servant::_get_component (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::SessionContext_var sc = + ::Components::SessionContext::_narrow (this->context_); + + if (! CORBA::is_nil(sc.in ())) + return sc->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + + // @@ Do we need to try the following case here? We are afterall implementing + // a session component here. + ::Components::EntityContext_var ec = + ::Components::EntityContext::_narrow (this->context_); + + if (! CORBA::is_nil(ec.in ())) + return ec->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); +} + +void +CIAO_GLUE_HUDisplay::RateGen_Servant::_ciao_activate (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + Components::SessionComponent_var temp = + Components::SessionComponent::_narrow (this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! CORBA::is_nil (temp.in ())) + temp->ccm_activate (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +void +CIAO_GLUE_HUDisplay::RateGen_Servant::_ciao_passivate (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + Components::SessionComponent_var temp = + Components::SessionComponent::_narrow (this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! CORBA::is_nil (temp.in ())) + temp->ccm_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +////////////////////////////////////////////////////////////////// +// Component Home Glue code implementation +////////////////////////////////////////////////////////////////// + +HUDisplay::RateGen_ptr +CIAO_GLUE_HUDisplay::RateGenHome_Servant::_ciao_activate_component (HUDisplay::CCM_RateGen_ptr exe + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + CORBA::Object_var hobj= this->container_->get_objref (this + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::CCMHome_var home = ::Components::CCMHome::_narrow (hobj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + CIAO_GLUE_HUDisplay::RateGen_Servant *svt = + new CIAO_GLUE_HUDisplay::RateGen_Servant (exe, + home.in (), + this->container_); + PortableServer::ServantBase_var safe (svt); + PortableServer::ObjectId_var oid; + + CORBA::Object_var objref + = this->container_->install_component (svt, + oid.out () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + svt->_ciao_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + HUDisplay::RateGen_var ho + = HUDisplay::RateGen::_narrow (objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (this->component_map_.bind (oid.in (), svt) == 0) + { + // @@ what should happen if bind fail? + safe._retn (); + } + return ho._retn (); +} + +void +CIAO_GLUE_HUDisplay::RateGenHome_Servant::_ciao_passivate_component (HUDisplay::RateGen_ptr comp + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + PortableServer::ObjectId_var oid; + + this->container_->uninstall_component (comp, + oid.out () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + CIAO_GLUE_HUDisplay::RateGen_Servant *servant = 0; + if (this->component_map_.unbind (oid.in (), servant) == 0) + { + PortableServer::ServantBase_var safe (servant); + servant->_ciao_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } + // What happen if unbind failed? + +} + +// Operations for Implicit Home interface +HUDisplay::RateGen_ptr +CIAO_GLUE_HUDisplay::RateGenHome_Servant::create (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)) +{ + if (this->executor_.in () == 0) + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); + + Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + HUDisplay::CCM_RateGen_var _ciao_comp + = HUDisplay::CCM_RateGen::_narrow (_ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return this->_ciao_activate_component (_ciao_comp.in () + ACE_ENV_ARG_PARAMETER); +} + +// Operations for CCMHome interface +void +CIAO_GLUE_HUDisplay::RateGenHome_Servant::remove_component (Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) +{ + HUDisplay::RateGen_var _ciao_comp + = HUDisplay::RateGen::_narrow (comp + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (_ciao_comp.in ())) + ACE_THROW (CORBA::INTERNAL ()); // What is the right exception to throw here? + + // @@ It seems to me that we need to make sure this is a component + // generated by this home before calling remove on this component. + _ciao_comp->remove (ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + + // Removing the object reference? get the servant from the POA with + // the objref, and call remove() on the component, deactivate the + // component, and then remove-ref the servant? + this->_ciao_passivate_component (_ciao_comp.in () + ACE_ENV_ARG_PARAMETER); +} + +extern "C" RATEGEN_SVNT_Export ::PortableServer::Servant +createRateGenHome_Servant (::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL) +{ + if (p == 0) + return 0; + + HUDisplay::CCM_RateGenHome_var x + = HUDisplay::CCM_RateGenHome::_narrow (p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (x.in ())) + return 0; + + return new CIAO_GLUE_HUDisplay::RateGenHome_Servant (x.in (), + c); +} diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.h b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.h new file mode 100644 index 00000000000..c7100fbbda6 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.h @@ -0,0 +1,400 @@ +// $Id$ + +// =========================================================== +// +// @file RateGen_svnt.h +// +// This is a pseudo-meta generic servant implementations template +// for CIAO's CIDL compiler. It demonstrates how a servant +// implementation for a session component should look like. +// +// @author Nanbor Wang <nanbor@cs.wustl.edu> +// +// =========================================================== + +#ifndef CIAO_GLUE_SESSION_RATEGEN_SVNT_H +#define CIAO_GLUE_SESSION_RATEGEN_SVNT_H +#include "ace/pre.h" + +#include "RateGenS.h" // Source in the skeletons for component + // client-view equivalent interfaces +#include "RateGenEC.h" // Source in the executor mapping + // that component implementations use +#include "ciao/Container_Base.h" //Source in the container interface definitions +#include "tao/LocalObject.h" +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Active_Map_Manager_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO_GLUE_HUDisplay +{ + ////////////////////////////////////////////////////////////////// + // Component specific context implementation + class RATEGEN_SVNT_Export RateGen_Context : + public virtual HUDisplay::CCM_RateGen_Context, + public virtual TAO_Local_RefCounted_Object + { + public: + // We will allow the the servant glue code we generate to access + // our states. + friend class RateGen_Servant; + + // Ctor. + RateGen_Context (::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + RateGen_Servant *sv); + + // Dtor. + virtual ~RateGen_Context (); + + void push_Pulse (HUDisplay::tick_ptr ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for ::Components::CCMContext + virtual ::Components::Principal_ptr get_caller_principal (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::CCMHome_ptr get_CCM_home (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Boolean get_rollback_only (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + + virtual ::Components::Transaction::UserTransaction_ptr get_user_transaction (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + + virtual CORBA::Boolean is_caller_in_role (const char * role + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void set_rollback_only (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + + // Operations for ::Components::SessionContext interface + virtual CORBA::Object_ptr get_CCM_object (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + + protected: + // We need to generate, in protected section, stuff that manage + // connections and consumers of this component. + + // Operations for publishes interfaces. + ::Components::Cookie_ptr + subscribe_Pulse (HUDisplay::tickConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + HUDisplay::tickConsumer_ptr + unsubscribe_Pulse (::Components::Cookie_ptr ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::InvalidConnection)); + + ACE_Active_Map_Manager<HUDisplay::tickConsumer_var> ciao_publishes_Pulse_map_; + + protected: + /// Cached component home reference. + ::Components::CCMHome_var home_; + + /// session container + ::CIAO::Session_Container *container_; + + /// Reference back to owner. + RateGen_Servant *servant_; + + /// @@ Cached component reference. + HUDisplay::RateGen_var component_; + }; + + ////////////////////////////////////////////////////////////////// + // Component Servant Glue code implementation + class RATEGEN_SVNT_Export RateGen_Servant + : public virtual POA_HUDisplay::RateGen, // full skeleton name here + public virtual PortableServer::RefCountServantBase + { + public: + // Ctor. + RateGen_Servant (HUDisplay::CCM_RateGen_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c); + + // Dtor. + ~RateGen_Servant (void); + + // Operations from supported interfaces and inherited components + + virtual void start (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void stop (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Boolean active (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Long hertz (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void hertz (CORBA::Long hertz + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for provides interfaces. + + // Operations for receptacles interfaces. + + // Operations for consumers interfaces. + + // Operations for emits interfaces. + + // Operations for publishes interfaces. + virtual ::Components::Cookie_ptr + subscribe_Pulse (HUDisplay::tickConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual HUDisplay::tickConsumer_ptr + unsubscribe_Pulse (::Components::Cookie_ptr ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::InvalidConnection)); + + // Operations for Navigation interface + virtual CORBA::Object_ptr provide_facet (const char * name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException , + Components::InvalidName)) ; + virtual ::Components::FacetDescriptions * get_all_facets (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual ::Components::FacetDescriptions * get_named_facets (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException , + Components::InvalidName)); + virtual CORBA::Boolean same_component (CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for Receptacles interface + virtual ::Components::Cookie_ptr connect (const char * name, + CORBA::Object_ptr connection + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::AlreadyConnected, + Components::ExceededConnectionLimit)); + virtual CORBA::Object_ptr disconnect (const char * name, + Components::Cookie_ptr ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::CookieRequired, + Components::NoConnection)); + virtual ::Components::ConnectionDescriptions * get_connections (const char * name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::ReceptacleDescriptions * get_all_receptacles (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual ::Components::ReceptacleDescriptions * get_named_receptacles (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + // Operations for Events interface + virtual ::Components::EventConsumerBase_ptr get_consumer (const char * sink_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + virtual ::Components::Cookie_ptr subscribe (const char * publisher_name, + Components::EventConsumerBase_ptr subscriber + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::ExceededConnectionLimit)); + virtual ::Components::EventConsumerBase_ptr unsubscribe (const char * publisher_name, + Components::Cookie_ptr ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)); + virtual void connect_consumer (const char * emitter_name, + Components::EventConsumerBase_ptr consumer + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::AlreadyConnected, + Components::InvalidConnection)); + virtual ::Components::EventConsumerBase_ptr disconnect_consumer (const char * source_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::NoConnection)); + virtual ::Components::ConsumerDescriptions * get_all_consumers (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual ::Components::ConsumerDescriptions * get_named_consumers (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + virtual ::Components::EmitterDescriptions * get_all_emitters (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual ::Components::EmitterDescriptions * get_named_emitters (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + virtual ::Components::PublisherDescriptions * get_all_publishers (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual ::Components::PublisherDescriptions * get_named_publishers (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + // Operations for CCMObject interface + virtual ::CORBA::IRObject_ptr get_component_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual ::Components::CCMHome_ptr get_ccm_home (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual ::Components::PrimaryKeyBase * get_primary_key (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::NoKeyAvailable)); + virtual void configuration_complete (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidConfiguration)); + virtual void remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + virtual ::Components::ComponentPortDescription * get_all_ports (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // get_component implementation. + virtual CORBA::Object_ptr _get_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // CIAO specific operations. + + // Activate the object in the container_ + void + _ciao_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + // My Executor. + HUDisplay::CCM_RateGen_var executor_; + + // My Run-time Context. + RateGen_Context *context_; + + // Managing container. + ::CIAO::Session_Container *container_; + }; + + ////////////////////////////////////////////////////////////////// + // Component Home Glue code implementation + + // Foreach component home + class RATEGEN_SVNT_Export RateGenHome_Servant : + public virtual POA_HUDisplay::RateGenHome, // full skeleton name here + public virtual PortableServer::RefCountServantBase + { + public: + // Ctor. + RateGenHome_Servant (HUDisplay::CCM_RateGenHome_ptr exe, + CIAO::Session_Container *c); + + // Dtor. + ~RateGenHome_Servant (void); + + // User defined and inherited operations + + // Factory operations. + virtual HUDisplay::RateGen_ptr new_RateGen (CORBA::Long hertz + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::CreateFailure)); + + // Finder operations. + + + // Operations for KeylessHome interface + virtual ::Components::CCMObject_ptr + create_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)); + + // Operations for Implicit Home interface + virtual HUDisplay::RateGen_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)); + + // Operations for CCMHome interface + virtual ::CORBA::IRObject_ptr + get_component_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::CORBA::IRObject_ptr + get_home_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + remove_component (Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + + protected: + // Helper method for factory operations. + HUDisplay::RateGen_ptr + _ciao_activate_component (HUDisplay::CCM_RateGen_ptr exe + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate_component (HUDisplay::RateGen_ptr comp + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // My Executor. + HUDisplay::CCM_RateGenHome_var executor_; + + // My Container + CIAO::Session_Container *container_; + + // Components this home manages. + ACE_Hash_Map_Manager_Ex <PortableServer::ObjectId, + RateGen_Servant*, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> component_map_; + }; +} + +extern "C" RATEGEN_SVNT_Export ::PortableServer::Servant +createRateGenHome_Servant (::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + +#if defined (__ACE_INLINE__) +# include "RateGen_svnt.inl" +#endif /* __ACE_INLINE__ */ + + +#include "ace/post.h" +#endif /* CIAO_GLUE_SESSION_RATEGEN_SVNT_H */ diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.inl b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.inl new file mode 100644 index 00000000000..19053f69747 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.inl @@ -0,0 +1,224 @@ +// $Id$ -*- C++ -*- + +// The generated filename for files using this template shoule be +// [idl-basename]GS.i GS --> GlueSession + +// @@ Notice: [ciao module name] can expand to either CIAO_GLUE or +// CIAO_GLUE_[module name] as defined in the header file. + +/// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +/// @@@ Notice that all component and interface names need to be +/// fully qualified as we are creating a new namespace for the CIAO's +/// container glue code. +/// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + + +////////////////////////////////////////////////////////////////// +// Component specific context implementation +////////////////////////////////////////////////////////////////// + +ACE_INLINE +CIAO_GLUE_HUDisplay::RateGen_Context::RateGen_Context (::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + CIAO_GLUE_HUDisplay::RateGen_Servant *sv) + : home_ (::Components::CCMHome::_duplicate (home)), + container_ (c), + servant_ (sv) +{ + +} + +ACE_INLINE +CIAO_GLUE_HUDisplay::RateGen_Context::~RateGen_Context () +{ +} + +// Operations for emits interfaces. + +// Operations for ::Components::CCMContext +ACE_INLINE ::Components::Principal_ptr +CIAO_GLUE_HUDisplay::RateGen_Context::get_caller_principal (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ We don't support Security in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +ACE_INLINE ::Components::CCMHome_ptr +CIAO_GLUE_HUDisplay::RateGen_Context::get_CCM_home (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return ::Components::CCMHome::_duplicate (this->home_.in ()); +} + +ACE_INLINE CORBA::Boolean +CIAO_GLUE_HUDisplay::RateGen_Context::get_rollback_only (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ We don't support Transaction in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +ACE_INLINE ::Components::Transaction::UserTransaction_ptr +CIAO_GLUE_HUDisplay::RateGen_Context::get_user_transaction (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ We don't support Transaction in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +ACE_INLINE CORBA::Boolean +CIAO_GLUE_HUDisplay::RateGen_Context::is_caller_in_role (const char * role + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_UNUSED_ARG (role); + + // @@ We don't support Transaction in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +ACE_INLINE void +CIAO_GLUE_HUDisplay::RateGen_Context::set_rollback_only (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ We don't support Transaction in CIAO yet. + ACE_THROW (CORBA::NO_IMPLEMENT ()); +} + +////////////////////////////////////////////////////////////////// +// Component Servant Glue code implementation +////////////////////////////////////////////////////////////////// + +ACE_INLINE void +CIAO_GLUE_HUDisplay::RateGen_Servant::start (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->executor_->start (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +ACE_INLINE void +CIAO_GLUE_HUDisplay::RateGen_Servant::stop (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // Simply relay to executor. May not need to return the result... + this->executor_->stop (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +ACE_INLINE CORBA::Boolean +CIAO_GLUE_HUDisplay::RateGen_Servant::active (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // Simply relay to executor. May not need to return the result... + return this->executor_->active (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +ACE_INLINE CORBA::Long +CIAO_GLUE_HUDisplay::RateGen_Servant::hertz (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // Simply relay to executor. May not need to return the result... + return this->executor_->hertz (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +ACE_INLINE void +CIAO_GLUE_HUDisplay::RateGen_Servant::hertz (CORBA::Long hertz + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // Simply relay to executor. May not need to return the result... + this->executor_->hertz (hertz + ACE_ENV_ARG_PARAMETER); +} + +// Operations for publishes interfaces. +ACE_INLINE ::Components::Cookie_ptr +CIAO_GLUE_HUDisplay::RateGen_Servant::subscribe_Pulse (HUDisplay::tickConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::ExceededConnectionLimit)) +{ + return this->context_->subscribe_Pulse (c + ACE_ENV_ARG_PARAMETER); +} + +ACE_INLINE HUDisplay::tickConsumer_ptr +CIAO_GLUE_HUDisplay::RateGen_Servant::unsubscribe_Pulse (::Components::Cookie_ptr ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::InvalidConnection)) +{ + return this->context_->unsubscribe_Pulse (ck + ACE_ENV_ARG_PARAMETER); +} + +////////////////////////////////////////////////////////////////// +// Component Home Glue code implementation +////////////////////////////////////////////////////////////////// + +ACE_INLINE +CIAO_GLUE_HUDisplay::RateGenHome_Servant::RateGenHome_Servant (HUDisplay::CCM_RateGenHome_ptr exe, + CIAO::Session_Container *c) + : executor_ (HUDisplay::CCM_RateGenHome::_duplicate (exe)), + container_ (c) +{ +} + +ACE_INLINE +CIAO_GLUE_HUDisplay::RateGenHome_Servant::~RateGenHome_Servant (void) +{ +} + +// for factory operations inherit from parent home(s), they should return +// the corresponding component types their homes manage +ACE_INLINE HUDisplay::RateGen_ptr +CIAO_GLUE_HUDisplay::RateGenHome_Servant::new_RateGen (CORBA::Long hertz + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::CreateFailure)) +{ + Components::EnterpriseComponent_var _ciao_ec = + this->executor_->new_RateGen (hertz + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + HUDisplay::CCM_RateGen_var _ciao_comp + = HUDisplay::CCM_RateGen::_narrow (_ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return this->_ciao_activate_component (_ciao_comp.in () + ACE_ENV_ARG_PARAMETER); +} + +// Operations for KeylessHome interface +ACE_INLINE ::Components::CCMObject_ptr +CIAO_GLUE_HUDisplay::RateGenHome_Servant::create_component (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)) +{ + // Simply forward to the create method. + return this->create (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +// Operations for CCMHome interface +ACE_INLINE ::CORBA::IRObject_ptr +CIAO_GLUE_HUDisplay::RateGenHome_Servant::get_component_def (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ TO-DO. Contact IfR? + + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +ACE_INLINE CORBA::IRObject_ptr +CIAO_GLUE_HUDisplay::RateGenHome_Servant::get_home_def (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ TO-DO. Contact IfR? + + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt_export.h b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt_export.h new file mode 100644 index 00000000000..ad773523aa8 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl RATEGEN_SVNT +// ------------------------------ +#ifndef RATEGEN_SVNT_EXPORT_H +#define RATEGEN_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (RATEGEN_SVNT_HAS_DLL) +# define RATEGEN_SVNT_HAS_DLL 1 +#endif /* ! RATEGEN_SVNT_HAS_DLL */ + +#if defined (RATEGEN_SVNT_HAS_DLL) && (RATEGEN_SVNT_HAS_DLL == 1) +# if defined (RATEGEN_SVNT_BUILD_DLL) +# define RATEGEN_SVNT_Export ACE_Proper_Export_Flag +# define RATEGEN_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define RATEGEN_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* RATEGEN_SVNT_BUILD_DLL */ +# define RATEGEN_SVNT_Export ACE_Proper_Import_Flag +# define RATEGEN_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define RATEGEN_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* RATEGEN_SVNT_BUILD_DLL */ +#else /* RATEGEN_SVNT_HAS_DLL == 1 */ +# define RATEGEN_SVNT_Export +# define RATEGEN_SVNT_SINGLETON_DECLARATION(T) +# define RATEGEN_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* RATEGEN_SVNT_HAS_DLL == 1 */ + +// Set RATEGEN_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (RATEGEN_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define RATEGEN_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define RATEGEN_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !RATEGEN_SVNT_NTRACE */ + +#if (RATEGEN_SVNT_NTRACE == 1) +# define RATEGEN_SVNT_TRACE(X) +#else /* (RATEGEN_SVNT_NTRACE == 1) */ +# define RATEGEN_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (RATEGEN_SVNT_NTRACE == 1) */ + +#endif /* RATEGEN_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/client.cpp b/TAO/CIAO/examples/handcrafted/Display/RateGen/client.cpp new file mode 100644 index 00000000000..1e894f82d81 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/client.cpp @@ -0,0 +1,66 @@ +// $Id$ + +/** + * @file client.cpp + * + * This is a simple client test program that interact with the RateGen + * component implementation. This test uses the explicit factory + * operation in the home interface to create a RateGen component + * instance, run it for a while, and destroy the component instance. + */ + +#include "RateGenC.h" + +int +main (int argc, char *argv[]) +{ + ACE_TRY_NEW_ENV + { + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv ACE_ENV_ARG_PARAMETER); + + // Resolve HomeFinder interface + + CORBA::Object_var obj + = orb->string_to_object ("file://RateGenHome.ior" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + HUDisplay::RateGenHome_var home + = HUDisplay::RateGenHome::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (home.in ())) + ACE_ERROR_RETURN ((LM_ERROR, "Unable to acquire RateGenHome objref\n"), -1); + + HUDisplay::RateGen_var pulser + = home->new_RateGen (8 + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + pulser->start (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_OS::sleep (5); + + pulser->stop (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + home->remove_component (pulser.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Who is the culprit \n"); + cerr << "Uncaught CORBA exception" << endl; + return 1; + } + ACE_ENDTRY; + + return 0; +} diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/controller.cpp b/TAO/CIAO/examples/handcrafted/Display/RateGen/controller.cpp new file mode 100644 index 00000000000..b681531fc53 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/controller.cpp @@ -0,0 +1,121 @@ +// $Id$ + +#include "RateGenC.h" +#include "ace/Get_Opt.h" + +/** + * @file controller.cpp + * + * This program interact with a RateGen component, using its supported + * interface "opmode" to switch it on/off, and set the rate of the + * RateGen. + */ + +char *rategen_ior_ = 0; +int rate = 2; +int turn_on = 1; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "k:r:of"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + turn_on = 1; + break; + + case 'f': + turn_on = 0; + break; + + case 'k': + rategen_ior_ = get_opts.opt_arg (); + break; + + case 'r': + rate = atoi (get_opts.opt_arg ()); + break; + + case '?': // display help for use of the server. + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s\n" + "-o (Turn on the rate generator)\n" + "-f (Turn off the rate generator)\n" + "-k <RateGen IOR> (default is file://rategen.ior)\n" + "-r <rate in hertz> (default is 3)\n" + "\n", + argv [0]), + -1); + } + + if (rategen_ior_ == 0) + rategen_ior_ = "file://rategen.ior"; + + if (rate == 0) + rate = 3; + + return 0; +} + +int +main (int argc, char *argv[]) +{ + ACE_TRY_NEW_ENV + { + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv ACE_ENV_ARG_PARAMETER); + + if (parse_args (argc, argv) != 0) + return -1; + + CORBA::Object_var obj + = orb->string_to_object (rategen_ior_ + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + HUDisplay::RateGen_var pulser + = HUDisplay::RateGen::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (pulser.in ())) + ACE_ERROR_RETURN ((LM_ERROR, "Unable to acquire 'RateGen' objref\n"), -1); + + if (turn_on) + { + pulser->hertz (rate + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, "Start up the Rate Generator\n")); + + pulser->start (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + else + { + pulser->stop (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, "Rate Generator stopped\n")); + } + + orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Who is the culprit \n"); + cerr << "Uncaught CORBA exception" << endl; + return 1; + } + ACE_ENDTRY; + + return 0; +} diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/run_test.pl b/TAO/CIAO/examples/handcrafted/Display/RateGen/run_test.pl new file mode 100644 index 00000000000..8e080d8d4bd --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/run_test.pl @@ -0,0 +1,112 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +# +# @@ Run this script from ../descriptors/ instead. +# + +use lib "../../../../../../bin"; +use PerlACE::Run_Test; + +$status = 0; +$daemon_ior = PerlACE::LocalFile ("daemon.ior"); +$svr_ior = PerlACE::LocalFile ("server.ior"); +$home_ior = PerlACE::LocalFile ("RateGenHome.ior"); + +unlink $daemon_ior; +unlink $svr_ior; +unlink $home_ior; + +# CIAO Daemon command line arguments +$daemon_args = "-o $daemon_ior -i CIAO_Installation_Data.ini -n ../../../../tools/ComponentServer/ComponentServer"; + +# CIAO Daemon Controller location: +$controller = "../../../../tools/Daemon/DaemonController"; + +# Daemon controller common command line arguments +$common_args = "-ORBInitRef CIAODaemon=file://$daemon_ior"; + +# Daemon controller start_home command +$start_args = "start_home -s RateGen.csd -m $home_ior -c $svr_ior"; + +# Daemon controller end_home command +$end_args = "end_home -c file://$svr_ior"; + +# Daemon controller shutdown command +$shutdown_args = "shutdown"; + +# Client program command line arguments +$cl_args = ""; + +# Naming_Service process definition +$DS = new PerlACE::Process ("../../../../tools/Daemon/CIAO_Daemon", + "$daemon_args"); + +# Client process definition +$CL = new PerlACE::Process ("../RateGen/client", + "$cl_args"); + +## Starting up the CIAO daemon +$DS->Spawn (); +if (PerlACE::waitforfile_timed ($daemon_ior, 15) == -1) { + print STDERR "ERROR: Could not find daemon ior file <$daemon_ior>\n"; + $DS->Kill (); + exit 1; +} + +## Starting up a ComponentServer running the RateGen home. +$DC = new PerlACE::Process ("$controller", + "$common_args $start_args"); + +$DC->SpawnWaitKill (60); +if (PerlACE::waitforfile_timed ($home_ior, 15) == -1) { + print STDERR "ERROR: Could not find home ior file <$home_ior>\n"; + $DS->Kill (); + exit 1; +} + +$client = $CL->SpawnWaitKill (60); + +if ($client != 0) { + print STDERR "ERROR: client returned $client\n"; + $status = 1; +} + +## Terminating the ComponentServer running the RateGen home. +$DC = new PerlACE::Process ("$controller", + "$common_args $end_args"); + +$ctrl = $DC->SpawnWaitKill (60); +if ($ctrl != 0) { + print STDERR "ERROR: Fail to end component server\n"; + $DS->Kill (); + exit 1; +} + +## Terminating the ComponentServer running the RateGen home. +$DC = new PerlACE::Process ("$controller", + "$common_args $shutdown_args"); + +$ctrl = $DC->SpawnWaitKill (60); +if ($ctrl != 0) { + print STDERR "ERROR: Fail to shutdown CIAODaemon\n"; + $DS->Kill (); + exit 1; +} + +$ctrl = $DS->WaitKill (60); +if ($ctrl != 0) { + print STDERR "ERROR: CIAODaemon didn't shutdown gracefully $ctrl\n"; + $DS->Kill (); + exit 1; +} + +unlink $daemon_ior; +unlink $svr_ior; +unlink $home_ior; + +exit $status; diff --git a/TAO/CIAO/examples/handcrafted/Display/cleanup_mpcfiles.cmd b/TAO/CIAO/examples/handcrafted/Display/cleanup_mpcfiles.cmd new file mode 100755 index 00000000000..4c11d847420 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/cleanup_mpcfiles.cmd @@ -0,0 +1 @@ +del /q /s *.plg *.pdb *.ilk *.lib *.dsw *.dsp *.ncb *.exp *.opt
\ No newline at end of file diff --git a/TAO/CIAO/examples/handcrafted/Display/descriptors/CIAO_Installation_Data.ini b/TAO/CIAO/examples/handcrafted/Display/descriptors/CIAO_Installation_Data.ini new file mode 100644 index 00000000000..245a0c5e4d9 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/descriptors/CIAO_Installation_Data.ini @@ -0,0 +1,9 @@ +[ComponentInstallation] +DCE:75309233-0E0A-4cfb-B186-3E99F69B1D40=GPS_svnt +DCE:82C2B032-37F0-4315-A59F-7020D3264E4D=RateGen_exec +DCE:8E92655E-CA07-46C8-B127-0F0872A8CC29=GPS_tracing_exec +DCE:93D254CF-9538-44e8-BB98-AABCD134ADD3=RateGen_svnt +DCE:CDC06FCA-50FC-43ca-8ECC-BEFBD33FEE78=NavDisplay_svnt +DCE:8E6C468D-A39F-46b4-962B-265F1AA8D538=NavDisplay_exec +DCE:D7984625-8561-431d-9927-4E498B317C02=NavDisplayGUI_exec +DCE:3148F760-F2ED-4204-A775-6B972C10E8CB=GPS_exec diff --git a/TAO/CIAO/examples/handcrafted/Display/descriptors/DuelDisplay.cad b/TAO/CIAO/examples/handcrafted/Display/descriptors/DuelDisplay.cad new file mode 100644 index 00000000000..a5bfb59ca80 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/descriptors/DuelDisplay.cad @@ -0,0 +1,113 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- XML doesn't really support the following $(CIAO_ROOT) syntax :) --> +<!DOCTYPE componentassembly SYSTEM "$(CIAO_ROOT)/docs/XML/componentassembly.dtd"> + +<componentassembly id="Single-process HUDisplay assembly"> + <componentfiles> + <componentfile id="com-RateGen"> + <fileinarchive name="RateGen.csd"/> + </componentfile> + <componentfile id="com-GPS"> + <fileinarchive name="GPS_tracing.csd"/> + </componentfile> + <componentfile id="com-NavDisplay"> + <fileinarchive name="NavDisplay.csd"/> + </componentfile> + <componentfile id="com-NavDisplayGUI"> + <fileinarchive name="NavDisplayGUI.csd"/> + </componentfile> + </componentfiles> + + <partitioning> + + <!-- A plain vanilla partition. We don't even need the processcollocation tag here. --> + <homeplacement id="a_RateGenHome"> + <componentfileref idref="com-RateGen"/> + <componentinstantiation id="a_RateGen"> + <registercomponent> + <!-- writeiortofile is a non-standard CIAO extension. --> + <writeiortofile name="rategen.ior"/> + </registercomponent> + </componentinstantiation> + </homeplacement> + + <homeplacement id="a_GPSHome"> + <componentfileref idref="com-GPS"/> + <componentinstantiation id="a_GPS"/> + </homeplacement> + + <homeplacement id="a_NavDisplayHome"> + <componentfileref idref="com-NavDisplay"/> + <componentinstantiation id="a_NavDisplay"/> + </homeplacement> + + <processcollocation> + <homeplacement id="a_NavDisplayGUIHome"> + <componentfileref idref="com-NavDisplayGUI"/> + <componentinstantiation id="a_NavDisplayGUI"/> + </homeplacement> + <destination>Remote</destination> + </processcollocation> + </partitioning> + + <connections> + + <connectevent> + <consumesport> + <consumesidentifier>Refresh</consumesidentifier> + <componentinstantiationref idref="a_GPS"/> + </consumesport> + <publishesport> + <publishesidentifier>Pulse</publishesidentifier> + <componentinstantiationref idref="a_RateGen"/> + </publishesport> + </connectevent> + + <connectevent> + <consumesport> + <consumesidentifier>Refresh</consumesidentifier> + <componentinstantiationref idref="a_NavDisplay"/> + </consumesport> + <publishesport> + <publishesidentifier>Ready</publishesidentifier> + <componentinstantiationref idref="a_GPS"/> + </publishesport> + </connectevent> + + <connectinterface> + <usesport> + <usesidentifier>GPSLocation</usesidentifier> + <componentinstantiationref idref="a_NavDisplay"/> + </usesport> + <providesport> + <providesidentifier>MyLocation</providesidentifier> + <componentinstantiationref idref="a_GPS"/> + </providesport> + </connectinterface> + + <connectevent> + <consumesport> + <consumesidentifier>Refresh</consumesidentifier> + <componentinstantiationref idref="a_NavDisplayGUI"/> + </consumesport> + <publishesport> + <publishesidentifier>Ready</publishesidentifier> + <componentinstantiationref idref="a_GPS"/> + </publishesport> + </connectevent> + + <connectinterface> + <usesport> + <usesidentifier>GPSLocation</usesidentifier> + <componentinstantiationref idref="a_NavDisplayGUI"/> + </usesport> + <providesport> + <providesidentifier>MyLocation</providesidentifier> + <componentinstantiationref idref="a_GPS"/> + </providesport> + </connectinterface> + + </connections> + +</componentassembly>
\ No newline at end of file diff --git a/TAO/CIAO/examples/handcrafted/Display/descriptors/GPS.csd b/TAO/CIAO/examples/handcrafted/Display/descriptors/GPS.csd new file mode 100644 index 00000000000..a6e17406f41 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/descriptors/GPS.csd @@ -0,0 +1,63 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- XML doesn't really support the following $(CIAO_ROOT) syntax :) --> +<!DOCTYPE softpkg SYSTEM "$(CIAO_ROOT)/docs/XML/softpkg.dtd"> + +<!-- GPS's Software Package Descriptor --> +<!-- This file describes various GPS executor --> +<!-- implementations. --> + + +<softpkg name="CIAO-GPS" version="1.0"> + <pkgtype>CORBA Component</pkgtype> + <title>Rate Generator</title> + <author> + <company>Washington University in St. Louis</company> + <webpage href="http://www.cs.wustl.edu/~doc/"/> + </author> + <description>A GPS executor implementation.</description> + <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/> + <idl id="IDL:HUDisplay/GPS:1.0" homeid="IDL:HUDisplay/GPSHome:1.0"> + <fileinarchive name="GPS.idl"/> + </idl> + + <!-- We don't need a property file for this example. However, --> + <!-- what to do with this element? Cache it in ComponentInstallation? --> + <!-- A better question maybe, when do we actually read the file and --> + <!-- build the attributes defined in the file? By Assembly perhaps? --> + <!-- Notice that this property file applies to the implementation itself. --> + <!-- Whatever that means. --> +<!-- <propertyfile> --> +<!-- <fileinarchive name="empty.cpf"/> --> +<!-- </propertyfile> --> + + <descriptor type="CORBA Component"> + <fileinarchive name="GPS.ccd"/> + </descriptor> + + <implementation id="DCE:3148F760-F2ED-4204-A775-6B972C10E8CB"> + + <!-- CIAO extension --> + <dependency type="CIAODLL"> + <softpkgref> + <!-- .ssd stands for Servant Software Descriptors which is a CIAO extension --> + <fileinarchive name="GPS.ssd"/> + <implref idref="DCE:75309233-0E0A-4cfb-B186-3E99F69B1D40"/> + </softpkgref> + </dependency> + + <!-- What happens when one define descriptors for both softpkg and --> + <!-- implementations? --> + + <code type="DLL"> + <!-- No need to specify extension below since ACE takes care of that, --> + <fileinarchive name="GPS_exec"/> + <entrypoint>createGPSHome_Impl</entrypoint> + </code> + + </implementation> + + <!-- Let's add more implementation description later when we try to --> + <!-- compile this stuff on, say, Solaris and Linux. --> + +</softpkg>
\ No newline at end of file diff --git a/TAO/CIAO/examples/handcrafted/Display/descriptors/GPS.ssd b/TAO/CIAO/examples/handcrafted/Display/descriptors/GPS.ssd new file mode 100644 index 00000000000..b68e7c62648 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/descriptors/GPS.ssd @@ -0,0 +1,47 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- XML doesn't really support the following $(CIAO_ROOT) syntax :) --> +<!DOCTYPE softpkg SYSTEM "$(CIAO_ROOT)/docs/XML/softpkg.dtd"> + +<!-- GPS's Servant Software Descriptor --> +<!-- This file describes various GPS servant --> +<!-- implementations. --> + + +<softpkg name="CIAO-GPS-Servant" version="1.0"> + <pkgtype>CIAO Servant</pkgtype> + <title>HUDisplay::GPS Servants</title> + <author> + <company>Washington University in St. Louis</company> + <webpage href="http://www.cs.wustl.edu/~doc/"/> + </author> + <description>A GPS servant implementation.</description> + <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/> + <idl id="IDL:HUDisplay/GPS:1.0" homeid="IDL:HUDisplay/GPSHome:1.0"> + <fileinarchive name="GPS.idl"/> + </idl> + + <!-- Duplicate information. We should use the copy in GPS.csd --> + <!-- So, do we really need this one? --> + <descriptor type="CORBA Component"> + <fileinarchive name="GPS.ccd"/> + </descriptor> + + <implementation id="DCE:75309233-0E0A-4cfb-B186-3E99F69B1D40"> + + <dependency type="ORB"> + <name>TAO</name> + </dependency> + + <code> + <!-- No need to specify extension below since ACE takes care of that, --> + <fileinarchive name="GPS_svnt"/> + <entrypoint>createGPSHome_Servant</entrypoint> + </code> + + </implementation> + + <!-- Let's add more implementation description later when we try to --> + <!-- compile this stuff on, say, Solaris and Linux. --> + +</softpkg>
\ No newline at end of file diff --git a/TAO/CIAO/examples/handcrafted/Display/descriptors/GPS_tracing.csd b/TAO/CIAO/examples/handcrafted/Display/descriptors/GPS_tracing.csd new file mode 100644 index 00000000000..894ccca55a7 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/descriptors/GPS_tracing.csd @@ -0,0 +1,63 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- XML doesn't really support the following $(CIAO_ROOT) syntax :) --> +<!DOCTYPE softpkg SYSTEM "$(CIAO_ROOT)/docs/XML/softpkg.dtd"> + +<!-- GPS's Software Package Descriptor --> +<!-- This file describes various GPS executor --> +<!-- implementations. --> + + +<softpkg name="CIAO-GPS" version="1.0"> + <pkgtype>CORBA Component</pkgtype> + <title>GPS tracing emulater</title> + <author> + <company>Washington University in St. Louis</company> + <webpage href="http://www.cs.wustl.edu/~doc/"/> + </author> + <description>A GPS executor implementation that emulate a trace.</description> + <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/> + <idl id="IDL:HUDisplay/GPS:1.0" homeid="IDL:HUDisplay/GPSHome:1.0"> + <fileinarchive name="GPS.idl"/> + </idl> + + <!-- We don't need a property file for this example. However, --> + <!-- what to do with this element? Cache it in ComponentInstallation? --> + <!-- A better question maybe, when do we actually read the file and --> + <!-- build the attributes defined in the file? By Assembly perhaps? --> + <!-- Notice that this property file applies to the implementation itself. --> + <!-- Whatever that means. --> +<!-- <propertyfile> --> +<!-- <fileinarchive name="empty.cpf"/> --> +<!-- </propertyfile> --> + + <descriptor type="CORBA Component"> + <fileinarchive name="GPS.ccd"/> + </descriptor> + + <implementation id="DCE:8E92655E-CA07-46C8-B127-0F0872A8CC29"> + + <!-- CIAO extension --> + <dependency type="CIAODLL"> + <softpkgref> + <!-- .ssd stands for Servant Software Descriptors which is a CIAO extension --> + <fileinarchive name="GPS.ssd"/> + <implref idref="DCE:75309233-0E0A-4cfb-B186-3E99F69B1D40"/> + </softpkgref> + </dependency> + + <!-- What happens when one define descriptors for both softpkg and --> + <!-- implementations? --> + + <code type="DLL"> + <!-- No need to specify extension below since ACE takes care of that, --> + <fileinarchive name="GPS_tracing_exec"/> + <entrypoint>createGPSHome_Tracing_Impl</entrypoint> + </code> + + </implementation> + + <!-- Let's add more implementation description later when we try to --> + <!-- compile this stuff on, say, Solaris and Linux. --> + +</softpkg>
\ No newline at end of file diff --git a/TAO/CIAO/examples/handcrafted/Display/descriptors/HUDisplay.cad b/TAO/CIAO/examples/handcrafted/Display/descriptors/HUDisplay.cad new file mode 100644 index 00000000000..9410aab95ba --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/descriptors/HUDisplay.cad @@ -0,0 +1,81 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- XML doesn't really support the following $(CIAO_ROOT) syntax :) --> +<!DOCTYPE componentassembly SYSTEM "$(CIAO_ROOT)/docs/XML/componentassembly.dtd"> + +<componentassembly id="Single-process HUDisplay assembly"> + <componentfiles> + <componentfile id="com-RateGen"> + <fileinarchive name="RateGen.csd"/> + </componentfile> + <componentfile id="com-GPS"> + <fileinarchive name="GPS.csd"/> + </componentfile> + <componentfile id="com-NavDisplay"> + <fileinarchive name="NavDisplay.csd"/> + </componentfile> + </componentfiles> + + <partitioning> + + <!-- A plain vanilla partition. We don't even need the processcollocation tag here. --> + <homeplacement id="a_RateGenHome"> + <componentfileref idref="com-RateGen"/> + <componentinstantiation id="a_RateGen"> + <registercomponent> + <!-- writeiortofile is a non-standard CIAO extension. --> + <writeiortofile name="rategen.ior"/> + </registercomponent> + </componentinstantiation> + </homeplacement> + + <homeplacement id="a_GPSHome"> + <componentfileref idref="com-GPS"/> + <componentinstantiation id="a_GPS"/> + </homeplacement> + + <homeplacement id="a_NavDisplayHome"> + <componentfileref idref="com-NavDisplay"/> + <componentinstantiation id="a_NavDisplay"/> + </homeplacement> + + </partitioning> + + <connections> + + <connectevent> + <consumesport> + <consumesidentifier>Refresh</consumesidentifier> + <componentinstantiationref idref="a_GPS"/> + </consumesport> + <publishesport> + <publishesidentifier>Pulse</publishesidentifier> + <componentinstantiationref idref="a_RateGen"/> + </publishesport> + </connectevent> + + <connectevent> + <consumesport> + <consumesidentifier>Refresh</consumesidentifier> + <componentinstantiationref idref="a_NavDisplay"/> + </consumesport> + <publishesport> + <publishesidentifier>Ready</publishesidentifier> + <componentinstantiationref idref="a_GPS"/> + </publishesport> + </connectevent> + + <connectinterface> + <usesport> + <usesidentifier>GPSLocation</usesidentifier> + <componentinstantiationref idref="a_NavDisplay"/> + </usesport> + <providesport> + <providesidentifier>MyLocation</providesidentifier> + <componentinstantiationref idref="a_GPS"/> + </providesport> + </connectinterface> + + </connections> + +</componentassembly>
\ No newline at end of file diff --git a/TAO/CIAO/examples/handcrafted/Display/descriptors/HUDisplayGUI.cad b/TAO/CIAO/examples/handcrafted/Display/descriptors/HUDisplayGUI.cad new file mode 100644 index 00000000000..d4252fe4cb8 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/descriptors/HUDisplayGUI.cad @@ -0,0 +1,81 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- XML doesn't really support the following $(CIAO_ROOT) syntax :) --> +<!DOCTYPE componentassembly SYSTEM "$(CIAO_ROOT)/docs/XML/componentassembly.dtd"> + +<componentassembly id="Single-process HUDisplay assembly"> + <componentfiles> + <componentfile id="com-RateGen"> + <fileinarchive name="RateGen.csd"/> + </componentfile> + <componentfile id="com-GPS"> + <fileinarchive name="GPS_tracing.csd"/> + </componentfile> + <componentfile id="com-NavDisplay"> + <fileinarchive name="NavDisplayGUI.csd"/> + </componentfile> + </componentfiles> + + <partitioning> + + <!-- A plain vanilla partition. We don't even need the processcollocation tag here. --> + <homeplacement id="a_RateGenHome"> + <componentfileref idref="com-RateGen"/> + <componentinstantiation id="a_RateGen"> + <registercomponent> + <!-- writeiortofile is a non-standard CIAO extension. --> + <writeiortofile name="rategen.ior"/> + </registercomponent> + </componentinstantiation> + </homeplacement> + + <homeplacement id="a_GPSHome"> + <componentfileref idref="com-GPS"/> + <componentinstantiation id="a_GPS"/> + </homeplacement> + + <homeplacement id="a_NavDisplayHome"> + <componentfileref idref="com-NavDisplay"/> + <componentinstantiation id="a_NavDisplay"/> + </homeplacement> + + </partitioning> + + <connections> + + <connectevent> + <consumesport> + <consumesidentifier>Refresh</consumesidentifier> + <componentinstantiationref idref="a_GPS"/> + </consumesport> + <publishesport> + <publishesidentifier>Pulse</publishesidentifier> + <componentinstantiationref idref="a_RateGen"/> + </publishesport> + </connectevent> + + <connectevent> + <consumesport> + <consumesidentifier>Refresh</consumesidentifier> + <componentinstantiationref idref="a_NavDisplay"/> + </consumesport> + <publishesport> + <publishesidentifier>Ready</publishesidentifier> + <componentinstantiationref idref="a_GPS"/> + </publishesport> + </connectevent> + + <connectinterface> + <usesport> + <usesidentifier>GPSLocation</usesidentifier> + <componentinstantiationref idref="a_NavDisplay"/> + </usesport> + <providesport> + <providesidentifier>MyLocation</providesidentifier> + <componentinstantiationref idref="a_GPS"/> + </providesport> + </connectinterface> + + </connections> + +</componentassembly>
\ No newline at end of file diff --git a/TAO/CIAO/examples/handcrafted/Display/descriptors/NOTE.txt b/TAO/CIAO/examples/handcrafted/Display/descriptors/NOTE.txt new file mode 100644 index 00000000000..e09bbb9467b --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/descriptors/NOTE.txt @@ -0,0 +1,141 @@ +This directory contains various XML descriptors and configuration +files required to compose the HUDisplay application in a variety of +different ways. Let's go over a few important files first: + +test.dat: +--------- + + This file describes the deployment daemons CIAO's Assembly_Manager + will contact to instantiate ComponentServer's, home's, and component + instances. Each line specify the name of a installation + "destination" (I used this to specify <processcollocation> + destination in various *.cad files) and the corresponding IOR for + the CIAO_Daemon. The first entry is the "default" destination the + deployment framework will use. + + For example, test.dat now contains: + + Default corbaloc:iiop:localhost:10000/ServerActivator + Remote corbaloc:iiop:localhost:12000/ServerActivator + + You can copy and modify the copy to deploy the components in various + different locations to let the application truely "distributed". + For example, changing the remote ServerActivator to: + corbaloc:iiop:deuce.doc.wustl.edu:13000/ServerActivator + + Remember to start up the Assembly_Manager in Step 2 using the + revised "test.dat" you created, and start up the CIAO_Daemon's in + Step 1 according to the specification. + +*.cad: +------ + + These files specify how an application should be composed. The + specification includes, where to install a component, what + implementation to use, and how to connect components together. + Currently, we have: + + HUDisplay.cad: Plain vanilla assembly descriptor. This file install + all components using the "Default" (the first daemon) + in 'test.dat. You can see the application output + from the default daemon shell. + + HUDisplayGUI.cad: Same as HUDisplay.cad, but instead of a text-based + NavDisplay component and a GPS component that + generates random coordinations, this descriptor + instantiate a GUI NavDisplay window and a GPS + component that emulate a trace. + + RemoteDisplay.cad: This descriptor causes the NavDisplay component + to be instantiated in the "Remote" daemon. + + RemoteDisplayGUI.cad: Similar to RemoteDisplay.cad but uses a + GUI-based NavDisplay and the tracing GPS + components. + + DuelDisplay.cad: A combination of HUDisplay.cad and + RemoteDisplayGUI.cad. This example uses 4 + components (two display components) and hooks them + up together. I think this is really cool. + +Unfortunately, there's no run_test.pl for starting and running these +example configurations/assemblies as these daemons/managers programs +are still under development. You will need several shell windows for +them. All the following step should be run from this subdirectory +($CIAO_ROOT/examples/handcrafted/Display/descriptors/). Here are the +steps to demonstrate the examples: + +Step 1: +======= + + You need to start up all the CIAO_Daemon's as specified in the + deployment configuration file 'test.dat' (Notice the endpoint + specification.) I recommend running each CIAO_Daemon in its own + shell window so you can tell where a component in the example + application is running. Here are some hints on how to start the + daemons: + + $(CIAO_ROOT)/tools/Daemon/CIAO_Daemon -ORBEndpoint iiop://localhost:10000 -n ../../../../tools/ComponentServer/ComponentServer + + $(CIAO_ROOT)/tools/Daemon/CIAO_Daemon -ORBEndpoint iiop://localhost:12000 -n ../../../../tools/ComponentServer/ComponentServer + +Step 2: +======= + + Next, you will need to start up the Assembly_Manager which actually + does the assembly work. This should also be started in a separate + shell window. + + $(CIAO_ROOT)/tools/Assembly_Deployer/Assembly_Manager -o ior -c test.dat + +Step 3: +======= + + You then need to instruct the Assembly_Manager to deploy a specific + compoennt assembly descriptor. For example: + + $(CIAO_ROOT)/tools/Assembly_Deployer/Assembly_Deployer -k file://ior -a HUDisplay.cad + + Replace "HUDisplay.cad" with other '.cad' files as you like. + +Step 4: +======= + + All the .cad files instruct the Assembly_Manager to write the IOR of + the RateGen component to a file called "rategen.ior" in this + directory. You will then need to use a controller program in a + separate shell window to switch on/off the Rate Generator. Cont + + Execute the controller with: + + ../RateGen/controller -o # To switch on the RateGen + + See its source to check what options are available to start up the + controller. (Hints: you can control the rate (hertz) of the Rate + Generator component.) + + Once the controller is running, check out the Daemon window (for + text-based NavDisplay component) or the GUI window for the output. + Once you are happy with it, you can stop the RateGen by executing + the controller as: + + ../RateGen/controller -f # To switch off the RateGen + + Repeat this step again to instruct the RateGen component to start + generating events. + +Step 5: +======= + + Once you are done with the test. Press <enter> in the shell window + running Assembly_Deployer that you started in Step 3. This will + tear_down the application, kill all ComponentServer's, and terminate + both the Assembly_Deployer and Assembly_Manager process. + + Repeat Step 2-5 using different configurations and assembly + descriptors. + +Step 6: +======= + + Terminate CIAO_Daemon (either using ^C or DaemonController.) diff --git a/TAO/CIAO/examples/handcrafted/Display/descriptors/NavDisplay.csd b/TAO/CIAO/examples/handcrafted/Display/descriptors/NavDisplay.csd new file mode 100644 index 00000000000..4d32cf58851 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/descriptors/NavDisplay.csd @@ -0,0 +1,63 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- XML doesn't really support the following $(CIAO_ROOT) syntax :) --> +<!DOCTYPE softpkg SYSTEM "$(CIAO_ROOT)/docs/XML/softpkg.dtd"> + +<!-- NavDisplay's Software Package Descriptor --> +<!-- This file describes various NavDisplay executor --> +<!-- implementations. --> + + +<softpkg name="CIAO-NavDisplay" version="1.0"> + <pkgtype>CORBA Component</pkgtype> + <title>Rate Generator</title> + <author> + <company>Washington University in St. Louis</company> + <webpage href="http://www.cs.wustl.edu/~doc/"/> + </author> + <description>A NavDisplay executor implementation.</description> + <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/> + <idl id="IDL:HUDisplay/NavDisplay:1.0" homeid="IDL:HUDisplay/NavDisplayHome:1.0"> + <fileinarchive name="NavDisplay.idl"/> + </idl> + + <!-- We don't need a property file for this example. However, --> + <!-- what to do with this element? Cache it in ComponentInstallation? --> + <!-- A better question maybe, when do we actually read the file and --> + <!-- build the attributes defined in the file? By Assembly perhaps? --> + <!-- Notice that this property file applies to the implementation itself. --> + <!-- Whatever that means. --> +<!-- <propertyfile> --> +<!-- <fileinarchive name="empty.cpf"/> --> +<!-- </propertyfile> --> + + <descriptor type="CORBA Component"> + <fileinarchive name="NavDisplay.ccd"/> + </descriptor> + + <implementation id="DCE:8E6C468D-A39F-46b4-962B-265F1AA8D538"> + + <!-- CIAO extension --> + <dependency type="CIAODLL"> + <softpkgref> + <!-- .ssd stands for Servant Software Descriptors which is a CIAO extension --> + <fileinarchive name="NavDisplay.ssd"/> + <implref idref="DCE:CDC06FCA-50FC-43ca-8ECC-BEFBD33FEE78"/> + </softpkgref> + </dependency> + + <!-- What happens when one define descriptors for both softpkg and --> + <!-- implementations? --> + + <code type="DLL"> + <!-- No need to specify extension below since ACE takes care of that, --> + <fileinarchive name="NavDisplay_exec"/> + <entrypoint>createNavDisplayHome_Impl</entrypoint> + </code> + + </implementation> + + <!-- Let's add more implementation description later when we try to --> + <!-- compile this stuff on, say, Solaris and Linux. --> + +</softpkg>
\ No newline at end of file diff --git a/TAO/CIAO/examples/handcrafted/Display/descriptors/NavDisplay.ssd b/TAO/CIAO/examples/handcrafted/Display/descriptors/NavDisplay.ssd new file mode 100644 index 00000000000..f1e16629f90 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/descriptors/NavDisplay.ssd @@ -0,0 +1,47 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- XML doesn't really support the following $(CIAO_ROOT) syntax :) --> +<!DOCTYPE softpkg SYSTEM "$(CIAO_ROOT)/docs/XML/softpkg.dtd"> + +<!-- NavDisplay's Servant Software Descriptor --> +<!-- This file describes various NavDisplay servant --> +<!-- implementations. --> + + +<softpkg name="CIAO-NavDisplay-Servant" version="1.0"> + <pkgtype>CIAO Servant</pkgtype> + <title>HUDisplay::NavDisplay Servants</title> + <author> + <company>Washington University in St. Louis</company> + <webpage href="http://www.cs.wustl.edu/~doc/"/> + </author> + <description>A NavDisplay servant implementation.</description> + <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/> + <idl id="IDL:HUDisplay/NavDisplay:1.0" homeid="IDL:HUDisplay/NavDisplayHome:1.0"> + <fileinarchive name="NavDisplay.idl"/> + </idl> + + <!-- Duplicate information. We should use the copy in NavDisplay.csd --> + <!-- So, do we really need this one? --> + <descriptor type="CORBA Component"> + <fileinarchive name="NavDisplay.ccd"/> + </descriptor> + + <implementation id="DCE:CDC06FCA-50FC-43ca-8ECC-BEFBD33FEE78"> + + <dependency type="ORB"> + <name>TAO</name> + </dependency> + + <code> + <!-- No need to specify extension below since ACE takes care of that, --> + <fileinarchive name="NavDisplay_svnt"/> + <entrypoint>createNavDisplayHome_Servant</entrypoint> + </code> + + </implementation> + + <!-- Let's add more implementation description later when we try to --> + <!-- compile this stuff on, say, Solaris and Linux. --> + +</softpkg>
\ No newline at end of file diff --git a/TAO/CIAO/examples/handcrafted/Display/descriptors/NavDisplayGUI.csd b/TAO/CIAO/examples/handcrafted/Display/descriptors/NavDisplayGUI.csd new file mode 100644 index 00000000000..fb3895c27ca --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/descriptors/NavDisplayGUI.csd @@ -0,0 +1,63 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- XML doesn't really support the following $(CIAO_ROOT) syntax :) --> +<!DOCTYPE softpkg SYSTEM "$(CIAO_ROOT)/docs/XML/softpkg.dtd"> + +<!-- NavDisplay's Software Package Descriptor --> +<!-- This file describes various NavDisplay executor --> +<!-- implementations. --> + + +<softpkg name="CIAO-NavDisplay" version="1.0"> + <pkgtype>CORBA Component</pkgtype> + <title>Rate Generator</title> + <author> + <company>Washington University in St. Louis</company> + <webpage href="http://www.cs.wustl.edu/~doc/"/> + </author> + <description>A NavDisplay executor implementation.</description> + <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/> + <idl id="IDL:HUDisplay/NavDisplay:1.0" homeid="IDL:HUDisplay/NavDisplayHome:1.0"> + <fileinarchive name="NavDisplay.idl"/> + </idl> + + <!-- We don't need a property file for this example. However, --> + <!-- what to do with this element? Cache it in ComponentInstallation? --> + <!-- A better question maybe, when do we actually read the file and --> + <!-- build the attributes defined in the file? By Assembly perhaps? --> + <!-- Notice that this property file applies to the implementation itself. --> + <!-- Whatever that means. --> +<!-- <propertyfile> --> +<!-- <fileinarchive name="empty.cpf"/> --> +<!-- </propertyfile> --> + + <descriptor type="CORBA Component"> + <fileinarchive name="NavDisplay.ccd"/> + </descriptor> + + <implementation id="DCE:D7984625-8561-431d-9927-4E498B317C02"> + + <!-- CIAO extension --> + <dependency type="CIAODLL"> + <softpkgref> + <!-- .ssd stands for Servant Software Descriptors which is a CIAO extension --> + <fileinarchive name="NavDisplay.ssd"/> + <implref idref="DCE:CDC06FCA-50FC-43ca-8ECC-BEFBD33FEE78"/> + </softpkgref> + </dependency> + + <!-- What happens when one define descriptors for both softpkg and --> + <!-- implementations? --> + + <code type="DLL"> + <!-- No need to specify extension below since ACE takes care of that, --> + <fileinarchive name="NavDisplayGUI_exec"/> + <entrypoint>createNavDisplayHome_Impl</entrypoint> + </code> + + </implementation> + + <!-- Let's add more implementation description later when we try to --> + <!-- compile this stuff on, say, Solaris and Linux. --> + +</softpkg>
\ No newline at end of file diff --git a/TAO/CIAO/examples/handcrafted/Display/descriptors/RateGen.csd b/TAO/CIAO/examples/handcrafted/Display/descriptors/RateGen.csd new file mode 100644 index 00000000000..37d60c4ed1a --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/descriptors/RateGen.csd @@ -0,0 +1,63 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- XML doesn't really support the following $(CIAO_ROOT) syntax :) --> +<!DOCTYPE softpkg SYSTEM "$(CIAO_ROOT)/docs/XML/softpkg.dtd"> + +<!-- RateGen's Software Package Descriptor --> +<!-- This file describes various RateGen executor --> +<!-- implementations. --> + + +<softpkg name="CIAO-RateGen" version="1.0"> + <pkgtype>CORBA Component</pkgtype> + <title>Rate Generator</title> + <author> + <company>Washington University in St. Louis</company> + <webpage href="http://www.cs.wustl.edu/~doc/"/> + </author> + <description>A RateGen executor implementation.</description> + <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/> + <idl id="IDL:HUDisplay/RateGen:1.0" homeid="IDL:HUDisplay/RateGenHome:1.0"> + <fileinarchive name="RateGen.idl"/> + </idl> + + <!-- We don't need a property file for this example. However, --> + <!-- what to do with this element? Cache it in ComponentInstallation? --> + <!-- A better question maybe, when do we actually read the file and --> + <!-- build the attributes defined in the file? By Assembly perhaps? --> + <!-- Notice that this property file applies to the implementation itself. --> + <!-- Whatever that means. --> +<!-- <propertyfile> --> +<!-- <fileinarchive name="empty.cpf"/> --> +<!-- </propertyfile> --> + + <descriptor type="CORBA Component"> + <fileinarchive name="RateGen.ccd"/> + </descriptor> + + <implementation id="DCE:82C2B032-37F0-4315-A59F-7020D3264E4D"> + + <!-- CIAO extension --> + <dependency type="CIAODLL"> + <softpkgref> + <!-- .ssd stands for Servant Software Descriptors which is a CIAO extension --> + <fileinarchive name="RateGen.ssd"/> + <implref idref="DCE:93D254CF-9538-44e8-BB98-AABCD134ADD3"/> + </softpkgref> + </dependency> + + <!-- What happens when one define descriptors for both softpkg and --> + <!-- implementations? --> + + <code type="DLL"> + <!-- No need to specify extension below since ACE takes care of that, --> + <fileinarchive name="RateGen_exec"/> + <entrypoint>createRateGenHome_Impl</entrypoint> + </code> + + </implementation> + + <!-- Let's add more implementation description later when we try to --> + <!-- compile this stuff on, say, Solaris and Linux. --> + +</softpkg>
\ No newline at end of file diff --git a/TAO/CIAO/examples/handcrafted/Display/descriptors/RateGen.ssd b/TAO/CIAO/examples/handcrafted/Display/descriptors/RateGen.ssd new file mode 100644 index 00000000000..670969c7ff2 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/descriptors/RateGen.ssd @@ -0,0 +1,47 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- XML doesn't really support the following $(CIAO_ROOT) syntax :) --> +<!DOCTYPE softpkg SYSTEM "$(CIAO_ROOT)/docs/XML/softpkg.dtd"> + +<!-- RateGen's Servant Software Descriptor --> +<!-- This file describes various RateGen servant --> +<!-- implementations. --> + + +<softpkg name="CIAO-RateGen-Servant" version="1.0"> + <pkgtype>CIAO Servant</pkgtype> + <title>HUDisplay::RateGen Servants</title> + <author> + <company>Washington University in St. Louis</company> + <webpage href="http://www.cs.wustl.edu/~doc/"/> + </author> + <description>A RateGen servant implementation.</description> + <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/> + <idl id="IDL:HUDisplay/RateGen:1.0" homeid="IDL:HUDisplay/RateGenHome:1.0"> + <fileinarchive name="RateGen.idl"/> + </idl> + + <!-- Duplicate information. We should use the copy in RateGen.csd --> + <!-- So, do we really need this one? --> + <descriptor type="CORBA Component"> + <fileinarchive name="RateGen.ccd"/> + </descriptor> + + <implementation id="DCE:93D254CF-9538-44e8-BB98-AABCD134ADD3"> + + <dependency type="ORB"> + <name>TAO</name> + </dependency> + + <code> + <!-- No need to specify extension below since ACE takes care of that, --> + <fileinarchive name="RateGen_svnt"/> + <entrypoint>createRateGenHome_Servant</entrypoint> + </code> + + </implementation> + + <!-- Let's add more implementation description later when we try to --> + <!-- compile this stuff on, say, Solaris and Linux. --> + +</softpkg>
\ No newline at end of file diff --git a/TAO/CIAO/examples/handcrafted/Display/descriptors/RemoteDisplay.cad b/TAO/CIAO/examples/handcrafted/Display/descriptors/RemoteDisplay.cad new file mode 100644 index 00000000000..42fe7c9c83e --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/descriptors/RemoteDisplay.cad @@ -0,0 +1,83 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- XML doesn't really support the following $(CIAO_ROOT) syntax :) --> +<!DOCTYPE componentassembly SYSTEM "$(CIAO_ROOT)/docs/XML/componentassembly.dtd"> + +<componentassembly id="Single-process HUDisplay assembly"> + <componentfiles> + <componentfile id="com-RateGen"> + <fileinarchive name="RateGen.csd"/> + </componentfile> + <componentfile id="com-GPS"> + <fileinarchive name="GPS.csd"/> + </componentfile> + <componentfile id="com-NavDisplay"> + <fileinarchive name="NavDisplay.csd"/> + </componentfile> + </componentfiles> + + <partitioning> + + <!-- A plain vanilla partition. We don't even need the processcollocation tag here. --> + <homeplacement id="a_RateGenHome"> + <componentfileref idref="com-RateGen"/> + <componentinstantiation id="a_RateGen"> + <registercomponent> + <!-- writeiortofile is a non-standard CIAO extension. --> + <writeiortofile name="rategen.ior"/> + </registercomponent> + </componentinstantiation> + </homeplacement> + + <homeplacement id="a_GPSHome"> + <componentfileref idref="com-GPS"/> + <componentinstantiation id="a_GPS"/> + </homeplacement> + + <processcollocation> + <homeplacement id="a_NavDisplayHome"> + <componentfileref idref="com-NavDisplay"/> + <componentinstantiation id="a_NavDisplay"/> + </homeplacement> + <destination>Remote</destination> + </processcollocation> + </partitioning> + + <connections> + + <connectevent> + <consumesport> + <consumesidentifier>Refresh</consumesidentifier> + <componentinstantiationref idref="a_GPS"/> + </consumesport> + <publishesport> + <publishesidentifier>Pulse</publishesidentifier> + <componentinstantiationref idref="a_RateGen"/> + </publishesport> + </connectevent> + + <connectevent> + <consumesport> + <consumesidentifier>Refresh</consumesidentifier> + <componentinstantiationref idref="a_NavDisplay"/> + </consumesport> + <publishesport> + <publishesidentifier>Ready</publishesidentifier> + <componentinstantiationref idref="a_GPS"/> + </publishesport> + </connectevent> + + <connectinterface> + <usesport> + <usesidentifier>GPSLocation</usesidentifier> + <componentinstantiationref idref="a_NavDisplay"/> + </usesport> + <providesport> + <providesidentifier>MyLocation</providesidentifier> + <componentinstantiationref idref="a_GPS"/> + </providesport> + </connectinterface> + + </connections> + +</componentassembly>
\ No newline at end of file diff --git a/TAO/CIAO/examples/handcrafted/Display/descriptors/RemoteDisplayGUI.cad b/TAO/CIAO/examples/handcrafted/Display/descriptors/RemoteDisplayGUI.cad new file mode 100644 index 00000000000..414b1cef160 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/descriptors/RemoteDisplayGUI.cad @@ -0,0 +1,83 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- XML doesn't really support the following $(CIAO_ROOT) syntax :) --> +<!DOCTYPE componentassembly SYSTEM "$(CIAO_ROOT)/docs/XML/componentassembly.dtd"> + +<componentassembly id="Single-process HUDisplay assembly"> + <componentfiles> + <componentfile id="com-RateGen"> + <fileinarchive name="RateGen.csd"/> + </componentfile> + <componentfile id="com-GPS"> + <fileinarchive name="GPS_tracing.csd"/> + </componentfile> + <componentfile id="com-NavDisplay"> + <fileinarchive name="NavDisplayGUI.csd"/> + </componentfile> + </componentfiles> + + <partitioning> + + <!-- A plain vanilla partition. We don't even need the processcollocation tag here. --> + <homeplacement id="a_RateGenHome"> + <componentfileref idref="com-RateGen"/> + <componentinstantiation id="a_RateGen"> + <registercomponent> + <!-- writeiortofile is a non-standard CIAO extension. --> + <writeiortofile name="rategen.ior"/> + </registercomponent> + </componentinstantiation> + </homeplacement> + + <homeplacement id="a_GPSHome"> + <componentfileref idref="com-GPS"/> + <componentinstantiation id="a_GPS"/> + </homeplacement> + + <processcollocation> + <homeplacement id="a_NavDisplayHome"> + <componentfileref idref="com-NavDisplay"/> + <componentinstantiation id="a_NavDisplay"/> + </homeplacement> + <destination>Remote</destination> + </processcollocation> + </partitioning> + + <connections> + + <connectevent> + <consumesport> + <consumesidentifier>Refresh</consumesidentifier> + <componentinstantiationref idref="a_GPS"/> + </consumesport> + <publishesport> + <publishesidentifier>Pulse</publishesidentifier> + <componentinstantiationref idref="a_RateGen"/> + </publishesport> + </connectevent> + + <connectevent> + <consumesport> + <consumesidentifier>Refresh</consumesidentifier> + <componentinstantiationref idref="a_NavDisplay"/> + </consumesport> + <publishesport> + <publishesidentifier>Ready</publishesidentifier> + <componentinstantiationref idref="a_GPS"/> + </publishesport> + </connectevent> + + <connectinterface> + <usesport> + <usesidentifier>GPSLocation</usesidentifier> + <componentinstantiationref idref="a_NavDisplay"/> + </usesport> + <providesport> + <providesidentifier>MyLocation</providesidentifier> + <componentinstantiationref idref="a_GPS"/> + </providesport> + </connectinterface> + + </connections> + +</componentassembly>
\ No newline at end of file diff --git a/TAO/CIAO/examples/handcrafted/Display/descriptors/test.dat b/TAO/CIAO/examples/handcrafted/Display/descriptors/test.dat new file mode 100644 index 00000000000..d26b3d4e070 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/descriptors/test.dat @@ -0,0 +1,2 @@ +Default corbaloc:iiop:localhost:10000/ServerActivator +Remote corbaloc:iiop:localhost:12000/ServerActivator
\ No newline at end of file diff --git a/TAO/CIAO/examples/handcrafted/Hello/CIAO_Installation_Data.ini b/TAO/CIAO/examples/handcrafted/Hello/CIAO_Installation_Data.ini new file mode 100644 index 00000000000..7eb0600bad5 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Hello/CIAO_Installation_Data.ini @@ -0,0 +1,3 @@ +[ComponentInstallation] +DCE:530a6305-8181-47ca-bd82-0b834016db97=hello_executors +DCE:05833d92-4783-4b85-ac14-e2575dac26f7=hello_servants diff --git a/TAO/CIAO/examples/handcrafted/Hello/README b/TAO/CIAO/examples/handcrafted/Hello/README new file mode 100644 index 00000000000..84e837e673c --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Hello/README @@ -0,0 +1,131 @@ +// $Id$ + +This example showcases a component implementation in its simplest +form. The utmost purpose of this example is to demonstrate how easy +it is to implement a component and a system using CCM and to provide +ourselves an example implementation of how the CCIDL generated code +should look like. + +To implement a component, all you need to do is to define the +component, as in hello.idl. Then you have to define some aspects of +the component implementations using the CIDL definition, as we do here +with hello.cidl. And finally, the component implementor implement the +component and home executors according to the executor mapping. + + +User Defined Notes +Files +--------- --------------------------------------- +hello.idl Component and Home IDL definitions. + +hello.cidl Component and Home implementation definitions. + +hello_executors Executor implementations. + + +Handcrafted +Files Notes: They should relly be generated by some (C)IDL compiler +--------- --------------------------------------- +helloC.idl Equivalent IDL definitions. This file is used for double + checking the correctness of the generated code. + +helloE.idl Executor equivalent IDL definitions. Since TAO_IDL still + doesn't generate code for the exeutor definition, we manually + create define the executor mapping in this file and compile it + to get the executor mapping code. + +hello_servants Generic servant implementation for interfaces which should be + generated from hello.cidl using CCIDL (in the future. :-) + + +We also generate 3 libraries and 2 executables in this example. They +may look perplexing at the first glance, but when we have full CCM +support, all but one library and one executable will need to be +generated manually. The rest should be generated thru the tools provided by CIAO. +Below is the list of libraries and executable in this example: + +Files Notes +--------- --------------------------------------- +hello_stub A library contains the client stub implementation. + Client programs can link to this library instead of including + the stub implementation directly in the executable. The real + purpose of putting the stub code in a separate library is + to avoid code duplication when various interdependent components + are installed into one component server (where they will need to + interact with other components using the collocation code in the + stub library.) + +hello_servants This library contains the server side skeletons and CIDL generated + (currently handcrafted) servant implementation for the component + and home defined in CIDL. + +server This is a minimalist's implementaion of a simple "generic server". + We should be able to generalize the example into a "component server" + in CIAO which will support component deployment and server configuration + thru some property files. + +client A simple client program that access the component. + +hello_executors This library contains the CIDL generated executor definitions and the + actual component and home implementations (business logic.) It it not + clear to me whether we should package this file together with hello_servants + library as most of the stuff included in these libraries are generated + by CIDL compiler. We will see in the future. + + +** Here's a more detailed break down of the process. + +1. Define the component, as in hello.idl which defines the client-view + of the component. This view is equivalent to the interfaces + defined in helloC.idl (for component unawared client.) + +2. Define how the component should be implemented, as in hello.cidl. + CIDL compiler should generate the executor definitions as in + helloE.idl. + +3. CIDL also generate the component-specific skeleton (container?) + implementations as in HelloSkel.xxx. These skeleton + implementations determine how the component should be activated, + how to manage the servant lifecycle, their OID and such. + +4. If a component implementation needs to support more advanced + features, such as transactional behavior, the developer needs to + "extend" the executor definitions by inheriting from other + components callback interfaces, such as SessionSynchronization. + We don't have an example here because we want to keep this example + as simple as possible. + +5. Component executors are implemention by implementing the desired + executor definition. + +6. Packaging and deploying the component.... This example only shows + how to deploy a single component implementation. The servant + skeletons can either be packaged with the component implementation + in a single DLL, or be packaged in a separate DLL which, in turn, + can be deployed with the component implementation together as an + assembly, or be put in some sort of repository. + + +How to Run: +---------- + +1. Start the Name Service and store the name service IOR in some file + <w:\ior>. + + Naming_Service -o w:\ior + +2. Start the Component servier with the config file and the + NameService IOR we stored in the previous step: + + w:\ACE_wrappers\bin\Simple_Component_Server -ORBInitRef \ + NameService=file://w:\ior -i config -o ior + + The component server we use here will create the HomeFinder IOR. + Store the IOR in a file <ior>. + +3. Finally, start the client program as: + + client -ORBInitRef HomeFinder=file://ior + + The client will try to use all thru operations to find the + HelloHome interface.
\ No newline at end of file diff --git a/TAO/CIAO/examples/handcrafted/Hello/client.cpp b/TAO/CIAO/examples/handcrafted/Hello/client.cpp new file mode 100644 index 00000000000..b85cfda64e5 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Hello/client.cpp @@ -0,0 +1,116 @@ +// $Id$ + +#include "helloC.h" +#include "ace/Read_Buffer.h" + +int +invoke (CORBA::Object_ptr obj, + const char *msg + ACE_ENV_ARG_DECL) +{ + // Narrow + HelloHome_var hh = HelloHome::_narrow (obj + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); ; + + if (CORBA::is_nil (hh.in ())) + ACE_ERROR_RETURN ((LM_ERROR, "Argument is not a HelloHome reference\n"), -1); + + HelloWorld_var hw = hh->create (); + + if (CORBA::is_nil (hw.in ())) + ACE_ERROR_RETURN ((LM_ERROR, "Fail to create a HelloWorld reference\n"), -1); + + CORBA::String_var name = CORBA::string_dup (msg); + CORBA::String_var hi = hw->sayhello (name + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + ACE_DEBUG ((LM_INFO, "%s\n", hi.in ())); + + hh->remove_component (hw.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + return 0; +} + +int +main (int argc, char *argv[]) +{ + ACE_TRY_NEW_ENV + { + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv ACE_ENV_ARG_PARAMETER); + + // Resolve HomeFinder interface + +#if 0 + CORBA::Object_var obj = orb->resolve_initial_references ("HomeFinder" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + Components::HomeFinder_var home_finder = + Components::HomeFinder::_narrow (obj ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (home_finder.in ())) + ACE_ERROR_RETURN ((LM_ERROR, "Can't resolve initial HomeFinder reference\n"), -1); + + // Now get the HelloHome + + obj = home_finder->find_home_by_name ("HelloHome" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + invoke (obj.in (), + "Frodo Baggins using 'find_home_by_name'" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + obj = home_finder->find_home_by_home_type + ("IDL:omg.org/HelloHome:1.0" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + invoke (obj.in (), + "Samwise Gamgee using 'find_home_by_home_type'" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + obj = home_finder->find_home_by_component_type + ("IDL:omg.org/HelloWorld:1.0" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + invoke (obj.in (), + "Meriadoc Brandybuck using 'find_home_by_component_type'" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + +#else + CORBA::Object_var obj + = orb->string_to_object ("file://hello.ior" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + invoke (obj.in (), + "Meriadoc Brandybuck using 'file://hello.ior'" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; +#endif + + + orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Who is the culprit \n"); + cerr << "Uncaught CORBA exception" << endl; + return 1; + } + ACE_ENDTRY; + + return 0; +} diff --git a/TAO/CIAO/examples/handcrafted/Hello/client.dsp b/TAO/CIAO/examples/handcrafted/Hello/client.dsp new file mode 100644 index 00000000000..0fe87e79c3a --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Hello/client.dsp @@ -0,0 +1,152 @@ +# Microsoft Developer Studio Project File - Name="client EXE" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=client EXE - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "client.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "client.mak" CFG="client EXE - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "client EXE - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "client EXE - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "client EXE - Win32 Release"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release\client"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "..\..\.." /I "..\..\..\ciao" /I "..\..\..\.." /I "..\..\..\..\tao" /I "..\..\..\..\.." /D NDEBUG=1 /D WIN32=1 /D _CONSOLE=1 /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0x409 /i "..\..\.." /i "..\..\..\ciao" /i "..\..\..\.." /i "..\..\..\..\tao" /i "..\..\..\..\.." /d NDEBUG=1
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 /machine:IX86
+# ADD LINK32 advapi32.lib user32.lib TAO.lib TAO_IFR_Client.lib CIAO_Client.lib ACE.lib hello_stubd.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\..\tao\IFR_Client" /libpath:"..\..\..\ciao" /libpath:"..\..\..\..\tao" /libpath:"..\..\..\..\..\ace" /version:1.3.1
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF "$(CFG)" == "client EXE - Win32 Debug"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "."
+# PROP Intermediate_Dir "Debug\client"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /Zi /Od /Gy /I "..\..\.." /I "..\..\..\ciao" /I "..\..\..\.." /I "..\..\..\..\tao" /I "..\..\..\..\.." /D _DEBUG=1 /D WIN32=1 /D _CONSOLE=1 /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0x409 /i "..\..\.." /i "..\..\..\ciao" /i "..\..\..\.." /i "..\..\..\..\tao" /i "..\..\..\..\.." /d _DEBUG=1
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 /machine:IX86
+# ADD LINK32 advapi32.lib user32.lib TAOd.lib TAO_IFR_Clientd.lib CIAO_Clientd.lib ACEd.lib hello_stubd.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /libpath:"..\..\..\..\tao\IFR_Client" /libpath:"..\..\..\ciao" /libpath:"..\..\..\..\tao" /libpath:"..\..\..\..\..\ace" /version:1.3.1
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "client EXE - Win32 Release"
+# Name "client EXE - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;cxx;c"
+# Begin Source File
+
+SOURCE=.\client.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hh"
+# Begin Source File
+
+SOURCE=.\hello_executors.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\hello_executors_export.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\hello_servants.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\hello_servants_export.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\hello_stub_export.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\helloC.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\helloEC.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\helloES.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\helloS.h
+# End Source File
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i;inl"
+# Begin Source File
+
+SOURCE=.\helloC.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\helloEC.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\helloES.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\helloS.i
+# End Source File
+# End Group
+# Begin Group "Documentation"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\README
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/CIAO/examples/handcrafted/Hello/config b/TAO/CIAO/examples/handcrafted/Hello/config new file mode 100644 index 00000000000..3bfe3d3dbe5 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Hello/config @@ -0,0 +1 @@ +hello_executors|createHelloHome_Impl|hello_servants|createHelloHome_Servant|IDL:omg.org/HelloHome:1.0|IDL:omg.org/HelloWorld:1.0|HelloHome diff --git a/TAO/CIAO/examples/handcrafted/Hello/hello.ccd b/TAO/CIAO/examples/handcrafted/Hello/hello.ccd new file mode 100644 index 00000000000..325a2a41e06 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Hello/hello.ccd @@ -0,0 +1,70 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- XML doesn't really support the following $(CIAO_ROOT) syntax :) --> +<!DOCTYPE corbacomponent SYSTEM "$(CIAO_ROOT)/docs/XML/corbacomponent.dtd"> + +<!-- Hello World CORBA Component Descriptor --> +<!-- This file describes features of HelloWorld and HelloHome. --> + +<corbacomponent> + <corbaversion>3.0</corbaversion> + <componentrepid repid="IDL:HelloWorld:1.0"/> + <homerepid repid="IDL:HelloHome:1.0"/> + <componentkind> + <!-- This particular example can either be <service/> or --> + <session> + <servant lifetime="container"/> + </session> + </componentkind> + + <threading policy="multithread"/> <!-- No effect for now --> + <configurationcomplete set="false"/> <!-- We don't support this yet. --> + + <!-- Use to set realtime POA policy? --> + <!-- Or should we use unclassified componentkind with this instead? --> + <!-- <extendedpoapolicy name="" value=""/> --> + + <!-- Can set the IfR reference here --> + + <!-- CIAO doesn't support segmented component now. --> + + <!-- You can specify the properties of a component here. --> +<!-- <componentproperties> --> +<!-- <fileinarchive name=""/> --> +<!-- </componentproperties> --> + + <!-- You can specify the properties of a componenthome here. --> +<!-- <homeproperties> --> +<!-- <fileinarchive name=""/> --> +<!-- </homeproperties> --> + + <!-- Ignore homefeatures for now? Yes. Nothing here worth worrying about --> + <!-- Unless we are going to extend the operationpolicies element. --> + <homefeatures name="HelloHome" repid="IDL:HelloHome:1.0"> + + </homefeatures> + + <!-- Ignore componentfeatures? --> + <componentfeatures name="HelloWorld" repid="IDL:HelloWorld:1.0"> + + <!-- inheritscomponent ... --> + + <!-- Nothing to worry about here unless we extend operationpolicies. --> + <supportsinterface repid="IDL:Hello:1.0"> + <!-- operationpolicies ... --> + </supportsinterface> + + <ports> + <!-- No Port for this component. --> + </ports> + + <!-- operationpolicies... --> + + </componentfeature> + + <interface name="Hello" repid="IDL:Hello:1.0"> + <!-- inheritsinterface repid="" --> + <!-- operationpolicies... --> + </interface> + +</corbacomponent>
\ No newline at end of file diff --git a/TAO/CIAO/examples/handcrafted/Hello/hello.cidl b/TAO/CIAO/examples/handcrafted/Hello/hello.cidl new file mode 100644 index 00000000000..dc4c4a256c6 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Hello/hello.cidl @@ -0,0 +1,17 @@ +// $Id$ -*- IDL -*- + +// Component implementation definition of hello.idl. +// Since we currently don't have a CCIDL (CIAO CIDL) compiler available, +// we need to generate the servant implementation manually. + +import HelloWorld; // Do we need this? +import HelloHome; // This should import all related defitions. + +composition session hello_example +{ + home executor HelloHome_Exec + { + implement HelloHome; // This implies that HelloWorld_Exec + manages HelloWorld_Exec; // implements HellowWorld. + }; +}; diff --git a/TAO/CIAO/examples/handcrafted/Hello/hello.csd b/TAO/CIAO/examples/handcrafted/Hello/hello.csd new file mode 100644 index 00000000000..771b36beae7 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Hello/hello.csd @@ -0,0 +1,74 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- XML doesn't really support the following $(CIAO_ROOT) syntax :) --> +<!DOCTYPE softpkg SYSTEM "$(CIAO_ROOT)/docs/XML/softpkg.dtd"> + +<!-- Hello World's Software Package Descriptor --> +<!-- This file describes various HelloWorld executor --> +<!-- implementations. --> + + +<softpkg name="CIAO-HelloWorld" version="1.0"> + <pkgtype>CORBA Component</pkgtype> + <title>Hello World</title> + <author> + <company>Washington University in St. Louis</company> + <webpage href="http://www.cs.wustl.edu/~doc/"/> + </author> + <description>A Hello World executor implementation.</description> + <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/> + <idl id="IDL:HelloWorld:1.0" homeid="IDL:HelloHome:1.0"> + <fileinarchive name="hello.idl"/> + </idl> + + <!-- We don't need a property file for this example. However, --> + <!-- what to do with this element? Cache it in ComponentInstallation? --> + <!-- A better question maybe, when do we actually read the file and --> + <!-- build the attributes defined in the file? By Assembly perhaps? --> + <!-- Notice that this property file applies to the implementation itself. --> + <!-- Whatever that means. --> +<!-- <propertyfile> --> +<!-- <fileinarchive name="empty.cpf"/> --> +<!-- </propertyfile> --> + + <descriptor type="CORBA Component"> + <fileinarchive name="hello.ccd"/> + </descriptor> + + <implementation id="DCE:530a6305-8181-47ca-bd82-0b834016db97"> + <!-- Perhaps we can list more OS here as ACE knows what to look for? --> + <!-- Maybe not... But then selecting the right configuration becomes hard. --> + <os name="WinNT" version="4.0"/> + <os name="WinXP" version="5.0"/> + <processor name="x86"/> + <!-- What about configuration? Such as Debug/Release? --> + <compile name="MSVC" version="6.0"/> + <programminglanguage name="C++"/> + <dependency type="ORB"> + <name>TAO</name> + </dependency> + + <!-- CIAO extension --> + <dependency type="CIAODLL"> + <softpkgref> + <!-- .ssd stands for Servant Software Descriptors which is a CIAO extension --> + <fileinarchive name="hello.ssd"/> + <implref idref="DCE:05833d92-4783-4b85-ac14-e2575dac26f7"/> + </softpkgref> + </dependency> + + <!-- What happens when one define descriptors for both softpkg and --> + <!-- implementations? --> + + <code type="DLL"> + <!-- No need to specify extension below since ACE takes care of that, --> + <fileinarchive name="hello_executors"/> + <entrypoint>createHelloHome_Impl</entrypoint> + </code> + + </implementation> + + <!-- Let's add more implementation description later when we try to --> + <!-- compile this stuff on, say, Solaris and Linux. --> + +</softpkg>
\ No newline at end of file diff --git a/TAO/CIAO/examples/handcrafted/Hello/hello.dsw b/TAO/CIAO/examples/handcrafted/Hello/hello.dsw new file mode 100644 index 00000000000..afb2955db0e --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Hello/hello.dsw @@ -0,0 +1,74 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "client"=.\client.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name hello_stub
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "hello_executors"=.\hello_executors.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name hello_servants
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "hello_servants"=.\hello_servants.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name hello_stub
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "hello_stub"=.\hello_stub.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/TAO/CIAO/examples/handcrafted/Hello/hello.idl b/TAO/CIAO/examples/handcrafted/Hello/hello.idl new file mode 100644 index 00000000000..ba758eab9de --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Hello/hello.idl @@ -0,0 +1,19 @@ +// $Id$ + +// A plain vanilla component definition. + +#include "ciao/CCM_Component.idl" + +interface Hello +{ + string sayhello (in string username); +}; + +component HelloWorld supports Hello +{ +}; + + +home HelloHome manages HelloWorld +{ +}; diff --git a/TAO/CIAO/examples/handcrafted/Hello/hello.mpc b/TAO/CIAO/examples/handcrafted/Hello/hello.mpc new file mode 100644 index 00000000000..902742796d0 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Hello/hello.mpc @@ -0,0 +1,60 @@ +project(hello_stub): ciao_client { + sharedname = hello_stub + idlflags += -I ../../.. -I ../../../.. -I ../../../../orbsvcs/orbsvcs + idlflags += -Wb,pre_include="ace/pre.h" -Wb,post_include="ace/post.h" + idlflags += -Wb,stub_export_macro=HELLO_STUB_Export -Wb,stub_export_include=hello_stub_export.h -Wb,skel_export_macro=HELLO_SERVANT_Export -Wb,skel_export_include=hello_servants_export.h + dllflags = HELLO_STUB_BUILD_DLL + + IDL_Files { + hello.idl + } + + Source_Files { + helloC.cpp + } +} + +project(hello_servants) : ciao_server { + depends += hello_stub + sharedname = hello_servants + libs += hello_stub + idlflags += -I ../../.. -I ../../../.. -I ../../../../orbsvcs/orbsvcs -Wb,export_macro=HELLO_SERVANT_Export -Wb,export_include=hello_servants_export.h -Wb,pre_include="ace/pre.h" -Wb,post_include="ace/post.h" + dllflags = HELLO_SERVANT_BUILD_DLL + + IDL_Files { + helloE.idl + } + + Source_Files { + helloEC.cpp + helloS.cpp + hello_servants.cpp + } +} + +project(hello_executors) : ciao_server { + depends += hello_servants + sharedname = hello_executors + libs += hello_stub hello_servants + dllflags = HELLO_EXECUTOR_BUILD_DLL + + IDL_Files { + } + + Source_Files { + hello_executors.cpp + } +} + +project (client) : ciao_client { + exename = client + depends += hello_stub + libs += hello_stub + + IDL_Files { + } + + Source_Files { + client.cpp + } +}
\ No newline at end of file diff --git a/TAO/CIAO/examples/handcrafted/Hello/hello.ssd b/TAO/CIAO/examples/handcrafted/Hello/hello.ssd new file mode 100644 index 00000000000..d06a89f13a7 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Hello/hello.ssd @@ -0,0 +1,52 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- XML doesn't really support the following $(CIAO_ROOT) syntax :) --> +<!DOCTYPE softpkg SYSTEM "$(CIAO_ROOT)/docs/XML/softpkg.dtd"> + +<!-- Hello World's Servant Software Descriptor --> +<!-- This file describes various HelloWorld servant --> +<!-- implementations. --> + + +<softpkg name="CIAO-HelloWorld-Servant" version="1.0"> + <pkgtype>CIAO Servant</pkgtype> + <title>Hello World Servants</title> + <author> + <company>Washington University in St. Louis</company> + <webpage href="http://www.cs.wustl.edu/~doc/"/> + </author> + <description>A Hello World executor implementation.</description> + <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/> + <idl id="IDL:HelloWorld:1.0" homeid="IDL:HelloHome:1.0"> + <fileinarchive name="hello.idl"/> + </idl> + + <!-- Duplicate information. We should use the copy in hello.csd --> + <!-- So, do we really need this one? --> + <descriptor type="CORBA Component"> + <fileinarchive name="hello.ccd"/> + </descriptor> + + <implementation id="DCE:05833d92-4783-4b85-ac14-e2575dac26f7"> + <!-- The following stuff should match those defined in csd file. --> + <os name="WinNT" version="4.0"/> + <os name="WinXP" version="5.0"/> + <processor name="x86"/> + <compile name="MSVC" version="6.0"/> + <programminglanguage name="C++"/> + <dependency type="ORB"> + <name>TAO</name> + </dependency> + + <code> + <!-- No need to specify extension below since ACE takes care of that, --> + <fileinarchive name="hello_servants"/> + <entrypoint>createHelloHome_Servant</entrypoint> + </code> + + </implementation> + + <!-- Let's add more implementation description later when we try to --> + <!-- compile this stuff on, say, Solaris and Linux. --> + +</softpkg>
\ No newline at end of file diff --git a/TAO/CIAO/examples/handcrafted/Hello/helloC.idl b/TAO/CIAO/examples/handcrafted/Hello/helloC.idl new file mode 100644 index 00000000000..325254bd556 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Hello/helloC.idl @@ -0,0 +1,38 @@ +// $Id$ + +// This is the equivalent interface definitions for Hello.idl. +// tao_idl -I ../../.. -I ../../../.. -Sc helloC.idl + +#include "ciao/CIAO_Component.pidl" + +interface Hello +{ + // Return the greating string as: + // "Greeting from <helloname>. How are you, <username>?" + string sayhello (in string username); +}; + +interface HelloWorld + : ::Components::CCMObject, + Hello +{ +}; + +interface HelloHomeExplicit + : ::Components::CCMHome +{ +}; + +interface HelloHomeImplicit + : ::Components::KeylessCCMHome +{ + HelloWorld create () + raises (::Components::CreateFailure) + ; +}; + +interface HelloHome + : HelloHomeExplicit, + HelloHomeImplicit +{ +}; diff --git a/TAO/CIAO/examples/handcrafted/Hello/helloE.idl b/TAO/CIAO/examples/handcrafted/Hello/helloE.idl new file mode 100644 index 00000000000..da04d01d64b --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Hello/helloE.idl @@ -0,0 +1,50 @@ +// $Id$ + +// Executor interface definitions of hello.cidl. +// tao_idl -I ../../.. -I ../../../.. -I ../../../../orbsvcs/orbsvcs -Sc helloE.idl + +#include "ciao/CCM_Container.idl" +#include "hello.idl" + +local interface CCM_Hello : Hello +{ +}; + +// Component main executor +local interface CCM_HelloWorld_Executor + : Components::EnterpriseComponent, + Hello +{ + // attribute string message; +}; + +local interface CCM_HelloWorld + : CCM_HelloWorld_Executor +/* +: Components::EnterpriseComponent, + Hello +*/ +{ +}; + +local interface CCM_HelloWorld_Context + : ::Components::SessionContext +{ +}; + +local interface CCM_HelloHomeImplicit +{ + Components::EnterpriseComponent create () + raises (Components::CreateFailure); +}; + +local interface CCM_HelloHomeExplicit + : Components::HomeExecutorBase +{ +}; + +local interface CCM_HelloHome + : CCM_HelloHomeExplicit, + CCM_HelloHomeImplicit +{ +}; diff --git a/TAO/CIAO/examples/handcrafted/Hello/hello_executors.cpp b/TAO/CIAO/examples/handcrafted/Hello/hello_executors.cpp new file mode 100644 index 00000000000..a6523607a2b --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Hello/hello_executors.cpp @@ -0,0 +1,52 @@ +// $Id$ + +#include "hello_executors.h" + +HelloWorld_Impl::HelloWorld_Impl () +{ +} + +HelloWorld_Impl::~HelloWorld_Impl + () +{ +} + +char * +HelloWorld_Impl::sayhello (const char *username + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + static const char *fmt = "Hello World message for "; + + CORBA::String_var str = + CORBA::string_alloc (ACE_OS::strlen (fmt) + + ACE_OS::strlen (username) + + 1); + + ACE_OS::strcpy (str.inout (), fmt); + ACE_OS::strcat (str.inout (), username); + + return str._retn (); +} + +HelloHome_Impl::HelloHome_Impl () +{ +} + +HelloHome_Impl::~HelloHome_Impl () +{ +} + +Components::EnterpriseComponent_ptr +HelloHome_Impl::create (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)) +{ + return new HelloWorld_Impl (); +} + +extern "C" HELLO_EXECUTOR_Export ::Components::HomeExecutorBase_ptr +createHelloHome_Impl (void) +{ + return new HelloHome_Impl (); +} diff --git a/TAO/CIAO/examples/handcrafted/Hello/hello_executors.dsp b/TAO/CIAO/examples/handcrafted/Hello/hello_executors.dsp new file mode 100644 index 00000000000..43910abe08f --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Hello/hello_executors.dsp @@ -0,0 +1,115 @@ +# Microsoft Developer Studio Project File - Name="hello_executors DLL" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=hello_executors DLL - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE run the tool that generated this project file and specify the
+!MESSAGE nmake output type. You can then use the following command:
+!MESSAGE
+!MESSAGE NMAKE /f "hello_executors.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "hello_executors.mak" CFG="hello_executors DLL - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "hello_executors DLL - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "hello_executors DLL - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "hello_executors DLL - Win32 Release"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "."
+# PROP Intermediate_Dir "Release\hello_executors"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD CPP /nologo /W3 /GX /O2 /MD /Zi /Ob2 /GR /I "..\..\..\..\orbsvcs\orbsvcs" /I "..\..\.." /I "..\..\..\ciao" /I "..\..\..\.." /I "..\..\..\..\tao" /I "..\..\..\..\.." /D NDEBUG=1 /D WIN32=1 /D _WINDOWS=1 /D HELLO_EXECUTOR_BUILD_DLL=1 /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d NDEBUG=1 /i "..\..\..\..\orbsvcs\orbsvcs" /i "..\..\.." /i "..\..\..\ciao" /i "..\..\..\.." /i "..\..\..\..\tao" /i "..\..\..\..\.."
+BSC32=bscmake.exe
+# ADD BSC32 /nologo /o".\hello_executors.bsc"
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO hello_stub.lib hello_servants.lib CIAO_Server.lib TAO_PortableServer.lib TAO_Security.lib CIAO_Container.lib TAO.lib TAO_IFR_Client.lib CIAO_Client.lib ACE.lib /libpath:"..\..\..\..\tao\PortableServer" /libpath:"..\..\..\..\orbsvcs\orbsvcs" /libpath:"..\..\..\..\tao\IFR_Client" /libpath:"..\..\..\ciao" /libpath:"..\..\..\..\tao" /libpath:"..\..\..\..\..\ace" /nologo /version:1.3.1 /subsystem:windows /pdb:"..\..\..\..\..\bin\hello_executors.pdb" /dll /machine:I386 /out:"..\..\..\..\..\bin\hello_executors.dll"
+
+!ELSEIF "$(CFG)" == "hello_executors DLL - Win32 Debug"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "."
+# PROP Intermediate_Dir "Debug\hello_executors"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /MDd /GR /Gy /I "..\..\..\..\orbsvcs\orbsvcs" /I "..\..\.." /I "..\..\..\ciao" /I "..\..\..\.." /I "..\..\..\..\tao" /I "..\..\..\..\.." /D _DEBUG=1 /D WIN32=1 /D _WINDOWS=1 /D HELLO_EXECUTOR_BUILD_DLL=1 /FD /c
+# SUBTRACT CPP /Fr /YX
+# ADD RSC /l 0x409 /d _DEBUG=1 /i "..\..\..\..\orbsvcs\orbsvcs" /i "..\..\.." /i "..\..\..\ciao" /i "..\..\..\.." /i "..\..\..\..\tao" /i "..\..\..\..\.."
+BSC32=bscmake.exe
+# ADD BSC32 /nologo /o".\hello_executors.bsc"
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO hello_stubd.lib hello_servantsd.lib CIAO_Serverd.lib TAO_PortableServerd.lib TAO_Securityd.lib CIAO_Containerd.lib TAOd.lib TAO_IFR_Clientd.lib CIAO_Clientd.lib ACEd.lib /libpath:"..\..\..\..\tao\PortableServer" /libpath:"..\..\..\..\orbsvcs\orbsvcs" /libpath:"..\..\..\..\tao\IFR_Client" /libpath:"..\..\..\ciao" /libpath:"..\..\..\..\tao" /libpath:"..\..\..\..\..\ace" /nologo /version:1.3.1 /subsystem:windows /pdb:"..\..\..\..\..\bin\hello_executorsd.pdb" /dll /debug /machine:I386 /out:"..\..\..\..\..\bin\hello_executorsd.dll"
+
+!ENDIF
+
+# Begin Target
+
+# Name "hello_executors DLL - Win32 Release"
+# Name "hello_executors DLL - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;cxx;c"
+# Begin Source File
+
+SOURCE=.\hello_executors.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hh"
+# Begin Source File
+
+SOURCE=.\hello_executors.h
+# End Source File
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i;inl"
+# Begin Source File
+
+SOURCE=.\helloC.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\helloEC.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\helloES.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\helloS.i
+# End Source File
+# End Group
+# Begin Group "Documentation"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\README
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/CIAO/examples/handcrafted/Hello/hello_executors.h b/TAO/CIAO/examples/handcrafted/Hello/hello_executors.h new file mode 100644 index 00000000000..322a89dff48 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Hello/hello_executors.h @@ -0,0 +1,53 @@ +// $Id$ + +// This file contains executor implementations. + +#if !defined (HELLO_EXECUTORS_H) +#define HELLO_EXECUTORS_H + +#include "helloEC.h" +#include "hello_executors_export.h" + +class HelloWorld_Impl : + public virtual CCM_HelloWorld, + public virtual TAO_Local_RefCounted_Object +{ +public: + /// Default ctor. + HelloWorld_Impl (); + + /// Default dtor. + ~HelloWorld_Impl (); + + virtual char *sayhello (const char *username + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + CORBA::SystemException + )); +}; + +class HelloHome_Impl : + public virtual CCM_HelloHome, + public virtual TAO_Local_RefCounted_Object +{ +public: + /// Default ctor. + HelloHome_Impl (); + + /// Default dtor. + ~HelloHome_Impl (); + + virtual ::Components::EnterpriseComponent_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)); +}; + +// We still need to figure out a way to clean up the object created by +// the factory correctly. Like we did in ACE_FACTORY macro, with a +// Gobbler function. + +extern "C" HELLO_EXECUTOR_Export ::Components::HomeExecutorBase_ptr +createHelloHome_Impl (void); + +#endif /* HELLO_EXECUTORS_H */ diff --git a/TAO/CIAO/examples/handcrafted/Hello/hello_executors_export.h b/TAO/CIAO/examples/handcrafted/Hello/hello_executors_export.h new file mode 100644 index 00000000000..776ed8f606f --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Hello/hello_executors_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl HELLO_EXECUTOR +// ------------------------------ +#ifndef HELLO_EXECUTOR_EXPORT_H +#define HELLO_EXECUTOR_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (HELLO_EXECUTOR_HAS_DLL) +# define HELLO_EXECUTOR_HAS_DLL 1 +#endif /* ! HELLO_EXECUTOR_HAS_DLL */ + +#if defined (HELLO_EXECUTOR_HAS_DLL) && (HELLO_EXECUTOR_HAS_DLL == 1) +# if defined (HELLO_EXECUTOR_BUILD_DLL) +# define HELLO_EXECUTOR_Export ACE_Proper_Export_Flag +# define HELLO_EXECUTOR_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define HELLO_EXECUTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* HELLO_EXECUTOR_BUILD_DLL */ +# define HELLO_EXECUTOR_Export ACE_Proper_Import_Flag +# define HELLO_EXECUTOR_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define HELLO_EXECUTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* HELLO_EXECUTOR_BUILD_DLL */ +#else /* HELLO_EXECUTOR_HAS_DLL == 1 */ +# define HELLO_EXECUTOR_Export +# define HELLO_EXECUTOR_SINGLETON_DECLARATION(T) +# define HELLO_EXECUTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* HELLO_EXECUTOR_HAS_DLL == 1 */ + +// Set HELLO_EXECUTOR_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (HELLO_EXECUTOR_NTRACE) +# if (ACE_NTRACE == 1) +# define HELLO_EXECUTOR_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define HELLO_EXECUTOR_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !HELLO_EXECUTOR_NTRACE */ + +#if (HELLO_EXECUTOR_NTRACE == 1) +# define HELLO_EXECUTOR_TRACE(X) +#else /* (HELLO_EXECUTOR_NTRACE == 1) */ +# define HELLO_EXECUTOR_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (HELLO_EXECUTOR_NTRACE == 1) */ + +#endif /* HELLO_EXECUTOR_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/Hello/hello_servants.cpp b/TAO/CIAO/examples/handcrafted/Hello/hello_servants.cpp new file mode 100644 index 00000000000..f7d61b94b55 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Hello/hello_servants.cpp @@ -0,0 +1,717 @@ +// $Id$ + +#include "hello_servants.h" + +// @@: Denote stuff that need to be fixed later. +// @@@: Denote stuff that need to be fixed now. + +CIAO_HelloWorld_Context::CIAO_HelloWorld_Context (::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c, + CIAO_HelloWorld_Servant *sv) + : home_ (::Components::CCMHome::_duplicate (h)), + container_ (c), + servant_ (sv) +{ + +} + +CIAO_HelloWorld_Context::~CIAO_HelloWorld_Context () +{ + +} + +// Operations for ::Components::SessionContext interface +CORBA::Object_ptr +CIAO_HelloWorld_Context::get_CCM_object (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ How do I check for IllegalState here? When it's not in a + // callback operation... + // ACE_THROW_RETURN (::Components::IllegalState (), 0); + + if (CORBA::is_nil (this->component_.in ())) + { + CORBA::Object_var obj = this->container_->get_objref (this->servant_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + this->component_ = HelloWorld::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (this->component_.in ())) + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); // This should not happen... + } + return HelloWorld::_duplicate (this->component_.in ()); +} + +// Operations for HellowWorld attributes, event source, and +// receptable defined in CCM_HelloWorld_Context. + +// Operations for ::Components::CCMContext +::Components::Principal_ptr +CIAO_HelloWorld_Context::get_caller_principal (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ We don't support Security in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +::Components::CCMHome_ptr +CIAO_HelloWorld_Context::get_CCM_home (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return ::Components::CCMHome::_duplicate (this->home_.in ()); +} + +CORBA::Boolean +CIAO_HelloWorld_Context::get_rollback_only (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ We don't support Transaction in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +::Components::Transaction::UserTransaction_ptr +CIAO_HelloWorld_Context::get_user_transaction (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ We don't support Transaction in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +CORBA::Boolean +CIAO_HelloWorld_Context::is_caller_in_role (const char * role + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_UNUSED_ARG (role); + + // @@ We don't support Transaction in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +void +CIAO_HelloWorld_Context::set_rollback_only (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ We don't support Transaction in CIAO yet. + ACE_THROW (CORBA::NO_IMPLEMENT ()); +} + + +//////////////////////////////////////////////////////////////// +/////////////////// CIAO_HelloWorld_Servant //////////////////// + +CIAO_HelloWorld_Servant::CIAO_HelloWorld_Servant (CCM_HelloWorld_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c) + : executor_ (CCM_HelloWorld::_duplicate (exe)), + container_ (c) +{ + this->context_ = new CIAO_HelloWorld_Context (h, c, this); + + ACE_TRY_NEW_ENV; + { + Components::SessionComponent_var temp = + Components::SessionComponent::_narrow (exe + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (! CORBA::is_nil (temp.in ())) + temp->set_session_context (this->context_.in () + ACE_ENV_ARG_PARAMETER); + } + ACE_CATCHANY + { + // @@ Ignore any exceptions? What happens if + // set_session_context throws an CCMException? + } + ACE_ENDTRY; +} + +CIAO_HelloWorld_Servant::~CIAO_HelloWorld_Servant (void) +{ + ACE_TRY_NEW_ENV; + { + Components::SessionComponent_var temp = + Components::SessionComponent::_narrow (this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (! CORBA::is_nil (temp.in ())) + temp->ccm_remove (ACE_ENV_SINGLE_ARG_PARAMETER); + } + ACE_CATCHANY + { + // @@ Ignore any exceptions? What happens if + // set_session_context throws an CCMException? + } + ACE_ENDTRY; +} + +// Operations for supported interfaces. +// Explicit opereations and attribute operations. +char * +CIAO_HelloWorld_Servant::sayhello (const char * username + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (this->executor_.in () == 0) + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); + + return this->executor_->sayhello (username ACE_ENV_ARG_DECL); +} + +// Operations for provides interfaces. + +// Operations for receptacles interfaces. + +// Operations for emits interfaces. + +// Operations for consumers interfaces. + +// Operations for publishes interfaces. + +// Operations for Navigation interface +CORBA::Object_ptr +CIAO_HelloWorld_Servant::provide_facet (const char * name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException , + Components::InvalidName)) +{ + ACE_UNUSED_ARG (name); + + // @@ We should probably provide a more generic contruct + // (Hash_Map?) to manage the navigation/receptacles/events + // interface. + + // This component doesn't provide any facets so whatever name you + // pass in is not a valid facet name. + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::FacetDescriptions * +CIAO_HelloWorld_Servant::get_all_facets (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::FacetDescriptions_var collection + = new ::Components::FacetDescriptions (1); + + ::Components::FacetDescription_var x + = new ::OBV_Components::FacetDescription; + + + x->Name ((const char *)"a_name"); + x->type_id ("repo id"); + x->facet_ref (CORBA::Object::_nil ()); + + CORBA::ULong i = 0; + collection[i] = x; + + return collection._retn (); + // No facet for this component. + // return new ::Components::FacetDescriptions; +} + +::Components::FacetDescriptions * +CIAO_HelloWorld_Servant::get_named_facets (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException , + Components::InvalidName)) +{ + // No facet for this component. + if (names.length () != 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + + // Or return an empty description sequence if you are not asking + // for anyhing in particular. + return new ::Components::FacetDescriptions; +} + +CORBA::Boolean +CIAO_HelloWorld_Servant::same_component (CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_UNUSED_ARG (object_ref); + + // @@@ Need to contact the POA, get the object reference, and invoke + // _is_equivalent on the object reference. + + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +// Operations for Receptacles interface +::Components::Cookie * +CIAO_HelloWorld_Servant::connect (const char * name, + CORBA::Object_ptr connection + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::AlreadyConnected, + Components::ExceededConnectionLimit)) +{ + ACE_UNUSED_ARG (name); + ACE_UNUSED_ARG (connection); + // @@ We need to come up with a generic interface to manage + // these connections. + + ACE_THROW_RETURN (::Components::InvalidName (), 0); +} + +CORBA::Object_ptr +CIAO_HelloWorld_Servant::disconnect (const char * name, + Components::Cookie * ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::CookieRequired, + Components::NoConnection)) +{ + ACE_UNUSED_ARG (name); + ACE_UNUSED_ARG (ck); + + ACE_THROW_RETURN (::Components::InvalidName (), 0); +} + +::Components::ConnectionDescriptions * +CIAO_HelloWorld_Servant::get_connections (const char * name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ACE_UNUSED_ARG (name); + + ACE_THROW_RETURN (::Components::InvalidName (), 0); +} + +::Components::ReceptacleDescriptions * +CIAO_HelloWorld_Servant::get_all_receptacles (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // No receptacles. Return an empty sequence. + return new ::Components::ReceptacleDescriptions; +} + +::Components::ReceptacleDescriptions * +CIAO_HelloWorld_Servant::get_named_receptacles (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + // No facet for this component. + if (names.length () != 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + + // Or return an empty description sequence if you are not asking + // for anyhing in particular. + return new ::Components::ReceptacleDescriptions; +} + +// Operations for Events interface +::Components::EventConsumerBase_ptr +CIAO_HelloWorld_Servant::get_consumer (const char * sink_name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ACE_UNUSED_ARG (sink_name); + + ACE_THROW_RETURN (::Components::InvalidName (), 0); +} + +::Components::Cookie * +CIAO_HelloWorld_Servant::subscribe (const char * publisher_name, + Components::EventConsumerBase_ptr subscriber + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::AlreadyConnected, + Components::InvalidConnection)) +{ + ACE_UNUSED_ARG (publisher_name); + ACE_UNUSED_ARG (subscriber); + + ACE_THROW_RETURN (::Components::InvalidName (), 0); +} + +::Components::EventConsumerBase_ptr +CIAO_HelloWorld_Servant::unsubscribe (const char * publisher_name, + Components::Cookie * ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)) +{ + ACE_UNUSED_ARG (publisher_name); + ACE_UNUSED_ARG (ck); + + ACE_THROW_RETURN (::Components::InvalidName (), 0); +} + +void +CIAO_HelloWorld_Servant::connect_consumer (const char * emitter_name, + Components::EventConsumerBase_ptr consumer + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::AlreadyConnected, + Components::InvalidConnection)) +{ + ACE_UNUSED_ARG (emitter_name); + ACE_UNUSED_ARG (consumer); + + ACE_THROW (::Components::InvalidName ()); +} + +::Components::EventConsumerBase_ptr +CIAO_HelloWorld_Servant::disconnect_consumer (const char * source_name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::NoConnection)) +{ + ACE_UNUSED_ARG (source_name); + + ACE_THROW_RETURN (::Components::InvalidName (), 0); +} + +::Components::ConsumerDescriptions * +CIAO_HelloWorld_Servant::get_all_consumers (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return new ::Components::ConsumerDescriptions; +} + +::Components::ConsumerDescriptions * +CIAO_HelloWorld_Servant::get_named_consumers (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + // No facet for this component. + if (names.length () != 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + + // Or return an empty description sequence if you are not asking + // for anyhing in particular. + return new ::Components::ConsumerDescriptions; +} + +::Components::EmitterDescriptions * +CIAO_HelloWorld_Servant::get_all_emitters (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return new ::Components::EmitterDescriptions; +} + +::Components::EmitterDescriptions * +CIAO_HelloWorld_Servant::get_named_emitters (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + // No facet for this component. + if (names.length () != 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + + // Or return an empty description sequence if you are not asking + // for anyhing in particular. + return new ::Components::EmitterDescriptions; +} + +::Components::PublisherDescriptions * +CIAO_HelloWorld_Servant::get_all_publishers (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return new ::Components::PublisherDescriptions; +} + +::Components::PublisherDescriptions * +CIAO_HelloWorld_Servant::get_named_publishers (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + // No facet for this component. + if (names.length () != 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + + // Or return an empty description sequence if you are not asking + // for anyhing in particular. + return new ::Components::PublisherDescriptions; +} + +// Operations for CCMObject interface +::CORBA::IRObject_ptr +CIAO_HelloWorld_Servant::get_component_def (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +::Components::CCMHome_ptr +CIAO_HelloWorld_Servant::get_ccm_home (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@@ How? Should we cache the home reference here? + return this->context_->get_CCM_home (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +::Components::PrimaryKeyBase * +CIAO_HelloWorld_Servant::get_primary_key (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::NoKeyAvailable)) +{ + // This is a keyless component. + ACE_THROW_RETURN (::Components::NoKeyAvailable (), 0); +} + +void +CIAO_HelloWorld_Servant::configuration_complete (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidConfiguration)) +{ + // @@ + return; +} + +void +CIAO_HelloWorld_Servant::remove (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) +{ + // @@ Tear down connections and stuff? + + return; +} + +::Components::ComponentPortDescription * +CIAO_HelloWorld_Servant::get_all_ports (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // No port, no nothing. + return new OBV_Components::ComponentPortDescription; +} + + +CORBA::Object_ptr +CIAO_HelloWorld_Servant::_get_component (ACE_ENV_SINGLE_ARG_DECL) +{ + ::Components::SessionContext_var sc = + ::Components::SessionContext::_narrow (this->context_.in ()); + + if (! CORBA::is_nil(sc.in ())) + return sc->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + + ::Components::EntityContext_var ec = + ::Components::EntityContext::_narrow (this->context_.in ()); + + if (! CORBA::is_nil(ec.in ())) + return ec->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); +} + +void +CIAO_HelloWorld_Servant::_ciao_activate (ACE_ENV_SINGLE_ARG_DECL) +{ + Components::SessionComponent_var temp = + Components::SessionComponent::_narrow (this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! CORBA::is_nil (temp.in ())) + temp->ccm_activate (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +void +CIAO_HelloWorld_Servant::_ciao_passivate (ACE_ENV_SINGLE_ARG_DECL) +{ + Components::SessionComponent_var temp = + Components::SessionComponent::_narrow (this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! CORBA::is_nil (temp.in ())) + temp->ccm_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +//////////////////////////////////////////////////////////////// +//////////////////// CIAO_HelloHome_Servant //////////////////// + +CIAO_HelloHome_Servant::CIAO_HelloHome_Servant (CCM_HelloHome_ptr exe, + CIAO::Session_Container *c) + : executor_ (CCM_HelloHome::_duplicate (exe)), + container_ (c) +{ +} + +CIAO_HelloHome_Servant::~CIAO_HelloHome_Servant (void) +{ +} + +// User defined and inherited operations +// (Factories, Finders, and explicit operations.) + +// Operations for KeylessHome interface +::Components::CCMObject_ptr +CIAO_HelloHome_Servant::create_component (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)) +{ + return this->create (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +HelloWorld_ptr +CIAO_HelloHome_Servant::_ciao_activate_component (CCM_HelloWorld_ptr exe + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + CORBA::Object_var hobj= this->container_->get_objref (this + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::CCMHome_var home = ::Components::CCMHome::_narrow (hobj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + CIAO_HelloWorld_Servant *svt = new CIAO_HelloWorld_Servant (exe, + home.in (), + this->container_); + PortableServer::ServantBase_var safe (svt); + PortableServer::ObjectId_var oid; + + CORBA::Object_var objref + = this->container_->install_component (svt, + oid.out () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + svt->_ciao_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + HelloWorld_var ho = HelloWorld::_narrow (objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (this->component_map_.bind (oid.in (), svt) == 0) + { + // @@ what should happen if bind fail? + safe._retn (); + } + return ho._retn (); +} + +void +CIAO_HelloHome_Servant::_ciao_passivate_component (HelloWorld_ptr comp + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + PortableServer::ObjectId_var oid; + + this->container_->uninstall_component (comp, + oid.out () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + CIAO_HelloWorld_Servant *servant = 0; + if (this->component_map_.unbind (oid.in (), servant) == 0) + { + PortableServer::ServantBase_var safe (servant); + servant->_ciao_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } + // What happen if unbind failed? + +} + +// Operations for Implicit Home interface +::HelloWorld_ptr +CIAO_HelloHome_Servant::create (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)) +{ + if (this->executor_.in () == 0) + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); + + Components::EnterpriseComponent_var com = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + CCM_HelloWorld_var hw = CCM_HelloWorld::_narrow (com.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return this->_ciao_activate_component (hw.in () + ACE_ENV_ARG_PARAMETER); +} + +// Operations for CCMHome interface +::CORBA::IRObject_ptr +CIAO_HelloHome_Servant::get_component_def (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ Not implemented yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +::CORBA::IRObject_ptr +CIAO_HelloHome_Servant::get_home_def (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ Not implemented yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +void +CIAO_HelloHome_Servant::remove_component (Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) +{ + HelloWorld_var hw = HelloWorld::_narrow (comp + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (hw.in ())) + ACE_THROW (CORBA::INTERNAL ()); // What is the right exception to throw here? + + hw->remove (ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + // Removing the object reference? get the servant from the POA with + // the objref, and call remove() on the component, passivate the + // component, and then remove-ref the servant? + + this->_ciao_passivate_component (hw.in () + ACE_ENV_ARG_PARAMETER); +} + + + +extern "C" HELLO_SERVANT_Export ::PortableServer::Servant +createHelloHome_Servant (::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL) +{ + if (p == 0) + return 0; + + CCM_HelloHome_var x = CCM_HelloHome::_narrow (p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (x.in ())) + return 0; + + return new CIAO_HelloHome_Servant (x.in (), + c); +} diff --git a/TAO/CIAO/examples/handcrafted/Hello/hello_servants.dsp b/TAO/CIAO/examples/handcrafted/Hello/hello_servants.dsp new file mode 100644 index 00000000000..2f3839da2bb --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Hello/hello_servants.dsp @@ -0,0 +1,198 @@ +# Microsoft Developer Studio Project File - Name="hello_servants DLL" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=hello_servants DLL - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE run the tool that generated this project file and specify the
+!MESSAGE nmake output type. You can then use the following command:
+!MESSAGE
+!MESSAGE NMAKE /f "hello_servants.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "hello_servants.mak" CFG="hello_servants DLL - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "hello_servants DLL - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "hello_servants DLL - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "hello_servants DLL - Win32 Release"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "."
+# PROP Intermediate_Dir "Release\hello_servants"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD CPP /nologo /W3 /GX /O2 /MD /Zi /Ob2 /GR /I "..\..\..\..\orbsvcs\orbsvcs" /I "..\..\.." /I "..\..\..\ciao" /I "..\..\..\.." /I "..\..\..\..\tao" /I "..\..\..\..\.." /D NDEBUG=1 /D WIN32=1 /D _WINDOWS=1 /D HELLO_SERVANT_BUILD_DLL=1 /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d NDEBUG=1 /i "..\..\..\..\orbsvcs\orbsvcs" /i "..\..\.." /i "..\..\..\ciao" /i "..\..\..\.." /i "..\..\..\..\tao" /i "..\..\..\..\.."
+BSC32=bscmake.exe
+# ADD BSC32 /nologo /o".\hello_servants.bsc"
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO hello_stub.lib CIAO_Server.lib TAO_PortableServer.lib TAO_Security.lib CIAO_Container.lib TAO.lib TAO_IFR_Client.lib CIAO_Client.lib ACE.lib /libpath:"..\..\..\..\tao\PortableServer" /libpath:"..\..\..\..\orbsvcs\orbsvcs" /libpath:"..\..\..\..\tao\IFR_Client" /libpath:"..\..\..\ciao" /libpath:"..\..\..\..\tao" /libpath:"..\..\..\..\..\ace" /nologo /version:1.3.1 /subsystem:windows /pdb:"..\..\..\..\..\bin\hello_servants.pdb" /dll /machine:I386 /out:"..\..\..\..\..\bin\hello_servants.dll"
+
+!ELSEIF "$(CFG)" == "hello_servants DLL - Win32 Debug"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "."
+# PROP Intermediate_Dir "Debug\hello_servants"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /MDd /GR /Gy /I "..\..\..\..\orbsvcs\orbsvcs" /I "..\..\.." /I "..\..\..\ciao" /I "..\..\..\.." /I "..\..\..\..\tao" /I "..\..\..\..\.." /D _DEBUG=1 /D WIN32=1 /D _WINDOWS=1 /D HELLO_SERVANT_BUILD_DLL=1 /FD /c
+# SUBTRACT CPP /Fr /YX
+# ADD RSC /l 0x409 /d _DEBUG=1 /i "..\..\..\..\orbsvcs\orbsvcs" /i "..\..\.." /i "..\..\..\ciao" /i "..\..\..\.." /i "..\..\..\..\tao" /i "..\..\..\..\.."
+BSC32=bscmake.exe
+# ADD BSC32 /nologo /o".\hello_servants.bsc"
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO hello_stubd.lib CIAO_Serverd.lib TAO_PortableServerd.lib TAO_Securityd.lib CIAO_Containerd.lib TAOd.lib TAO_IFR_Clientd.lib CIAO_Clientd.lib ACEd.lib /libpath:"..\..\..\..\tao\PortableServer" /libpath:"..\..\..\..\orbsvcs\orbsvcs" /libpath:"..\..\..\..\tao\IFR_Client" /libpath:"..\..\..\ciao" /libpath:"..\..\..\..\tao" /libpath:"..\..\..\..\..\ace" /nologo /version:1.3.1 /subsystem:windows /pdb:"..\..\..\..\..\bin\hello_servantsd.pdb" /dll /debug /machine:I386 /out:"..\..\..\..\..\bin\hello_servantsd.dll"
+
+!ENDIF
+
+# Begin Target
+
+# Name "hello_servants DLL - Win32 Release"
+# Name "hello_servants DLL - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;cxx;c"
+# Begin Source File
+
+SOURCE=.\hello_servants.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\helloEC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\helloS.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hh"
+# Begin Source File
+
+SOURCE=.\hello_servants.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\helloEC.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\helloS.h
+# End Source File
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i;inl"
+# Begin Source File
+
+SOURCE=.\helloEC.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\helloS.i
+# End Source File
+# End Group
+# Begin Group "Documentation"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\README
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter "idl"
+# Begin Source File
+
+SOURCE=.\helloE.idl
+
+!IF "$(CFG)" == "hello_servants DLL - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO_IDL Compiler on $(InputPath)
+InputPath=.\helloE.idl
+InputName=helloE
+InputDir=.
+OutDir=.
+
+BuildCmds= \
+ ..\..\..\..\..\bin\tao_idl -o $(OutDir) -I ..\..\.. -I ..\..\..\.. -I ..\..\..\..\orbsvcs\orbsvcs -Wb,export_macro=HELLO_SERVANT_Export -Wb,export_include=hello_servants_export.h -Wb,pre_include="ace\pre.h" -Wb,post_include="ace\post.h" -I..\..\..\.. -I..\..\..\..\CIAO\ciao -Wb,pre_include="ace\pre.h" -Wb,post_include="ace\post.h" -I ..\..\.. -I ..\..\..\.. -I ..\..\..\..\orbsvcs\orbsvcs -Ge 1 -Sc $(InputPath)
+
+"$(OutDir)\$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "hello_servants DLL - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO_IDL Compiler on $(InputPath)
+InputPath=.\helloE.idl
+InputName=helloE
+InputDir=.
+OutDir=.
+
+BuildCmds= \
+ ..\..\..\..\..\bin\tao_idl -o $(OutDir) -I ..\..\.. -I ..\..\..\.. -I ..\..\..\..\orbsvcs\orbsvcs -Wb,export_macro=HELLO_SERVANT_Export -Wb,export_include=hello_servants_export.h -Wb,pre_include="ace\pre.h" -Wb,post_include="ace\post.h" -I..\..\..\.. -I..\..\..\..\CIAO\ciao -Wb,pre_include="ace\pre.h" -Wb,post_include="ace\post.h" -I ..\..\.. -I ..\..\..\.. -I ..\..\..\..\orbsvcs\orbsvcs -Ge 1 -Sc $(InputPath)
+
+"$(OutDir)\$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/CIAO/examples/handcrafted/Hello/hello_servants.h b/TAO/CIAO/examples/handcrafted/Hello/hello_servants.h new file mode 100644 index 00000000000..b83866b583c --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Hello/hello_servants.h @@ -0,0 +1,312 @@ +// $Id$ + +// =========================================================== +// +// +// = LIBRARY +// CIAO/examples/handcrafted/hello +// +// = FILENAME +// hello_servants.h +// +// = DESCRIPTION +// Generic Servant implementations for hello world example. +// This file is currently handcrafted but it should really +// be generated by the CCIDL compiler. +// +// This example demonstrates how a servant implementation for a +// session component should look like. +// +// @author Nanbor Wang <nanbor@cs.wustl.edu> +// +// =========================================================== + +#include "helloS.h" +#include "helloEC.h" +#include "ciao/Container_Base.h" +#include "tao/LocalObject.h" +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Hash_Map_Manager_T.h" + +class CIAO_HelloWorld_Servant; + +class HELLO_SERVANT_Export CIAO_HelloWorld_Context : + public virtual CCM_HelloWorld_Context, + public virtual TAO_Local_RefCounted_Object +{ +public: + // Ctor. + CIAO_HelloWorld_Context (::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c, + CIAO_HelloWorld_Servant *sv); + + // Dtor. + virtual ~CIAO_HelloWorld_Context (); + + // We need to overwrite the following method to avoid ambiguity + // This is strange, but thankfully, this is generated code so it's + // okay (?) to mess with this. + + // Operations for HellowWorld attributes, event source, and + // receptable defined in CCM_HelloWorld_Context. + + // Operations for ::Components::CCMContext + virtual ::Components::Principal_ptr get_caller_principal (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual ::Components::CCMHome_ptr get_CCM_home (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual CORBA::Boolean get_rollback_only (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + virtual ::Components::Transaction::UserTransaction_ptr get_user_transaction (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + virtual CORBA::Boolean is_caller_in_role (const char * role + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual void set_rollback_only (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + + // Operations for ::Components::SessionContext interface + virtual CORBA::Object_ptr + get_CCM_object (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); +protected: + ::Components::CCMHome_var home_; + + ::CIAO::Session_Container *container_; + + CIAO_HelloWorld_Servant *servant_; + + HelloWorld_var component_; +}; + +class HELLO_SERVANT_Export CIAO_HelloWorld_Servant + : public virtual POA_HelloWorld, + // @@ Perhaps we could implement a common component servant class + // which provide common functionality for operations defined in + // Navigation/Events/Receptacles interfaces. + public virtual PortableServer::RefCountServantBase +{ +public: + // Ctor. + CIAO_HelloWorld_Servant (CCM_HelloWorld_ptr executor, + ::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c); + + // Dtor. + ~CIAO_HelloWorld_Servant (void); + + // Operations for supported interfaces. + // Explicit opereations and attribute operations. + virtual char * sayhello (const char * username + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for provides interfaces. + + // Operations for receptacles interfaces. + + // Operations for emits interfaces. + + // Operations for consumers interfaces. + + // Operations for publishes interfaces. + + // Operations for Navigation interface + virtual CORBA::Object_ptr provide_facet (const char * name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException , + Components::InvalidName)) ; + virtual ::Components::FacetDescriptions * get_all_facets (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual ::Components::FacetDescriptions * get_named_facets (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException , + Components::InvalidName)); + virtual CORBA::Boolean same_component (CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for Receptacles interface + virtual ::Components::Cookie * connect (const char * name, + CORBA::Object_ptr connection + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::AlreadyConnected, + Components::ExceededConnectionLimit)); + virtual CORBA::Object_ptr disconnect (const char * name, + Components::Cookie * ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::CookieRequired, + Components::NoConnection)); + virtual ::Components::ConnectionDescriptions * get_connections (const char * name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::ReceptacleDescriptions * get_all_receptacles (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual ::Components::ReceptacleDescriptions * get_named_receptacles (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + // Operations for Events interface + virtual ::Components::EventConsumerBase_ptr get_consumer (const char * sink_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + virtual ::Components::Cookie * subscribe (const char * publisher_name, + Components::EventConsumerBase_ptr subscriber + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::AlreadyConnected, + Components::InvalidConnection)); + virtual ::Components::EventConsumerBase_ptr unsubscribe (const char * publisher_name, + Components::Cookie * ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)); + virtual void connect_consumer (const char * emitter_name, + Components::EventConsumerBase_ptr consumer + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::AlreadyConnected, + Components::InvalidConnection)); + virtual ::Components::EventConsumerBase_ptr disconnect_consumer (const char * source_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::NoConnection)); + virtual ::Components::ConsumerDescriptions * get_all_consumers (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual ::Components::ConsumerDescriptions * get_named_consumers (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + virtual ::Components::EmitterDescriptions * get_all_emitters (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual ::Components::EmitterDescriptions * get_named_emitters (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + virtual ::Components::PublisherDescriptions * get_all_publishers (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual ::Components::PublisherDescriptions * get_named_publishers (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + // Operations for CCMObject interface + virtual ::CORBA::IRObject_ptr get_component_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual ::Components::CCMHome_ptr get_ccm_home (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual ::Components::PrimaryKeyBase * get_primary_key (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::NoKeyAvailable)); + virtual void configuration_complete (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidConfiguration)); + virtual void remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + virtual ::Components::ComponentPortDescription * get_all_ports (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // From Servant_Base + + // get_component implementation. + virtual CORBA::Object_ptr _get_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); + + // CIAO specific operations. + + void _ciao_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); + void _ciao_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); + +protected: + // My Executor. + CCM_HelloWorld_var executor_; + + // My Run-time Context. + CCM_HelloWorld_Context_var context_; + + // Managing container. + ::CIAO::Session_Container *container_; +}; + + +class HELLO_SERVANT_Export CIAO_HelloHome_Servant : + public virtual POA_HelloHome, + public virtual PortableServer::RefCountServantBase +{ +public: + // Ctor. + CIAO_HelloHome_Servant (CCM_HelloHome_ptr exe, + CIAO::Session_Container *c); + + // Dtor. + ~CIAO_HelloHome_Servant (void); + + // User defined and inherited operations + // (Factories, Finders, and explicit operations.) + + // Operations for KeylessHome interface + virtual ::Components::CCMObject_ptr create_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)); + + // Operations for Implicit Home interface + virtual ::HelloWorld_ptr create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)); + + // Operations for CCMHome interface + virtual ::CORBA::IRObject_ptr get_component_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual ::CORBA::IRObject_ptr get_home_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual void remove_component (Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + +protected: + // Activate the object in the container_ + HelloWorld_ptr _ciao_activate_component (CCM_HelloWorld_ptr exe + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void _ciao_passivate_component (HelloWorld_ptr comp + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // My Executor. + CCM_HelloHome_var executor_; + + // My Container + CIAO::Session_Container *container_; + + // Components this home manages. + ACE_Hash_Map_Manager_Ex <PortableServer::ObjectId, + CIAO_HelloWorld_Servant*, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> component_map_; +}; + +extern "C" HELLO_SERVANT_Export ::PortableServer::Servant +createHelloHome_Servant (::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); diff --git a/TAO/CIAO/examples/handcrafted/Hello/hello_servants_export.h b/TAO/CIAO/examples/handcrafted/Hello/hello_servants_export.h new file mode 100644 index 00000000000..81f97e59340 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Hello/hello_servants_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl HELLO_SERVANT +// ------------------------------ +#ifndef HELLO_SERVANT_EXPORT_H +#define HELLO_SERVANT_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (HELLO_SERVANT_HAS_DLL) +# define HELLO_SERVANT_HAS_DLL 1 +#endif /* ! HELLO_SERVANT_HAS_DLL */ + +#if defined (HELLO_SERVANT_HAS_DLL) && (HELLO_SERVANT_HAS_DLL == 1) +# if defined (HELLO_SERVANT_BUILD_DLL) +# define HELLO_SERVANT_Export ACE_Proper_Export_Flag +# define HELLO_SERVANT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define HELLO_SERVANT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* HELLO_SERVANT_BUILD_DLL */ +# define HELLO_SERVANT_Export ACE_Proper_Import_Flag +# define HELLO_SERVANT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define HELLO_SERVANT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* HELLO_SERVANT_BUILD_DLL */ +#else /* HELLO_SERVANT_HAS_DLL == 1 */ +# define HELLO_SERVANT_Export +# define HELLO_SERVANT_SINGLETON_DECLARATION(T) +# define HELLO_SERVANT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* HELLO_SERVANT_HAS_DLL == 1 */ + +// Set HELLO_SERVANT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (HELLO_SERVANT_NTRACE) +# if (ACE_NTRACE == 1) +# define HELLO_SERVANT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define HELLO_SERVANT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !HELLO_SERVANT_NTRACE */ + +#if (HELLO_SERVANT_NTRACE == 1) +# define HELLO_SERVANT_TRACE(X) +#else /* (HELLO_SERVANT_NTRACE == 1) */ +# define HELLO_SERVANT_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (HELLO_SERVANT_NTRACE == 1) */ + +#endif /* HELLO_SERVANT_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/Hello/hello_stub.dsp b/TAO/CIAO/examples/handcrafted/Hello/hello_stub.dsp new file mode 100644 index 00000000000..650d285844b --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Hello/hello_stub.dsp @@ -0,0 +1,178 @@ +# Microsoft Developer Studio Project File - Name="hello_stub DLL" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=hello_stub DLL - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE run the tool that generated this project file and specify the
+!MESSAGE nmake output type. You can then use the following command:
+!MESSAGE
+!MESSAGE NMAKE /f "hello_stub.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "hello_stub.mak" CFG="hello_stub DLL - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "hello_stub DLL - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "hello_stub DLL - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "hello_stub DLL - Win32 Release"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "."
+# PROP Intermediate_Dir "Release\hello_stub"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD CPP /nologo /W3 /GX /O2 /MD /Zi /Ob2 /GR /I "..\..\.." /I "..\..\..\ciao" /I "..\..\..\.." /I "..\..\..\..\tao" /I "..\..\..\..\.." /D NDEBUG=1 /D WIN32=1 /D _WINDOWS=1 /D HELLO_STUB_BUILD_DLL=1 /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d NDEBUG=1 /i "..\..\.." /i "..\..\..\ciao" /i "..\..\..\.." /i "..\..\..\..\tao" /i "..\..\..\..\.."
+BSC32=bscmake.exe
+# ADD BSC32 /nologo /o".\hello_stub.bsc"
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO TAO.lib TAO_IFR_Client.lib CIAO_Client.lib ACE.lib /libpath:"..\..\..\..\tao\IFR_Client" /libpath:"..\..\..\ciao" /libpath:"..\..\..\..\tao" /libpath:"..\..\..\..\..\ace" /nologo /version:1.3.1 /subsystem:windows /pdb:"..\..\..\..\..\bin\hello_stub.pdb" /dll /machine:I386 /out:"..\..\..\..\..\bin\hello_stub.dll"
+
+!ELSEIF "$(CFG)" == "hello_stub DLL - Win32 Debug"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "."
+# PROP Intermediate_Dir "Debug\hello_stub"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /MDd /GR /Gy /I "..\..\.." /I "..\..\..\ciao" /I "..\..\..\.." /I "..\..\..\..\tao" /I "..\..\..\..\.." /D _DEBUG=1 /D WIN32=1 /D _WINDOWS=1 /D HELLO_STUB_BUILD_DLL=1 /FD /c
+# SUBTRACT CPP /Fr /YX
+# ADD RSC /l 0x409 /d _DEBUG=1 /i "..\..\.." /i "..\..\..\ciao" /i "..\..\..\.." /i "..\..\..\..\tao" /i "..\..\..\..\.."
+BSC32=bscmake.exe
+# ADD BSC32 /nologo /o".\hello_stub.bsc"
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO TAOd.lib TAO_IFR_Clientd.lib CIAO_Clientd.lib ACEd.lib /libpath:"..\..\..\..\tao\IFR_Client" /libpath:"..\..\..\ciao" /libpath:"..\..\..\..\tao" /libpath:"..\..\..\..\..\ace" /nologo /version:1.3.1 /subsystem:windows /pdb:"..\..\..\..\..\bin\hello_stubd.pdb" /dll /debug /machine:I386 /out:"..\..\..\..\..\bin\hello_stubd.dll"
+
+!ENDIF
+
+# Begin Target
+
+# Name "hello_stub DLL - Win32 Release"
+# Name "hello_stub DLL - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;cxx;c"
+# Begin Source File
+
+SOURCE=.\helloC.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hh"
+# Begin Source File
+
+SOURCE=.\helloC.h
+# End Source File
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i;inl"
+# Begin Source File
+
+SOURCE=.\helloC.i
+# End Source File
+# End Group
+# Begin Group "Documentation"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\README
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter "idl"
+# Begin Source File
+
+SOURCE=.\hello.idl
+
+!IF "$(CFG)" == "hello_stub DLL - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO_IDL Compiler on $(InputPath)
+InputPath=.\hello.idl
+InputName=hello
+InputDir=.
+OutDir=.
+
+BuildCmds= \
+ ..\..\..\..\..\bin\tao_idl -o $(OutDir) -Wb,stub_export_macro=HELLO_STUB_Export -Wb,stub_export_include=hello_stub_export.h -Wb,skel_export_macro=HELLO_SERVANT_Export -Wb,skel_export_include=hello_servants_export.h -Wb,pre_include="ace\pre.h" -Wb,post_include="ace\post.h" -I ..\..\.. -I ..\..\..\.. -I ..\..\..\..\orbsvcs\orbsvcs -Wb,pre_include="ace\pre.h" -Wb,post_include="ace\post.h" -I ..\..\.. -I ..\..\..\.. -I ..\..\..\..\orbsvcs\orbsvcs -Ge 1 -Sc $(InputPath)
+
+"$(OutDir)\$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "hello_stub DLL - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO_IDL Compiler on $(InputPath)
+InputPath=.\hello.idl
+InputName=hello
+InputDir=.
+OutDir=.
+
+BuildCmds= \
+ ..\..\..\..\..\bin\tao_idl -o $(OutDir) -Wb,stub_export_macro=HELLO_STUB_Export -Wb,stub_export_include=hello_stub_export.h -Wb,skel_export_macro=HELLO_SERVANT_Export -Wb,skel_export_include=hello_servants_export.h -Wb,pre_include="ace\pre.h" -Wb,post_include="ace\post.h" -I ..\..\.. -I ..\..\..\.. -I ..\..\..\..\orbsvcs\orbsvcs -Wb,pre_include="ace\pre.h" -Wb,post_include="ace\post.h" -I ..\..\.. -I ..\..\..\.. -I ..\..\..\..\orbsvcs\orbsvcs -Ge 1 -Sc $(InputPath)
+
+"$(OutDir)\$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/CIAO/examples/handcrafted/Hello/hello_stub_export.h b/TAO/CIAO/examples/handcrafted/Hello/hello_stub_export.h new file mode 100644 index 00000000000..58812b077ad --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Hello/hello_stub_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl HELLO_STUB +// ------------------------------ +#ifndef HELLO_STUB_EXPORT_H +#define HELLO_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (HELLO_STUB_HAS_DLL) +# define HELLO_STUB_HAS_DLL 1 +#endif /* ! HELLO_STUB_HAS_DLL */ + +#if defined (HELLO_STUB_HAS_DLL) && (HELLO_STUB_HAS_DLL == 1) +# if defined (HELLO_STUB_BUILD_DLL) +# define HELLO_STUB_Export ACE_Proper_Export_Flag +# define HELLO_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define HELLO_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* HELLO_STUB_BUILD_DLL */ +# define HELLO_STUB_Export ACE_Proper_Import_Flag +# define HELLO_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define HELLO_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* HELLO_STUB_BUILD_DLL */ +#else /* HELLO_STUB_HAS_DLL == 1 */ +# define HELLO_STUB_Export +# define HELLO_STUB_SINGLETON_DECLARATION(T) +# define HELLO_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* HELLO_STUB_HAS_DLL == 1 */ + +// Set HELLO_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (HELLO_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define HELLO_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define HELLO_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !HELLO_STUB_NTRACE */ + +#if (HELLO_STUB_NTRACE == 1) +# define HELLO_STUB_TRACE(X) +#else /* (HELLO_STUB_NTRACE == 1) */ +# define HELLO_STUB_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (HELLO_STUB_NTRACE == 1) */ + +#endif /* HELLO_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/Hello/run_test.pl b/TAO/CIAO/examples/handcrafted/Hello/run_test.pl new file mode 100755 index 00000000000..2d4995c42de --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Hello/run_test.pl @@ -0,0 +1,108 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "../../../../../bin"; +use PerlACE::Run_Test; + +$status = 0; +$daemon_ior = PerlACE::LocalFile ("daemon.ior"); +$svr_ior = PerlACE::LocalFile ("server.ior"); +$home_ior = PerlACE::LocalFile ("hello.ior"); + +unlink $daemon_ior; +unlink $svr_ior; +unlink $home_ior; + +# CIAO Daemon command line arguments +$daemon_args = "-o $daemon_ior -n ../../../tools/ComponentServer/ComponentServer"; + +# CIAO Daemon Controller location: +$controller = "../../../tools/Daemon/DaemonController"; + +# Daemon controller common command line arguments +$common_args = "-ORBInitRef CIAODaemon=file://$daemon_ior"; + +# Daemon controller start_home command +$start_args = "start_home -s hello.csd -m $home_ior -c $svr_ior"; + +# Daemon controller end_home command +$end_args = "end_home -c file://$svr_ior"; + +# Daemon controller shutdown command +$shutdown_args = "shutdown"; + +# Client program command line arguments +$cl_args = ""; + +# Naming_Service process definition +$DS = new PerlACE::Process ("../../../tools/Daemon/CIAO_Daemon", + "$daemon_args"); + +# Client process definition +$CL = new PerlACE::Process ("client", + "$cl_args"); + +## Starting up the CIAO daemon +$DS->Spawn (); +if (PerlACE::waitforfile_timed ($daemon_ior, 15) == -1) { + print STDERR "ERROR: Could not find daemon ior file <$daemon_ior>\n"; + $DS->Kill (); + exit 1; +} + +## Starting up a ComponentServer running the hello world home. +$DC = new PerlACE::Process ("$controller", + "$common_args $start_args"); + +$DC->SpawnWaitKill (60); +if (PerlACE::waitforfile_timed ($home_ior, 15) == -1) { + print STDERR "ERROR: Could not find home ior file <$home_ior>\n"; + $DS->Kill (); + exit 1; +} + +$client = $CL->SpawnWaitKill (60); + +if ($client != 0) { + print STDERR "ERROR: client returned $client\n"; + $status = 1; +} + +## Terminating the ComponentServer running the hello world home. +$DC = new PerlACE::Process ("$controller", + "$common_args $end_args"); + +$ctrl = $DC->SpawnWaitKill (60); +if ($ctrl != 0) { + print STDERR "ERROR: Fail to end component server\n"; + $DS->Kill (); + exit 1; +} + +## Terminating the ComponentServer running the hello world home. +$DC = new PerlACE::Process ("$controller", + "$common_args $shutdown_args"); + +$ctrl = $DC->SpawnWaitKill (60); +if ($ctrl != 0) { + print STDERR "ERROR: Fail to shutdown CIAODaemon\n"; + $DS->Kill (); + exit 1; +} + +$ctrl = $DS->WaitKill (60); +if ($ctrl != 0) { + print STDERR "ERROR: CIAODaemon didn't shutdown gracefully $ctrl\n"; + $DS->Kill (); + exit 1; +} + +unlink $daemon_ior; +unlink $svr_ior; +unlink $home_ior; + +exit $status; diff --git a/TAO/CIAO/examples/handcrafted/Philosophers/Philosophers.idl b/TAO/CIAO/examples/handcrafted/Philosophers/Philosophers.idl new file mode 100644 index 00000000000..7a29bc03c23 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Philosophers/Philosophers.idl @@ -0,0 +1,75 @@ +// $Id$ + +// The famous Dining Philosopher example in CCM tutorial slides + +module Example +{ + exception InUse {}; + + interface Fork + /** + * Provided facet interface definition. + * It should be defined by the IDL file. + */ + { + void get () raises (InUse); + + void release (); + }; + + component ForkManager + { + provides Fork the_fork; + }; + + home ForkHome manages ForkManager + { + }; + + enum PhilosopherState + { + EATING, + THINKING, + HUNGRY, + STARVING, + DEAD + }; + + eventtype StatusInfo + { + public string name; + public PhilosopherState state; + public unsigned long ticks_since_last_meal; + public boolean has_left_fork; + public boolean has_right_fork; + }; + + component Philosopher + { + attribute string name; + + // The left fork receptacle. + uses Fork left; + + // The right fork receptacle. + uses Fork right; + + // The status info event source. + publishes StatusInfo info; + }; + + home PhilosopherHome manages Philosopher + { + factory new (in string name); + }; + + component Observer + { + // The status info sink port. + consumes StatusInfo info; + }; + + home ObserverHome manages Observer + { + }; +}; diff --git a/TAO/CIAO/examples/handcrafted/Philosophers/PhilosophersC.idl b/TAO/CIAO/examples/handcrafted/Philosophers/PhilosophersC.idl new file mode 100644 index 00000000000..d9f7e53f79b --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Philosophers/PhilosophersC.idl @@ -0,0 +1,52 @@ +// $Id$ + +// Hand-drafted IDL files for component testing. +// tao_idl -Gv -I W:/ACE_wrappers/TAO -I W:/ACE_wrappers/TAO/orbsvcs/orbsvcs -I W:/ACE_wrappers/TAO/CIAO/ciao Philosophers.idl + +#include "Component_Base.idl" + +module Example +{ + + exception InUse {}; + + interface Fork + /** + * Provided facet interface definition. + * It should be defined by the IDL file. + */ + { + void get () raises (InUse); + + void release (); + }; + + // **************************************** + // Client Side Equivalent Interfaces + // **************************************** + + // component ForkManager + interface ForkManager // : ::Components::CCMObject + /** + * Client side equivalent interface. + * Must inherit from Components::CCMObject instead of CORBA::Object. + */ + { + // provides Fork the_fork; + Fork provide_the_fork (); + }; + + // home ForkHome manages ForkManager + interface ForkHomeExplicit // : ::Components::CCMHome + {}; + + interface ForkHomeImplicit // : ::Components::KeylessCCMHome + { + ForkManager create (); + }; + + interface ForkHome : ForkHomeExplicit, ForkHomeImplicit + { + }; + +}; diff --git a/TAO/CIAO/examples/handcrafted/Philosophers/PhilosophersS.idl b/TAO/CIAO/examples/handcrafted/Philosophers/PhilosophersS.idl new file mode 100644 index 00000000000..b8b88d56362 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Philosophers/PhilosophersS.idl @@ -0,0 +1,56 @@ +// $Id$ + +// Hand-drafted IDL files for component testing. +// tao_idl -Gv -I W:/ACE_wrappers/TAO -I W:/ACE_wrappers/TAO/orbsvcs/orbsvcs -I W:/ACE_wrappers/TAO/CIAO/ciao Philosophers.idl + +#include "PhilosopherC.idl" + +module Example +{ + // **************************************** + // Server Side Equivalent Interfaces + // Generated by CIDL? + // **************************************** + + // Facet executor definition. + local interface CCM_Fork : Fork {}; + + // Main component executor (ExecutorLocator based) + local interface CCM_ForkManager_Executor : + // ::Components:EnterpriseComponent, + ForkManager + { + }; + + // Monolithic executor definition. + local interface CCM_ForkManager : + // ::Components:EnterpriseComponent, + ForkManager + { + }; + + // Interface specific context object. + local interface CCM_ForkManager_Context + // : ::Components::CCMContext + { + }; + + // Explicit ForkHome + local interface CCM_ForkHomeExplicit + // : ::Components::HomeExecutorBase + { + }; + + // Implicit ForkHome + local interface CCM_ForkHomeImplicit + { + // ::Components::EnterpriseComponent create () + // raises (::Components::CCMException); + }; + + // Main ForkHome + local interface CCM_ForkHome + : CCM_ForkHomeExplicit, CCM_ForkHomeImplicit + { + }; +}; diff --git a/TAO/CIAO/tests/temp/README b/TAO/CIAO/tests/temp/README new file mode 100644 index 00000000000..ce3d69a5557 --- /dev/null +++ b/TAO/CIAO/tests/temp/README @@ -0,0 +1,3 @@ +This directory contains some simple test programs to verify correct +operations of CIAO interal modules. We will most likely remove the +whole subdirectory in the future. diff --git a/TAO/CIAO/tests/temp/assembly/README b/TAO/CIAO/tests/temp/assembly/README new file mode 100644 index 00000000000..4dcb5f638e7 --- /dev/null +++ b/TAO/CIAO/tests/temp/assembly/README @@ -0,0 +1,4 @@ +The purpose of this test is to ensure the proper functionality of +Map_Key_Cookie, CIAO's internal Cookie implementation, using +::Components::Deployment::AssemblyFactory and +::Components::Deployment::Assembly interfaces. diff --git a/TAO/CIAO/tests/temp/assembly/assembly.dsw b/TAO/CIAO/tests/temp/assembly/assembly.dsw new file mode 100644 index 00000000000..2b42646ed51 --- /dev/null +++ b/TAO/CIAO/tests/temp/assembly/assembly.dsw @@ -0,0 +1,98 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "server EXE"=server.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name PortableServer DLL
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name tao DLL
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name TAO_IDL_EXE EXE
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name ace DLL
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name CIAO_Server DLL
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name CIAO_Container DLL
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name CIAO_Client DLL
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name TAO_IDL_EXE EXE
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name tao DLL
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name ace DLL
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "client EXE"=client.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name tao DLL
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name TAO_IDL_EXE EXE
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name ace DLL
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name CIAO_Server DLL
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name CIAO_Container DLL
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name CIAO_Client DLL
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name TAO_IDL_EXE EXE
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name tao DLL
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name ace DLL
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/TAO/CIAO/tests/temp/assembly/client.cpp b/TAO/CIAO/tests/temp/assembly/client.cpp new file mode 100644 index 00000000000..078e743ea79 --- /dev/null +++ b/TAO/CIAO/tests/temp/assembly/client.cpp @@ -0,0 +1,120 @@ +// $Id$ + +#include "controlC.h" +#include "Client_init.h" +#include "ace/Get_Opt.h" + +ACE_RCSID(Hello, client, "$Id$") + +const char *ior = "file://test.ior"; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "k:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +main (int argc, char *argv[]) +{ + ACE_TRY_NEW_ENV + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (parse_args (argc, argv) != 0) + return 1; + + CIAO::Client_init (orb.in ()); + + CORBA::Object_var tmp = + orb->string_to_object(ior ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ATest::controller_var ctrlr = + ATest::controller::_narrow(tmp.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (ctrlr.in ())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Nil Test::Hello reference <%s>\n", + ior), + 1); + } + + ::Components::Deployment::AssemblyFactory_var fac + = ctrlr->get_factory (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + ::Components::Cookie_var ck1 = fac->create_assembly ("test1" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + ::Components::Cookie_var ck2 = fac->create_assembly ("test2" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ::Components::Deployment::Assembly_var asb1 + = fac->lookup (ck1.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + ::Components::Deployment::Assembly_var asb2 + = fac->lookup (ck2.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + asb1->build (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + asb1->tear_down (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + fac->destroy (ck1.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + asb2->build (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + // This should tear down assembly2 first. + fac->destroy (ck2.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ctrlr->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Exception caught:"); + return 1; + } + ACE_ENDTRY; + + return 0; +} diff --git a/TAO/CIAO/tests/temp/assembly/client.dsp b/TAO/CIAO/tests/temp/assembly/client.dsp new file mode 100644 index 00000000000..ffb847a6ad7 --- /dev/null +++ b/TAO/CIAO/tests/temp/assembly/client.dsp @@ -0,0 +1,180 @@ +# Microsoft Developer Studio Project File - Name="client EXE" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=client EXE - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE run the tool that generated this project file and specify the
+!MESSAGE nmake output type. You can then use the following command:
+!MESSAGE
+!MESSAGE NMAKE /f "client.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "client.mak" CFG="client EXE - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "client EXE - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "client EXE - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "client EXE - Win32 Release"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD CPP /nologo /W3 /GX /O2 /MD /GR /I "..\..\..\..\orbsvcs\orbsvcs" /I "..\..\..\..\CIAO" /I "..\..\..\..\CIAO\ciao" /I "..\..\..\.." /I "..\..\..\..\tao" /I "..\..\..\..\.." /D NDEBUG=1 /D WIN32=1 /D _CONSOLE=1 /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d NDEBUG=1 /i "..\..\..\..\orbsvcs\orbsvcs" /i "..\..\..\..\CIAO" /i "..\..\..\..\CIAO\ciao" /i "..\..\..\.." /i "..\..\..\..\tao" /i "..\..\..\..\.."
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO CIAO_Server.lib TAO_PortableServer.lib TAO_Security.lib CIAO_Container.lib TAO.lib TAO_IFR_Client.lib CIAO_Client.lib ACE.lib /libpath:"..\..\..\..\tao\PortableServer" /libpath:"..\..\..\..\orbsvcs\orbsvcs" /libpath:"..\..\..\..\tao\IFR_Client" /libpath:"..\..\..\..\CIAO\ciao" /libpath:"..\..\..\..\tao" /libpath:"..\..\..\..\..\ace" /nologo /version:1.3 /subsystem:console /machine:I386 /out:"client.exe"
+
+!ELSEIF "$(CFG)" == "client EXE - Win32 Debug"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /MDd /GR /Gy /I "..\..\..\..\orbsvcs\orbsvcs" /I "..\..\..\..\CIAO" /I "..\..\..\..\CIAO\ciao" /I "..\..\..\.." /I "..\..\..\..\tao" /I "..\..\..\..\.." /D _DEBUG=1 /D WIN32=1 /D _CONSOLE=1 /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d _DEBUG=1 /i "..\..\..\..\orbsvcs\orbsvcs" /i "..\..\..\..\CIAO" /i "..\..\..\..\CIAO\ciao" /i "..\..\..\.." /i "..\..\..\..\tao" /i "..\..\..\..\.."
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO CIAO_Serverd.lib TAO_PortableServerd.lib TAO_Securityd.lib CIAO_Containerd.lib TAOd.lib TAO_IFR_Clientd.lib CIAO_Clientd.lib ACEd.lib /libpath:"..\..\..\..\tao\PortableServer" /libpath:"..\..\..\..\orbsvcs\orbsvcs" /libpath:"..\..\..\..\tao\IFR_Client" /libpath:"..\..\..\..\CIAO\ciao" /libpath:"..\..\..\..\tao" /libpath:"..\..\..\..\..\ace" /nologo /version:1.3 /subsystem:console /debug /machine:I386 /out:"client.exe"
+
+!ENDIF
+
+# Begin Target
+
+# Name "client EXE - Win32 Release"
+# Name "client EXE - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;cxx;c"
+# Begin Source File
+
+SOURCE=.\client.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\controlC.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hh"
+# Begin Source File
+
+SOURCE=.\controlC.h
+# End Source File
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i;inl"
+# Begin Source File
+
+SOURCE=.\controlC.i
+# End Source File
+# End Group
+# Begin Group "Documentation"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\README
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter "idl"
+# Begin Source File
+
+SOURCE=.\control.idl
+
+!IF "$(CFG)" == "client EXE - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO_IDL Compiler on $(InputPath)
+InputPath=.\control.idl
+InputName=control
+InputDir=.
+OutDir=.
+
+BuildCmds= \
+ ..\..\..\..\..\bin\tao_idl -o $(OutDir) -I..\..\..\.. -I..\..\..\ciao -I..\..\..\.. -Ge 1 -Sc $(InputPath)
+
+"$(OutDir)\$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "client EXE - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO_IDL Compiler on $(InputPath)
+InputPath=.\control.idl
+InputName=control
+InputDir=.
+OutDir=.
+
+BuildCmds= \
+ ..\..\..\..\..\bin\tao_idl -o $(OutDir) -I..\..\..\.. -I..\..\..\ciao -I..\..\..\.. -Ge 1 -Sc $(InputPath)
+
+"$(OutDir)\$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/CIAO/tests/temp/assembly/control.idl b/TAO/CIAO/tests/temp/assembly/control.idl new file mode 100644 index 00000000000..328d93980c9 --- /dev/null +++ b/TAO/CIAO/tests/temp/assembly/control.idl @@ -0,0 +1,13 @@ +// $Id$ + +#include "CCM_Deployment.idl" + +module ATest +{ + interface controller + { + ::Components::Deployment::AssemblyFactory get_factory (); + + oneway void shutdown (); + }; +}; diff --git a/TAO/CIAO/tests/temp/assembly/control.mpc b/TAO/CIAO/tests/temp/assembly/control.mpc new file mode 100644 index 00000000000..2a4caa51b4a --- /dev/null +++ b/TAO/CIAO/tests/temp/assembly/control.mpc @@ -0,0 +1,18 @@ +project : ciao_server, server { + idlflags += -I$(TAO_ROOT) -I../../../ciao -I../../../.. + + Source_Files { + controlS.cpp + controlC.cpp + server.cpp + } +} + +project : ciao_server, client { + idlflags += -I$(TAO_ROOT) -I../../../ciao -I../../../.. + + Source_Files { + controlC.cpp + client.cpp + } +}
\ No newline at end of file diff --git a/TAO/CIAO/tests/temp/assembly/run_test.pl b/TAO/CIAO/tests/temp/assembly/run_test.pl new file mode 100644 index 00000000000..005a06f96a3 --- /dev/null +++ b/TAO/CIAO/tests/temp/assembly/run_test.pl @@ -0,0 +1,42 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib '../../../../../bin'; +use PerlACE::Run_Test; + +$iorfile = PerlACE::LocalFile ("server.ior"); +unlink $iorfile; +$status = 0; + +$SV = new PerlACE::Process ("server", "-o $iorfile"); +$CL = new PerlACE::Process ("client", " -k file://$iorfile"); + +$SV->Spawn (); + +if (PerlACE::waitforfile_timed ($iorfile, 5) == -1) { + print STDERR "ERROR: cannot find file <$iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$client = $CL->SpawnWaitKill (300); + +if ($client != 0) { + print STDERR "ERROR: client returned $client\n"; + $status = 1; +} + +$server = $SV->WaitKill (10); + +if ($server != 0) { + print STDERR "ERROR: server returned $server\n"; + $status = 1; +} + +unlink $iorfile; + +exit $status; diff --git a/TAO/CIAO/tests/temp/assembly/server.cpp b/TAO/CIAO/tests/temp/assembly/server.cpp new file mode 100644 index 00000000000..3bc4079490d --- /dev/null +++ b/TAO/CIAO/tests/temp/assembly/server.cpp @@ -0,0 +1,169 @@ +// $Id$ + +#include "Assembly_Impl.h" +#include "Server_init.h" +#include "ace/Get_Opt.h" +#include "controlS.h" + +class control_impl + : public virtual POA_ATest::controller, + public virtual PortableServer::RefCountServantBase +{ +public: + control_impl (CORBA::ORB_ptr o, + PortableServer::POA_ptr p); + + ::Components::Deployment::AssemblyFactory_ptr + get_factory (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void shutdown (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + +protected: + CORBA::ORB_var orb_; + PortableServer::POA_var poa_; +}; + +control_impl::control_impl (CORBA::ORB_ptr o, + PortableServer::POA_ptr p) + : orb_ (CORBA::ORB::_duplicate (o)), + poa_ (PortableServer::POA::_duplicate (p)) +{ +} + +::Components::Deployment::AssemblyFactory_ptr +control_impl::get_factory (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + CIAO::AssemblyFactory_Impl *afactory_impl; + ACE_NEW_RETURN (afactory_impl, + CIAO::AssemblyFactory_Impl (this->orb_.in (), + this->poa_.in ()), + 0); + + PortableServer::ServantBase_var owner_transfer(afactory_impl); + + ::Components::Deployment::AssemblyFactory_var fac = + afactory_impl->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return fac._retn (); +} + +void +control_impl::shutdown (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->orb_->shutdown (0 ACE_ENV_ARG_PARAMETER); +} + +const char *ior_output_file = "test.ior"; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "o:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile>" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +main (int argc, char *argv[]) +{ + ACE_TRY_NEW_ENV + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + + CIAO::Server_init (orb.in ()); + + CORBA::Object_var poa_object = + orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Panic: nil RootPOA\n"), + 1); + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (parse_args (argc, argv) != 0) + return 1; + + control_impl *c_impl; + ACE_NEW_RETURN (c_impl, + control_impl (orb.in (), + root_poa.in ()), + 1); + PortableServer::ServantBase_var owner_transfer(c_impl); + + ATest::controller_var ctrlr = + c_impl->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::String_var ior = + orb->object_to_string (ctrlr.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Output the IOR to the <ior_output_file> + FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file for writing IOR: %s", + ior_output_file), + 1); + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + + poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + orb->run (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); + + root_poa->destroy (1, 1 ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Exception caught:"); + return 1; + } + ACE_ENDTRY; + + return 0; +} diff --git a/TAO/CIAO/tests/temp/assembly/server.dsp b/TAO/CIAO/tests/temp/assembly/server.dsp new file mode 100644 index 00000000000..300990750b2 --- /dev/null +++ b/TAO/CIAO/tests/temp/assembly/server.dsp @@ -0,0 +1,192 @@ +# Microsoft Developer Studio Project File - Name="server EXE" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=server EXE - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE run the tool that generated this project file and specify the
+!MESSAGE nmake output type. You can then use the following command:
+!MESSAGE
+!MESSAGE NMAKE /f "server.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "server.mak" CFG="server EXE - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "server EXE - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "server EXE - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "server EXE - Win32 Release"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD CPP /nologo /W3 /GX /O2 /MD /GR /I "..\..\..\..\orbsvcs\orbsvcs" /I "..\..\..\..\CIAO" /I "..\..\..\..\CIAO\ciao" /I "..\..\..\.." /I "..\..\..\..\tao" /I "..\..\..\..\.." /D NDEBUG=1 /D WIN32=1 /D _CONSOLE=1 /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d NDEBUG=1 /i "..\..\..\..\orbsvcs\orbsvcs" /i "..\..\..\..\CIAO" /i "..\..\..\..\CIAO\ciao" /i "..\..\..\.." /i "..\..\..\..\tao" /i "..\..\..\..\.."
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO CIAO_Server.lib TAO_PortableServer.lib TAO_Security.lib CIAO_Container.lib TAO.lib TAO_IFR_Client.lib CIAO_Client.lib ACE.lib /libpath:"..\..\..\..\tao\PortableServer" /libpath:"..\..\..\..\orbsvcs\orbsvcs" /libpath:"..\..\..\..\tao\IFR_Client" /libpath:"..\..\..\..\CIAO\ciao" /libpath:"..\..\..\..\tao" /libpath:"..\..\..\..\..\ace" /nologo /version:1.3 /subsystem:console /machine:I386 /out:"server.exe"
+
+!ELSEIF "$(CFG)" == "server EXE - Win32 Debug"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /MDd /GR /Gy /I "..\..\..\..\orbsvcs\orbsvcs" /I "..\..\..\..\CIAO" /I "..\..\..\..\CIAO\ciao" /I "..\..\..\.." /I "..\..\..\..\tao" /I "..\..\..\..\.." /D _DEBUG=1 /D WIN32=1 /D _CONSOLE=1 /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d _DEBUG=1 /i "..\..\..\..\orbsvcs\orbsvcs" /i "..\..\..\..\CIAO" /i "..\..\..\..\CIAO\ciao" /i "..\..\..\.." /i "..\..\..\..\tao" /i "..\..\..\..\.."
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO CIAO_Serverd.lib TAO_PortableServerd.lib TAO_Securityd.lib CIAO_Containerd.lib TAOd.lib TAO_IFR_Clientd.lib CIAO_Clientd.lib ACEd.lib /libpath:"..\..\..\..\tao\PortableServer" /libpath:"..\..\..\..\orbsvcs\orbsvcs" /libpath:"..\..\..\..\tao\IFR_Client" /libpath:"..\..\..\..\CIAO\ciao" /libpath:"..\..\..\..\tao" /libpath:"..\..\..\..\..\ace" /nologo /version:1.3 /subsystem:console /debug /machine:I386 /out:"server.exe"
+
+!ENDIF
+
+# Begin Target
+
+# Name "server EXE - Win32 Release"
+# Name "server EXE - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;cxx;c"
+# Begin Source File
+
+SOURCE=.\controlC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\controlS.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\server.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hh"
+# Begin Source File
+
+SOURCE=.\controlC.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\controlS.h
+# End Source File
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i;inl"
+# Begin Source File
+
+SOURCE=.\controlC.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\controlS.i
+# End Source File
+# End Group
+# Begin Group "Documentation"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\README
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter "idl"
+# Begin Source File
+
+SOURCE=.\control.idl
+
+!IF "$(CFG)" == "server EXE - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO_IDL Compiler on $(InputPath)
+InputPath=.\control.idl
+InputName=control
+InputDir=.
+OutDir=.
+
+BuildCmds= \
+ ..\..\..\..\..\bin\tao_idl -o $(OutDir) -I..\..\..\.. -I..\..\..\ciao -I..\..\..\.. -Ge 1 -Sc $(InputPath)
+
+"$(OutDir)\$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "server EXE - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO_IDL Compiler on $(InputPath)
+InputPath=.\control.idl
+InputName=control
+InputDir=.
+OutDir=.
+
+BuildCmds= \
+ ..\..\..\..\..\bin\tao_idl -o $(OutDir) -I..\..\..\.. -I..\..\..\ciao -I..\..\..\.. -Ge 1 -Sc $(InputPath)
+
+"$(OutDir)\$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.cpp b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.cpp new file mode 100644 index 00000000000..22ccd028f6c --- /dev/null +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.cpp @@ -0,0 +1,125 @@ +// $Id$ + +#include "CCM_DeploymentC.h" +#include "Assembly_ServiceC.h" +#include "Client_init.h" +#include "ace/Get_Opt.h" + +const char *ior = "file://test.ior"; +const char *cad = 0; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "a:k:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'a': + cad = get_opts.opt_arg (); + break; + + case 'k': + ior = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s \n" + "-a <assembly descriptor (.cad)>\n" + "-k <Assembly_Manager ior> \n" + "\n", + argv [0]), + -1); + } + + if (cad == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Must specify an assembly descriptor using -a flag.\n"), + -1); + + // Indicates sucessful parsing of the command line + return 0; +} + +int +main (int argc, char *argv[]) +{ + ACE_TRY_NEW_ENV + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (parse_args (argc, argv) != 0) + return 1; + + CIAO::Client_init (orb.in ()); + + CORBA::Object_var tmp = + orb->string_to_object(ior ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CIAO::Assembly_Service_var as_svc + = CIAO::Assembly_Service::_narrow (tmp.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ::Components::Deployment::AssemblyFactory_var factory = + as_svc->get_assemblyfactory (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (factory.in ())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Nil ServerActivator reference <%s>\n", + ior), + 1); + } + + + ACE_DEBUG ((LM_DEBUG, "Try creating an Assembly with %s\n", cad)); + + Components::Cookie_var ck = + factory->create_assembly (cad + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + Components::Deployment::Assembly_var assembly = + factory->lookup (ck.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + assembly->build (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, "Press <enter> to tear down the assembly\n")); + char dummy [256]; + cin.getline (dummy, 256); + + assembly->tear_down (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + factory->destroy (ck.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + as_svc->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Exception caught:"); + return 1; + } + ACE_ENDTRY; + + return 0; +} diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.mpc b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.mpc new file mode 100644 index 00000000000..3258f89bfe8 --- /dev/null +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Deployer.mpc @@ -0,0 +1,23 @@ +project(Assembly_Manager): ciao_server, acexml { + + libs += TAO_IORTable CIAO_XML_Helpers + libpaths += $(TAO_ROOT)/tao/IORTable ../XML_Helpers + depends += XML_Helpers + + Source_Files { + Assembly_ServiceC.cpp + Assembly_ServiceS.cpp + Assembly_Impl.cpp + Assembly_Visitors.cpp + Deployment_Configuration.cpp + Assembly_Manager.cpp // Main + Assembly_Service_Impl.cpp + } +} + +project(Assembly_Deployer) : ciao_server { + Source_Files { + Assembly_ServiceC.cpp + Assembly_Deployer.cpp + } +}
\ No newline at end of file diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Impl.cpp b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Impl.cpp new file mode 100644 index 00000000000..08f452d843f --- /dev/null +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Impl.cpp @@ -0,0 +1,509 @@ +// $Id$ + +#include "Assembly_Impl.h" +//#include "ACtive_Objref_Map.h" +#include "Cookies.h" +#include "../XML_Helpers/Assembly_Spec.h" +#include "../XML_Helpers/XML_Utils.h" + +#if !defined (__ACE_INLINE__) +# include "Assembly_Impl.inl" +#endif /* __ACE_INLINE__ */ + +CIAO::AssemblyFactory_Impl::~AssemblyFactory_Impl () +{ + // @@ remove all Containers? +} + +PortableServer::POA_ptr +CIAO::AssemblyFactory_Impl::_default_POA (void) +{ + return PortableServer::POA::_duplicate (this->poa_.in ()); +} + +int +CIAO::AssemblyFactory_Impl::init (const char *init_file + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->deployment_config_.init (init_file); +} + +::Components::Cookie * +CIAO::AssemblyFactory_Impl::create_assembly (const char * assembly_loc + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::Deployment::InvalidLocation, + Components::CreateFailure)) +{ + CIAO::Assembly_Spec *assembly_spec; + ACE_NEW_RETURN (assembly_spec, + CIAO::Assembly_Spec, + 0); + + if (CIAO::XML_Utils::parse_componentassembly (assembly_loc, + assembly_spec) != 0) + ACE_THROW_RETURN (Components::Deployment::InvalidLocation (), 0); + + CIAO::Assembly_Impl *servant = 0; + ACE_NEW_RETURN (servant, + CIAO::Assembly_Impl (this->orb_.in (), + this->poa_.in (), + assembly_spec, + this->deployment_config_), + 0); + + PortableServer::ServantBase_var save_servant (servant); + + // @@ TO-DO: acquire and parse a Component Assembly descriptor from + // the assembly_loc and then the Assembly servant will use it to + // initialize itself here. + + // Register with our POA. + PortableServer::ObjectId_var oid + = this->poa_->activate_object (servant + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + CORBA::Object_var objref + = this->poa_->id_to_reference (oid + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::Deployment::Assembly_var assembly = + ::Components::Deployment::Assembly::_narrow (objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ACE_Active_Map_Manager_Key key; + this->assembly_map_.bind (assembly, + key); + + ::Components::Cookie_var retv = new CIAO::Map_Key_Cookie (key); + + return retv._retn (); +} + +::Components::Deployment::Assembly_ptr +CIAO::AssemblyFactory_Impl::lookup (Components::Cookie * c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::Deployment::InvalidAssembly)) +{ + ::Components::Deployment::Assembly_var retv; + if (c == 0) + ACE_THROW_RETURN (::Components::Deployment::InvalidAssembly (), 0); + + ACE_Active_Map_Manager_Key key; + if (CIAO::Map_Key_Cookie::extract (c, key) == -1) + ACE_THROW_RETURN (::Components::Deployment::InvalidAssembly (), 0); + + if (this->assembly_map_.find (key, + retv) != 0) + ACE_THROW_RETURN (::Components::Deployment::InvalidAssembly (), 0); + + return retv._retn (); +} + +void +CIAO::AssemblyFactory_Impl::destroy (Components::Cookie * c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::Deployment::InvalidAssembly, + Components::RemoveFailure)) +{ + ::Components::Deployment::Assembly_var assembly; + if (c == 0) + ACE_THROW (::Components::Deployment::InvalidAssembly ()); + + ACE_Active_Map_Manager_Key key; + if (CIAO::Map_Key_Cookie::extract (c, key) == -1) + ACE_THROW (::Components::Deployment::InvalidAssembly ()); + + if (this->assembly_map_.unbind (key, + assembly) != 0) + ACE_THROW (::Components::Deployment::InvalidAssembly ()); + + ::Components::Deployment::AssemblyState + state = assembly->get_state (ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (state == ::Components::Deployment::INSERVICE) + { + assembly->tear_down (ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + + PortableServer::ObjectId_var oid + = this->poa_->reference_to_id (assembly.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->poa_->deactivate_object (oid + ACE_ENV_ARG_PARAMETER); +} + + +CORBA::ULong CIAO::Assembly_Impl::assembly_count_ = 0; + +CIAO::Assembly_Impl::~Assembly_Impl () +{ + // @@ tearing down everything? + + ACE_DEBUG ((LM_DEBUG, + "CIAO::Assembly_Impl::~Assembly_Impl %d\n", + this->serial_number_)); + + delete this->assembly_spec_; +} + +PortableServer::POA_ptr +CIAO::Assembly_Impl::_default_POA (void) +{ + return PortableServer::POA::_duplicate (this->poa_.in ()); +} + +int +CIAO::Assembly_Impl::init (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ Initialize Assembly and create the internal container + // implementation that actually interacts with installed + // homes/components. + + // We will probably need two ORBs in this process. One for the + // deployment framework, and one for the actual components. + return 0; +} + +void +CIAO::Assembly_Impl::build (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)) +{ + ACE_DEBUG ((LM_DEBUG, + "CIAO::Assembly_Impl::build %d\n", + this->serial_number_)); + if (this->state_ == Components::Deployment::INSERVICE) + return; // We are running already. + + ACE_DEBUG ((LM_DEBUG, "------------------------------------\n")); + + // Installing homes and instantiating components + + CIAO::Assembly_Builder_Visitor builder (this->orb_.in (), + this->assembly_context_, + this->assembly_spec_->componentfiles_, + this->deployment_config_); + int build_result = this->assembly_spec_->partitioning_.accept (builder + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + ACE_DEBUG ((LM_DEBUG, "------------------------------------\n")); + + if (build_result != 0) + { + ACE_ERROR ((LM_ERROR, "Failed to install all homes or instantiate all components\n")); + ACE_THROW (Components::CreateFailure ()); + } + // Setting connections + + CIAO::Assembly_Spec::CONNECTION_QUEUE::ITERATOR + conn_iter (this->assembly_spec_->connections_); + + while (!conn_iter.done ()) + { + CIAO::Assembly_Connection::Connect_Info *connection; + conn_iter.next (connection); + + this->make_connection (connection + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + conn_iter.advance (); + } + + this->state_ = ::Components::Deployment::INSERVICE; +} + +void +CIAO::Assembly_Impl::tear_down (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) +{ + if (this->state_ != Components::Deployment::INSERVICE) + return; // Nothing to do here. + + // @@ At least we should remove home and kill the component server. + // Remove all components: + { + CIAO::Assembly_Context::COMP_MAP::ITERATOR + iter (this->assembly_context_.instantiated_components_); + + while (!iter.done ()) + { + CIAO::Assembly_Context::COMP_MAP::ENTRY *entry; + iter.next (entry); + + entry->int_id_->remove (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + iter.advance (); + } + } + + // Remove all server + { + CIAO::Assembly_Context::SERVER_QUEUE::ITERATOR + iter (this->assembly_context_.component_servers_); + + while (!iter.done ()) + { + Components::Deployment::ComponentServer_var *entry; + iter.next (entry); + + (*entry)->remove (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + iter.advance (); + } + } + + ACE_DEBUG ((LM_DEBUG, + "CIAO::Assembly_Impl::tear_down %d\n", + this->serial_number_)); + this->state_ = ::Components::Deployment::INACTIVE; +} + +::Components::Deployment::AssemblyState +CIAO::Assembly_Impl::get_state (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_DEBUG ((LM_DEBUG, + "CIAO::Assembly_Impl::get_state %d\n", + this->serial_number_)); + return this->state_; +} + +void +CIAO::Assembly_Impl::make_connection (CIAO::Assembly_Connection::Connect_Info *info + ACE_ENV_ARG_DECL) +{ + switch (info->type_) + { + case CIAO::Assembly_Connection::INTERFACE: + { + CORBA::Object_var source + = this->resolve_interface (info->interface_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + Components::CCMObject_var comp + = this->resolve_component (info->component_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + comp->connect (info->name_.c_str (), + source.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + // @@ Register the connection? How? + } + break; + + case CIAO::Assembly_Connection::EMITTER_CONSUMER: + { + Components::EventConsumerBase_var source + = this->resolve_consumer (info->interface_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + Components::CCMObject_var comp + = this->resolve_component (info->component_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + comp->connect_consumer (info->name_.c_str (), + source.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + break; + + case CIAO::Assembly_Connection::PUBLISHER_CONSUMER: + { + Components::EventConsumerBase_var source + = this->resolve_consumer (info->interface_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + Components::CCMObject_var comp + = this->resolve_component (info->component_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + comp->subscribe (info->name_.c_str (), + source.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + break; + + case CIAO::Assembly_Connection::HOME: + ACE_THROW (CORBA::NO_IMPLEMENT ()); + + default: + ACE_THROW (CORBA::INTERNAL ()); + } +} + +CORBA::Object_ptr +CIAO::Assembly_Impl::resolve_interface (CIAO::Assembly_Connection::IF_Resolver_Info *info + ACE_ENV_ARG_DECL_WITH_DEFAULTS) +{ + switch (info->resolver_type ()) + { + case CIAO::Assembly_Connection::PROVIDER: + { + Components::CCMObject_var comp = + this->resolve_component (info->nested_resolver () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return comp->provide_facet (info->resolver_info () + ACE_ENV_ARG_PARAMETER); + } + + case CIAO::Assembly_Connection::CONSUMER: + return this->resolve_consumer (info + ACE_ENV_ARG_PARAMETER); + + case CIAO::Assembly_Connection::COMP_IDREF: + return this->resolve_component (info + ACE_ENV_ARG_PARAMETER); + + case CIAO::Assembly_Connection::HOME_IDREF: + return this->resolve_home (info + ACE_ENV_ARG_PARAMETER); + + case CIAO::Assembly_Connection::NAMINGSERVICE: + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + + case CIAO::Assembly_Connection::STRINGIFIEDOBJECTREF: + return this->orb_->string_to_object (info->resolver_info () + ACE_ENV_ARG_PARAMETER); + + case CIAO::Assembly_Connection::HOMEFINDER: + return this->resolve_home (info + ACE_ENV_ARG_PARAMETER); + + case CIAO::Assembly_Connection::TRADERQUERY: + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + + default: + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); + } +} + +Components::CCMObject_ptr +CIAO::Assembly_Impl::resolve_component (CIAO::Assembly_Connection::IF_Resolver_Info *info + ACE_ENV_ARG_DECL_WITH_DEFAULTS) +{ + if (info->resolver_type () == CIAO::Assembly_Connection::COMP_IDREF) + { + CIAO::Assembly_Context::COMP_MAP::ENTRY *entry; + + if (this->assembly_context_.instantiated_components_.find (info->resolver_info (), + entry) != 0) + // This isn't really a good exception to throw unless we can + // specify FailureReason somehow. + ACE_THROW_RETURN (Components::CreateFailure (), 0); + + return Components::CCMObject::_duplicate (entry->int_id_.in ()); + } + + CORBA::Object_var obj = this->resolve_interface (info + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + Components::CCMObject_var comp + = Components::CCMObject::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return comp._retn (); +} + +Components::CCMHome_ptr +CIAO::Assembly_Impl::resolve_home (CIAO::Assembly_Connection::IF_Resolver_Info *info + ACE_ENV_ARG_DECL_WITH_DEFAULTS) +{ + switch (info->resolver_type ()) + { + case CIAO::Assembly_Connection::HOME_IDREF: + { + CIAO::Assembly_Context::HOME_MAP::ENTRY *entry; + + if (this->assembly_context_.installed_homes_.find (info->resolver_info (), + entry) != 0) + // This isn't really a good exception to throw unless we can + // specify FailureReason somehow. + ACE_THROW_RETURN (Components::CreateFailure (), 0); + + return Components::CCMHome::_duplicate (entry->int_id_.in ()); + } + + case CIAO::Assembly_Connection::HOMEFINDER: + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + + default: + { + CORBA::Object_var obj = this->resolve_interface (info + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + Components::CCMHome_var home + = Components::CCMHome::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return home._retn (); + } + } + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); +} + +Components::EventConsumerBase_ptr +CIAO::Assembly_Impl::resolve_consumer (CIAO::Assembly_Connection::IF_Resolver_Info *info + ACE_ENV_ARG_DECL_WITH_DEFAULTS) +{ + if (info->resolver_type () == CIAO::Assembly_Connection::CONSUMER) + { + Components::CCMObject_var comp = + this->resolve_component (info->nested_resolver () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return comp->get_consumer (info->resolver_info () + ACE_ENV_ARG_PARAMETER); + } + + CORBA::Object_var obj = this->resolve_interface (info + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + Components::EventConsumerBase_var consumer + = Components::EventConsumerBase::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return consumer._retn (); +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) || \ + defined (ACE_HAS_GNU_REPO) +template class ACE_Active_Map_Manager<::Components::Deployment::Assembly_var>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Active_Map_Manager<::Components::Deployment::Assembly_var> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Impl.h b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Impl.h new file mode 100644 index 00000000000..043163ef879 --- /dev/null +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Impl.h @@ -0,0 +1,201 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Assembly_Impl.h + * + * $Id$ + * + * This file contains implementations for + * Components::Deployment::AssemblyFactory and + * Components::Deployment::Assembly interface. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + + +#ifndef CIAO_ASSEMBLY_IMPL_H +#define CIAO_ASSEMBLY_IMPL_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Active_Map_Manager_T.h" +#include "CCM_DeploymentS.h" +#include "../XML_Helpers/Assembly_Spec.h" +#include "Deployment_Configuration.h" +#include "Assembly_Visitors.h" + +namespace CIAO +{ + /** + * @class AssemblyFactory_Impl + * + * @brief Servant implementation for Components::Deployment::AssemblyFactory + * + * This class implements the Components::Deployment::AssemblyFactory + * interface as defined by the CCM spcification. As the interface + * implies, this is actually part of the deployment interface and is + * used to manage the lifecycle of containers running on the server. + */ + class AssemblyFactory_Impl + : public virtual POA_Components::Deployment::AssemblyFactory, + public virtual PortableServer::RefCountServantBase + { + public: + /// Constructor + AssemblyFactory_Impl (CORBA::ORB_ptr o, + PortableServer::POA_ptr p); + + /// Destructor + virtual ~AssemblyFactory_Impl (void); + + /// Get the containing POA. This operation does *not* + /// increase the reference count of the POA. + virtual PortableServer::POA_ptr _default_POA (void); + + /// Initialize the AssemblyFactory with a configuration file. + /// @sa CIAO::Deployment_Configuration + int init (const char *config_file + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Components::Deployment::Assembly defined attributes/operations. + virtual ::Components::Cookie * create_assembly (const char * assembly_loc + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::Deployment::InvalidLocation, + Components::CreateFailure)); + + virtual ::Components::Deployment::Assembly_ptr lookup (Components::Cookie * c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::Deployment::InvalidAssembly)); + + virtual void destroy (Components::Cookie * c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::Deployment::InvalidAssembly, + Components::RemoveFailure)); + + protected: + /// Keep a pointer to the managing ORB serving this servant. + CORBA::ORB_var orb_; + + /// Keep a pointer to the managing POA. + PortableServer::POA_var poa_; + + /// Keep a list of managed Assembly objects. + ACE_Active_Map_Manager<Components::Deployment::Assembly_var> assembly_map_; + + /// Deployment Configuration Info. + CIAO::Deployment_Configuration deployment_config_; + }; + + /** + * @class Assembly_Impl + * + * @brief Servant implementation for Components::Deployment::Assembly + * + * This class implements the Components::Deployment::Assembly + * interface as defined by the CCM spcification. As the interface + * implies, this is actually part of the deployment interface and is + * used to manage the lifecycle of containers running on the server. + */ + class Assembly_Impl + : public virtual POA_Components::Deployment::Assembly, + public virtual PortableServer::RefCountServantBase + { + public: + /// Constructor + Assembly_Impl (CORBA::ORB_ptr o, + PortableServer::POA_ptr p, + Assembly_Spec *spec, + Deployment_Configuration &config); + + /// Destructor + virtual ~Assembly_Impl (void); + + /// Get the containing POA. This operation does *not* + /// increase the reference count of the POA. + virtual PortableServer::POA_ptr _default_POA (void); + + /** + * Initialize the Assembly with an Assembly_Spec and a reference + * to a Deployment_Configuration object. The Assembly class + * assumes the ownership of Assembly_Spec. + */ + int init (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Components::Deployment::Assembly defined attributes/operations. + + virtual void build (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)); + + virtual void tear_down (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + + virtual ::Components::Deployment::AssemblyState + get_state (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + /** + * Connection establishment helper functions + */ + /// @{ + void make_connection (Assembly_Connection::Connect_Info *info + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + CORBA::Object_ptr + resolve_interface (Assembly_Connection::IF_Resolver_Info *info + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + Components::CCMObject_ptr + resolve_component (Assembly_Connection::IF_Resolver_Info *info + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + Components::CCMHome_ptr + resolve_home (Assembly_Connection::IF_Resolver_Info *info + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + Components::EventConsumerBase_ptr + resolve_consumer (Assembly_Connection::IF_Resolver_Info *info + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + /// @} + + /// Keep a pointer to the managing ORB serving this servant. + CORBA::ORB_var orb_; + + /// Keep a pointer to the managing POA. + PortableServer::POA_var poa_; + + /// Current State + ::Components::Deployment::AssemblyState state_; + + /// <Debug> My instance number. + CORBA::ULong serial_number_; + + /// <Debug> instance counter. + static CORBA::ULong assembly_count_; + + /// Deployment Configuration Info. + Deployment_Configuration &deployment_config_; + + /// Assembly Specification. + Assembly_Spec *assembly_spec_; + + Assembly_Context assembly_context_; + }; +} + +#if defined (__ACE_INLINE__) +# include "Assembly_Impl.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* CIAO_ASSEMBLY_IMPL_H */ diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Impl.inl b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Impl.inl new file mode 100644 index 00000000000..b6abaa37513 --- /dev/null +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Impl.inl @@ -0,0 +1,28 @@ +/* -*- C++ -*- */ +// $Id$ + +ACE_INLINE +CIAO::AssemblyFactory_Impl::AssemblyFactory_Impl (CORBA::ORB_ptr o, + PortableServer::POA_ptr p) + : orb_ (CORBA::ORB::_duplicate (o)), + poa_ (PortableServer::POA::_duplicate (p)), + deployment_config_ (o) +{ +} + +ACE_INLINE +CIAO::Assembly_Impl::Assembly_Impl (CORBA::ORB_ptr o, + PortableServer::POA_ptr p, + Assembly_Spec *spec, + Deployment_Configuration &config) + : orb_ (CORBA::ORB::_duplicate (o)), + poa_ (PortableServer::POA::_duplicate (p)), + state_ (::Components::Deployment::INACTIVE), + serial_number_ (++CIAO::Assembly_Impl::assembly_count_), + deployment_config_ (config), + assembly_spec_ (spec) +{ + ACE_DEBUG ((LM_DEBUG, + "CIAO::Assembly_Impl::Assembly_Impl %d\n", + this->serial_number_)); +} diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Manager.cpp b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Manager.cpp new file mode 100644 index 00000000000..cc7d08f22e0 --- /dev/null +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Manager.cpp @@ -0,0 +1,219 @@ +// $Id$ + +/** + * @file Assembly_Manager.cpp + * + * @brief CIAO's Assembly managing process. + * + */ + +#include "Assembly_Impl.h" +#include "Assembly_Service_Impl.h" +#include "CIAO_ServersC.h" +#include "Server_init.h" +#include "tao/IORTable/IORTable.h" +#include "ace/SString.h" +#include "ace/Read_Buffer.h" +#include "ace/Get_Opt.h" + +char *config_filename_ = 0; +char *output_ior_filename_ = 0; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "c:o:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'c': // Get the configuration file for deployment configuration info. + config_filename_ = get_opts.opt_arg (); + break; + + case 'o': // get the file name to write to + output_ior_filename_ = get_opts.opt_arg (); + break; + + case '?': // display help for use of the server. + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s\n" + "-c <deployment configuration file>\n" + "-o <ior_output_file>\n" + "\n", + argv [0]), + -1); + } + + if (config_filename_ == 0) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Require a deployment configuration flag. Use -c to set it \n" + ), + -1); + } + + return 0; +} + +int +write_IOR(const char* ior) +{ + FILE* ior_output_file_ = + ACE_OS::fopen (output_ior_filename_, "w"); + + if (ior_output_file_) + { + ACE_OS::fprintf (ior_output_file_, + "%s", + ior); + ACE_OS::fclose (ior_output_file_); + } + + return 0; +} + +int +main (int argc, char *argv[]) +{ + ACE_TRY_NEW_ENV + { + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init (argc, + argv + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CIAO::Server_init (orb.in ()); + + if (parse_args (argc, argv) != 0) + return -1; + + // Get reference to Root POA. + CORBA::Object_var obj + = orb->resolve_initial_references ("RootPOA" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableServer::POA_var poa + = PortableServer::POA::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Activate POA manager + PortableServer::POAManager_var mgr + = poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + mgr->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + CIAO::AssemblyFactory_Impl *assembly_factory_servant; + + ACE_NEW_RETURN (assembly_factory_servant, + CIAO::AssemblyFactory_Impl (orb.in (), + poa.in ()), + -1); + + PortableServer::ServantBase_var safe_servant (assembly_factory_servant); + + assembly_factory_servant->init (config_filename_ + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Configuring AssemblyFactory. + PortableServer::ObjectId_var cs_oid + = poa->activate_object (assembly_factory_servant + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + obj = poa->id_to_reference (cs_oid + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + Components::Deployment::AssemblyFactory_var assembly_factory_obj = + Components::Deployment::AssemblyFactory::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (assembly_factory_obj.in ())) + ACE_ERROR_RETURN ((LM_ERROR, "Unable to activate AssemblyFactory object\n"), -1); + + + CORBA::String_var str = orb->object_to_string (assembly_factory_obj.in () + ACE_ENV_ARG_PARAMETER); + + CORBA::Object_var table_object = + orb->resolve_initial_references ("IORTable" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + IORTable::Table_var adapter = + IORTable::Table::_narrow (table_object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (adapter.in ())) + { + ACE_ERROR ((LM_ERROR, "Nil IORTable\n")); + } + else + { + adapter->bind ("AssemblyFactory", str.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + + // Now create the assembly service object + CIAO::Assembly_Service_Impl *service_servant; + ACE_NEW_RETURN (service_servant, + CIAO::Assembly_Service_Impl (orb.in (), + poa.in (), + assembly_factory_obj.in ()), + -1); + + safe_servant = service_servant; + + PortableServer::ObjectId_var as_oid + = poa->activate_object (service_servant + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + obj = poa->id_to_reference (as_oid + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CIAO::Assembly_Service_var service_obj = + CIAO::Assembly_Service::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (service_obj.in ())) + ACE_ERROR_RETURN ((LM_ERROR, "Unable to activate Assembly_Service object\n"), -1); + + + str = orb->object_to_string (service_obj.in () + ACE_ENV_ARG_PARAMETER); + + write_IOR (str.in ()); + ACE_DEBUG ((LM_INFO, "Assembly_Manager IOR: %s\n", str.in ())); + + // End Deployment part + + ACE_DEBUG ((LM_DEBUG, + "Running Assembly_Manager...\n")); + + // Run the main event loop for the ORB. + orb->run (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Assembly_Manager::main\t\n"); + return 1; + } + ACE_ENDTRY; + + return 0; +} diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Service.idl b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Service.idl new file mode 100644 index 00000000000..c471e67c83e --- /dev/null +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Service.idl @@ -0,0 +1,15 @@ +// $Id$ + +#include "CCM_Deployment.idl" + +module CIAO +{ + + interface Assembly_Service + { + Components::Deployment::AssemblyFactory get_assemblyfactory (); + + oneway void shutdown (); + }; + +}; diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Service_Impl.cpp b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Service_Impl.cpp new file mode 100644 index 00000000000..cd0e50a2551 --- /dev/null +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Service_Impl.cpp @@ -0,0 +1,36 @@ +// $Id$ + +#include "Assembly_Service_Impl.h" + +CIAO::Assembly_Service_Impl::Assembly_Service_Impl (CORBA::ORB_ptr o, + PortableServer::POA_ptr p, + Components::Deployment::AssemblyFactory_ptr f) + : orb_ (CORBA::ORB::_duplicate (o)), + poa_ (PortableServer::POA::_duplicate (p)), + factory_ (Components::Deployment::AssemblyFactory::_duplicate (f)) +{ +} + +CIAO::Assembly_Service_Impl::~Assembly_Service_Impl (void) +{ +} + +PortableServer::POA_ptr +CIAO::Assembly_Service_Impl::_default_POA (void) +{ + return PortableServer::POA::_duplicate (this->poa_.in ()); +} + +Components::Deployment::AssemblyFactory_ptr +CIAO::Assembly_Service_Impl::get_assemblyfactory (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return Components::Deployment::AssemblyFactory::_duplicate (this->factory_.in ()); +} + +void +CIAO::Assembly_Service_Impl::shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->orb_->shutdown (); +} diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Service_Impl.h b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Service_Impl.h new file mode 100644 index 00000000000..9d66d072c8c --- /dev/null +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Service_Impl.h @@ -0,0 +1,67 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Assembly_Service_Impl.h + * + * $Id$ + * + * This file contains implementations for + * Components::Deployment::AssemblyFactory and + * Components::Deployment::Assembly interface. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + + +#ifndef CIAO_ASSEMBLY_SERVICE_IMPL_H +#define CIAO_ASSEMBLY_SERVICE_IMPL_H +#include "ace/pre.h" + +#include "Assembly_ServiceS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO +{ + class Assembly_Service_Impl + : public virtual POA_CIAO::Assembly_Service, + public virtual PortableServer::RefCountServantBase + { + public: + /// Constructor + Assembly_Service_Impl (CORBA::ORB_ptr o, + PortableServer::POA_ptr p, + Components::Deployment::AssemblyFactory_ptr f); + + /// Destructor + virtual ~Assembly_Service_Impl (void); + + /// Get the containing POA. This operation does *not* + /// increase the reference count of the POA. + virtual PortableServer::POA_ptr _default_POA (void); + + virtual ::Components::Deployment::AssemblyFactory_ptr + get_assemblyfactory (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + /// Keep a pointer to the managing ORB serving this servant. + CORBA::ORB_var orb_; + + /// Keep a pointer to the managing POA. + PortableServer::POA_var poa_; + + /// Cached AssemblyFactory reference. + Components::Deployment::AssemblyFactory_var factory_; + }; +} + +#include "ace/post.h" +#endif /* CIAO_ASSEMBLY_IMPL_H */ diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.cpp b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.cpp new file mode 100644 index 00000000000..f49eb6524c1 --- /dev/null +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.cpp @@ -0,0 +1,336 @@ +// $Id$ + +#include "Assembly_Visitors.h" +#include "../XML_Helpers/XML_Utils.h" + +#if !defined (__ACE_INLINE__) +# include "Assembly_Visitors.inl" +#endif /* __ACE_INLINE__ */ + +CIAO::Assembly_Builder_Visitor::~Assembly_Builder_Visitor (void) +{ +} + +int +CIAO::Assembly_Builder_Visitor::visit_Container +(CIAO::Assembly_Placement::Container *c + ACE_ENV_ARG_DECL) +{ + ACE_DEBUG ((LM_DEBUG, "partitioning %s\n", c->id ())); + + // This can only happen when we hit a partitioning (root) node. + CIAO::Assembly_Placement::Container::ITERATOR iter (*c); + CIAO::Assembly_Placement::Node *node = 0; + + while (iter.next (node)) + { + int retv = node->accept (*this + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + if (retv != 0) + return -1; + iter.advance (); + } + return 0; +} + +int +CIAO::Assembly_Builder_Visitor::visit_hostcollocation +(CIAO::Assembly_Placement::hostcollocation *hc + ACE_ENV_ARG_DECL) +{ + ACE_DEBUG ((LM_DEBUG, "hostcollocation %s\n", hc->id ())); + + + + CIAO::Assembly_Placement::Container::ITERATOR iter (*hc); + CIAO::Assembly_Placement::Node *node = 0; + + while (iter.next (node)) + { + int retv = node->accept (*this + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + if (retv != 0) + return -1; + iter.advance (); + } + return 0; +} + +int +CIAO::Assembly_Builder_Visitor::visit_processcollocation +(CIAO::Assembly_Placement::processcollocation *pc + ACE_ENV_ARG_DECL) +{ + ACE_DEBUG ((LM_DEBUG, "processcollocation %s\n", pc->id ())); + + if (pc->destination () != 0) + { + Components::Deployment::ServerActivator_var activator = + this->deployment_config_.get_activator (pc->destination ()); + + if (CORBA::is_nil (activator.in ())) + ACE_ERROR_RETURN ((LM_ERROR, "Fail to acquire ServerActivator (%s)\n", + pc->destination ()), + -1); + + Components::ConfigValues server_config; + // @@ Nothing to config yet. + + this->compserv_ = + activator->create_component_server (server_config + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + this->context_.component_servers_.enqueue_tail (this->compserv_); + + Components::ConfigValues container_config; + // @@ Should we get the config value from Softpkg_Info? + this->container_ = + this->compserv_->create_container (container_config + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + } + + CIAO::Assembly_Placement::Container::ITERATOR iter (*pc); + CIAO::Assembly_Placement::Node *node = 0; + + while (iter.next (node)) + { + int retv = node->accept (*this + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + if (retv != 0) + return -1; + iter.advance (); + } + return 0; +} + +int +CIAO::Assembly_Builder_Visitor::visit_homeplacement +(CIAO::Assembly_Placement::homeplacement *hp + ACE_ENV_ARG_DECL) +{ + ACE_DEBUG ((LM_DEBUG, "homeplacement %s\n", hp->id ())); + + // @@ Create and register home before creating components. + ACE_CString csd_file; + + if (this->impl_idref_map_.find (hp->componentfileref (), + csd_file) != 0) + ACE_ERROR_RETURN ((LM_DEBUG, + "Unable to find implementation reference: %s", + hp->componentfileref ()), + -1); + + CIAO::Softpkg_Handler::Softpkg_Info info; + info.csd_path_ = csd_file.c_str (); + + if (CIAO::XML_Utils::parse_softpkg (&info) == 0) + { + // info.dump (); // For debug purpose. + + // install home + Components::ConfigValues home_config; + // Setting home config value here: + home_config.length (2); + + Components::ConfigValue_ptr item = new OBV_Components::ConfigValue (); + item->name (CORBA::string_dup ("CIAO-servant-UUID")); + item->value () <<= CORBA::string_dup (info.servant_UUID_.c_str ()); + home_config[0] = item; + + item = new OBV_Components::ConfigValue (); + item->name (CORBA::string_dup ("CIAO-servant-entrypt")); + item->value () <<= CORBA::string_dup (info.servant_entrypt_.c_str ()); + home_config[1] = item; + + Components::Deployment::Container_var container + = this->get_current_container (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + if (CORBA::is_nil (container.in ())) + ACE_ERROR_RETURN ((LM_DEBUG, + "Unable to acquire a reference to ServerActivator\n"), + -1); + + Components::CCMHome_var home = + container->install_home (info.executor_UUID_.c_str (), + info.executor_entrypt_.c_str (), + home_config + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + Components::KeylessCCMHome_var klhome = + Components::KeylessCCMHome::_narrow (home.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + if (CORBA::is_nil (klhome.in ())) + return -1; + + // register home with context + if (this->context_.installed_homes_.bind (hp->id (), + home) != 0) + ACE_ERROR_RETURN ((LM_DEBUG, + "Failed to register home\n"), + -1); + // Save the home for component instantiation. + this->home_ = klhome; + + // @@ Register home according to register spec. + // @@ Not implemented yet. + } + + CIAO::Assembly_Placement::Container::ITERATOR iter (*hp); + CIAO::Assembly_Placement::Node *node = 0; + + while (iter.next (node)) + { + int retv = node->accept (*this + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + if (retv != 0) + return -1; + iter.advance (); + } + + // Reset current home + this->home_ = 0; + return 0; +} + +int +CIAO::Assembly_Builder_Visitor::visit_componentinstantiation +(CIAO::Assembly_Placement::componentinstantiation *ci + ACE_ENV_ARG_DECL) +{ + // @@ instantiation and register component. + ACE_DEBUG ((LM_DEBUG, "ComponentInstantiation %s\n", ci->id ())); + + Components::CCMObject_var comp + = this->home_->create_component (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + this->context_.instantiated_components_.bind (ci->id (), + comp); + + // Registering component. + CIAO::Assembly_Placement::componentinstantiation::REGISTRATION_QUEUE::ITERATOR + iter (ci->register_info_); + + while (!iter.done ()) + { + CIAO::Assembly_Placement::componentinstantiation::Register_Info *info; + iter.next (info); + + this->register_component (info, + comp.in () + ACE_ENV_ARG_PARAMETER); + + iter.advance (); + } + return 0; +} + +Components::Deployment::Container_ptr +CIAO::Assembly_Builder_Visitor::get_current_container (ACE_ENV_SINGLE_ARG_DECL) +{ + if (CORBA::is_nil (this->compserv_.in ())) + { + Components::Deployment::ServerActivator_var activator = + this->deployment_config_.get_default_activator (); + + if (CORBA::is_nil (activator.in ())) + ACE_ERROR_RETURN ((LM_ERROR, "Fail to acquire default ServerActivator\n"), + 0); + + Components::ConfigValues server_config; + // @@ Nothing to config yet. + + this->compserv_ = + activator->create_component_server (server_config + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + this->context_.component_servers_.enqueue_tail (this->compserv_); + + Components::ConfigValues container_config; + // @@ Should we get the config value from Softpkg_Info? + this->container_ = + this->compserv_->create_container (container_config + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + } + + return Components::Deployment::Container::_duplicate + (this->container_.in ()); +} + +void +CIAO::Assembly_Builder_Visitor::register_component +(Assembly_Placement::componentinstantiation::Register_Info *i, + Components::CCMObject_ptr c + ACE_ENV_ARG_DECL) +{ + CORBA::Object_ptr reg_obj; + + // Extract the right interface to register: + switch (i->type_) + { + case CIAO::Assembly_Placement::componentinstantiation::COMPONENT: + reg_obj = c; + break; + + case CIAO::Assembly_Placement::componentinstantiation::PROVIDESID: + reg_obj = c->provide_facet (i->port_id_.c_str () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + break; + + case CIAO::Assembly_Placement::componentinstantiation::CONSUMESID: + reg_obj = c->get_consumer (i->port_id_.c_str () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + break; + + default: + ACE_THROW (CORBA::INTERNAL ()); + } + + // Now actually register the interface + switch (i->method_) + { + case CIAO::Assembly_Placement::componentinstantiation::NAMINGSERVICE: + ACE_THROW (CORBA::NO_IMPLEMENT ()); + + case CIAO::Assembly_Placement::componentinstantiation::IORFILE: + { + CORBA::String_var ior + = this->orb_->object_to_string (reg_obj + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + FILE* ior_output_file_ = + ACE_OS::fopen (i->name_.c_str (), "w"); + + if (ior_output_file_) + { + ACE_OS::fprintf (ior_output_file_, + "%s", + ior.in ()); + ACE_OS::fclose (ior_output_file_); + } + } + break; + + default: + ACE_THROW (CORBA::INTERNAL ()); + } +} diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.h b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.h new file mode 100644 index 00000000000..bf1ad209c79 --- /dev/null +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.h @@ -0,0 +1,135 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Assembly_Visitors.h + * + * $Id$ + * + * This file contains implementations for various visitors that + * traverse and process CIAO::Assembly_Spec. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + + +#ifndef CIAO_ASSEMBLY_VISITOR_H +#define CIAO_ASSEMBLY_VISITOR_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "CCM_DeploymentS.h" +#include "ace/Hash_Map_Manager_T.h" +#include "../XML_Helpers/Assembly_Spec.h" +#include "Deployment_Configuration.h" + +namespace CIAO +{ + /** + * @typedef Assembly_Context + * + * This is a structure for collecting information of a running Assembly. + */ + typedef struct _assembly_context + { + typedef ACE_Hash_Map_Manager_Ex<ACE_CString, + Components::CCMHome_var, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> HOME_MAP; + HOME_MAP installed_homes_; + + typedef ACE_Hash_Map_Manager_Ex<ACE_CString, + Components::CCMObject_var, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> COMP_MAP; + COMP_MAP instantiated_components_; + + typedef ACE_Unbounded_Queue<Components::Deployment::ComponentServer_var> SERVER_QUEUE; + SERVER_QUEUE component_servers_; + } Assembly_Context; + + /** + * @class Assembly_Builder_Visitor + * + * @brief A visitor implementation that "build" up the application + * ACE_Hash_Map_Manager_Exby visiting nodes in an Assembly_Spec + */ + class Assembly_Builder_Visitor : public CIAO::Assembly_Placement::Visitor + { + public: + /// Constructor + Assembly_Builder_Visitor (CORBA::ORB_ptr o, + Assembly_Context &context, + CIAO::ID_IMPL_MAP &idmap, + Deployment_Configuration &config); + + /// Destructor + virtual ~Assembly_Builder_Visitor (void); + + virtual int visit_Container (Assembly_Placement::Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + virtual int visit_hostcollocation (Assembly_Placement::hostcollocation *hc + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + virtual int visit_processcollocation (Assembly_Placement::processcollocation *pc + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + virtual int visit_homeplacement (Assembly_Placement::homeplacement *hp + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + virtual int visit_componentinstantiation (Assembly_Placement::componentinstantiation *ci + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + Components::Deployment::Container_ptr + get_current_container (void); + + protected: + /// Registering a component using the info specified in @c i . + void register_component (Assembly_Placement::componentinstantiation::Register_Info *i, + Components::CCMObject_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + /// Current Component Server. + Components::Deployment::ComponentServer_var compserv_; + + /// Current Container. (This shouldn't be necessary because the + /// component server supposedly should be able to figure out if a + /// component home can be installed in the same container based on + /// its configvalue. However, our component server don't do that + /// yet, so we just install all home in a process into one single + /// container.) + Components::Deployment::Container_var container_; + + /// Current Component Home. We only support keyless home + /// operations for now. + Components::KeylessCCMHome_var home_; + + /// Keep a pointer to the managing ORB serving this servant. + CORBA::ORB_var orb_; + + /// Context to build on. + Assembly_Context &context_; + + /// Context to build on. + CIAO::ID_IMPL_MAP &impl_idref_map_; + + /// Deployment Configuration Info. + Deployment_Configuration &deployment_config_; + }; +} + +#if defined (__ACE_INLINE__) +# include "Assembly_Visitors.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* CIAO_ASSEMBLY_VISITOR_H */ diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.inl b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.inl new file mode 100644 index 00000000000..dc8160a3ac4 --- /dev/null +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.inl @@ -0,0 +1,13 @@ +// $Id$ + +ACE_INLINE +CIAO::Assembly_Builder_Visitor::Assembly_Builder_Visitor (CORBA::ORB_ptr o, + Assembly_Context &context, + CIAO::ID_IMPL_MAP &idmap, + Deployment_Configuration &config) + : orb_ (CORBA::ORB::_duplicate (o)), + context_ (context), + impl_idref_map_ (idmap), + deployment_config_ (config) +{ +} diff --git a/TAO/CIAO/tools/Assembly_Deployer/Deployment_Configuration.cpp b/TAO/CIAO/tools/Assembly_Deployer/Deployment_Configuration.cpp new file mode 100644 index 00000000000..d546e0756b8 --- /dev/null +++ b/TAO/CIAO/tools/Assembly_Deployer/Deployment_Configuration.cpp @@ -0,0 +1,118 @@ +// $Id$ + +#include "Deployment_Configuration.h" + +#if !defined (__ACE_INLINE__) +# include "Deployment_Configuration.inl" +#endif /* __ACE_INLINE__ */ + +#define NAME_BUFSIZE 1024 + +CIAO::Deployment_Configuration::Deployment_Configuration (CORBA::ORB_ptr o) + : orb_ (CORBA::ORB::_duplicate (o)) +{ +} + +CIAO::Deployment_Configuration::~Deployment_Configuration (void) +{ +} + +int +CIAO::Deployment_Configuration::init (const char *filename) +{ + // @@ We should change to use ACE_Configuration here. + + if (filename == 0) + return -1; + + FILE *inf = ACE_OS::fopen (filename, "r"); + + if (inf == NULL) + ACE_ERROR_RETURN ((LM_ERROR, "Fail to open data file.\n"), -1); + + char destination[NAME_BUFSIZE], ior[NAME_BUFSIZE]; + + int first = 1; + + while (fscanf (inf, "%s %s", destination, ior ) != EOF) + { + this->deployment_info_.bind (destination, ior); + + if (first) + { + this->default_activator_.IOR_ = ior; + first = 0; + } + } + + return 0; +} + +const char * +CIAO::Deployment_Configuration::get_activator_ior (const char *name) +{ + ACE_Hash_Map_Entry + <ACE_CString, + CIAO::Deployment_Configuration::Activator_Info> *entry; + + if (this->deployment_info_.find (ACE_CString (name), + entry) != 0) + return 0; // no valid name found. + + return entry->int_id_.IOR_.c_str (); +} + +const char * +CIAO::Deployment_Configuration::get_default_activator_ior (void) +{ + if (this->default_activator_.IOR_.length () == 0) + return 0; + return this->default_activator_.IOR_.c_str (); +} + +Components::Deployment::ServerActivator_ptr +CIAO::Deployment_Configuration::get_activator (const char *name + ACE_ENV_ARG_DECL) +{ + ACE_Hash_Map_Entry + <ACE_CString, + CIAO::Deployment_Configuration::Activator_Info> *entry; + + if (this->deployment_info_.find (ACE_CString (name), + entry) != 0) + return 0; // no valid name found. + + if (CORBA::is_nil (entry->int_id_.activator_.in ())) + { + CORBA::Object_var temp = this->orb_->string_to_object + (entry->int_id_.IOR_.c_str () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + entry->int_id_.activator_ = + Components::Deployment::ServerActivator::_narrow (temp.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + } + return Components::Deployment::ServerActivator::_duplicate + (entry->int_id_.activator_.in ()); +} + +Components::Deployment::ServerActivator_ptr +CIAO::Deployment_Configuration::get_default_activator (void) +{ + if (CORBA::is_nil (this->default_activator_.activator_.in ())) + { + CORBA::Object_var temp = this->orb_->string_to_object + (this->default_activator_.IOR_.c_str () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + this->default_activator_.activator_ = + Components::Deployment::ServerActivator::_narrow (temp.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + } + return Components::Deployment::ServerActivator::_duplicate + (this->default_activator_.activator_.in ()); +} diff --git a/TAO/CIAO/tools/Assembly_Deployer/Deployment_Configuration.h b/TAO/CIAO/tools/Assembly_Deployer/Deployment_Configuration.h new file mode 100644 index 00000000000..5bda09c988b --- /dev/null +++ b/TAO/CIAO/tools/Assembly_Deployer/Deployment_Configuration.h @@ -0,0 +1,126 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Deployment_Configuration.h + * + * $Id$ + * + * The Deployment_Configuration provides abstraction for the + * deployment mechanisms. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + + +#ifndef CIAO_DEPLOYMENT_CONFIGURATION_H +#define CIAO_DEPLOYMENT_CONFIGURATION_H +#include "ace/pre.h" + +#include "ace/Hash_Map_Manager_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "CCM_DeploymentC.h" + +namespace CIAO +{ + /** + * @class Deployment_Configuration + * + * @brief A class that provides strategies on deployment topology + * + * This class provides strategies on how the Assembly framework + * should deploy an assembly. This is achieved by providing + * mappings from deployment destination names to actually CIAO daemon + * IORs, and the strategy for which default CIAO daemon a deployment + * mechanism should use. + * + * This is a trivial implementation of the deployment configuration + * strategy. We can enhance this class later on to provide + * different deployment location strategies. + */ + class Deployment_Configuration + { + public: + typedef struct _activator_info + { + _activator_info (const char *ior = 0) + { + IOR_ = ior; + } + + ACE_CString IOR_; + Components::Deployment::ServerActivator_var activator_; + } Activator_Info; + + Deployment_Configuration (CORBA::ORB_ptr o); + + /// Destructor + virtual ~Deployment_Configuration (void); + + /** + * Init method takes the filename to a configuration file which + * has a simple line format of name, ior string delimited by a + * space in each line. + * + * name IOR-string + * + * @retval 0 on success. + * @retval -1 otherwise. + */ + int init (const char *filename); + + /** + * @retval 0 if no valid name were found. + */ + virtual const char *get_activator_ior (const char *name); + + /** + * Return the default ServerActivator the Assembly mechanism + * should use to deploy a component. In this implementation, the + * first entry in the deployment configuration data file is always + * the entry for default activator. + * + * @retval 0 if no valid daemon is configured. + */ + virtual const char *get_default_activator_ior (void); + + /** + * @retval nil if no valid name were found. + */ + virtual Components::Deployment::ServerActivator_ptr + get_activator (const char *name); + + /** + * Return the reference to the default ServerActivator the + * Assembly mechanism should use to deploy a component. + * + * @retval nil if no valid daemon is configured. + */ + virtual Components::Deployment::ServerActivator_ptr + get_default_activator (void); + + protected: + CORBA::ORB_var orb_; + + ACE_Hash_Map_Manager_Ex<ACE_CString, + Activator_Info, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> deployment_info_; + + Activator_Info default_activator_; + }; + +} + +#if defined (__ACE_INLINE__) +# include "Deployment_Configuration.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* CIAO_DEPLOYMENT_CONFIGURATION_H */ diff --git a/TAO/CIAO/tools/Assembly_Deployer/Deployment_Configuration.inl b/TAO/CIAO/tools/Assembly_Deployer/Deployment_Configuration.inl new file mode 100644 index 00000000000..cfa1da318d3 --- /dev/null +++ b/TAO/CIAO/tools/Assembly_Deployer/Deployment_Configuration.inl @@ -0,0 +1 @@ +// $Id$ diff --git a/TAO/CIAO/tools/ComponentServer/ComponentServer.cpp b/TAO/CIAO/tools/ComponentServer/ComponentServer.cpp new file mode 100644 index 00000000000..5040374b371 --- /dev/null +++ b/TAO/CIAO/tools/ComponentServer/ComponentServer.cpp @@ -0,0 +1,196 @@ +// $Id$ + +/** + * @file ComponentServer.cpp + * + * @brief CIAO's ComponentServer implementation + * + */ + +#include "ComponentServer_Impl.h" +#include "CIAO_ServersC.h" +#include "Server_init.h" +#include "tao/IORTable/IORTable.h" +#include "ace/SString.h" +#include "ace/Read_Buffer.h" +#include "ace/Get_Opt.h" + +char *ior_file_name_ = 0; +char *callback_ior_ = 0; +int use_callback = 1; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "nk:o:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'n': + use_callback = 0; + break; + + case 'o': // get the file name to write to + ior_file_name_ = get_opts.opt_arg (); + break; + + case 'k': // get the activator callback IOR + callback_ior_ = get_opts.opt_arg (); + break; + + case '?': // display help for use of the server. + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s\n" + "-n Don't not try to callback ServerActivator (testing)\n" + "-o <ior_output_file>\n" + "-k <activator_callback_ior>\n" + "\n", + argv [0]), + -1); + } + + if (use_callback && callback_ior_ == 0) + ACE_ERROR_RETURN ((LM_ERROR, "Callback IOR to ServerActivator is required.\n"), + -1); + + return 0; +} + +int +write_IOR(const char* ior) +{ + FILE* ior_output_file_ = + ACE_OS::fopen (ior_file_name_, "w"); + + if (ior_output_file_) + { + ACE_OS::fprintf (ior_output_file_, + "%s", + ior); + ACE_OS::fclose (ior_output_file_); + } + + return 0; +} + +int +main (int argc, char *argv[]) +{ + ACE_TRY_NEW_ENV + { + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init (argc, + argv + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CIAO::Server_init (orb.in ()); + + if (parse_args (argc, argv) != 0) + return -1; + + // Get reference to Root POA. + CORBA::Object_var obj + = orb->resolve_initial_references ("RootPOA" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableServer::POA_var poa + = PortableServer::POA::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Activate POA manager + PortableServer::POAManager_var mgr + = poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + mgr->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + CIAO::ComponentServer_Impl *comserv_servant; + + ACE_NEW_RETURN (comserv_servant, + CIAO::ComponentServer_Impl (orb.in (), + poa.in ()), + -1); + + PortableServer::ServantBase_var safe_servant (comserv_servant); + + // @@ We need to call ComponentServer servant's init method. + // But it's not sure to me where exactly we can get the + // ConfigValues needed by the init method at this moment. + + // comserv_servant->init (config ACE_ENV_ARG_PARAMETER); + + // Configuring ComponentServer. + PortableServer::ObjectId_var cs_oid + = poa->activate_object (comserv_servant + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + obj = poa->id_to_reference (cs_oid + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + Components::Deployment::ComponentServer_var comserv_obj = + Components::Deployment::ComponentServer::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (comserv_obj.in ())) + ACE_ERROR_RETURN ((LM_ERROR, "Unable to activate ComponentServer object\n"), -1); + + + Components::Deployment::ServerActivator_var activator; + + if (use_callback) + { + obj = orb->string_to_object (callback_ior_ + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CIAO::Activator_Callback_var act_callback + = ::CIAO::Activator_Callback::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + activator + = act_callback->register_component_server (comserv_obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + + comserv_servant->set_objref (activator.in (), + comserv_obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::String_var str = orb->object_to_string (comserv_obj.in () + ACE_ENV_ARG_PARAMETER); + + write_IOR (str.in ()); + ACE_DEBUG ((LM_INFO, "ComponentServer IOR: %s\n", str.in ())); + + // End Deployment part + + ACE_DEBUG ((LM_DEBUG, + "Running ComponentServer...\n")); + + // Run the main event loop for the ORB. + orb->run (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "server::main\t\n"); + return 1; + } + ACE_ENDTRY; + + return 0; +} diff --git a/TAO/CIAO/tools/ComponentServer/ComponentServer.dsp b/TAO/CIAO/tools/ComponentServer/ComponentServer.dsp new file mode 100644 index 00000000000..e437ecfdc16 --- /dev/null +++ b/TAO/CIAO/tools/ComponentServer/ComponentServer.dsp @@ -0,0 +1,102 @@ +# Microsoft Developer Studio Project File - Name="ComponentServer" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=ComponentServer - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "ComponentServer.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "ComponentServer.mak" CFG="ComponentServer - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "ComponentServer - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "ComponentServer - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "ComponentServer - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\.." /I "..\..\.." /I "..\..\ciao" /I "..\..\..\orbsvcs\orbsvcs" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib tao.lib TAO_IFR_Client.lib CIAO_Container.lib CIAO_Client.lib CIAO_Server.lib TAO_PortableServer.lib TAO_Security.lib TAO_IORTable.lib /nologo /subsystem:console /machine:I386 /out:"Release\ComponentServer.exe" /libpath:"..\..\..\..\ace" /libpath:"..\..\..\tao" /libpath:"..\..\..\tao\PortableServer" /libpath:"..\..\..\tao\IFR_Client" /libpath:"..\..\ciao" /libpath:"..\..\..\orbsvcs\orbsvcs" /libpath:"..\..\..\tao\IORTable"
+
+!ELSEIF "$(CFG)" == "ComponentServer - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "server___Win32_Debug"
+# PROP BASE Intermediate_Dir "server___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\.." /I "..\..\.." /I "..\..\ciao" /I "..\..\..\orbsvcs\orbsvcs" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib taod.lib TAO_IFR_Clientd.lib CIAO_Containerd.lib CIAO_Clientd.lib CIAO_Serverd.lib TAO_PortableServerd.lib TAO_Securityd.lib TAO_CosNamingd.lib TAO_IORTabled.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\ace" /libpath:"..\..\..\tao" /libpath:"..\..\..\tao\PortableServer" /libpath:"..\..\..\tao\IFR_Client" /libpath:"..\..\ciao" /libpath:"..\..\..\orbsvcs\orbsvcs" /libpath:"..\..\..\tao\IORTable"
+
+!ENDIF
+
+# Begin Target
+
+# Name "ComponentServer - Win32 Release"
+# Name "ComponentServer - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\ComponentServer.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/TAO/CIAO/tools/ComponentServer/ComponentServer.dsw b/TAO/CIAO/tools/ComponentServer/ComponentServer.dsw new file mode 100644 index 00000000000..06fafb8159c --- /dev/null +++ b/TAO/CIAO/tools/ComponentServer/ComponentServer.dsw @@ -0,0 +1,41 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "ComponentServer"=.\ComponentServer.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "ComponentServer_test_client EXE"=.\ComponentServer_test_client.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/TAO/CIAO/tools/ComponentServer/ComponentServer.mpc b/TAO/CIAO/tools/ComponentServer/ComponentServer.mpc new file mode 100644 index 00000000000..a87efd1e32e --- /dev/null +++ b/TAO/CIAO/tools/ComponentServer/ComponentServer.mpc @@ -0,0 +1,17 @@ +// $Id$ + +project(ComponentServer): ciao_server { + + libs += TAO_IORTable + libpaths += $(TAO_ROOT)/tao/IORTable + + Source_Files { + ComponentServer.cpp + } +} + +project(ComponentServer_test_client) : ciao_server { + Source_Files { + ComponentServer_test_client.cpp + } +} diff --git a/TAO/CIAO/tools/ComponentServer/ComponentServer_test_client.cpp b/TAO/CIAO/tools/ComponentServer/ComponentServer_test_client.cpp new file mode 100644 index 00000000000..e0cbbd92500 --- /dev/null +++ b/TAO/CIAO/tools/ComponentServer/ComponentServer_test_client.cpp @@ -0,0 +1,114 @@ +// $Id$ + +#include "CCM_DeploymentC.h" +#include "Client_init.h" +#include "ace/Get_Opt.h" + +const char *ior = "file://test.ior"; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "k:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s \n" + "-k <ComponentServer ior> \n" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +main (int argc, char *argv[]) +{ + ACE_TRY_NEW_ENV + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (parse_args (argc, argv) != 0) + return 1; + + CIAO::Client_init (orb.in ()); + + CORBA::Object_var tmp = + orb->string_to_object(ior ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ::Components::Deployment::ComponentServer_var comserv = + ::Components::Deployment::ComponentServer::_narrow(tmp.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (comserv.in ())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Nil ServerActivator reference <%s>\n", + ior), + 1); + } + + + ACE_DEBUG ((LM_DEBUG, "Try creating a Container\n")); + ::Components::ConfigValues config; + Components::Deployment::Container_var container + = comserv->create_container (config + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // now install a fake home: + Components::ConfigValues com_config (2); + com_config.length (2); + + Components::ConfigValue_ptr item = new OBV_Components::ConfigValue (); + + item->name (CORBA::string_dup ("CIAO-servant-UUID")); + item->value () <<= CORBA::string_dup ("DCE:93D254CF-9538-44e8-BB98-AABCD134ADD3"); + com_config[0] = item; + + item = new OBV_Components::ConfigValue (); + item->name (CORBA::string_dup ("CIAO-servant-entrypt")); + item->value () <<= CORBA::string_dup ("createRateGenHome_Servant"); + com_config[1] = item; + + // ACE_OS::sleep (2); + + container->install_home ("DCE:82C2B032-37F0-4315-A59F-7020D3264E4D", + "createRateGenHome_Impl", + com_config + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, "Try removing a ComponentServer\n")); + comserv->remove_container (container.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Exception caught:"); + return 1; + } + ACE_ENDTRY; + + return 0; +} diff --git a/TAO/CIAO/tools/ComponentServer/ComponentServer_test_client.dsp b/TAO/CIAO/tools/ComponentServer/ComponentServer_test_client.dsp new file mode 100644 index 00000000000..fe72a715c59 --- /dev/null +++ b/TAO/CIAO/tools/ComponentServer/ComponentServer_test_client.dsp @@ -0,0 +1,89 @@ +# Microsoft Developer Studio Project File - Name="ComponentServer_test_client EXE" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=ComponentServer_test_client EXE - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "ComponentServer_test_client.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "ComponentServer_test_client.mak" CFG="ComponentServer_test_client EXE - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "ComponentServer_test_client EXE - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "ComponentServer_test_client EXE - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "ComponentServer_test_client EXE - Win32 Release"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "..\..\..\.." /I "..\..\.." /I "..\..\ciao" /I "..\..\..\orbsvcs\orbsvcs" /D NDEBUG=1 /D WIN32=1 /D _CONSOLE=1 /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0x409 /i "..\..\..\..\orbsvcs\orbsvcs" /i "..\..\..\..\CIAO" /i "..\..\..\..\CIAO\ciao" /i "..\..\..\.." /i "..\..\..\..\tao" /i "..\..\..\..\.." /d NDEBUG=1
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 /machine:IX86
+# ADD LINK32 advapi32.lib user32.lib CIAO_Server.lib TAO_PortableServer.lib TAO_Security.lib CIAO_Container.lib TAO.lib TAO_IFR_Client.lib CIAO_Client.lib ACE.lib /nologo /version:1.3 /subsystem:console /machine:I386 /out:"ComponentServer_test_client.exe" /libpath:"..\..\..\..\ace" /libpath:"..\..\..\tao" /libpath:"..\..\..\tao\PortableServer" /libpath:"..\..\..\tao\IFR_Client" /libpath:"..\..\ciao" /libpath:"..\..\..\orbsvcs\orbsvcs"
+
+!ELSEIF "$(CFG)" == "ComponentServer_test_client EXE - Win32 Debug"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /Zi /Od /Gy /I "..\..\..\.." /I "..\..\.." /I "..\..\ciao" /I "..\..\..\orbsvcs\orbsvcs" /D _DEBUG=1 /D WIN32=1 /D _CONSOLE=1 /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0x409 /i "..\..\..\..\orbsvcs\orbsvcs" /i "..\..\..\..\CIAO" /i "..\..\..\..\CIAO\ciao" /i "..\..\..\.." /i "..\..\..\..\tao" /i "..\..\..\..\.." /d _DEBUG=1
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 /machine:IX86
+# ADD LINK32 advapi32.lib user32.lib CIAO_Serverd.lib TAO_PortableServerd.lib TAO_Securityd.lib CIAO_Containerd.lib TAOd.lib TAO_IFR_Clientd.lib CIAO_Clientd.lib ACEd.lib /nologo /version:1.3 /subsystem:console /incremental:no /debug /machine:I386 /libpath:"..\..\..\..\ace" /libpath:"..\..\..\tao" /libpath:"..\..\..\tao\PortableServer" /libpath:"..\..\..\tao\IFR_Client" /libpath:"..\..\ciao" /libpath:"..\..\..\orbsvcs\orbsvcs"
+
+!ENDIF
+
+# Begin Target
+
+# Name "ComponentServer_test_client EXE - Win32 Release"
+# Name "ComponentServer_test_client EXE - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;cxx;c"
+# Begin Source File
+
+SOURCE=.\ComponentServer_test_client.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hh"
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i;inl"
+# End Group
+# End Target
+# End Project
diff --git a/TAO/CIAO/tools/ComponentServer/README b/TAO/CIAO/tools/ComponentServer/README new file mode 100644 index 00000000000..606c3e7d519 --- /dev/null +++ b/TAO/CIAO/tools/ComponentServer/README @@ -0,0 +1,15 @@ +$Id$ + +This directory contains the ComponentServer implementation and a +simple test program called ComponentServer_test_client. + +ComponentServer supports the following command line flags: + + * -n : Do not try to call back ServerActivator. This is only useful + when testing the server and the server is not created by a + ServerActivator. + + * -o <filename> : Specify the filename ComponentServer will write + IOR to. This is only useful when debugging also. + + * -d <IOR> : Specify the IOR to the ServerActivator.
\ No newline at end of file diff --git a/TAO/CIAO/tools/Daemon/CIAO_Daemon.cpp b/TAO/CIAO/tools/Daemon/CIAO_Daemon.cpp new file mode 100644 index 00000000000..8ac18062288 --- /dev/null +++ b/TAO/CIAO/tools/Daemon/CIAO_Daemon.cpp @@ -0,0 +1,246 @@ +// $Id$ + +/** + * @file server_activator.cpp + * + * @brief CIAO's server activator implementation + * + * ServerActivator is the bootstraping mechanism to create new + * component servers on the localhost. We currently depend on + * starting the ServerActivator process on some specific port of all + * the hosts that have ServerActivator install to function properly. + */ + +#include "ServerActivator_Impl.h" +#include "ComponentInstallation_Impl.h" +#include "Daemon_Impl.h" +#include "tao/IORTable/IORTable.h" +#include "ace/SString.h" +#include "ace/Read_Buffer.h" +#include "ace/Get_Opt.h" + +char *ior_file_name_ = "daemon.ior"; +char *comserv_path_ = "../ComponentServer/ComponentServer"; +CORBA::ULong spawn_wait_ = 5; +char *installation_datafile_ = "CIAO_Installation_Data.ini"; +char *section_name_ = 0; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "i:n:o:d:s:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': // get the file name to write to + ior_file_name_ = get_opts.opt_arg (); + break; + + case 'n': // get the path name to the component server + comserv_path_ = get_opts.opt_arg (); + break; + + case 'd': // time to wait before we consider a ComponentServer + // fails to start. + spawn_wait_ = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case 'i': // get the name for the ComponentInstallation data file + installation_datafile_ = get_opts.opt_arg (); + break; + + case 's': // get the section name to use in ComponentInstallation data file + section_name_ = get_opts.opt_arg (); + break; + + case '?': // display help for use of the server. + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s\n" + "-n <component server pathname>\n" + "-o <ior_output_file>\n" + "-d <time (in second) to wait for component server>\n" + "-i <installation data filename>\n" + "-s <section name to use in installation data file>\n" + "\n", + argv [0]), + -1); + } + + return 0; +} + +int +write_IOR(const char* ior) +{ + FILE* ior_output_file_ = + ACE_OS::fopen (ior_file_name_, "w"); + + if (ior_output_file_) + { + ACE_OS::fprintf (ior_output_file_, + "%s", + ior); + ACE_OS::fclose (ior_output_file_); + } + + return 0; +} + +int +main (int argc, char *argv[]) +{ + ACE_TRY_NEW_ENV + { + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init (argc, + argv + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (parse_args (argc, argv) != 0) + return -1; + + // Get reference to Root POA. + CORBA::Object_var obj + = orb->resolve_initial_references ("RootPOA" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableServer::POA_var poa + = PortableServer::POA::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::Object_var table_object = + orb->resolve_initial_references ("IORTable" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + IORTable::Table_var adapter = + IORTable::Table::_narrow (table_object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (adapter.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, "Nil IORTable\n"), -1); + } + + // Create and install the CIAO Daemon servant + + CIAO::Daemon_Impl *daemon_servant = 0; + ACE_NEW_RETURN (daemon_servant, + CIAO::Daemon_Impl ("CIAODaemon", + orb.in (), + poa.in ()), + -1); + PortableServer::ServantBase_var safe_daemon (daemon_servant); + // Implicit activation + CIAO::Daemon_var daemon = daemon_servant->_this (); + + // Create and install the ComponentInstallation servant + + CIAO::ComponentInstallation_Impl *installation_servant = 0; + + ACE_NEW_RETURN (installation_servant, + CIAO::ComponentInstallation_Impl (orb.in (), + poa.in ()), + -1); + + installation_servant->init (installation_datafile_, + section_name_ + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableServer::ServantBase_var safe_installation (installation_servant); + + Components::Deployment::ComponentInstallation_var installation + = installation_servant->_this (); + + CORBA::String_var str = orb->object_to_string (installation.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + adapter->bind ("ComponentInstallation", str.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (daemon_servant->bind ("ComponentInstallation", installation.in ()) != 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Failed to register ComponentInstallation with CIAO Daemon\n"), + -1); + + // Create and install the ServerActivator servant + + CIAO::ServerActivator_Impl *activator_servant = 0; + + ACE_NEW_RETURN (activator_servant, + CIAO::ServerActivator_Impl (orb.in (), + poa.in ()), + -1); + + activator_servant->init (comserv_path_, + spawn_wait_, + str.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableServer::ServantBase_var safe_activator (activator_servant); + + Components::Deployment::ServerActivator_ptr activator + = activator_servant->_ciao_get_objref (); + + str = orb->object_to_string (activator + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + adapter->bind ("ServerActivator", str.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (daemon_servant->bind ("ServerActivator", activator) != 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Failed to register ServerActivator with CIAO Daemon\n"), + -1); + + // Now register daemon with IOR table and write its IOR. + str = orb->object_to_string (daemon.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + adapter->bind ("CIAO-Daemon", str.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + write_IOR (str.in ()); + ACE_DEBUG ((LM_INFO, "CIAO-Daemon IOR: %s\n", str.in ())); + + // Activate POA manager + PortableServer::POAManager_var mgr + = poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + mgr->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + // End Deployment part + + ACE_DEBUG ((LM_DEBUG, + "CIAO_Daemon is running...\n")); + + // Run the main event loop for the ORB. + orb->run (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "server::main\t\n"); + return 1; + } + ACE_ENDTRY; + + ACE_DEBUG ((LM_DEBUG, + "CIAO_Daemon has closed\n")); + + return 0; +} diff --git a/TAO/CIAO/tools/Daemon/CIAO_Installation_Data.ini b/TAO/CIAO/tools/Daemon/CIAO_Installation_Data.ini new file mode 100644 index 00000000000..259a5ec8251 --- /dev/null +++ b/TAO/CIAO/tools/Daemon/CIAO_Installation_Data.ini @@ -0,0 +1 @@ +[ComponentInstallation] diff --git a/TAO/CIAO/tools/Daemon/Daemon.idl b/TAO/CIAO/tools/Daemon/Daemon.idl new file mode 100644 index 00000000000..8c5ed9d8cda --- /dev/null +++ b/TAO/CIAO/tools/Daemon/Daemon.idl @@ -0,0 +1,28 @@ +// $Id$ + +/** + * @file daemon.idl + * + * @brief Controling interface for managing and controling CIAO daemon. + */ + +module CIAO +{ + exception NotFound {}; + + /** + * @brief CIAO daemon process control program. + */ + interface Daemon + { + // Canonical name of this daemon + readonly attribute string name; + + // Acquire a specific service + Object get_service (in string svc_name) + raises (NotFound); + + // Shutdown the daemon process. + oneway void shutdown (); + }; +}; diff --git a/TAO/CIAO/tools/Daemon/Daemon.mpc b/TAO/CIAO/tools/Daemon/Daemon.mpc new file mode 100644 index 00000000000..1b6d2ceb0ca --- /dev/null +++ b/TAO/CIAO/tools/Daemon/Daemon.mpc @@ -0,0 +1,35 @@ +project(CIAO_Daemon): ciao_server { + + libs += TAO_IORTable + libpaths += $(TAO_ROOT)/tao/IORTable + + IDL_Files { + Daemon.idl + } + + Source_Files { + DaemonC.cpp + DaemonS.cpp + Daemon_Impl.cpp + CIAO_Daemon.cpp + } +} + +project(DaemonController) : ciao_server, acexml { + + libs += CIAO_XML_Helpers + libpaths += ../XML_Helpers + depends += XML_Helpers + + IDL_Files { + Daemon.idl + } + + Source_Files { + DaemonC.cpp + DaemonController.cpp + controller_i.cpp + Daemon_Commands.cpp + Softpkg_Commands.cpp + } +} diff --git a/TAO/CIAO/tools/Daemon/DaemonController.cpp b/TAO/CIAO/tools/Daemon/DaemonController.cpp new file mode 100644 index 00000000000..d89eff6c9a5 --- /dev/null +++ b/TAO/CIAO/tools/Daemon/DaemonController.cpp @@ -0,0 +1,56 @@ +// $Id$ + +/// Run with -ORBInifRef CIAODaemon=file://daemon.ior + + +#include "controller_i.h" +#include "ace/Get_Opt.h" + +int +write_IOR(const char* ior) +{ + FILE* ior_output_file_ = + ACE_OS::fopen ("hello.ior", "w"); + + if (ior_output_file_) + { + ACE_OS::fprintf (ior_output_file_, + "%s", + ior); + ACE_OS::fclose (ior_output_file_); + } + + return 0; +} + +int +main (int argc, char *argv[]) +{ + ACE_TRY_NEW_ENV + { + CIAO::Daemon_i::controller control_module; + + int res = control_module.init (argc, argv ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (res != 0) + return -1; + + res = control_module.run (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (res != 0) + return -1; + + control_module.fini (); + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Exception caught:"); + return 1; + } + ACE_ENDTRY; + + return 0; +} diff --git a/TAO/CIAO/tools/Daemon/Daemon_Commands.cpp b/TAO/CIAO/tools/Daemon/Daemon_Commands.cpp new file mode 100644 index 00000000000..32502baaac1 --- /dev/null +++ b/TAO/CIAO/tools/Daemon/Daemon_Commands.cpp @@ -0,0 +1,348 @@ +// $Id$ + +#include "Daemon_Commands.h" +#include "ace/Get_Opt.h" +#include "CCM_DeploymentC.h" + +#if !defined (__ACE_INLINE__) +# include "Daemon_Commands.inl" +#endif /* __ACE_INLINE__ */ + +//================================================================= + +CIAO::Daemon_i::CMD_Shutdown::~CMD_Shutdown () +{ +} + +int +CIAO::Daemon_i::CMD_Shutdown::parse_args (int , + char *[] + ACE_ENV_ARG_DECL_NOT_USED) +{ + return 0; +} + +int +CIAO::Daemon_i::CMD_Shutdown::run (ACE_ENV_SINGLE_ARG_DECL) +{ + this->controller_->daemon ()->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); + return 0; +} + +//================================================================= + +CIAO::Daemon_i::CMD_Install::~CMD_Install () +{ +} + +int +CIAO::Daemon_i::CMD_Install::parse_args (int argc, + char *argv[] + ACE_ENV_ARG_DECL_NOT_USED) +{ + ACE_Get_Opt get_opts (argc, argv, "c:l:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'c': + this->component_name_ = CORBA::string_dup (get_opts.opt_arg ()); + break; + + case 'l': + this->location_ = CORBA::string_dup (get_opts.opt_arg ()); + break; + + case '?': + case 'h': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "install: %s\n" + "-c <component UUID>\n" + "-l <component location>\n" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +CIAO::Daemon_i::CMD_Install::run (ACE_ENV_SINGLE_ARG_DECL) +{ + CORBA::Object_var tmp = + this->controller_->daemon ()->get_service ("ComponentInstallation" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + Components::Deployment::ComponentInstallation_var inst = + Components::Deployment::ComponentInstallation::_narrow (tmp.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + if (CORBA::is_nil (inst.in ())) + ACE_THROW_RETURN (CORBA::INTERNAL (), -1); + + inst->install (this->component_name_.in (), + this->location_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + return 0; +} + +//================================================================= + +CIAO::Daemon_i::CMD_Uninstall::~CMD_Uninstall () +{ +} + +int +CIAO::Daemon_i::CMD_Uninstall::parse_args (int argc, + char *argv[] + ACE_ENV_ARG_DECL_NOT_USED) +{ + ACE_Get_Opt get_opts (argc, argv, "c:l:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'c': + this->component_name_ = CORBA::string_dup (get_opts.opt_arg ()); + break; + + case '?': + case 'h': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "uninstall: %s\n" + "-c <component UUID>\n" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +CIAO::Daemon_i::CMD_Uninstall::run (ACE_ENV_SINGLE_ARG_DECL) +{ + CORBA::Object_var tmp = + this->controller_->daemon ()->get_service ("ComponentInstallation" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + Components::Deployment::ComponentInstallation_var inst = + Components::Deployment::ComponentInstallation::_narrow (tmp.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + if (CORBA::is_nil (inst.in ())) + ACE_THROW_RETURN (CORBA::INTERNAL (), -1); + + inst->remove (this->component_name_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + return 0; +} + +//================================================================= + +CIAO::Daemon_i::CMD_Query::~CMD_Query () +{ +} + +int +CIAO::Daemon_i::CMD_Query::parse_args (int argc, + char *argv[] + ACE_ENV_ARG_DECL_NOT_USED) +{ + ACE_Get_Opt get_opts (argc, argv, "c:l:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'c': + this->component_name_ = CORBA::string_dup (get_opts.opt_arg ()); + break; + + case '?': + case 'h': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "query: %s\n" + "-c <component UUID>\n" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +CIAO::Daemon_i::CMD_Query::run (ACE_ENV_SINGLE_ARG_DECL) +{ + CORBA::Object_var tmp = + this->controller_->daemon ()->get_service ("ComponentInstallation" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + Components::Deployment::ComponentInstallation_var inst = + Components::Deployment::ComponentInstallation::_narrow (tmp.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + if (CORBA::is_nil (inst.in ())) + ACE_THROW_RETURN (CORBA::INTERNAL (), -1); + + CORBA::String_var str = + inst->get_implementation (this->component_name_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + ACE_DEBUG ((LM_DEBUG, + "Implmentation for %s is located at:\n\t%s\n", + this->component_name_.in (), + str.in ())); + + return 0; +} + +//================================================================= + +CIAO::Daemon_i::CMD_Replace::~CMD_Replace () +{ +} + +int +CIAO::Daemon_i::CMD_Replace::parse_args (int argc, + char *argv[] + ACE_ENV_ARG_DECL_NOT_USED) +{ + ACE_Get_Opt get_opts (argc, argv, "c:l:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'c': + this->component_name_ = CORBA::string_dup (get_opts.opt_arg ()); + break; + + case 'l': + this->location_ = CORBA::string_dup (get_opts.opt_arg ()); + break; + + case '?': + case 'h': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "replace: %s\n" + "-c <component UUID>\n" + "-l <new component location>\n" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +CIAO::Daemon_i::CMD_Replace::run (ACE_ENV_SINGLE_ARG_DECL) +{ + CORBA::Object_var tmp = + this->controller_->daemon ()->get_service ("ComponentInstallation" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + Components::Deployment::ComponentInstallation_var inst = + Components::Deployment::ComponentInstallation::_narrow (tmp.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + if (CORBA::is_nil (inst.in ())) + ACE_THROW_RETURN (CORBA::INTERNAL (), -1); + + inst->replace (this->component_name_.in (), + this->location_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + return 0; +} + +//================================================================= + +CIAO::Daemon_i::CMD_Get_IOR::~CMD_Get_IOR () +{ +} + +int +CIAO::Daemon_i::CMD_Get_IOR::parse_args (int argc, + char *argv[] + ACE_ENV_ARG_DECL_NOT_USED) +{ + ACE_Get_Opt get_opts (argc, argv, "o:n:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'n': + this->service_name_ = CORBA::string_dup (get_opts.opt_arg ()); + break; + + case 'o': + this->filename_ = CORBA::string_dup (get_opts.opt_arg ()); + break; + + case '?': + case 'h': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "get_ior: %s\n" + "-n service name\n" + "-o <filename>\n" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +CIAO::Daemon_i::CMD_Get_IOR::run (ACE_ENV_SINGLE_ARG_DECL) +{ + CORBA::Object_var tmp = + this->controller_->daemon ()->get_service (this->service_name_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + if (CORBA::is_nil (tmp.in ())) + ACE_THROW_RETURN (CIAO::NotFound (), -1); + + CORBA::String_var ior + = this->controller_->orb ()->object_to_string (tmp.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + ACE_DEBUG ((LM_DEBUG, + "%s IOR: %s\n", + this->service_name_.in (), + ior.in ())); + + if (this->filename_.in () != 0) + this->controller_->write_IOR (ior.in (), + this->filename_.in ()); + + return 0; +} diff --git a/TAO/CIAO/tools/Daemon/Daemon_Commands.h b/TAO/CIAO/tools/Daemon/Daemon_Commands.h new file mode 100644 index 00000000000..8692a8225e2 --- /dev/null +++ b/TAO/CIAO/tools/Daemon/Daemon_Commands.h @@ -0,0 +1,163 @@ +// -*- C++ -*- +// $Id$ + +/** + * @file Daemon_Commands.h + * + * @brief Controller command implementations for general Daemon command + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#ifndef CIAO_DAEMON_COMMANDS_H +#define CIAO_DAEMON_COMMANDS_H +#include "ace/pre.h" + +#include "controller_i.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + + +namespace CIAO +{ + namespace Daemon_i + { + /** + * @class CMD_Install + * + * @brief Daemon command to install a component implementation. + */ + class CMD_Install : public Command_Base + { + public: + CMD_Install (controller *c); + + virtual ~CMD_Install (); + + virtual int parse_args (int argc, + char *argv[] + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + virtual int run (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); + private: + CORBA::String_var component_name_; + CORBA::String_var location_; + }; + + /** + * @class CMD_Get_IOR + * + * @brief Daemon command that returns the IOR of some service + * available on a daemon. + */ + class CMD_Get_IOR : public Command_Base + { + public: + CMD_Get_IOR (controller *c); + + virtual ~CMD_Get_IOR (); + + virtual int parse_args (int argc, + char *argv[] + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + virtual int run (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); + private: + CORBA::String_var service_name_; + CORBA::String_var filename_; + }; + + /** + * @class CMD_Uninstall + * + * @brief Daemon command to uninstall a component implementation. + */ + class CMD_Uninstall : public Command_Base + { + public: + CMD_Uninstall (controller *c); + + virtual ~CMD_Uninstall (); + + virtual int parse_args (int argc, + char *argv[] + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + virtual int run (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); + private: + CORBA::String_var component_name_; + }; + + /** + * @class CMD_Shutdown + * + * @brief Daemon command to shutdown the daemon process. + */ + class CMD_Shutdown : public Command_Base + { + public: + CMD_Shutdown (controller *c); + + virtual ~CMD_Shutdown (); + + virtual int parse_args (int argc, + char *argv[] + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + virtual int run (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); + }; + + /** + * @class CMD_Shutdown + * + * @brief Daemon command to replace an component implementation with another one. + */ + class CMD_Replace : public Command_Base + { + public: + CMD_Replace (controller *c); + + virtual ~CMD_Replace (); + + virtual int parse_args (int argc, + char *argv[] + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + virtual int run (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); + private: + CORBA::String_var component_name_; + CORBA::String_var location_; + }; + + /** + * @class CMD_Shutdown + * + * @brief Daemon command for quering the location of an installed component. + */ + class CMD_Query : public Command_Base + { + public: + CMD_Query (controller *c); + + virtual ~CMD_Query (); + + virtual int parse_args (int argc, + char *argv[] + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + virtual int run (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); + private: + CORBA::String_var component_name_; + }; + } +} + + +#if defined (__ACE_INLINE__) +# include "Daemon_Commands.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* CIAO_DAEMON_COMMAND_H */ diff --git a/TAO/CIAO/tools/Daemon/Daemon_Commands.inl b/TAO/CIAO/tools/Daemon/Daemon_Commands.inl new file mode 100644 index 00000000000..7400f5c84ef --- /dev/null +++ b/TAO/CIAO/tools/Daemon/Daemon_Commands.inl @@ -0,0 +1,38 @@ +// -*- C++ -*- +// $Id$ + +ACE_INLINE +CIAO::Daemon_i::CMD_Install::CMD_Install (CIAO::Daemon_i::controller *c) + : Command_Base (c) +{ +} + +ACE_INLINE +CIAO::Daemon_i::CMD_Uninstall::CMD_Uninstall (CIAO::Daemon_i::controller *c) + : Command_Base (c) +{ +} + +ACE_INLINE +CIAO::Daemon_i::CMD_Query::CMD_Query (CIAO::Daemon_i::controller *c) + : Command_Base (c) +{ +} + +ACE_INLINE +CIAO::Daemon_i::CMD_Replace::CMD_Replace (CIAO::Daemon_i::controller *c) + : Command_Base (c) +{ +} + +ACE_INLINE +CIAO::Daemon_i::CMD_Get_IOR::CMD_Get_IOR (CIAO::Daemon_i::controller *c) + : Command_Base (c) +{ +} + +ACE_INLINE +CIAO::Daemon_i::CMD_Shutdown::CMD_Shutdown (CIAO::Daemon_i::controller *c) + : Command_Base (c) +{ +} diff --git a/TAO/CIAO/tools/Daemon/Daemon_Impl.cpp b/TAO/CIAO/tools/Daemon/Daemon_Impl.cpp new file mode 100644 index 00000000000..69dbd9d0708 --- /dev/null +++ b/TAO/CIAO/tools/Daemon/Daemon_Impl.cpp @@ -0,0 +1,113 @@ +// $Id$ + +#include "Daemon_Impl.h" + +#if !defined (__ACE_INLINE__) +# include "Daemon_Impl.inl" +#endif /* __ACE_INLINE__ */ + +CIAO::Daemon_Impl::~Daemon_Impl () +{ + for (Iterator i = this->table_.begin (); + i != this->table_.end (); + ++i) + { + // Deallocate the id. + CORBA::string_free (ACE_const_cast (char *, (*i).ext_id_)); + + // Release the Object. + CORBA::release ((*i).int_id_); + } + + this->table_.unbind_all (); +} + +PortableServer::POA_ptr +CIAO::Daemon_Impl::_default_POA (void) +{ + return PortableServer::POA::_duplicate (this->poa_.in ()); +} + +char * +CIAO::Daemon_Impl::name (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return CORBA::string_dup (this->name_.in ()); +} + +CORBA::Object_ptr +CIAO::Daemon_Impl::get_service (const char * svc_name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + CIAO::NotFound)) +{ + CORBA::Object_ptr found = CORBA::Object::_nil (); + + this->table_.find (svc_name, found); + + if (CORBA::is_nil (found)) + ACE_THROW_RETURN (CIAO::NotFound (), 0); + + return CORBA::Object::_duplicate (found); +} + +void +CIAO::Daemon_Impl::shutdown (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->orb_->shutdown (0 ACE_ENV_SINGLE_ARG_PARAMETER); +} + +int +CIAO::Daemon_Impl::bind (const char *id, + CORBA::Object_ptr obj) +{ + // Make sure that the supplied Object reference is valid, + // i.e. not nil. + if (id == 0 || CORBA::is_nil (obj)) + { + errno = EINVAL; + return -1; + }; + + CORBA::String_var name = CORBA::string_dup (id); + CORBA::Object_var object = CORBA::Object::_duplicate (obj); + + int result = this->table_.bind (name.in (), + object.in ()); + + if (result == 0) + { + // Transfer ownership to the Object Table. + (void) name._retn (); + (void) object._retn (); + } + + return result; +} + +int +CIAO::Daemon_Impl::unbind (const char *id) +{ + Table::ENTRY *entry = 0; + + int result = this->table_.find (id, entry); + + if (result == 0) + { + // Deallocate the external ID and obtain the ORB core pointer + // before unbinding the entry since the entry is deallocated + // during the call to unbind(). + CORBA::string_free (ACE_const_cast (char *, entry->ext_id_)); + CORBA::Object_ptr obj = entry->int_id_; + + result = this->table_.unbind (entry); + + if (result != 0) + return result; + + CORBA::release (obj); + } + + return result; +} diff --git a/TAO/CIAO/tools/Daemon/Daemon_Impl.h b/TAO/CIAO/tools/Daemon/Daemon_Impl.h new file mode 100644 index 00000000000..a9cf15fa40a --- /dev/null +++ b/TAO/CIAO/tools/Daemon/Daemon_Impl.h @@ -0,0 +1,104 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Daemon_Impl.h + * + * $Id$ + * + * This file contains servant implementation for CIAO's daemon process control + * interface. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + + +#ifndef CIAO_DAEMON_IMPL_H +#define CIAO_DAEMON_IMPL_H +#include "ace/pre.h" + +#include "DaemonS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Synch.h" +#include "ace/Hash_Map_Manager_T.h" +#include "ace/Functor.h" + +namespace CIAO +{ + /** + * @class Daemon_Impl + * + * @brief Servant implementation CIAO's daemon process control interface + * + * This class implements the CIAO:Daemon interface. We use this interface + * to acquire the + */ + class Daemon_Impl + : public virtual POA_CIAO::Daemon, + public virtual PortableServer::RefCountServantBase + { + public: + + /// Constructor + Daemon_Impl (const char *name, + CORBA::ORB_ptr o, + PortableServer::POA_ptr p); + + /// Destructor + virtual ~Daemon_Impl (void); + + /// Get the containing POA. This operation does *not* + /// increase the reference count of the POA. + virtual PortableServer::POA_ptr _default_POA (void); + + /// CIAO::Daemon defined attributes/operations. + + virtual char * name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Object_ptr get_service (const char * svc_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + CIAO::NotFound)); + + virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /** + * @name CIAO::Daemon_Impl internal operations using the + * canonical ACE_Map methods + */ + //@{ + int bind (const char *orb_id, CORBA::Object_ptr obj); + int unbind (const char *orb_id); + //@} + + protected: + typedef ACE_Hash_Map_Manager_Ex<const char *, CORBA::Object_ptr, ACE_Hash<const char *>, ACE_Equal_To<const char *>, TAO_SYNCH_MUTEX> Table; + typedef Table::iterator Iterator; + + /// Keep a pointer to the managing ORB serving this servant. + CORBA::ORB_var orb_; + + /// Keep a pointer to the managing POA. + PortableServer::POA_var poa_; + + /// My Canonical name. + CORBA::String_var name_; + + /// Internal object hash table. + Table table_; + }; +} + +#if defined (__ACE_INLINE__) +# include "Daemon_Impl.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* CIAO_DAEMON_IMPL_H */ diff --git a/TAO/CIAO/tools/Daemon/Daemon_Impl.inl b/TAO/CIAO/tools/Daemon/Daemon_Impl.inl new file mode 100644 index 00000000000..e2b4e9b3564 --- /dev/null +++ b/TAO/CIAO/tools/Daemon/Daemon_Impl.inl @@ -0,0 +1,12 @@ +/* -*- C++ -*- */ +// $Id$ + +ACE_INLINE +CIAO::Daemon_Impl::Daemon_Impl (const char *name, + CORBA::ORB_ptr o, + PortableServer::POA_ptr p) + : orb_ (CORBA::ORB::_duplicate (o)), + poa_ (PortableServer::POA::_duplicate (p)), + name_ (CORBA::string_dup (name)) +{ +} diff --git a/TAO/CIAO/tools/Daemon/README b/TAO/CIAO/tools/Daemon/README new file mode 100644 index 00000000000..c089665c782 --- /dev/null +++ b/TAO/CIAO/tools/Daemon/README @@ -0,0 +1,99 @@ +$Id$ + +CIAO_Daemon: +============ + +This directory contains CIAO's per-host daemon process implementation +- CIAO_Daemon. It includes implementations for two major CCM +interfaces, namely, ComponentImplementation and ServerActivation. +ComponentInstallation interfaces must be available per-host so all +ComponentServer running on the same host can query it to acquire +component impolementations they need. Likewise, ServerActivator +interacts with CCM's Assembly framework and is responsible to start up +new ComponentServer processes on this host. + +The Daemon process registers three simple ObjectKey, "CIAODaemon", +"ComponentInstallation", and "ServerActivator" to the IORTable, so if you +start up the CIAO_Daemon process on a fixed endpoint like: + + CIAO_Daemon -ORBEndpoint iiop://hostname:13000 + +You can get to any of the three interfaces using one of the following +IOR: + + corbaloc:iiop:hostname:13000/CIAODaemon + corbaloc:iiop:hostname:13000/ComponentInstallation + corbaloc:iiop:hostname:13000/ServerActivator + + +Other command line flags supported by ServerActivator include: + + * -o <filename> : Specify the filename where CIAO_Daemon + writes the IOR of the Daemon interface to. By + default, it writes to "daemon.ior". + DaemonController uses the IOR to get the object + refrence to interact with the Daemon process. + + * -n <pathname> : Specify the pathname to a ComponentServer + program that ServerActivator uses to + startup a ComponentServer process. + + * -d <second> : Specify the time, in second, ServerActivator will + wait for the ComponentServer to callback to notify + ServerActivator their IOR. ServerActivator + considers the activation fails if the + ComponentServer does not call back in time. + + * -i : Specify the name of the datafile ComponentInstallation + interface uses to keep the persistent installation data. By + default, CIAO_Daemon uses the file + "CIAO_Installation_Data.ini". This file (even if empty) must + exist before the process starts. + + * -s : Specify the Section name within the persistent data file the + ComponentInstallation uses to retrieve and backup the + installation data. Changing this name allows us to switch + among various sets of component implementations easily just + by restarting the daemon process. By default, CIAO_Daemon + uses the name "ComponentInstallation" if this flag is not + specified. + + +DaemonController: +================= + +This is a small command line utility program for interacting with the +CIAO_Daemon process. It offers two major function groups thru 6 +commands: + + * General daemon process control: + + - get_ior: use this command to query the IOR of any service + interfaces running on the daemon process and store the IOR into + a specified file. + + - shutdown: use this command to shutdown the daemon process. + + + * ComponentInstallation related control: + + - install: to install a new location of a component + implementation + + - uninstall: to remove a location of a component implementation + + - replace: to replace an existing compoment implementaion + location with a new one + + - query: to query the location of a component implementation + +This program uses resolve_initial_references ("CIAODaemon") to acqurie +the daemon control interface, so you must provide the reference to the +program somehow. For example: + + DaemonController -ORBInitRef CIAODaemon=file://daemon.ior <command> [command options] + +To check the parameter required for each of the commands listed above, +just append the -h command option flag, such as: + + DaemonController -ORBInitRef CIAODaemon=file://daemon.ior install -h diff --git a/TAO/CIAO/tools/Daemon/Softpkg_Commands.cpp b/TAO/CIAO/tools/Daemon/Softpkg_Commands.cpp new file mode 100644 index 00000000000..7b76d549a31 --- /dev/null +++ b/TAO/CIAO/tools/Daemon/Softpkg_Commands.cpp @@ -0,0 +1,223 @@ +// $Id$ + +#include "Softpkg_Commands.h" +#include "ace/Get_Opt.h" +#include "CCM_DeploymentC.h" +#include "../XML_Helpers/XML_Utils.h" + +#if !defined (__ACE_INLINE__) +# include "Softpkg_Commands.inl" +#endif /* __ACE_INLINE__ */ + +//================================================================= + +CIAO::Daemon_i::CMD_Start_Home::~CMD_Start_Home () +{ +} + +int +CIAO::Daemon_i::CMD_Start_Home::parse_args (int argc, + char *argv[] + ACE_ENV_ARG_DECL_NOT_USED) +{ + ACE_Get_Opt get_opts (argc, argv, "s:m:c:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 's': + this->softpkg_filename_ = CORBA::string_dup (get_opts.opt_arg ()); + break; + + case 'm': + this->home_ior_filename_ = CORBA::string_dup (get_opts.opt_arg ()); + break; + + case 'c': + this->com_server_ior_filename_ = CORBA::string_dup (get_opts.opt_arg ()); + break; + + case '?': + case 'h': + default: + this->print_usage (argv[0]); + return -1; + } + // Indicates sucessful parsing of the command line + if (this->home_ior_filename_.in () == 0 || + this->com_server_ior_filename_.in () == 0) + { + this->print_usage (argv[0]); + return -1; + } + + return 0; +} + +void +CIAO::Daemon_i::CMD_Start_Home::print_usage (const char *name) const +{ + ACE_ERROR ((LM_ERROR, + "start_home: %s\n" + "-s <softpkg filename to install>\n" + "-m <CCMHome IOR output filename>\n" + "-c <ComponentServer IOR output filename>\n" + "-? this help\n" + "\n", + name)); +} + +int +CIAO::Daemon_i::CMD_Start_Home::run (ACE_ENV_SINGLE_ARG_DECL) +{ + CIAO::Softpkg_Handler::Softpkg_Info info; + info.csd_path_ = this->softpkg_filename_.in (); + + if (CIAO::XML_Utils::parse_softpkg (&info) == 0) + { + // info.dump (); // For debug purpose. + CORBA::Object_var tmp = + this->controller_->daemon ()->get_service ("ServerActivator" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + Components::Deployment::ServerActivator_var activator = + Components::Deployment::ServerActivator::_narrow (tmp.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + if (CORBA::is_nil (activator.in ())) + ACE_THROW_RETURN (CORBA::INTERNAL (), -1); + + Components::ConfigValues server_config; + // @@ Nothing to config yet. + + Components::Deployment::ComponentServer_var com_server = + activator->create_component_server (server_config + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + CORBA::String_var ior = + this->controller_->orb ()->object_to_string (com_server.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + this->controller_->write_IOR (ior.in (), + this->com_server_ior_filename_.in ()); + + // Write IOR of newly created ComponentServer immediately. + + Components::ConfigValues container_config; + // @@ Should we get the config value from Softpkg_Info? + Components::Deployment::Container_var container = + com_server->create_container (container_config + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + Components::ConfigValues home_config; + // Setting home config value here: + home_config.length (2); + Components::ConfigValue_ptr item = new OBV_Components::ConfigValue (); + + item->name (CORBA::string_dup ("CIAO-servant-UUID")); + item->value () <<= CORBA::string_dup (info.servant_UUID_.c_str ()); + home_config[0] = item; + + item = new OBV_Components::ConfigValue (); + item->name (CORBA::string_dup ("CIAO-servant-entrypt")); + item->value () <<= CORBA::string_dup (info.servant_entrypt_.c_str ()); + home_config[1] = item; + + Components::CCMHome_var home = + container->install_home (info.executor_UUID_.c_str (), + info.executor_entrypt_.c_str (), + home_config + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + ior = + this->controller_->orb ()->object_to_string (home.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + this->controller_->write_IOR (ior.in (), + this->home_ior_filename_.in ()); + } + + return 0; +} + +//================================================================= + +CIAO::Daemon_i::CMD_End_Home::~CMD_End_Home () +{ +} + +int +CIAO::Daemon_i::CMD_End_Home::parse_args (int argc, + char *argv[] + ACE_ENV_ARG_DECL_NOT_USED) +{ + ACE_Get_Opt get_opts (argc, argv, "s:m:c:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'c': + this->com_server_ior_ = CORBA::string_dup (get_opts.opt_arg ()); + break; + + case '?': + case 'h': + default: + this->print_usage (argv[0]); + return -1; + } + // Indicates sucessful parsing of the command line + if (this->com_server_ior_.in () == 0) + { + this->print_usage (argv[0]); + return -1; + } + + return 0; +} + +void +CIAO::Daemon_i::CMD_End_Home::print_usage (const char *name) const +{ + ACE_ERROR ((LM_ERROR, + "end_home: %s\n" + "-c <ComponentServer IOR>\n" + "-? this help\n" + "\n", + name)); +} + +int +CIAO::Daemon_i::CMD_End_Home::run (ACE_ENV_SINGLE_ARG_DECL) +{ + CORBA::Object_var tmp = + this->controller_->orb ()->string_to_object (this->com_server_ior_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + Components::Deployment::ComponentServer_var server = + Components::Deployment::ComponentServer::_narrow (tmp.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + Components::Deployment::ServerActivator_var activator = + server->get_server_activator (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + activator->remove_component_server (server.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + return 0; +} + +//================================================================= diff --git a/TAO/CIAO/tools/Daemon/Softpkg_Commands.h b/TAO/CIAO/tools/Daemon/Softpkg_Commands.h new file mode 100644 index 00000000000..1137269a952 --- /dev/null +++ b/TAO/CIAO/tools/Daemon/Softpkg_Commands.h @@ -0,0 +1,89 @@ +// -*- C++ -*- +// $Id$ + +/** + * @file Softpkg_Commands.h + * + * @brief Controller commands implementations for creating and + * removing component server for a single home in a softpkg. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#ifndef CIAO_SOFTPKG_COMMANDS_H +#define CIAO_SOFTPKG_COMMANDS_H +#include "ace/pre.h" + +#include "controller_i.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + + +namespace CIAO +{ + namespace Daemon_i + { + /** + * @class CMD_Start_Home + * + * @brief Daemon command to start up a component server for hosting + * a component home as specified in a softpkg descriptor. + */ + class CMD_Start_Home : public Command_Base + { + public: + CMD_Start_Home (controller *c); + + virtual ~CMD_Start_Home (); + + virtual int parse_args (int argc, + char *argv[] + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + virtual int run (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); + + void print_usage (const char *name) const; + + private: + CORBA::String_var softpkg_filename_; + + CORBA::String_var home_ior_filename_; + + CORBA::String_var com_server_ior_filename_; + }; + + /** + * @class CMD_End_Home + * + * @brief Daemon command to end a component server that hosts a component home. + */ + class CMD_End_Home : public Command_Base + { + public: + CMD_End_Home (controller *c); + + virtual ~CMD_End_Home (); + + virtual int parse_args (int argc, + char *argv[] + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + virtual int run (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); + + void print_usage (const char *name) const; + + private: + CORBA::String_var com_server_ior_; + }; + } +} + + +#if defined (__ACE_INLINE__) +# include "Softpkg_Commands.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* CIAO_SOFTPKG_COMMANDS_H */ diff --git a/TAO/CIAO/tools/Daemon/Softpkg_Commands.inl b/TAO/CIAO/tools/Daemon/Softpkg_Commands.inl new file mode 100644 index 00000000000..9c717bccde1 --- /dev/null +++ b/TAO/CIAO/tools/Daemon/Softpkg_Commands.inl @@ -0,0 +1,14 @@ +// -*- C++ -*- +// $Id$ + +ACE_INLINE +CIAO::Daemon_i::CMD_Start_Home::CMD_Start_Home (CIAO::Daemon_i::controller *c) + : Command_Base (c) +{ +} + +ACE_INLINE +CIAO::Daemon_i::CMD_End_Home::CMD_End_Home (CIAO::Daemon_i::controller *c) + : Command_Base (c) +{ +} diff --git a/TAO/CIAO/tools/Daemon/controller_i.cpp b/TAO/CIAO/tools/Daemon/controller_i.cpp new file mode 100644 index 00000000000..54f515b4876 --- /dev/null +++ b/TAO/CIAO/tools/Daemon/controller_i.cpp @@ -0,0 +1,138 @@ +// $Id$ + +#include "controller_i.h" +#include "Daemon_Commands.h" +#include "Softpkg_Commands.h" +#include "Client_init.h" +#include "ace/Get_Opt.h" +#include "CCM_DeploymentC.h" + +#if !defined (__ACE_INLINE__) +# include "controller_i.inl" +#endif /* __ACE_INLINE__ */ + +void +CIAO::Daemon_i::controller::print_usage (void) +{ + ACE_ERROR ((LM_ERROR, + "Usage: DaemonController [options] command [command-arguments]\n" + " where [options] are ORB options\n" + " where command is one of the following:\n" + " install Install a component into the ComponentInstallation\n" + " get_ior get the IOR of a service supported by this daemon\n" + " uninstall Ininstall a component from the ComponentInstallation\n" + " shutdown Shuts down the Daemon process\n" + " replace Replace a component with another one\n" + " query Show the location of a component in the ComponentInstallation\n" + " start_home Start up a ComponentServer and install a component home\n" + " end_home Terminate a ComponentServer and remove the home and components\n" + " where [command-arguments] depend on the command\n")); +} + +int +CIAO::Daemon_i::controller::write_IOR(const char* ior, + const char *filename) +{ + FILE* ior_output_file_ = + ACE_OS::fopen (filename, "w"); + + if (ior_output_file_) + { + ACE_OS::fprintf (ior_output_file_, + "%s", + ior); + ACE_OS::fclose (ior_output_file_); + } + + return 0; +} + +int +CIAO::Daemon_i::controller::parse_args (int argc, char *argv[] ACE_ENV_ARG_DECL) +{ + // Make sure one command was given + if (argc < 2) + { + this->print_usage (); + return -1; + } + + const char *op_name = argv[1]; + + if (ACE_OS::strcasecmp (op_name, ACE_TEXT ("install")) == 0) + this->cmd_ = new CIAO::Daemon_i::CMD_Install (this); + else if (ACE_OS::strcasecmp (op_name, ACE_TEXT ("get_ior")) == 0) + this->cmd_ = new CIAO::Daemon_i::CMD_Get_IOR (this); + else if (ACE_OS::strcasecmp (op_name, ACE_TEXT ("uninstall")) == 0) + this->cmd_ = new CIAO::Daemon_i::CMD_Uninstall (this); + else if (ACE_OS::strcasecmp (op_name, ACE_TEXT ("shutdown")) == 0) + this->cmd_ = new CIAO::Daemon_i::CMD_Shutdown (this); + else if (ACE_OS::strcasecmp (op_name, ACE_TEXT ("replace")) == 0) + this->cmd_ = new CIAO::Daemon_i::CMD_Replace (this); + else if (ACE_OS::strcasecmp (op_name, ACE_TEXT ("query")) == 0) + this->cmd_ = new CIAO::Daemon_i::CMD_Query (this); + else if (ACE_OS::strcasecmp (op_name, ACE_TEXT ("start_home")) == 0) + this->cmd_ = new CIAO::Daemon_i::CMD_Start_Home (this); + else if (ACE_OS::strcasecmp (op_name, ACE_TEXT ("end_home")) == 0) + this->cmd_ = new CIAO::Daemon_i::CMD_End_Home (this); + else + { + this->print_usage (); + return -1; + } + + if (this->cmd_ == 0) + return -1; + + return this->cmd_->parse_args (argc - 1, argv + 1); +} + +int +CIAO::Daemon_i::controller::init (int argc, + char *argv[] + ACE_ENV_ARG_DECL) +{ + this->orb_ = + CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + CIAO::Client_init (this->orb_.in ()); + + CORBA::Object_var obj = this->orb_->resolve_initial_references ("CIAODaemon" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + this->daemon_ = CIAO::Daemon::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + if (CORBA::is_nil (this->daemon_.in ())) + return -1; + + if (this->parse_args (argc, argv) != 0) + return -1; + + return 0; +} + +int +CIAO::Daemon_i::controller::run (ACE_ENV_SINGLE_ARG_DECL) +{ + this->cmd_->run (ACE_ENV_SINGLE_ARG_PARAMETER); + return 0; +} + +int +CIAO::Daemon_i::controller::fini (void) +{ + this->orb_->destroy (); + delete this->cmd_; + this->cmd_ = 0; + return 0; +} + +//================================================================= + +CIAO::Daemon_i::Command_Base::~Command_Base () +{ +} diff --git a/TAO/CIAO/tools/Daemon/controller_i.h b/TAO/CIAO/tools/Daemon/controller_i.h new file mode 100644 index 00000000000..2261ee9574c --- /dev/null +++ b/TAO/CIAO/tools/Daemon/controller_i.h @@ -0,0 +1,119 @@ +// -*- C++ -*- +// $Id$ + +/** + * @file controller_i.h + * + * @brief Controller command implementations for CIAO's daemon controller. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#ifndef CIAO_CONTROLLER_I_H +#define CIAO_CONTROLLER_I_H +#include "ace/pre.h" + +#include "DaemonC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO +{ + namespace Daemon_i + { + class Command_Base; + + /** + * @class controller + * + * @brief Daemon Controller. + */ + class controller + { + public: + controller (void); + + ~controller (void); + + int parse_args (int argc, char *argv[] ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + int init (int argc, + char *argv[] + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + int run (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); + + int fini (void); + + void print_usage (void); + + int write_IOR (const char *ior, + const char *filename); + + /// Does not increase reference count. + Daemon_ptr daemon (); + CORBA::ORB_ptr orb (); + + protected: + CORBA::ORB_var orb_; + + Command_Base *cmd_; + + Daemon_var daemon_; + }; + + /** + * @class Command + * + * @brief Abstract base for CIAO daemon controller supported commands. + */ + class Command + { + public: + Command (controller *c); + + virtual ~Command () = 0; + + virtual int parse_args (int argc, + char *argv[] + ACE_ENV_ARG_DECL_WITH_DEFAULTS) = 0; + + virtual int run (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) = 0; + + protected: + controller *controller_; + }; + + /** + * @class Command_Base + * + * @brief Abstract base for CIAO daemon controller supported commands. + */ + class Command_Base + { + public: + Command_Base (controller *c); + + virtual ~Command_Base () = 0; + + virtual int parse_args (int argc, + char *argv[] + ACE_ENV_ARG_DECL_WITH_DEFAULTS) = 0; + + virtual int run (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) = 0; + + protected: + controller *controller_; + }; + } +} + + +#if defined (__ACE_INLINE__) +# include "controller_i.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* CIAO_CONTROLLER_I_H */ diff --git a/TAO/CIAO/tools/Daemon/controller_i.inl b/TAO/CIAO/tools/Daemon/controller_i.inl new file mode 100644 index 00000000000..edc71a0d4ab --- /dev/null +++ b/TAO/CIAO/tools/Daemon/controller_i.inl @@ -0,0 +1,32 @@ +// -*- C++ -*- +// $Id$ + +ACE_INLINE +CIAO::Daemon_i::controller::controller () + : cmd_ (0) +{ +} + +ACE_INLINE +CIAO::Daemon_i::controller::~controller () +{ + // this->fini (); +} + +ACE_INLINE CIAO::Daemon_ptr +CIAO::Daemon_i::controller::daemon (void) +{ + return this->daemon_.in (); +} + +ACE_INLINE CORBA::ORB_ptr +CIAO::Daemon_i::controller::orb (void) +{ + return this->orb_.in (); +} + +ACE_INLINE +CIAO::Daemon_i::Command_Base::Command_Base (CIAO::Daemon_i::controller *c) + : controller_ (c) +{ +} diff --git a/TAO/CIAO/tools/ServerActivator/README b/TAO/CIAO/tools/ServerActivator/README new file mode 100644 index 00000000000..1335c11b1a7 --- /dev/null +++ b/TAO/CIAO/tools/ServerActivator/README @@ -0,0 +1,47 @@ +$Id$ + +This directory contains an implementation of ServerActivator, which is +the per-host daemon process CIAO's deployment and assembling framework +uses to spawn new component servers on the host. CIAO currently does +not define how the deployment and assembling framework can locate +ServerActivator's so it is recommended that you start up all your +ServerActivator processes at a specific host. + +The ServerActivator implementation registers a simple ObjectKey +"ServerActivator" to the IORTable, so if you start up the +ServerActivator process with: + + ServerActivator -ORBEndpoint iiop://hostname:13000 + +You can get to the ServerActivator interface using the following +IOR: + + corbaloc:iiop:hostname:13000/ServerActivator + + +Other command line flags supported by ServerActivator include: + + * -n <pathname> : Specify the pathname ServerActivator uses to + startup a ComponentServer process. + + * -o <filename> : Specify the filename ServerActivator uses to + write the IOR. + + * -i <ior> : Specify the IOR for the ComponentInstallation interface. + It will be passed as + + "-ORBInitRef ComponentInstallation=<ior>" + + command line options to the ComponentServer. + + * -d <second> : Specify the time, in second, ServerActivator will + wait for the ComponentServer to callback to notify + ServerActivator their IOR. ServerActivator + considers the activation fails if the + ComponentServer does not call back in time. + + * -c : Try creating a container and install a home. + +There is also a simple test program in this directory called +ServerActivator_test_client. It is used to debug ServerActivator +implementation.
\ No newline at end of file diff --git a/TAO/CIAO/tools/ServerActivator/ServerActivator.cpp b/TAO/CIAO/tools/ServerActivator/ServerActivator.cpp new file mode 100644 index 00000000000..44cf4def4cb --- /dev/null +++ b/TAO/CIAO/tools/ServerActivator/ServerActivator.cpp @@ -0,0 +1,179 @@ +// $Id$ + +/** + * @file server_activator.cpp + * + * @brief CIAO's server activator implementation + * + * ServerActivator is the bootstraping mechanism to create new + * component servers on the localhost. We currently depend on + * starting the ServerActivator process on some specific port of all + * the hosts that have ServerActivator install to function properly. + */ + +#include "ServerActivator_Impl.h" +#include "tao/IORTable/IORTable.h" +#include "ace/SString.h" +#include "ace/Read_Buffer.h" +#include "ace/Get_Opt.h" + +char *ior_file_name_ = 0; +char *comserv_path_ = "../ComponentServer/ComponentServer"; +char *installation_ior_ = 0; +CORBA::ULong spawn_wait_ = 5; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "n:o:d:i:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': // get the file name to write to + ior_file_name_ = get_opts.opt_arg (); + break; + + case 'n': // get the path name to the component server + comserv_path_ = get_opts.opt_arg (); + break; + + case 'd': // get the path name to the component server + spawn_wait_ = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case 'i': // get the ior to a ComponentInstallation interface + installation_ior_ = get_opts.opt_arg (); + break; + + case '?': // display help for use of the server. + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s" + "-n <component server pathname>" + "-o <ior_output_file>" + "-d <time (in second) to wait for component server>" + "\n", + argv [0]), + -1); + } + + if (installation_ior_ == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "An IOR to a ComponentInstallation interface is needed." + " Specified with \"-i <ior>\"\n"), + -1); + + return 0; +} + +int +write_IOR(const char* ior) +{ + FILE* ior_output_file_ = + ACE_OS::fopen (ior_file_name_, "w"); + + if (ior_output_file_) + { + ACE_OS::fprintf (ior_output_file_, + "%s", + ior); + ACE_OS::fclose (ior_output_file_); + } + + return 0; +} + +int +main (int argc, char *argv[]) +{ + ACE_TRY_NEW_ENV + { + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init (argc, + argv + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (parse_args (argc, argv) != 0) + return -1; + + // Get reference to Root POA. + CORBA::Object_var obj + = orb->resolve_initial_references ("RootPOA" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableServer::POA_var poa + = PortableServer::POA::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Activate POA manager + PortableServer::POAManager_var mgr + = poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + mgr->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + CIAO::ServerActivator_Impl *activator_servant; + + ACE_NEW_RETURN (activator_servant, + CIAO::ServerActivator_Impl (orb.in (), + poa.in ()), + -1); + + activator_servant->init (comserv_path_, + spawn_wait_, + installation_ior_ + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableServer::ServantBase_var safe_servant (activator_servant); + + CORBA::String_var str = orb->object_to_string (activator_servant->_ciao_get_objref () + ACE_ENV_ARG_PARAMETER); + + CORBA::Object_var table_object = + orb->resolve_initial_references ("IORTable" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + IORTable::Table_var adapter = + IORTable::Table::_narrow (table_object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (adapter.in ())) + { + ACE_ERROR ((LM_ERROR, "Nil IORTable\n")); + } + else + { + adapter->bind ("ServerActivator", str.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + + write_IOR (str.in ()); + ACE_DEBUG ((LM_INFO, "ServerActivator IOR: %s\n", str.in ())); + + // End Deployment part + + ACE_DEBUG ((LM_DEBUG, + "Running ServerActivator...\n")); + + // Run the main event loop for the ORB. + orb->run (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "server::main\t\n"); + return 1; + } + ACE_ENDTRY; + + return 0; +} diff --git a/TAO/CIAO/tools/ServerActivator/ServerActivator.dsp b/TAO/CIAO/tools/ServerActivator/ServerActivator.dsp new file mode 100644 index 00000000000..ce5af41a3f8 --- /dev/null +++ b/TAO/CIAO/tools/ServerActivator/ServerActivator.dsp @@ -0,0 +1,102 @@ +# Microsoft Developer Studio Project File - Name="ServerActivator" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=ServerActivator - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "ServerActivator.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "ServerActivator.mak" CFG="ServerActivator - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "ServerActivator - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "ServerActivator - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "ServerActivator - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\.." /I "..\..\.." /I "..\..\ciao" /I "..\..\..\orbsvcs\orbsvcs" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib tao.lib TAO_IFR_Client.lib CIAO_Container.lib CIAO_Client.lib CIAO_Server.lib TAO_PortableServer.lib TAO_Security.lib TAO_IORTable.lib /nologo /subsystem:console /machine:I386 /out:"Release\ServerActivator.exe" /libpath:"..\..\..\..\ace" /libpath:"..\..\..\tao" /libpath:"..\..\..\tao\PortableServer" /libpath:"..\..\..\tao\IFR_Client" /libpath:"..\..\ciao" /libpath:"..\..\..\orbsvcs\orbsvcs" /libpath:"..\..\..\tao\IORTable"
+
+!ELSEIF "$(CFG)" == "ServerActivator - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "server___Win32_Debug"
+# PROP BASE Intermediate_Dir "server___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\.." /I "..\..\.." /I "..\..\ciao" /I "..\..\..\orbsvcs\orbsvcs" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib taod.lib TAO_IFR_Clientd.lib CIAO_Containerd.lib CIAO_Clientd.lib CIAO_Serverd.lib TAO_PortableServerd.lib TAO_Securityd.lib TAO_CosNamingd.lib TAO_IORTabled.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\ace" /libpath:"..\..\..\tao" /libpath:"..\..\..\tao\PortableServer" /libpath:"..\..\..\tao\IFR_Client" /libpath:"..\..\ciao" /libpath:"..\..\..\orbsvcs\orbsvcs" /libpath:"..\..\..\tao\IORTable"
+
+!ENDIF
+
+# Begin Target
+
+# Name "ServerActivator - Win32 Release"
+# Name "ServerActivator - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\ServerActivator.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/TAO/CIAO/tools/ServerActivator/ServerActivator.dsw b/TAO/CIAO/tools/ServerActivator/ServerActivator.dsw new file mode 100644 index 00000000000..87eb6a5f665 --- /dev/null +++ b/TAO/CIAO/tools/ServerActivator/ServerActivator.dsw @@ -0,0 +1,41 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "ServerActivator"=.\ServerActivator.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "ServerActivator_test_client EXE"=.\ServerActivator_test_client.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/TAO/CIAO/tools/ServerActivator/ServerActivator.mpc b/TAO/CIAO/tools/ServerActivator/ServerActivator.mpc new file mode 100644 index 00000000000..ebc7757da49 --- /dev/null +++ b/TAO/CIAO/tools/ServerActivator/ServerActivator.mpc @@ -0,0 +1,15 @@ +project(ServerActivator): ciao_server { + + libs += TAO_IORTable + libpaths += $(TAO_ROOT)/tao/IORTable + + Source_Files { + ServerActivator.cpp + } +} + +project(ServerActivator_test_client) : ciao_server { + Source_Files { + ServerActivator_test_client.cpp + } +} diff --git a/TAO/CIAO/tools/ServerActivator/ServerActivator_test_client.cpp b/TAO/CIAO/tools/ServerActivator/ServerActivator_test_client.cpp new file mode 100644 index 00000000000..71e27431aff --- /dev/null +++ b/TAO/CIAO/tools/ServerActivator/ServerActivator_test_client.cpp @@ -0,0 +1,177 @@ +// $Id$ + +#include "CCM_DeploymentC.h" +#include "Client_init.h" +#include "ace/Get_Opt.h" + +const char *ior = "file://test.ior"; +int test_container = 0; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "ck:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + + case 'c': + test_container = 1; + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s\n" + "-c Test Creating containers on ComponentServer\n" + "-k <ior>\n" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +write_IOR(const char* ior) +{ + FILE* ior_output_file_ = + ACE_OS::fopen ("hello.ior", "w"); + + if (ior_output_file_) + { + ACE_OS::fprintf (ior_output_file_, + "%s", + ior); + ACE_OS::fclose (ior_output_file_); + } + + return 0; +} + +int +main (int argc, char *argv[]) +{ + ACE_TRY_NEW_ENV + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (parse_args (argc, argv) != 0) + return 1; + + CIAO::Client_init (orb.in ()); + + CORBA::Object_var tmp = + orb->string_to_object(ior ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ::Components::Deployment::ServerActivator_var activator = + ::Components::Deployment::ServerActivator::_narrow(tmp.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (activator.in ())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Nil ServerActivator reference <%s>\n", + ior), + 1); + } + + ACE_DEBUG ((LM_DEBUG, "Try creating a ComponentServer\n")); + ::Components::ConfigValues config; + + ::Components::Deployment::ComponentServer_var comserv + = activator->create_component_server (config + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + Components::Deployment::Container_var container; + + if (test_container) + { + ACE_DEBUG ((LM_DEBUG, "Try creating a Container\n")); + + container + = comserv->create_container (config + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // now install a fake home: + Components::ConfigValues com_config (2); + com_config.length (2); + + Components::ConfigValue_ptr item = new OBV_Components::ConfigValue (); + + item->name (CORBA::string_dup ("CIAO-executor-path")); + item->value () <<= CORBA::string_dup ("hello_executors"); + com_config[0] = item; + + item = new OBV_Components::ConfigValue (); + item->name (CORBA::string_dup ("CIAO-executor-entrypt")); + item->value () <<= CORBA::string_dup ("createHelloHome_Impl"); + com_config[1] = item; + + item = new OBV_Components::ConfigValue (); + item->name (CORBA::string_dup ("CIAO-servant-path")); + item->value () <<= CORBA::string_dup ("hello_servants"); + com_config[2] = item; + + item = new OBV_Components::ConfigValue (); + item->name (CORBA::string_dup ("CIAO-servant-entrypt")); + item->value () <<= CORBA::string_dup ("createHelloHome_Servant"); + com_config[3] = item; + + // ACE_OS::sleep (2); + + Components::CCMHome_var home = + container->install_home ("a", + "b", + com_config + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::String_var hior = + orb->object_to_string (home.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + write_IOR (hior.in ()); + + while (1) + { + ACE_OS::sleep (1); + } + + ACE_DEBUG ((LM_DEBUG, "Try removing a ComponentServer\n")); + comserv->remove_container (container.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + + ACE_DEBUG ((LM_DEBUG, "Try removing a ComponentServer\n")); + activator->remove_component_server (comserv.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Exception caught:"); + return 1; + } + ACE_ENDTRY; + + return 0; +} diff --git a/TAO/CIAO/tools/ServerActivator/ServerActivator_test_client.dsp b/TAO/CIAO/tools/ServerActivator/ServerActivator_test_client.dsp new file mode 100644 index 00000000000..98789e5753c --- /dev/null +++ b/TAO/CIAO/tools/ServerActivator/ServerActivator_test_client.dsp @@ -0,0 +1,89 @@ +# Microsoft Developer Studio Project File - Name="ServerActivator_test_client EXE" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=ServerActivator_test_client EXE - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "ServerActivator_test_client.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "ServerActivator_test_client.mak" CFG="ServerActivator_test_client EXE - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "ServerActivator_test_client EXE - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "ServerActivator_test_client EXE - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "ServerActivator_test_client EXE - Win32 Release"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "..\..\..\.." /I "..\..\.." /I "..\..\ciao" /I "..\..\..\orbsvcs\orbsvcs" /D NDEBUG=1 /D WIN32=1 /D _CONSOLE=1 /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0x409 /i "..\..\..\..\orbsvcs\orbsvcs" /i "..\..\..\..\CIAO" /i "..\..\..\..\CIAO\ciao" /i "..\..\..\.." /i "..\..\..\..\tao" /i "..\..\..\..\.." /d NDEBUG=1
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 /machine:IX86
+# ADD LINK32 advapi32.lib user32.lib CIAO_Server.lib TAO_PortableServer.lib TAO_Security.lib CIAO_Container.lib TAO.lib TAO_IFR_Client.lib CIAO_Client.lib ACE.lib /nologo /version:1.3 /subsystem:console /machine:I386 /out:"ServerActivator_test_client.exe" /libpath:"..\..\..\..\ace" /libpath:"..\..\..\tao" /libpath:"..\..\..\tao\PortableServer" /libpath:"..\..\..\tao\IFR_Client" /libpath:"..\..\ciao" /libpath:"..\..\..\orbsvcs\orbsvcs"
+
+!ELSEIF "$(CFG)" == "ServerActivator_test_client EXE - Win32 Debug"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /Zi /Od /Gy /I "..\..\..\.." /I "..\..\.." /I "..\..\ciao" /I "..\..\..\orbsvcs\orbsvcs" /D _DEBUG=1 /D WIN32=1 /D _CONSOLE=1 /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0x409 /i "..\..\..\..\orbsvcs\orbsvcs" /i "..\..\..\..\CIAO" /i "..\..\..\..\CIAO\ciao" /i "..\..\..\.." /i "..\..\..\..\tao" /i "..\..\..\..\.." /d _DEBUG=1
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 /machine:IX86
+# ADD LINK32 advapi32.lib user32.lib CIAO_Serverd.lib TAO_PortableServerd.lib TAO_Securityd.lib CIAO_Containerd.lib TAOd.lib TAO_IFR_Clientd.lib CIAO_Clientd.lib ACEd.lib /nologo /version:1.3 /subsystem:console /incremental:no /debug /machine:I386 /libpath:"..\..\..\..\ace" /libpath:"..\..\..\tao" /libpath:"..\..\..\tao\PortableServer" /libpath:"..\..\..\tao\IFR_Client" /libpath:"..\..\ciao" /libpath:"..\..\..\orbsvcs\orbsvcs"
+
+!ENDIF
+
+# Begin Target
+
+# Name "ServerActivator_test_client EXE - Win32 Release"
+# Name "ServerActivator_test_client EXE - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;cxx;c"
+# Begin Source File
+
+SOURCE=.\ServerActivator_test_client.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hh"
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i;inl"
+# End Group
+# End Target
+# End Project
diff --git a/TAO/CIAO/tools/Simple_Component_Server/Makefile b/TAO/CIAO/tools/Simple_Component_Server/Makefile new file mode 100644 index 00000000000..6025957c787 --- /dev/null +++ b/TAO/CIAO/tools/Simple_Component_Server/Makefile @@ -0,0 +1,46 @@ +#---------------------------------------------------------------------------- +# +# $Id$ +# +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# Local macros +#---------------------------------------------------------------------------- + +ifndef TAO_ROOT + TAO_ROOT = $(ACE_ROOT)/TAO +endif # ! TAO_ROOT +ifndef CIAO_ROOT + CIAO_ROOT = $(ACE_ROOT)/TAO/CIAO +endif # ! CIAO_ROOT + +LDLIBS = -lTAO_IFR_Client \ + -lCIAO_Client \ + -lCIAO_Container \ + -lCIAO_Server \ + -lTAO_CosNaming \ + -lTAO_PortableServer \ + -lTAO + +SRC = Simple_Component_Server.cpp + +BIN = Simple_Component_Server + +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- + +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(TAO_ROOT)/rules.tao.GNU +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU +include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU +include $(TAO_ROOT)/taoconfig.mk + +INCLDIRS += -I$(CIAO_ROOT) -I$(TAO_ROOT)/orbsvcs/orbsvcs + +# DO NOT DELETE THIS LINE -- g++dep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. diff --git a/TAO/CIAO/tools/Simple_Component_Server/README b/TAO/CIAO/tools/Simple_Component_Server/README new file mode 100644 index 00000000000..b4e34da174e --- /dev/null +++ b/TAO/CIAO/tools/Simple_Component_Server/README @@ -0,0 +1,63 @@ +$Id$ + +Summary +------- + +This directory contains an implmentation for a "simple" component +server. + +Running +------- + +To run the component server, invoke it from command line as foloowing: + + Simple_Component_Server -i <config_file> -o <home_finder_ior_output_file> + +The <config_file> currently contains information the component server +needs to install component implementations. The detail format of the +file will be explained at the end of this file. This configuration +mechanism should eventually be replaced by the standard component +deployment interfaces so component are installed and instantiated +through a set of interfaces. + +The <home_finder_ior_output_file> points to the file name where the +component server will output a IOR (for the HomeFinder interfaces) +hosted on the component server. Currently, Simple_Component_Server +always instantiates a HomeRegistrar service within the server process. + + +Server Configuration: +--------------------- +There is currently not much to configure for the component server. + + +Config file format: +------------------- + +We are temporarily using a config file to read in the list of +components that are to be installed into the component server. Each +line of the configuration file contains a set of information for +installing one component home (the component home manages the life +cycle for managed comopnent instances.) These info. are delimited by +the vertical bar '|' characters. Here is an example for the +"HelloHome" component home in +$(CIAO_ROOT)/examples/handcrafted/Hello/. + +hello_executors|createHelloHome_Impl|hello_servants|createHelloHome_Servant|IDL:omg.org/HelloHome:1.0|IDL:omg.org/HelloWorld:1.0|HelloHome + +Here's a breakdown of what each field contains: + +0 -> Name of the DLL containing component and component home executors +1 -> Entry point (factory method) for the previous DLL +2 -> Name of the DLL containing component and component home servant + glue code. +3 -> Entry point (factory method) for the previous DLL +4 -> Repo ID for the component home interface +5 -> Repo ID for the managed component interface +6 -> Canonical name for the installed component home. + +Todos +----- + +Improve the command line processing routine. Currently, we do not +process the ORB command line options correctly. diff --git a/TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.cpp b/TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.cpp new file mode 100644 index 00000000000..4c9a00cea51 --- /dev/null +++ b/TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.cpp @@ -0,0 +1,239 @@ +// $Id$ + +#include "ciao/Container_Base.h" +#include "ace/SString.h" +#include "ace/Read_Buffer.h" +#include "ace/Get_Opt.h" +#include "ciao/HomeRegistrar_i.h" + +char *ior_file_name_ = 0; +char *component_list_ = 0; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "i:o:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': // get the file name to write to + ior_file_name_ = get_opts.opt_arg (); + break; + + case 'i': // get + component_list_ = get_opts.opt_arg (); + break; + + case '?': // display help for use of the server. + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s" + "-i <config file>" + "-o <ior_output_file>" + "\n", + argv [0]), + -1); + } + + return 0; +} + +int +write_IOR(const char *filename + const char *ior) +{ + if (filename == 0 || ior == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "A valid filename and an IOR string are required for saving IOR\n"), + -1); + + + FILE* ior_output_file_ = + ACE_OS::fopen (filename, "w"); + + if (ior_output_file_ == NULL) + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to open <%s> for writing\n", filename), + -1); + + ACE_OS::fprintf (ior_output_file_, + "%s", + ior); + + ACE_OS::fclose (ior_output_file_); + + return 0; +} + +int breakdown (char *source, + int len, + char *list[]) +{ + ACE_Tokenizer line (source); + line.delimiter_replace ('|', 0); + + int cntr = 0; + char *p; + for (p = line.next (); + p && cntr < len; + ++cntr, p=line.next ()) + list[cntr] = ACE::strnew (p); + + return cntr; +} + +void +install_homes (CIAO::Session_Container &container, + CORBA::ORB_ptr orb, + ACE_ENV_ARG_DECL_WITH_DEFAULTS) +{ + if (component_list_ == 0) + ACE_THROW (CORBA::BAD_PARAM ()); + + FILE* config_file = + ACE_OS::fopen (component_list_, "r"); + + if (config_file) + { + ACE_Read_Buffer ior_buffer (config_file); + char *data = 0; + while ((data = ior_buffer.read ('\n')) != 0) + { + char *items[10]; + auto_ptr<char> an_entry (data); + int len = breakdown (an_entry.get (), + 10, + items); + + if (len < 7) + { + ACE_DEBUG ((LM_DEBUG, "Error parsing configuration file\n")); + continue; + } + + // len should be at least such and such long so we have all + // the information we need. These items are separate with + // character '|'. + + // 0 -> DLL path to home executor + // 1 -> entry point for home executor factory + // 2 -> DLL path to servant glue code + // 3 -> entry point for servant glue code factory + + // we are not using these until we support HomeFinder. + + // 4 -> Repository ID for home interface + // 5 -> Repository ID for managed component + // 6 -> Canonical Name of home interface. + + Components::CCMHome_var home = + container.ciao_install_home (items[0], + items[1], + items[2], + items[3] + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (home)) + { + ACE_DEBUG ((LM_DEBUG, "Fail to create %s\n", items[6])); + continue; + } + } + } + ACE_OS::fclose (config_file); +} + +int +main (int argc, char *argv[]) +{ + ACE_TRY_NEW_ENV + { + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init (argc, + argv + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (parse_args (argc, argv) != 0) + return -1; + + // Get reference to Root POA. + CORBA::Object_var obj + = orb->resolve_initial_references ("RootPOA" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableServer::POA_var poa + = PortableServer::POA::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Activate POA manager + PortableServer::POAManager_var mgr + = poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + mgr->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Configuring HomeRegistrar. + obj = orb->resolve_initial_references ("NameService"); + CosNaming::NamingContext_var ns = CosNaming::NamingContext::_narrow (obj); + if (CORBA::is_nil (ns)) + return -1; + + PortableServer::Servant hr_svt = new CIAO::HomeRegistrar_Impl (ns); + PortableServer::ObjectId_var hr_oid + = poa->activate_object (hr_svt + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + obj = poa->id_to_reference (hr_oid + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CIAO::HomeRegistrar_var home_registrar = + CIAO::HomeRegistrar::_narrow (obj + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (home_registrar)) + ACE_ERROR_RETURN ((LM_ERROR, "Unable to acquire HomeRegistrar interface\n"), -1); + + CORBA::String_var str = orb->object_to_string (home_registrar.in () + ACE_ENV_ARG_PARAMETER); + write_IOR (str.in ()); + ACE_DEBUG ((LM_INFO, "HomeFinder IOR: %s\n", str.in ())); + + // Start Deployment part + + CIAO::Session_Container container (orb); + container.init (); + + // install component + + install_homes (container, orb, home_registrar ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // End Deployment part + + ACE_DEBUG ((LM_DEBUG, + "Running generic server...\n")); + + // Run the main event loop for the ORB. + orb->run (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "server::main\t\n"); + return 1; + } + ACE_ENDTRY; + + return 0; +} diff --git a/TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.dsp b/TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.dsp new file mode 100644 index 00000000000..9467178558d --- /dev/null +++ b/TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.dsp @@ -0,0 +1,102 @@ +# Microsoft Developer Studio Project File - Name="Simple_Component_Server" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Simple_Component_Server - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "Simple_Component_Server.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "Simple_Component_Server.mak" CFG="Simple_Component_Server - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Simple_Component_Server - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Simple_Component_Server - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Simple_Component_Server - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\.." /I "..\..\.." /I "..\.." /I "..\..\..\orbsvcs\orbsvcs" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib tao.lib TAO_IFR_Client.lib CIAO_Container.lib CIAO_Client.lib CIAO_Server.lib TAO_PortableServer.lib TAO_Security.lib /nologo /subsystem:console /machine:I386 /out:"Release\Simple_Component_Server.exe" /libpath:"..\..\..\..\ace" /libpath:"..\..\..\tao" /libpath:"..\..\..\tao\PortableServer" /libpath:"..\..\..\tao\IFR_Client" /libpath:"..\..\ciao" /libpath:"..\..\..\orbsvcs\orbsvcs"
+
+!ELSEIF "$(CFG)" == "Simple_Component_Server - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "server___Win32_Debug"
+# PROP BASE Intermediate_Dir "server___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\.." /I "..\..\.." /I "..\.." /I "..\..\..\orbsvcs\orbsvcs" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib taod.lib TAO_IFR_Clientd.lib CIAO_Containerd.lib CIAO_Clientd.lib CIAO_Serverd.lib TAO_PortableServerd.lib TAO_Securityd.lib TAO_CosNamingd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\ace" /libpath:"..\..\..\tao" /libpath:"..\..\..\tao\PortableServer" /libpath:"..\..\..\tao\IFR_Client" /libpath:"..\..\ciao" /libpath:"..\..\..\orbsvcs\orbsvcs"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Simple_Component_Server - Win32 Release"
+# Name "Simple_Component_Server - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Simple_Component_Server.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.dsw b/TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.dsw new file mode 100644 index 00000000000..8645d357970 --- /dev/null +++ b/TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.dsw @@ -0,0 +1,28 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "Simple_Component_Server"=.\Simple_Component_Server.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
diff --git a/TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.mpc b/TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.mpc new file mode 100644 index 00000000000..10ebccea6a4 --- /dev/null +++ b/TAO/CIAO/tools/Simple_Component_Server/Simple_Component_Server.mpc @@ -0,0 +1,3 @@ +project (Simple_Component_Server) : ciao_server { + exename = Simple_Component_Server +}
\ No newline at end of file diff --git a/TAO/CIAO/tools/XML_Helpers/Assembly_Handlers.cpp b/TAO/CIAO/tools/XML_Helpers/Assembly_Handlers.cpp new file mode 100644 index 00000000000..9b20004765d --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/Assembly_Handlers.cpp @@ -0,0 +1,924 @@ +// $Id$ + +#include "Assembly_Handlers.h" + +#if !defined (__ACE_INLINE__) +# include "Assembly_Handlers.inl" +#endif /* __ACE_INLINE__ */ + +void +CIAO::Assembly_Handler::characters (const ACEXML_Char *, + int , + int + ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ +} + +void +CIAO::Assembly_Handler::startElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *alist + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + switch (this->state_) + { + case START: + if (ACE_OS::strcmp (qName, "componentfiles") == 0) + { + ACE_DEBUG ((LM_DEBUG, "Start componentfiles\n")); + CIAO::XMLHelpers::Cascadable_DocHandler *new_handler; + + ACE_NEW (new_handler, + CIAO::Comp_File_Handler (this->context_, + this->parser_, + this, + namespaceURI, + localName, + qName, + alist + ACEXML_ENV_ARG_PARAMETER)); + ACEXML_CHECK; + + this->push_handler (new_handler, + alist + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; + } + return; + + case COMPONENTFILES_DONE: + if (ACE_OS::strcmp (qName, "partitioning") == 0) + { + ACE_DEBUG ((LM_DEBUG, "Start partitioning\n")); + CIAO::XMLHelpers::Cascadable_DocHandler *new_handler; + + ACE_NEW (new_handler, + CIAO::Partitioning_Handler (this->context_, + this->parser_, + this, + namespaceURI, + localName, + qName, + alist + ACEXML_ENV_ARG_PARAMETER)); + ACEXML_CHECK; + + this->push_handler (new_handler, + alist + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; + } + return; + + + case PLACEMENT_DONE: + if (ACE_OS::strcmp (qName, "connections") == 0) + { + ACE_DEBUG ((LM_DEBUG, "Start connections\n")); + CIAO::XMLHelpers::Cascadable_DocHandler *new_handler; + + ACE_NEW (new_handler, + CIAO::Connections_Handler (this->context_, + this->parser_, + this, + namespaceURI, + localName, + qName, + alist + ACEXML_ENV_ARG_PARAMETER)); + ACEXML_CHECK; + + this->push_handler (new_handler, + alist + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; + } + return; + + case CONNECTION_DONE: + if (ACE_OS::strcmp (qName, "extension") == 0) + { + ACE_DEBUG ((LM_DEBUG, "Start skipping extension\n")); + CIAO::XMLHelpers::Cascadable_DocHandler *new_handler; + + ACE_NEW (new_handler, + CIAO::XMLHelpers::Skip_DocHandler (this->parser_, + this, + namespaceURI, + localName, + qName, + alist + ACEXML_ENV_ARG_PARAMETER)); + ACEXML_CHECK; + + this->push_handler (new_handler, + alist + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; + } + return; + + + default: + ACEXML_THROW (ACEXML_SAXException + (ACE_TEXT ("Assembly handler internal error"))); + break; + } + ACEXML_THROW (ACEXML_SAXException + (ACE_TEXT ("Assembly handler internal error"))); +} + +void +CIAO::Assembly_Handler::endElement (const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char *qName + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + switch (this->state_) + { + case START: + if (ACE_OS::strcmp (qName, "componentfiles") == 0) + { + ACE_DEBUG ((LM_DEBUG, "End componentfiles\n")); + this->state_ = COMPONENTFILES_DONE; + } + return; + + case COMPONENTFILES_DONE: + if (ACE_OS::strcmp (qName, "partitioning") == 0) + { + ACE_DEBUG ((LM_DEBUG, "End partitioning\n")); + this->state_ = PLACEMENT_DONE; + } + return; + + case PLACEMENT_DONE: + if (ACE_OS::strcmp (qName, "connections") == 0) + { + ACE_DEBUG ((LM_DEBUG, "End connections\n")); + this->state_ = CONNECTION_DONE; + } + return; + + case CONNECTION_DONE: + if (ACE_OS::strcmp (qName, "extension") == 0) + { + ACE_DEBUG ((LM_DEBUG, "End skipping extension\n")); + this->state_ = DONE; + } + return; + + default: + ACEXML_THROW (ACEXML_SAXException + (ACE_TEXT ("Assembly handler internal error"))); + break; + } + ACEXML_THROW (ACEXML_SAXException + (ACE_TEXT ("Assembly handler internal error"))); +} + +// ================================================================= + +void +CIAO::Comp_File_Handler::endElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + ACE_TRACE ("CIAO::Comp_File_Handler::endElement"); + + --this->element_count_; + if (this->element_count_ == 0) + { + this->parent_->pop_handler (namespaceURI, + localName, + qName + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; + return; + } + + if (ACE_OS::strcmp (qName, "componentfile") == 0) + { + // @@ We can only handle fileinarchive for now. + if (this->id_.length () == 0 || this->fileinarchive_.length () == 0) + ACEXML_THROW + (ACEXML_SAXException + ("No valid id or component implementation in element \"componentfile\"")); + + if (this->context_->componentfiles_.bind (this->id_, + this->fileinarchive_) != 0) + ACEXML_THROW + (ACEXML_SAXException + ("File to bind component implementation with id in element \"componentfile\"")); + + this->id_.clear (); + this->fileinarchive_.clear (); + } + +} + +/* +<!ENTITY % simple-link-attributes " + xml:link CDATA #FIXED 'SIMPLE' + href CDATA #REQUIRED +" > + +<!ELEMENT fileinarchive + ( link? ) > +<!ATTLIST fileinarchive + name CDATA #REQUIRED > + +<!ELEMENT codebase EMPTY > +<!ATTLIST codebase + filename CDATA #IMPLIED + %simple-link-attributes; > + +<!ELEMENT link ( #PCDATA ) > +<!ATTLIST link + %simple-link-attributes; > +*/ + +void +CIAO::Comp_File_Handler::startElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + ACE_UNUSED_ARG (namespaceURI); + ACE_UNUSED_ARG (localName); + + ACE_TRACE ("CIAO::Comp_File_Handler::startElement"); + ++this->element_count_; + + if (ACE_OS::strcmp (qName, "componentfile") == 0) + { + for (size_t i = 0; i < atts->getLength (); ++i) + { + if (ACE_OS_String::strcmp (atts->getQName (i), ACE_TEXT ("id")) == 0) + { + this->id_ = atts->getValue (i); + } + else if (ACE_OS_String::strcmp (atts->getQName (i), ACE_TEXT ("type")) == 0) + { + // @@ Discard the value for now. CIAO doesn't support + // things other than CORBA component. + } + else + { + ACEXML_THROW + (ACEXML_SAXException + ("Invalid attribute encountered in element \"componentfile\"")); + } + } + } + else if (ACE_OS::strcmp (qName, "fileinarchive") == 0) + { + for (size_t i = 0; i < atts->getLength (); ++i) + { + if (ACE_OS_String::strcmp (atts->getQName (i), "name") == 0) + { + this->fileinarchive_ = atts->getValue (i); + } + else + { + ACEXML_THROW + (ACEXML_SAXException + ("Invalid attribute encountered in element \"fileinarchive\"")); + } + } + } + else if (ACE_OS::strcmp (qName, "link") == 0) + { + } + else if (ACE_OS::strcmp (qName, "codebase") == 0) + { + } + else if (ACE_OS::strcmp (qName, "componentfiles") == 0) + { + // Do nothing + } + else + { + ACE_DEBUG ((LM_DEBUG, "tag is: %s\n", qName)); + ACEXML_THROW (ACEXML_SAXException + (ACE_TEXT ("Invalid tag encounter while parsing \"componentfiles\""))); + } +} + +// ================================================================= + +void +CIAO::Partitioning_Handler::endElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + ACE_TRACE ("CIAO::Partitioning_Handler::endElement"); + + --this->element_count_; + if (this->element_count_ == 0) + { + this->parent_->pop_handler (namespaceURI, + localName, + qName + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; + return; + } + + switch (this->state_) + { + case START: + if (ACE_OS::strcmp (qName, "hostcollocation") == 0) + { + this->context_->partitioning_.insert_tail (this->host_collocation_); + this->host_collocation_ = 0; + } + else if (ACE_OS::strcmp (qName, "processcollocation") == 0) + { + if (this->host_collocation_ != 0) + this->host_collocation_->insert_tail (this->process_collocation_); + else + this->context_->partitioning_.insert_tail (this->process_collocation_); + this->process_collocation_ = 0; + } + else if (ACE_OS::strcmp (qName, "partitioning") == 0) + { + } + else if (ACE_OS::strcmp (qName, "extension") == 0) + { + // Do nothing for now. + } + else if (ACE_OS::strcmp (qName, "destination") == 0) + { + if (this->process_collocation_ != 0) + this->process_collocation_->destination (this->characters_.c_str ()); + else + this->host_collocation_->destination (this->characters_.c_str ()); + } + else if (ACE_OS::strcmp (qName, "usagename") == 0) + { + if (this->process_collocation_ != 0) + this->process_collocation_->usagename (this->characters_.c_str ()); + else + this->host_collocation_->usagename (this->characters_.c_str ()); + } + break; + + case HOMEPLACEMENT: + if (ACE_OS::strcmp (qName, "homeplacement") == 0) + { + this->state_ = START; + if (this->process_collocation_ != 0) + this->process_collocation_->insert_tail (this->home_placement_); + else if (this->host_collocation_ != 0) + this->host_collocation_->insert_tail (this->home_placement_); + else + this->context_->partitioning_.insert_tail (this->home_placement_); + this->home_placement_ = 0; + } + else if (ACE_OS::strcmp (qName, "homeplacement") == 0) + { + this->home_placement_->destination (this->characters_.c_str ()); + } + else if (ACE_OS::strcmp (qName, "usagename") == 0) + { + this->home_placement_->usagename (this->characters_.c_str ()); + } + break; + + case COMPONENT_INSTANTIATION: + if (ACE_OS::strcmp (qName, "componentinstantiation") == 0) + { + this->state_ = HOMEPLACEMENT; + this->home_placement_->insert_tail (this->comp_instance_); + this->comp_instance_ = 0; + } + else if (ACE_OS::strcmp (qName, "registercomponent") == 0) + { + this->comp_instance_->register_info_.enqueue_tail (this->comp_register_info_); + } + else if (ACE_OS::strcmp (qName, "providesidentifier") == 0) + { + this->comp_register_info_.type_ = + CIAO::Assembly_Placement::componentinstantiation::PROVIDESID; + this->comp_register_info_.port_id_ = this->characters_.c_str (); + } + else if (ACE_OS::strcmp (qName, "consumesidentifier") == 0) + { + this->comp_register_info_.type_ = + CIAO::Assembly_Placement::componentinstantiation::CONSUMESID; + this->comp_register_info_.port_id_ = this->characters_.c_str (); + } + break; + + default: + break; + } +} + +void +CIAO::Partitioning_Handler::characters (const ACEXML_Char *ch, + int start, + int length + ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + this->characters_.set (ch + start, length); +} + +void +CIAO::Partitioning_Handler::startElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + ACE_UNUSED_ARG (namespaceURI); + ACE_UNUSED_ARG (localName); + + // We are assuming we have a working ACEXML validator. + + ACE_TRACE ("CIAO::Partitioning_Handler::startElement"); + ++this->element_count_; + + switch (this->state_) + { + case START: + if (ACE_OS::strcmp (qName, "homeplacement") == 0) + { + this->state_ = HOMEPLACEMENT; + const char *id = 0; + long cardinality = + CIAO::XML_Utils::get_id_and_cardinality (id, + atts + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; + + ACEXML_NEW_THROW_EX (this->home_placement_, + CIAO::Assembly_Placement::homeplacement (id, + cardinality), + ACEXML_SAXException + ("Internal error, no memory.")); + ACEXML_CHECK; + } + else if (ACE_OS::strcmp (qName, "processcollocation") == 0) + { + const char *id = 0; + long cardinality = + CIAO::XML_Utils::get_id_and_cardinality (id, + atts + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; + + ACEXML_NEW_THROW_EX (this->process_collocation_, + CIAO::Assembly_Placement::processcollocation (id, + cardinality), + ACEXML_SAXException + ("Internal error, no memory.")); + ACEXML_CHECK; + } + else if (ACE_OS::strcmp (qName, "hostcollocation") == 0) + { + const char *id = 0; + long cardinality = + CIAO::XML_Utils::get_id_and_cardinality (id, + atts + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; + + ACEXML_NEW_THROW_EX (this->host_collocation_, + CIAO::Assembly_Placement::hostcollocation (id, + cardinality), + ACEXML_SAXException + ("Internal error, no memory.")); + ACEXML_CHECK; + } + else if (ACE_OS::strcmp (qName, "executableplacement") == 0) + { + ACEXML_THROW (ACEXML_SAXException + (ACE_TEXT ("\"executableplacement\" is not yet supported."))); + } + else if (ACE_OS::strcmp (qName, "extension") == 0) + { + ACEXML_THROW (ACEXML_SAXException + (ACE_TEXT ("\"extension\" is not yet supported."))); + } + else if (ACE_OS::strcmp (qName, "partitioning") == 0 || + ACE_OS::strcmp (qName, "destination") == 0) + { + // do nothing + } + else + { + ACEXML_THROW + (ACEXML_SAXException + ("Invalid tag encounter while parsing \"partitioning\"")); + } + break; + + case HOMEPLACEMENT: + if (ACE_OS::strcmp (qName, "componentfileref") == 0) + { + const char *id; + CIAO::XML_Utils::get_single_attribute ("idref", + id, + atts + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; + + this->home_placement_->componentfileref (id); + } + else if (ACE_OS::strcmp (qName, "componentinstantiation") == 0) + { + const char *id; + CIAO::XML_Utils::get_id_and_cardinality (id, + atts + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; + + ACEXML_NEW_THROW_EX (this->comp_instance_, + CIAO::Assembly_Placement::componentinstantiation (id), + ACEXML_SAXException + ("Internal error, no memory.")); + ACEXML_CHECK; + this->state_ = COMPONENT_INSTANTIATION; + + } + else if (ACE_OS::strcmp (qName, "registerwithhomefinder") == 0 || + ACE_OS::strcmp (qName, "registerwithnaming") == 0) + { + const char *name; + CIAO::XML_Utils::get_single_attribute ("name", + name, + atts + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; + + CIAO::Assembly_Placement::homeplacement::Register_Info reg_info; + if (ACE_OS::strcmp (qName, "registerwithhomefinder") == 0) + reg_info.type_ = CIAO::Assembly_Placement::homeplacement::HOMEFINDER; + else + reg_info.type_ = CIAO::Assembly_Placement::homeplacement::NAMING; + reg_info.name_ = name; + this->home_placement_->register_info_.enqueue_tail (reg_info); + } + // @@ Ignore the rest of element in home placement for now. + break; + + case COMPONENT_INSTANTIATION: + if (ACE_OS::strcmp (qName, "registercomponent") == 0) + { + this->comp_register_info_.reset (); + } + else if (ACE_OS::strcmp (qName, "registerwithnaming") == 0) + { + const char *name; + CIAO::XML_Utils::get_single_attribute ("name", + name, + atts + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; + + this->comp_register_info_.name_ = name; + this->comp_register_info_.method_ = + CIAO::Assembly_Placement::componentinstantiation::NAMINGSERVICE; + } + else if (ACE_OS::strcmp (qName, "writeiortofile") == 0) + { + const char *name; + CIAO::XML_Utils::get_single_attribute ("name", + name, + atts + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; + + this->comp_register_info_.name_ = name; + this->comp_register_info_.method_ = + CIAO::Assembly_Placement::componentinstantiation::IORFILE; + } + + break; + + default: + ACEXML_THROW + (ACEXML_SAXException + ("Invalid state encounter while parsing \"partitioning\"")); + } + +} + +// ================================================================= + +void +CIAO::Connections_Handler::characters (const ACEXML_Char *ch, + int start, + int length + ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + this->characters_.set (ch + start, length); +} + +void +CIAO::Connections_Handler::endElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + ACE_TRACE ("CIAO::Connections_Handler::endElement"); + + --this->element_count_; + if (this->element_count_ == 0) + { + this->parent_->pop_handler (namespaceURI, + localName, + qName + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; + return; + } + + if (ACE_OS::strcmp (qName, "stringifiedobjectref") == 0) + { + ACEXML_NEW_THROW_EX (this->resolver_, + CIAO::Assembly_Connection::IF_Resolver_Info + (CIAO::Assembly_Connection::STRINGIFIEDOBJECTREF, + this->characters_.c_str ()), + ACEXML_SAXException ("No memory left")); + ACEXML_CHECK; + return; + } + + switch (this->state_) + { + case START: + if (ACE_OS::strcmp (qName, "usesidentifier") == 0 || + ACE_OS::strcmp (qName, "emitsidentifier") == 0 || + ACE_OS::strcmp (qName, "publishesidentifier") == 0) + { + this->info_.name_ = this->characters_.c_str (); + } + else if (ACE_OS::strcmp (qName, "usesport") == 0 || + ACE_OS::strcmp (qName, "proxyhome") == 0) + { + if (this->resolver_ == 0) + ACEXML_THROW (ACEXML_SAXException ("No valide IF resolver available")); + this->info_.component_ = this->resolver_; + this->resolver_ = 0; + this->state_ = SOURCE; + } + else if (ACE_OS::strcmp (qName, "emitsport") == 0 || + ACE_OS::strcmp (qName, "publishesport") == 0) + { + if (this->resolver_ == 0) + ACEXML_THROW (ACEXML_SAXException + ("No valide nested IF resolver available")); + this->info_.component_ = this->resolver_; + this->resolver_ = 0; + } + else if (ACE_OS::strcmp (qName, "connectevent") == 0) + this->context_->connections_.enqueue_tail (this->info_); + else if (ACE_OS::strcmp (qName, "extension") == 0) + { + // @@ Not supported yet. + } + break; + + + case SOURCE: + if (ACE_OS::strcmp (qName, "destinationhome") == 0 || + ACE_OS::strcmp (qName, "existinginterface") == 0) + { + if (this->resolver_ == 0) + ACEXML_THROW (ACEXML_SAXException ("No valide IF resolver available")); + this->info_.interface_ = this->resolver_; + this->resolver_ = 0; + } + else if (ACE_OS::strcmp (qName, "consumesport") == 0) + { + if (this->resolver_ == 0) + ACEXML_THROW (ACEXML_SAXException + ("No valide nested IF resolver available")); + CIAO::Assembly_Connection::IF_Resolver_Info *nested = this->resolver_; + + ACEXML_NEW_THROW_EX (this->resolver_, + CIAO::Assembly_Connection::IF_Resolver_Info + (CIAO::Assembly_Connection::CONSUMER, + this->resolver_info_.c_str (), + nested), + ACEXML_SAXException ("No memory left")); + ACEXML_CHECK; + this->info_.interface_ = this->resolver_; + this->resolver_ = 0; + this->state_ = START; + } + else if (ACE_OS::strcmp (qName, "consumesidentifier") == 0 || + ACE_OS::strcmp (qName, "providesidentifier") == 0) + { + this->resolver_info_ = this->characters_.c_str (); + } + else if (ACE_OS::strcmp (qName, "providesport") == 0) + { + if (this->resolver_ == 0) + ACEXML_THROW (ACEXML_SAXException + ("No valide nested IF resolver available")); + CIAO::Assembly_Connection::IF_Resolver_Info *nested = this->resolver_; + + ACEXML_NEW_THROW_EX (this->resolver_, + CIAO::Assembly_Connection::IF_Resolver_Info + (CIAO::Assembly_Connection::PROVIDER, + this->resolver_info_.c_str (), + nested), + ACEXML_SAXException ("No memory left")); + ACEXML_CHECK; + this->info_.interface_ = this->resolver_; + this->resolver_ = 0; + } + else if (ACE_OS::strcmp (qName, "connectinterface") == 0 || + ACE_OS::strcmp (qName, "connecthomes") == 0) + { + this->context_->connections_.enqueue_tail (this->info_); + this->state_ = START; + } + break; + + default: + ACEXML_THROW + (ACEXML_SAXException + ("Invalid state encounter while parsing \"connections\"")); + break; + } +} + +void +CIAO::Connections_Handler::startElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + ACE_UNUSED_ARG (namespaceURI); + ACE_UNUSED_ARG (localName); + + ACE_TRACE ("CIAO::Connections_Handler::startElement"); + ++this->element_count_; + + if (ACE_OS::strcmp (qName, "componentinstantiationref") == 0) + { + const char *idref; + CIAO::XML_Utils::get_single_attribute ("idref", + idref, + atts + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; + + ACEXML_NEW_THROW_EX (this->resolver_, + CIAO::Assembly_Connection::IF_Resolver_Info + (CIAO::Assembly_Connection::COMP_IDREF, + idref), + ACEXML_SAXException ("No memory left")); + ACEXML_CHECK; + return; + } + else if (ACE_OS::strcmp (qName, "homeplacementref") == 0) + { + const char *idref; + CIAO::XML_Utils::get_single_attribute ("idref", + idref, + atts + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; + + ACEXML_NEW_THROW_EX (this->resolver_, + CIAO::Assembly_Connection::IF_Resolver_Info + (CIAO::Assembly_Connection::HOME_IDREF, + idref), + ACEXML_SAXException ("No memory left")); + ACEXML_CHECK; + return; + } + else if (ACE_OS::strcmp (qName, "namingservice") == 0) + { + const char *name; + CIAO::XML_Utils::get_single_attribute ("name", + name, + atts + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; + + ACEXML_NEW_THROW_EX (this->resolver_, + CIAO::Assembly_Connection::IF_Resolver_Info + (CIAO::Assembly_Connection::NAMINGSERVICE, + name), + ACEXML_SAXException ("No memory left")); + ACEXML_CHECK; + return; + } + else if (ACE_OS::strcmp (qName, "homefinder") == 0) + { + const char *name; + CIAO::XML_Utils::get_single_attribute ("name", + name, + atts + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; + + ACEXML_NEW_THROW_EX (this->resolver_, + CIAO::Assembly_Connection::IF_Resolver_Info + (CIAO::Assembly_Connection::HOMEFINDER, + name), + ACEXML_SAXException ("No memory left")); + ACEXML_CHECK; + return; + } + else if (ACE_OS::strcmp (qName, "traderquery") == 0) + ACEXML_THROW (ACEXML_SAXException ("\'traderquery\' is not supported yet.")); + + switch (this->state_) + { + case START: + if (ACE_OS::strcmp (qName, "connectinterface") == 0) + { + this->reset_info (atts + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; + + this->info_.type_ = CIAO::Assembly_Connection::INTERFACE; + } + else if (ACE_OS::strcmp (qName, "connectevent") == 0) + { + this->reset_info (atts + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; + this->state_ = SOURCE; + } + else if (ACE_OS::strcmp (qName, "connecthomes") == 0) + { + this->reset_info (atts + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; + this->info_.type_ = CIAO::Assembly_Connection::HOME; + } + else if (ACE_OS::strcmp (qName, "emitsport") == 0) + { + this->info_.type_ = CIAO::Assembly_Connection::EMITTER_CONSUMER; + } + else if (ACE_OS::strcmp (qName, "publishesport") == 0) + { + this->info_.type_ = CIAO::Assembly_Connection::PUBLISHER_CONSUMER; + } + else if (ACE_OS::strcmp (qName, "extension") == 0) + { + // @@ Not supported yet. + } + break; + + case SOURCE: + break; + + default: + ACEXML_THROW + (ACEXML_SAXException + ("Invalid state encounter while parsing \"connections\"")); + break; + } +} + +void +CIAO::Connections_Handler::reset_info (ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + this->info_.type_ = CIAO::Assembly_Connection::INVALID_CONN; + this->info_.id_.clear (); + this->info_.name_.clear (); + + // @@ Potential memory leaks below. Need to ensure the allocated + // memory is free when the Assembly_Spec is destroyed. + + this->info_.component_ = 0; + this->info_.interface_ = 0; + + for (size_t i = 0; i < atts->getLength (); ++i) + { + if (ACE_OS_String::strcmp (atts->getQName (i), ACE_TEXT ("id")) == 0) + this->info_.id_ = atts->getValue (i); + else + ACEXML_THROW + (ACEXML_SAXException + ("Invalid tag encounter while parsing \"componentfiles\"")); + } +} diff --git a/TAO/CIAO/tools/XML_Helpers/Assembly_Handlers.h b/TAO/CIAO/tools/XML_Helpers/Assembly_Handlers.h new file mode 100644 index 00000000000..5c9a25aa1d9 --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/Assembly_Handlers.h @@ -0,0 +1,323 @@ +// $Id$ + +//============================================================================= +/** + * @file $Name$ + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + +#ifndef CIAO_ASSEMBLY_HANDLERS_H +#define CIAO_ASSEMBLY_HANDLERS_H + +#include "Cascadable_DocHandler.h" +#include "XML_Utils.h" + +namespace CIAO +{ + + /** + * @class Assembly_Handler + * + * @brief Assembly_Handler parse the root componentassembly descriptors + * + */ + class Assembly_Handler : public CIAO::XMLHelpers::Cascadable_DocHandler + { + public: + enum CS_States + { + START, + COMPONENTFILES_DONE, + PLACEMENT_DONE, + CONNECTION_DONE, + DONE + }; + + /** + * Default constructor. + */ + Assembly_Handler (ACEXML_XMLReader *parser, + Assembly_Spec *spec + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) ; + + /** + * Default destructor. + */ + virtual ~Assembly_Handler (void); + + // Methods inherit from ACEXML_ContentHandler. + + /** + * Receive notification of character data. + */ + virtual void characters (const ACEXML_Char *ch, + int start, + int length ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /** + * Receive notification of the end of an element. + */ + virtual void endElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /** + * Receive notification of the beginning of an element. + */ + virtual void startElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *atts ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + protected: + Assembly_Spec *context_; + + CS_States state_; + + private: + }; + + /** + * @class Comp_File_Handler + * + * @brief This DocHandler handles the "componentfiles" tag + */ + class Comp_File_Handler : public CIAO::XMLHelpers::Cascadable_DocHandler + { + public: + // @@ CF_States is not used for now. + enum CF_States + { + START + }; + + /// Constructor. + Comp_File_Handler (Assembly_Spec *spec, + ACEXML_XMLReader *parser, + CIAO::XMLHelpers::Cascadable_DocHandler *parent, + const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)); + + /// Destructor + virtual ~Comp_File_Handler (); + + /** + * Receive notification of the end of an element. + */ + virtual void endElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) ; + + /** + * Receive notification of the beginning of an element. + */ + virtual void startElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) ; + + protected: + long element_count_; + + Assembly_Spec *context_; + + ACE_CString id_; + ACE_CString fileinarchive_; + + CF_States state_; + }; + + /** + * @class Partitioning_Handler + * + * @brief This DocHandler handles the "partitioning" tag + */ + class Partitioning_Handler : public CIAO::XMLHelpers::Cascadable_DocHandler + { + public: + // @@ Do we need PH_States? + enum PH_States + { + START, + HOMEPLACEMENT, + COMPONENT_INSTANTIATION + }; + + enum CHAR_States + { + IDLE, + DESTINATION + }; + + /// Constructor. + Partitioning_Handler (Assembly_Spec *spec, + ACEXML_XMLReader *parser, + CIAO::XMLHelpers::Cascadable_DocHandler *parent, + const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)); + + /// Destructor + virtual ~Partitioning_Handler (); + + /* + * Receive notification of character data. + */ + virtual void characters (const ACEXML_Char *ch, + int start, + int length + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) ; + + /** + * Receive notification of the end of an element. + */ + virtual void endElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) ; + + /** + * Receive notification of the beginning of an element. + */ + virtual void startElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) ; + + protected: + long element_count_; + + Assembly_Spec *context_; + + /// Temporary holder when building componentinstantiation spec. + Assembly_Placement::hostcollocation *host_collocation_; + + /// Temporary holder when building componentinstantiation spec. + Assembly_Placement::processcollocation *process_collocation_; + + /// Temporary holder when building homeplacement spec. + Assembly_Placement::homeplacement *home_placement_; + + /// Temporary holder when building componentinstantiation spec. + Assembly_Placement::componentinstantiation *comp_instance_; + + // State of this partitioning handler. + PH_States state_; + + ACE_CString characters_; + + /// Temporary holder when building registration information + Assembly_Placement::componentinstantiation::Register_Info comp_register_info_; + }; + + /** + * @class Connections_Handler + * + * @brief This DocHandler handles the "connections" tag + */ + class Connections_Handler : public CIAO::XMLHelpers::Cascadable_DocHandler + { + public: + enum CH_States + { + START, // parsing destination info + SOURCE // parsing source I/F resolution method + }; + + /// Constructor. + Connections_Handler (Assembly_Spec *spec, + ACEXML_XMLReader *parser, + CIAO::XMLHelpers::Cascadable_DocHandler *parent, + const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)); + + /// Destructor + virtual ~Connections_Handler (); + + /* + * Receive notification of character data. + */ + virtual void characters (const ACEXML_Char *ch, + int start, + int length + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) ; + + /** + * Receive notification of the end of an element. + */ + virtual void endElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) ; + + /** + * Receive notification of the beginning of an element. + */ + virtual void startElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) ; + + protected: + // Create a new blank Connect_Info. + void reset_info (ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) ; + + long element_count_; + + Assembly_Spec *context_; + + // Connection Info currently being built. + Assembly_Connection::Connect_Info info_; + + CH_States state_; + + // Resolver info cache. + ACE_CString resolver_info_; + + // Resolver cache. + Assembly_Connection::IF_Resolver_Info *resolver_; + + ACE_CString characters_; + }; +} + +#if defined (__ACE_INLINE__) +# include "Assembly_Handlers.inl" +#endif /* __ACE_INLINE__ */ +#endif /* CIAO_ASSEMBLY_HANDLERS_H */ diff --git a/TAO/CIAO/tools/XML_Helpers/Assembly_Handlers.inl b/TAO/CIAO/tools/XML_Helpers/Assembly_Handlers.inl new file mode 100644 index 00000000000..32c53b4af5b --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/Assembly_Handlers.inl @@ -0,0 +1,117 @@ +// $Id$ + +ACE_INLINE +CIAO::Assembly_Handler::Assembly_Handler (ACEXML_XMLReader *reader, + Assembly_Spec *spec + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + : Cascadable_DocHandler (reader, + 0, + 0, + 0, + 0, + 0 + ACEXML_ENV_ARG_PARAMETER), + context_ (spec), + state_ (START) +{ +} + +ACE_INLINE +CIAO::Assembly_Handler::~Assembly_Handler (void) +{ +} + +// ================================================================= + +ACE_INLINE +CIAO::Comp_File_Handler::Comp_File_Handler (Assembly_Spec *spec, + ACEXML_XMLReader *parser, + CIAO::XMLHelpers::Cascadable_DocHandler *p, + const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + : Cascadable_DocHandler (parser, + p, + namespaceURI, + localName, + qName, + atts + ACEXML_ENV_ARG_PARAMETER), + element_count_ (0), + context_ (spec), + state_ (START) +{ +} + +ACE_INLINE +CIAO::Comp_File_Handler::~Comp_File_Handler (void) +{ +} + +// ================================================================= + +ACE_INLINE +CIAO::Partitioning_Handler::Partitioning_Handler (Assembly_Spec *spec, + ACEXML_XMLReader *parser, + CIAO::XMLHelpers::Cascadable_DocHandler *p, + const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + : Cascadable_DocHandler (parser, + p, + namespaceURI, + localName, + qName, + atts + ACEXML_ENV_ARG_PARAMETER), + element_count_ (0), + context_ (spec), + host_collocation_ (0), + process_collocation_ (0), + home_placement_ (0), + comp_instance_ (0), + state_ (START) +{ +} + +ACE_INLINE +CIAO::Partitioning_Handler::~Partitioning_Handler (void) +{ +} + +// ================================================================= + +ACE_INLINE +CIAO::Connections_Handler::Connections_Handler (Assembly_Spec *spec, + ACEXML_XMLReader *parser, + CIAO::XMLHelpers::Cascadable_DocHandler *p, + const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + : Cascadable_DocHandler (parser, + p, + namespaceURI, + localName, + qName, + atts + ACEXML_ENV_ARG_PARAMETER), + element_count_ (0), + context_ (spec), + state_ (START) +{ +} + +ACE_INLINE +CIAO::Connections_Handler::~Connections_Handler (void) +{ +} diff --git a/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.cpp b/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.cpp new file mode 100644 index 00000000000..f0ce278f379 --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.cpp @@ -0,0 +1,101 @@ +// $Id$ + +#include "Assembly_Spec.h" + +#if !defined (__ACE_INLINE__) +# include "Assembly_Spec.inl" +#endif /* __ACE_INLINE__ */ + + +// ================================================================ + +int +CIAO::Assembly_Placement::Node::accept +(CIAO::Assembly_Placement::Visitor & + ACE_ENV_ARG_DECL) +{ + // This should have never gotten called. + ACE_ASSERT (0); + return -1; +} + +CIAO::Assembly_Placement::Node::~Node () +{ +} + +// ================================================================ + +int +CIAO::Assembly_Placement::Container::accept +(CIAO::Assembly_Placement::Visitor &visitor + ACE_ENV_ARG_DECL) +{ + return visitor.visit_Container (this + ACE_ENV_ARG_PARAMETER); +} + +// ================================================================ + +int +CIAO::Assembly_Placement::componentinstantiation::accept +(CIAO::Assembly_Placement::Visitor &visitor + ACE_ENV_ARG_DECL) +{ + return visitor.visit_componentinstantiation (this + ACE_ENV_ARG_PARAMETER); +} + +CIAO::Assembly_Placement::componentinstantiation::~componentinstantiation () +{ +} + +// ================================================================ + +int +CIAO::Assembly_Placement::homeplacement::accept +(CIAO::Assembly_Placement::Visitor &visitor + ACE_ENV_ARG_DECL) +{ + return visitor.visit_homeplacement (this + ACE_ENV_ARG_PARAMETER); +} + +CIAO::Assembly_Placement::homeplacement::~homeplacement () +{ +} + +// ================================================================ + +int +CIAO::Assembly_Placement::hostcollocation::accept +(CIAO::Assembly_Placement::Visitor &visitor + ACE_ENV_ARG_DECL) +{ + return visitor.visit_hostcollocation (this + ACE_ENV_ARG_PARAMETER); +} + +CIAO::Assembly_Placement::hostcollocation::~hostcollocation () +{ +} + +// ================================================================ + +int +CIAO::Assembly_Placement::processcollocation::accept +(CIAO::Assembly_Placement::Visitor &visitor + ACE_ENV_ARG_DECL) +{ + return visitor.visit_processcollocation (this + ACE_ENV_ARG_PARAMETER); +} + +CIAO::Assembly_Placement::processcollocation::~processcollocation () +{ +} + +// ================================================================ + +CIAO::Assembly_Placement::Visitor::~Visitor (void) +{ +} diff --git a/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.h b/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.h new file mode 100644 index 00000000000..f4746470d0b --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.h @@ -0,0 +1,395 @@ +// $Id$ + +//============================================================================= +/** + * @file $Name$ + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + +#ifndef CIAO_ASSEMBLY_SPEC_H +#define CIAO_ASSEMBLY_SPEC_H + +#include "ace/Hash_Map_Manager_T.h" +#include "ace/Containers_T.h" +#include "ace/SString.h" +#include "ace/CORBA_macros.h" +#include "XML_Helpers_Export.h" + +namespace CIAO +{ + /** + * @typedef ID_IMPL_MAP + * + * A hash map type for indexing implmentation IDs to corresponding + * softpkg paths. + */ + typedef ACE_Hash_Map_Manager_Ex<ACE_CString, + ACE_CString, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> ID_IMPL_MAP; + + namespace Assembly_Placement + { + /** + * @enum Node Type + */ + typedef enum _nodetype + { + INVALID_NODE, + INVALID_CONTAINER, + HOST, + PROCESS, + HOME, + COMPONENT + } Node_Type; + + // Forward declaration. + class Visitor; + + /** + * @class Node + * + * Abstract base class for placement information + */ + class CIAO_XML_HELPERS_Export Node + { + public: + /// Default constructor. + Node (const char *id = 0); + + /// Accepting a visitor. + virtual int accept (Visitor &v + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + virtual ~Node (); + + void usagename (const char *un); + const char *usagename (void) const; + + const char *id (void) const; + + /// Double linked list required internal data + Node *prev_; + Node *next_; + + protected: + /// Node ID. + ACE_CString id_; + + /// Usage information. + ACE_CString usagename_; + }; + + /** + * @class Container + * + * Abstract base class for container type placement node + */ + class CIAO_XML_HELPERS_Export Container + : public Node, + public ACE_Double_Linked_List<Node> + { + public: + Container (const char *id, + unsigned long cardinality); + + /// Accepting a visitor. + virtual int accept (Visitor &v + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + //@{ + /** Accesor/mutator for destination information */ + void destination (const char *des); + const char *destination (void) const; + + unsigned long cardinality (void) const; + //@} + + protected: + /// A corbaloc string pointing to a CIAO_Daemon interface. + ACE_CString destination_; + + // cardinality + unsigned long cardinality_; + }; + + /** + * @class componentinstantiation + */ + class CIAO_XML_HELPERS_Export componentinstantiation + : public Node + { + public: + typedef enum _if_register_type + { + COMPONENT, + PROVIDESID, + CONSUMESID + } IF_Register_Type; + + typedef enum _register_method + { + NAMINGSERVICE, + IORFILE // CIAO extension + } Register_Method; + + typedef struct _register_info + { + IF_Register_Type type_; + Register_Method method_; + + ACE_CString port_id_; + ACE_CString name_; + + void reset () + { + type_ = COMPONENT; + port_id_.clear (); + name_.clear (); + } + } Register_Info; + + componentinstantiation (const char *id); + + + /// Accepting a visitor. + virtual int accept (Visitor &v + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + virtual ~componentinstantiation (); + + typedef ACE_Unbounded_Queue <Register_Info> REGISTRATION_QUEUE; + REGISTRATION_QUEUE register_info_; + + protected: + }; + + /** + * @class homeplacement + */ + class CIAO_XML_HELPERS_Export homeplacement + : public Container + { + public: + typedef enum _register_method + { + HOMEFINDER, + NAMING, + TRADER // No implementation for trader yet. + } Register_Method; + + typedef struct _register_info + { + /// Register_Method + Register_Method type_; + + /// Name to be registered with the finder/namingservice + ACE_CString name_; + } Register_Info; + + homeplacement (const char *id, + unsigned long cardinality = 1); + /// Accepting a visitor. + virtual int accept (Visitor &v + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + virtual ~homeplacement (); + + //@{ + /** Accessor/mutator functions */ + void componentfileref (const char *file); + const char *componentfileref (void) const; + //@} + + ACE_Unbounded_Queue <Register_Info> register_info_; + + protected: + // idref to component implementation file. + ACE_CString componentfileref_; + }; + + /** + * @class hostcollocation + */ + class CIAO_XML_HELPERS_Export hostcollocation + : public Container + { + public: + hostcollocation (const char *id, + unsigned long cardinality = 1); + + /// Accepting a visitor. + virtual int accept (Visitor &v + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + virtual ~hostcollocation (); + + protected: + }; + + /** + * @class hostcollocation + */ + class CIAO_XML_HELPERS_Export processcollocation + : public Container + { + public: + processcollocation (const char *id, + unsigned long cardinality = 1); + + /// Accepting a visitor. + virtual int accept (Visitor &v + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + virtual ~processcollocation (); + + protected: + }; + + /** + * @class Placement_Visitor + * + * Abstract Base class for placement node visitor. + */ + class CIAO_XML_HELPERS_Export Visitor + { + public: + Visitor (); + + virtual ~Visitor () = 0; + + virtual int visit_Container (Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) = 0; + + virtual int visit_hostcollocation (hostcollocation *hc + ACE_ENV_ARG_DECL_WITH_DEFAULTS) = 0; + + virtual int visit_processcollocation (processcollocation *pc + ACE_ENV_ARG_DECL_WITH_DEFAULTS) = 0; + + virtual int visit_homeplacement (homeplacement *hp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) = 0; + + virtual int visit_componentinstantiation (componentinstantiation *ci + ACE_ENV_ARG_DECL_WITH_DEFAULTS) = 0; + + protected: + }; + } + + namespace Assembly_Connection + { + /** + * + */ + typedef enum _if_resolution + { + PROVIDER, // Requires a component ref. (compound) + CONSUMER, // Requires a component ref. (compound) + COMP_IDREF, // Requires an idref + HOME_IDREF, // Requires an idref + NAMINGSERVICE, // Requires a name + STRINGIFIEDOBJECTREF, // Requires an IOR + HOMEFINDER, // Requries a name (similar to naming) + TRADERQUERY // Require trader query structure. No support for now. + } IF_Resolution_Method; + + typedef enum _conxion_type + { + INTERFACE, + EMITTER_CONSUMER, + PUBLISHER_CONSUMER, + HOME, + INVALID_CONN + } Connection_Type; + + class CIAO_XML_HELPERS_Export IF_Resolver_Info + { + public: + IF_Resolver_Info (IF_Resolution_Method type, + const char *info, + IF_Resolver_Info *nested = 0); + + ~IF_Resolver_Info (); + + IF_Resolution_Method resolver_type (void) const; + + /// The string we use to resolve the interface. + const char *resolver_info (void) const; + + /// Return a nested resolver this resolver depends on. + IF_Resolver_Info *nested_resolver (void); + + /// Return the trader structure. (Not implemented yet. + /// therefore, we are returning void * for now.) + void *traderquery (void) const; + + protected: + /// Hints the kind of resolve info. + IF_Resolution_Method resolver_type_; + + /// Information this info contains + ACE_CString resolver_info_; + + /// Dependent resolver info. + IF_Resolver_Info *nested_resolver_; + + /// @@@ Future placeholder for trader query info. + void *traderquery_; + }; + + /** + * + */ + typedef struct CIAO_XML_HELPERS_Export _CII + { + _CII (); + + ~_CII (); + + // The kind of connection this info describes. + Connection_Type type_; + + /// The id of the connection. + ACE_CString id_; + + /// The name of the receptacle or consumer. + ACE_CString name_; + + /// The component that uses the receptacle or consumes the event. + IF_Resolver_Info *component_; + + /// The interface that is to be connected to the port. + IF_Resolver_Info *interface_; + + } Connect_Info; + } + + /** + * + */ + typedef struct CIAO_XML_HELPERS_Export _ASpec + { + _ASpec (); + + /// ID to implementation map. + ID_IMPL_MAP componentfiles_; + + /// Partitioning data + Assembly_Placement::Container partitioning_; + + /// Connection data + typedef ACE_Unbounded_Queue<Assembly_Connection::Connect_Info> CONNECTION_QUEUE; + CONNECTION_QUEUE connections_; + } Assembly_Spec; +} + +#if defined (__ACE_INLINE__) +# include "Assembly_Spec.inl" +#endif /* __ACE_INLINE__ */ +#endif /* CIAO_ASSEMBLY_SPEC_H */ diff --git a/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.inl b/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.inl new file mode 100644 index 00000000000..711fd5816ed --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.inl @@ -0,0 +1,189 @@ +// $Id$ + +// ================================================================ + +ACE_INLINE +CIAO::Assembly_Placement::Node::Node (const char *id) + : prev_ (0), + next_ (0), + id_ (id) +{ +} + +ACE_INLINE void +CIAO::Assembly_Placement::Node::usagename (const char *un) +{ + this->usagename_ = un; +} + +ACE_INLINE const char * +CIAO::Assembly_Placement::Node::usagename () const +{ + return this->usagename_.c_str (); +} + +ACE_INLINE const char * +CIAO::Assembly_Placement::Node::id () const +{ + return this->id_.c_str (); +} + +// ================================================================ + +ACE_INLINE +CIAO::Assembly_Placement::Container::Container (const char *id, + unsigned long cardinality) + : CIAO::Assembly_Placement::Node (id), + cardinality_ (cardinality) +{ +} + +ACE_INLINE void +CIAO::Assembly_Placement::Container::destination (const char *des) +{ + this->destination_ = des; +} + +ACE_INLINE const char * +CIAO::Assembly_Placement::Container::destination (void) const +{ + if (this->destination_.length () == 0) + return 0; + return this->destination_.c_str (); +} + +ACE_INLINE unsigned long +CIAO::Assembly_Placement::Container::cardinality (void) const +{ + return this->cardinality_; +} + +// ================================================================ + +ACE_INLINE +CIAO::Assembly_Placement::componentinstantiation::componentinstantiation (const char *id) + : CIAO::Assembly_Placement::Node (id) +{ +} + +// ================================================================ + +ACE_INLINE +CIAO::Assembly_Placement::homeplacement::homeplacement (const char *id, + unsigned long cardinality) + : CIAO::Assembly_Placement::Container (id, + cardinality) +{ +} + +ACE_INLINE const char * +CIAO::Assembly_Placement::homeplacement::componentfileref (void) const +{ + return this->componentfileref_.c_str (); +} + +ACE_INLINE void +CIAO::Assembly_Placement::homeplacement::componentfileref (const char *ref) +{ + this->componentfileref_ = ref; +} + +// ================================================================ + +ACE_INLINE +CIAO::Assembly_Placement::hostcollocation::hostcollocation (const char *id, + unsigned long cardinality) + : CIAO::Assembly_Placement::Container (id, cardinality) +{ +} + +// ================================================================ + +ACE_INLINE +CIAO::Assembly_Placement::processcollocation::processcollocation (const char *id, + unsigned long cardinality) + : CIAO::Assembly_Placement::Container (id, cardinality) +{ +} + +// ================================================================ + +ACE_INLINE +CIAO::Assembly_Placement::Visitor::Visitor (void) +{ +} + +// ================================================================ + +ACE_INLINE +CIAO::Assembly_Connection::IF_Resolver_Info::IF_Resolver_Info +(CIAO::Assembly_Connection::IF_Resolution_Method type, + const char *info, + CIAO::Assembly_Connection::IF_Resolver_Info *nested) + : resolver_type_ (type), + resolver_info_ (info), + nested_resolver_ (nested), + traderquery_ (0) +{ +} + +ACE_INLINE +CIAO::Assembly_Connection::IF_Resolver_Info::~IF_Resolver_Info (void) +{ + delete this->nested_resolver_; +} + +ACE_INLINE CIAO::Assembly_Connection::IF_Resolution_Method +CIAO::Assembly_Connection::IF_Resolver_Info::resolver_type (void) const +{ + return this->resolver_type_; +} + +ACE_INLINE const char * +CIAO::Assembly_Connection::IF_Resolver_Info::resolver_info (void) const +{ + return this->resolver_info_.c_str (); +} + +ACE_INLINE CIAO::Assembly_Connection::IF_Resolver_Info * +CIAO::Assembly_Connection::IF_Resolver_Info::nested_resolver (void) +{ + return this->nested_resolver_; +} + +ACE_INLINE void * +CIAO::Assembly_Connection::IF_Resolver_Info::traderquery (void) const +{ + return this->traderquery_; +} + +// ================================================================ + +ACE_INLINE +CIAO::Assembly_Connection::_CII::_CII (void) + : type_ (CIAO::Assembly_Connection::INVALID_CONN), + component_ (0), + interface_ (0) +{ +} + +ACE_INLINE +CIAO::Assembly_Connection::_CII::~_CII (void) +{ + // Do not manage memory here. We will try to manage the memory + // explicitly for now. +#if 0 + delete this->component_; + delete this->interface_; +#endif /* 0 */ +} + +// ================================================================ + +ACE_INLINE +CIAO::_ASpec::_ASpec (void) + : partitioning_ ("CIAO_ROOT_PARTITIONING", + 0) + +{ +} diff --git a/TAO/CIAO/tools/XML_Helpers/Cascadable_DocHandler.cpp b/TAO/CIAO/tools/XML_Helpers/Cascadable_DocHandler.cpp new file mode 100644 index 00000000000..e4fe356907b --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/Cascadable_DocHandler.cpp @@ -0,0 +1,161 @@ +// $Id$ + +#include "Cascadable_DocHandler.h" + +#if !defined (__ACE_INLINE__) +# include "Cascadable_DocHandler.i" +#endif /* __ACE_INLINE__ */ + +CIAO::XMLHelpers::Cascadable_DocHandler::Cascadable_DocHandler (ACEXML_XMLReader *parser, + Cascadable_DocHandler *parent, + const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes * + ACEXML_ENV_ARG_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) + : namespaceURI_ (ACE::strnew (namespaceURI)), + localName_ (ACE::strnew (localName)), + qName_ (ACE::strnew (qName)), + parser_ (parser), + parent_ (parent), + child_ (0), + locator_ (0) +{ +} + +CIAO::XMLHelpers::Cascadable_DocHandler::~Cascadable_DocHandler () +{ + delete[] this->namespaceURI_; + delete[] this->localName_; + delete[] this->qName_; + delete[] this->child_; +} + +void +CIAO::XMLHelpers::Cascadable_DocHandler::destroy () +{ + delete this; +} + + +void +CIAO::XMLHelpers::Cascadable_DocHandler::push_handler (Cascadable_DocHandler *new_handler, + ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // This method should be invoked from this->startElement (). + + new_handler->setDocumentLocator (this->locator_); + this->child_ = new_handler; + this->parser_->setContentHandler (new_handler); + this->parser_->setDTDHandler (new_handler); + this->parser_->setEntityResolver (new_handler); + this->parser_->setErrorHandler (new_handler); + + new_handler->startElement (new_handler->namespaceURI (), + new_handler->localName (), + new_handler->qName (), + atts + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; +} + +void +CIAO::XMLHelpers::Cascadable_DocHandler::pop_handler (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // This method should be invoked from this->child_->endElement (). + + this->parser_->setContentHandler (this); + this->parser_->setDTDHandler (this); + this->parser_->setEntityResolver (this); + this->parser_->setErrorHandler (this); + + // endElement should harvest the parse result stored in the + // this->child_ somehow because it's the last chance to do so. + this->endElement (namespaceURI, + localName, + qName + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; + + this->child_->destroy (); + this->child_ = 0; +} + +void +CIAO::XMLHelpers::Cascadable_DocHandler::print_warning (const ACEXML_Char *level, + ACEXML_SAXParseException & ex + ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + ACE_DEBUG ((LM_DEBUG, "%s (%s): line :%d col: %d ", + level, + this->locator_->getSystemId (), + this->locator_->getLineNumber(), + this->locator_->getColumnNumber())); + ex.print(); + ACE_DEBUG ((LM_DEBUG, "\n")); +} + +CIAO::XMLHelpers::Skip_DocHandler::Skip_DocHandler (ACEXML_XMLReader *parser, + Cascadable_DocHandler *parent, + const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *attrs + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + // The exception stuff will not work for platform without native exception. + : Cascadable_DocHandler (parser, + parent, + namespaceURI, + localName, + qName, + attrs + ACEXML_ENV_ARG_PARAMETER), + element_count_ (0) +{ +} + +CIAO::XMLHelpers::Skip_DocHandler::~Skip_DocHandler () +{ +} + +void +CIAO::XMLHelpers::Skip_DocHandler::endElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + ACE_TRACE ("CIAO::XMLHelpers::Skip_DocHandler::endElement"); + + --this->element_count_; + if (this->element_count_ == 0) + { + this->parent_->pop_handler (namespaceURI, + localName, + qName + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; + } +} + +void +CIAO::XMLHelpers::Skip_DocHandler::startElement (const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char *, + ACEXML_Attributes * + ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + ACE_TRACE ("CIAO::XMLHelpers::Skip_DocHandler::startElement"); + + ++this->element_count_; +} diff --git a/TAO/CIAO/tools/XML_Helpers/Cascadable_DocHandler.h b/TAO/CIAO/tools/XML_Helpers/Cascadable_DocHandler.h new file mode 100644 index 00000000000..875bed6d50a --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/Cascadable_DocHandler.h @@ -0,0 +1,252 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Cascadable_DocHandler.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= +#ifndef CIAO_XMLHELPERS_CASCADABLE_DOCHANDLER_H +#define CIAO_XMLHELPERS_CASCADABLE_DOCHANDLER_H + +#include "ace/pre.h" +#include "ACEXML/common/DefaultHandler.h" +#include "ACEXML/common/XMLReader.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO +{ + namespace XMLHelpers + { + /** + * @class Cascadable_DocHandler + * + * @brief A helper class for implementing cascadable XML Document Handler. + * + * This class is available as a convenience base class for writing + * cascadable XML Document DefaultHandler. This class implement + * the basic functionality for DocHandlers that can be cascaded + * together to handling nested XML tags. Users can write specific + * handlers to handle specific XML elements so they can be + * composed together to handle complex XML definitions. This + * class utilize the "Interpreter" design pattern as described in + * GoF. + * + * Application writers should extend this class to implement a + * handler that interpret a specific XML element. There are just + * a few rules to use the Cascadable_DocHandler. + * + * 1. A Cascadable_DocHandler determines whether a new + * Cascadable_DocHandler should be used to handle a subelement + * in its startElement method. When it encounter a subelement + * that requires a different implementation of + * Cascadable_DocHandler, it should create the new + * Cascadable_DocHandler, and then invoke the @c push_handler + * method to inform the @c parser to use the new handler (this + * in effect switches all four handlers the parse uses to the + * new handler.) + * + * 2. A Cascadable_DocHandler determines whether it has done + * handling an element structure in @a endElement method, it + * invoke the pop_handler method of its parent handler. The + * pop_handler in turn invokes the endElement eventhandler of + * the parent handler so it has a chance to harvest the parse + * result from the child handler. + * + * See the Handler-Interaction.png for how handlers interact with + * each other. + * + * @sa ACEXML_DefaultHandler + * @sa DocHandler_Context + */ + class Cascadable_DocHandler : public ACEXML_DefaultHandler + { + public: + /** + * Constructor. + */ + Cascadable_DocHandler (ACEXML_XMLReader *parser, + Cascadable_DocHandler *parent, + const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) ; + + /** + * destructor. + */ + virtual ~Cascadable_DocHandler (void); + + /** + * Destroy method. + */ + virtual void destroy (); + + /** + * THIS function should be called by the @c startElement method + * of the parent Handler to replace it (the current *Handlers) + * the parser is using with the this Handler. This method will + * also invoke the startElement operations of this Handler. + * + * @@ I haven't figured out what should happen if an exception + * occurs in push_handler. It can either restore the original + * handler, or let the user decide what to do. + */ + void push_handler (Cascadable_DocHandler *new_handler, + ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) ; + + /** + * This function should be called at the end of @c endElement + * method of this Handler to restore the Handler's used by the + * parser. This method aldo invokes the @c endElement method of + * the parent Handler before restoring the parser Handlers. + * This allows the parent handler to have a chance to harvest + * the parse result from this Handler. @c pop_handler will + * eventually invoke the @c destroy method of child handler. + * Since @c pop_handler should be invoked from child handler's + * @c endElement method, care should be taken to avoid accessing + * free'ed memory after calling parent's @c pop_handler method. + */ + void pop_handler (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) ; + + /** + * Accessors for the element Context we are in. Make copy if + * you need to store the return strings for later use. + */ + const ACEXML_Char *namespaceURI (void) const; + const ACEXML_Char *localName (void) const; + const ACEXML_Char *qName (void) const; + + /** + * Receive an object for locating the origin of SAX document events. + */ + virtual void setDocumentLocator (ACEXML_Locator *locator) ; + + // Methods inherit from ACEXML_ErrorHandler. + + /** + * Receive notification of a recoverable error. + */ + virtual void error (ACEXML_SAXParseException &exception + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /** + * Receive notification of a non-recoverable error. + */ + virtual void fatalError (ACEXML_SAXParseException &exception + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /** + * Receive notification of a warning. + */ + virtual void warning (ACEXML_SAXParseException &exception + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + protected: + /** + * Print out an error/warning message + */ + virtual void print_warning (const ACEXML_Char *level, + ACEXML_SAXParseException &exception + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /** + * Element tag information. + */ + ACEXML_Char *namespaceURI_; + ACEXML_Char *localName_; + ACEXML_Char *qName_; + + /// Pointer to the parser that send us events. + ACEXML_XMLReader *parser_; + + /// Pointer to the parent event handler that handles the parent + /// element. + Cascadable_DocHandler *parent_; + + /// Pointer to the child event handler that handles a sub-element. + Cascadable_DocHandler *child_; + + private: + /// No implement + Cascadable_DocHandler (); + + /// Pointer to Locator. + ACEXML_Locator* locator_; + }; + + /** + * @class Skip_DocHandler + * + * @brief This DocHandler ignore and skip over a specific tag. + */ + class Skip_DocHandler : public Cascadable_DocHandler + { + public: + /// Constructor. + Skip_DocHandler (ACEXML_XMLReader *parser, + Cascadable_DocHandler *parent, + const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)); + + /// Destructor + virtual ~Skip_DocHandler (); + + /** + * Receive notification of the end of an element. + */ + virtual void endElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) ; + + /** + * Receive notification of the beginning of an element. + */ + virtual void startElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) ; + + protected: + long element_count_; + }; + + } +} + +#if defined (__ACE_INLINE__) +# include "Cascadable_DocHandler.i" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* CIAO_XMLHELPERS_CASCADABLE_DOCHANDLER_H */ diff --git a/TAO/CIAO/tools/XML_Helpers/Cascadable_DocHandler.i b/TAO/CIAO/tools/XML_Helpers/Cascadable_DocHandler.i new file mode 100644 index 00000000000..bc63e540bc5 --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/Cascadable_DocHandler.i @@ -0,0 +1,55 @@ +// $Id$ + +ACE_INLINE const ACEXML_Char * +CIAO::XMLHelpers::Cascadable_DocHandler::namespaceURI () const +{ + return this->namespaceURI_; +} + +ACE_INLINE const ACEXML_Char * +CIAO::XMLHelpers::Cascadable_DocHandler::localName () const +{ + return this->localName_; +} + +ACE_INLINE const ACEXML_Char * +CIAO::XMLHelpers::Cascadable_DocHandler::qName () const +{ + return this->qName_; +} + +ACE_INLINE void +CIAO::XMLHelpers::Cascadable_DocHandler::setDocumentLocator (ACEXML_Locator * locator) +{ + this->locator_ = locator; +} + +ACE_INLINE void +CIAO::XMLHelpers::Cascadable_DocHandler::error (ACEXML_SAXParseException & ex + ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + this->print_warning (ACE_TEXT ("Error"), + ex + ACEXML_ENV_ARG_PARAMETER); +} + +ACE_INLINE void +CIAO::XMLHelpers::Cascadable_DocHandler::fatalError (ACEXML_SAXParseException & ex + ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + this->print_warning (ACE_TEXT ("Fatal Error"), + ex + ACEXML_ENV_ARG_PARAMETER); +} + +ACE_INLINE void +CIAO::XMLHelpers::Cascadable_DocHandler::warning (ACEXML_SAXParseException & ex + ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + this->print_warning (ACE_TEXT ("Warning"), + ex + ACEXML_ENV_ARG_PARAMETER); +} diff --git a/TAO/CIAO/tools/XML_Helpers/Handler-Interaction.png b/TAO/CIAO/tools/XML_Helpers/Handler-Interaction.png Binary files differnew file mode 100644 index 00000000000..361295b2752 --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/Handler-Interaction.png diff --git a/TAO/CIAO/tools/XML_Helpers/Handler-Interaction.vsd b/TAO/CIAO/tools/XML_Helpers/Handler-Interaction.vsd Binary files differnew file mode 100644 index 00000000000..26986824778 --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/Handler-Interaction.vsd diff --git a/TAO/CIAO/tools/XML_Helpers/README b/TAO/CIAO/tools/XML_Helpers/README new file mode 100644 index 00000000000..3e38803bf92 --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/README @@ -0,0 +1,16 @@ + $Id$ + +This directory containers a collection of XML Helper classes to aid +the parsing and manupilation of various XML descriptors in CIAO. + +Some of the classes under this directory should probably be kept under +ACEXML/common/. But let's worry about that later. + + +CIAO::XMLHelper + Cascadable_DocHandler + +The following files implement a test program for Cascadable_DocHandler: + + Svcconf_Handler.* + main.cpp
\ No newline at end of file diff --git a/TAO/CIAO/tools/XML_Helpers/Softpkg_Handlers.cpp b/TAO/CIAO/tools/XML_Helpers/Softpkg_Handlers.cpp new file mode 100644 index 00000000000..e0b6d92bfed --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/Softpkg_Handlers.cpp @@ -0,0 +1,275 @@ +// -*- C++ -*- $Id$ + +#include "Softpkg_Handlers.h" +#include "ace/ACE.h" +#include "ace/Log_Msg.h" + +#if !defined (__ACE_INLINE__) +# include "Softpkg_Handlers.inl" +#endif /* __ACE_INLINE__ */ + +void +CIAO::Softpkg_Handler::Softpkg_Info::dump (void) const +{ + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("\nCORBA Component Descriptor -> %s\n") + ACE_TEXT ("CSD file pathname -> %s\n") + ACE_TEXT ("Executor UUID -> %s\n") + ACE_TEXT ("Executor entry point -> %s\n") + ACE_TEXT ("SSD file pathname -> %s\n") + ACE_TEXT ("Servant UUID -> %s\n") + ACE_TEXT ("Servant entry point -> %s\n"), + descriptor_.c_str (), + csd_path_.c_str (), + executor_UUID_.c_str (), + executor_entrypt_.c_str (), + ssd_path_.c_str (), + servant_UUID_.c_str (), + servant_entrypt_.c_str ())); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +} + +void +CIAO::Softpkg_Handler::characters (const ACEXML_Char *cdata, + int start, + int len + ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + if (this->rec_cdata_) + { + this->characters_.set (cdata + start, + len, + 1); + this->rec_cdata_ = false; + } +} + +void +CIAO::Softpkg_Handler::startElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *alist + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + ACE_UNUSED_ARG (namespaceURI); + ACE_UNUSED_ARG (localName); + + switch (this->state_) + { + case ROOT: + + if (ACE_OS::strcmp (qName, ACE_TEXT ("pkgtype")) == 0) + { + this->rec_cdata_ = true; + } + else if (ACE_OS::strcmp (qName, ACE_TEXT ("descriptor")) == 0) + { + // @@ We should really check the "type" attribute and make + // sure that we are dealing with a CORBA Component + // descriptor here before we switch state. + + this->state_ = DESCRIPTOR; + } + else if (ACE_OS::strcmp (qName, ACE_TEXT ("implementation")) == 0) + { + if (alist != 0) + for (size_t i = 0; i < alist->getLength (); ++i) + { + if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0) + { + this->impluuid_.set (alist->getValue (i)); + } + } + this->state_ = IMPLEMENTATION; + } + break; + + case DESCRIPTOR: + if (ACE_OS::strcmp (qName, ACE_TEXT ("fileinarchive")) == 0) + { + if (alist != 0) + for (size_t i = 0; i < alist->getLength (); ++i) + { + if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("name")) == 0) + { + this->softpkg_info_->descriptor_.set (alist->getValue (i)); + } + } + } + break; + + case IMPLEMENTATION: + // @@ Note: WE currently ignore most everything without even + // checking the validity of OS/compiler and such. + if (ACE_OS::strcmp (qName, ACE_TEXT ("dependency")) == 0) + { + if (alist != 0) + for (size_t i = 0; i < alist->getLength (); ++i) + { + if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("type")) == 0 && + ACE_OS_String::strcmp (alist->getValue (i), ACE_TEXT ("CIAODLL")) == 0) + { + this->state_ = CIAODLL; + } + } + } + else if (ACE_OS::strcmp (qName, ACE_TEXT ("code")) == 0) + { + // @@ We should check for "type" attribute here. + this->state_ = CODE; + } + break; + + case CIAODLL: + // CIAO extension. + if (ACE_OS::strcmp (qName, ACE_TEXT ("fileinarchive")) == 0) + { + if (alist != 0) + for (size_t i = 0; i < alist->getLength (); ++i) + { + if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("name")) == 0) + { + this->ssd_.set (alist->getValue (i)); + } + } + } + else if (ACE_OS::strcmp (qName, ACE_TEXT ("implref")) == 0) + { + if (alist != 0) + for (size_t i = 0; i < alist->getLength (); ++i) + { + if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("idref")) == 0) + { + this->ssd_id_.set (alist->getValue (i)); + } + } + } + break; + + + case CODE: + if (ACE_OS::strcmp (qName, ACE_TEXT ("fileinarchive")) == 0) + { + if (alist != 0) + for (size_t i = 0; i < alist->getLength (); ++i) + { + if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("name")) == 0) + { + this->path_.set (alist->getValue (i)); + } + } + } + else if (ACE_OS::strcmp (qName, ACE_TEXT ("entrypoint")) == 0) + { + this->rec_cdata_ = true; + } + break; + + default: + ACEXML_THROW (ACEXML_SAXException + (ACE_TEXT ("Softpkg handler internal error"))); + break; + } +} + +void +CIAO::Softpkg_Handler::endElement (const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char *qName + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + switch (this->state_) + { + case ROOT: + + if (ACE_OS::strcmp (qName, ACE_TEXT ("pkgtype")) == 0) + { + if (ACE_OS::strcmp (this->characters_.c_str (), + ACE_TEXT ("CORBA Component")) == 0) + { + this->type_ = CSD; + } + else if (ACE_OS::strcmp (this->characters_.c_str (), + ACE_TEXT ("CIAO Servant")) == 0) + { + this->type_ = SSD; + } + else + ACEXML_THROW (ACEXML_SAXNotRecognizedException + (ACE_TEXT ("Unknown pkgtype"))); + } + break; + + case DESCRIPTOR: + if (ACE_OS::strcmp (qName, ACE_TEXT ("descriptor")) == 0) + { + this->state_ = ROOT; + } + break; + + case IMPLEMENTATION: + if (ACE_OS::strcmp (qName, ACE_TEXT ("implementation")) == 0) + { + // @@ Check the validity somehow here before we move the data. + if (this->type_ == CSD) + { + this->softpkg_info_->executor_UUID_ = this->impluuid_; + this->softpkg_info_->executor_entrypt_ = this->entry_pt_; + this->softpkg_info_->ssd_path_ = this->ssd_; + this->softpkg_info_->servant_UUID_ = this->ssd_id_; + } + else if (this->type_ == SSD && + this->softpkg_info_->servant_UUID_ == this->impluuid_) + { + + this->softpkg_info_->servant_entrypt_ = this->entry_pt_; + } + + this->state_ = ROOT; + } + break; + + case CIAODLL: + if (ACE_OS::strcmp (qName, ACE_TEXT ("dependency")) == 0) + { + this->state_ = IMPLEMENTATION; + } + + break; + + case CODE: + if (ACE_OS::strcmp (qName, ACE_TEXT ("entrypoint")) == 0) + { + this->entry_pt_ = this->characters_; + } + else if (ACE_OS::strcmp (qName, ACE_TEXT ("code")) == 0) + { + this->state_ = IMPLEMENTATION; + } + break; + + default: + ACEXML_THROW (ACEXML_SAXException + (ACE_TEXT ("Softpkg handler internal error"))); + break; + } +} + +void +CIAO::Softpkg_Handler::startDocument (ACEXML_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +CIAO::Softpkg_Handler::endDocument (ACEXML_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} diff --git a/TAO/CIAO/tools/XML_Helpers/Softpkg_Handlers.h b/TAO/CIAO/tools/XML_Helpers/Softpkg_Handlers.h new file mode 100644 index 00000000000..f1a438327dc --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/Softpkg_Handlers.h @@ -0,0 +1,196 @@ +// $Id$ + +//============================================================================= +/** + * @file $Name$ + * + * $Id$ + * + * This file turned out to host only one handler. We'll still keep + * the name as Softpkg_Handlers, however. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + +#ifndef CIAO_SOFTPKG_HANDLER_H +#define CIAO_SOFTPKG_HANDLER_H + +#include "XML_Helpers_Export.h" +#include "Cascadable_DocHandler.h" + +namespace CIAO +{ + /** + * @class Svcconf_Handler + * + * @brief Svcconf_Handler is an example SAX event handler. + * + * This SAX event handler try to regenerate the XML document it + * reads with correct indentation. + */ + class CIAO_XML_HELPERS_Export Softpkg_Handler + : public CIAO::XMLHelpers::Cascadable_DocHandler + { + public: + /** + * @enum + * + * @brief Softpkg type identifier + */ + typedef enum + { + CSD, // CORBA's Component Softpkg Descriptor + SSD // CIAO's Servent Softpkg Descriptor + } Softpkg_Type; + + /** + * + */ + typedef enum + { + ROOT, + DESCRIPTOR, + IMPLEMENTATION, + CIAODLL, + CODE + } Softpkg_State; + + /** + * @struct Softpkg_Info + * + * @Brief Relevant information that we are interested in + * + * This Softpkg_Info combines information from both a component + * softpkg descriptor and a servant softpkg descriptor. + */ + typedef struct CIAO_XML_HELPERS_Export Struct_Softpkg_Info + { + /// Specify the pathname (should change to URI later) to the + /// component descriptor file. + ACE_TString descriptor_; + + /// Specify the pathname to the root softpkg (as defined in CCM.) + ACE_TString csd_path_; + + /// Specify the pathname to component executor DLL. + ACE_TString executor_UUID_; + + /// Specify the entrypoint to component executor DLL. + ACE_TString executor_entrypt_; + + /// Specify the pathname to the servant softpkg (as defined in CIAO.) + ACE_TString ssd_path_; + + /// Specify the pathname to component servant DLL. + ACE_TString servant_UUID_; + + /// Specify the entrypoint to component servant DLL. + ACE_TString servant_entrypt_; + + void dump (void) const; + } Softpkg_Info; + + public: + /** + * Default constructor. + */ + Softpkg_Handler (ACEXML_XMLReader *parser, + Softpkg_Info *info + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) ; + + /** + * Default destructor. + */ + virtual ~Softpkg_Handler (void); + + // Methods inherit from ACEXML_ContentHandler. + + /** + * Receive notification of character data. + */ + virtual void characters (const ACEXML_Char *ch, + int start, + int length ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /** + * Receive notification of the end of a document. + */ + virtual void endDocument (ACEXML_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /** + * Receive notification of the end of an element. + */ + virtual void endElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /** + * Receive notification of the beginning of a document. + */ + virtual void startDocument (ACEXML_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /** + * Receive notification of the beginning of an element. + */ + virtual void startElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *atts ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + protected: + + private: + /// if we need to trace the CDATA. + bool rec_cdata_; + + /// Parse state + Softpkg_State state_; + + /// Type of softpkg we are parsing. + Softpkg_Type type_; + + /// Character info. + ACE_TString characters_; + + /// Cached the Implementation UUID before it can be determined + /// suitable for use. + ACE_TString impluuid_; + + /// Cached the servant path before it can be determined + /// suitable for use. + ACE_TString ssd_; + + /// Cached the servant uuid before it can be determined + /// suitable for use. + ACE_TString ssd_id_; + + /// Cached the Implementation path before it can be determined + /// suitable for use. + ACE_TString path_; + + /// Cached the Implementation entry point before it can be + /// determined suitable for use. + ACE_TString entry_pt_; + + /// Parse result + Softpkg_Info *softpkg_info_; + }; + +} + +#if defined (__ACE_INLINE__) +# include "Softpkg_Handlers.inl" +#endif /* __ACE_INLINE__ */ +#endif /* CIAO_SOFTPKG_HANDLER_H */ diff --git a/TAO/CIAO/tools/XML_Helpers/Softpkg_Handlers.inl b/TAO/CIAO/tools/XML_Helpers/Softpkg_Handlers.inl new file mode 100644 index 00000000000..99a8925b4ef --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/Softpkg_Handlers.inl @@ -0,0 +1,26 @@ +// -*- C++ -*- $Id$ + +ACE_INLINE +CIAO::Softpkg_Handler::Softpkg_Handler (ACEXML_XMLReader *parser, + CIAO::Softpkg_Handler::Softpkg_Info *info + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + : Cascadable_DocHandler (parser, + 0, + 0, + 0, + 0, + 0 + ACEXML_ENV_ARG_PARAMETER), + rec_cdata_ (false), + state_ (CIAO::Softpkg_Handler::ROOT), + softpkg_info_ (info) +{ + // no-op +} + +ACE_INLINE +CIAO::Softpkg_Handler::~Softpkg_Handler (void) +{ + // no-op +} diff --git a/TAO/CIAO/tools/XML_Helpers/Svcconf_Handler.cpp b/TAO/CIAO/tools/XML_Helpers/Svcconf_Handler.cpp new file mode 100644 index 00000000000..782420d135b --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/Svcconf_Handler.cpp @@ -0,0 +1,524 @@ +// -*- C++ -*- $Id$ + +#include "Svcconf_Handler.h" +#include "ace/ACE.h" +#include "ace/Log_Msg.h" + +#if !defined (__ACE_INLINE__) +# include "Svcconf_Handler.i" +#endif /* __ACE_INLINE__ */ + +Svcconf_Handler::Svcconf_Handler (ACEXML_XMLReader *parser, + CIAO::XMLHelpers::Cascadable_DocHandler *parent, + const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + : Cascadable_DocHandler (parser, + parent, + namespaceURI, + localName, + qName, + atts + ACEXML_ENV_ARG_PARAMETER), + in_stream_def_ (0), + in_module_ (0) +{ + // no-op +} + +Svcconf_Handler::~Svcconf_Handler (void) +{ + // no-op +} + +void +Svcconf_Handler::characters (const ACEXML_Char *, + int, + int + ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +Svcconf_Handler::endDocument (ACEXML_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +Svcconf_Handler::endElement (const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char *qName + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + + + if (ACE_OS_String::strcmp (qName, ACE_TEXT ("dynamic")) == 0) + { + if (this->in_stream_def_) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Create dynamic %s for stream\n"), + this->stream_info_.name ())); + } + else + { + if (this->in_module_) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Push dynamic %s into stream %s\n"), + this->parsed_info_.name (), + this->stream_info_.name ())); + } + else + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Apply dynamic %s\n"), + this->parsed_info_.name ())); + } + this->parsed_info_.reset (); + } + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("static")) == 0) + { + if (this->in_stream_def_) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Create sttaic %s for stream\n"), + this->stream_info_.name ())); + } + else + { + if (this->in_module_) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Push static %s into stream %s\n"), + this->parsed_info_.name (), + this->stream_info_.name ())); + } + else + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Apply static %s\n"), + this->parsed_info_.name ())); + } + this->parsed_info_.reset (); + } + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("module")) == 0) + { + this->in_module_ = 0; + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("streamdef")) == 0 || + ACE_OS_String::strcmp (qName, ACE_TEXT ("stream")) == 0) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Apply stream %s of type %s\n"), + this->stream_info_.name (), + this->stream_info_.name ())); + this->stream_info_.reset (); + } + else + { + } +} + +void +Svcconf_Handler::endPrefixMapping (const ACEXML_Char * + ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +Svcconf_Handler::ignorableWhitespace (const ACEXML_Char *, + int, + int + ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +Svcconf_Handler::processingInstruction (const ACEXML_Char *, + const ACEXML_Char * + ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +Svcconf_Handler::setDocumentLocator (ACEXML_Locator* ) +{ +} + +void +Svcconf_Handler::skippedEntity (const ACEXML_Char * + ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +Svcconf_Handler::startDocument (ACEXML_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +Svcconf_Handler::startElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *alist + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + if (ACE_OS_String::strcmp (qName, ACE_TEXT ("dynamic")) == 0) + { + this->get_dynamic_attrs (alist ACEXML_ENV_ARG_PARAMETER); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("initializer")) == 0) + { + this->get_initializer_attrs (alist ACEXML_ENV_ARG_PARAMETER); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("static")) == 0) + { + this->get_static_attrs (alist ACEXML_ENV_ARG_PARAMETER); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("stream")) == 0) + { + this->get_stream_id (alist ACEXML_ENV_ARG_PARAMETER); + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Retrieve stream %s from repository\n"), + this->stream_info_.name ())); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("streamdef")) == 0) + { + this->in_stream_def_ = 1; + // @@ Set up stream service object + + CIAO::XMLHelpers::Skip_DocHandler *new_handler; + + ACE_NEW (new_handler, + CIAO::XMLHelpers::Skip_DocHandler (this->parser_, + this, + namespaceURI, + localName, + qName, + alist + ACEXML_ENV_ARG_PARAMETER)); + ACEXML_CHECK; + + this->push_handler (new_handler, + alist + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("module")) == 0) + { + this->in_stream_def_ = 0; + this->in_module_ = 1; + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("resume")) == 0) + { + this->get_id (alist ACEXML_ENV_ARG_PARAMETER); + if (this->in_module_) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Resume %s in stream %s\n"), + this->parsed_info_.name (), + this->stream_info_.name ())); + } + else + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Resume %s\n"), + this->parsed_info_.name ())); + } + this->parsed_info_.reset (); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("suspend")) == 0) + { + this->get_id (alist ACEXML_ENV_ARG_PARAMETER); + if (this->in_module_) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Suspend %s in stream %s\n"), + this->parsed_info_.name (), + this->stream_info_.name ())); + } + else + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Suspend %s\n"), + this->parsed_info_.name ())); + } + this->parsed_info_.reset (); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("remove")) == 0) + { + this->get_id (alist ACEXML_ENV_ARG_PARAMETER); + if (this->in_module_) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Remove %s in stream %s\n"), + this->parsed_info_.name (), + this->stream_info_.name ())); + } + else + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Remove %s\n"), + this->parsed_info_.name ())); + } + this->parsed_info_.reset (); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("ACE_Svc_Conf")) == 0) + { + // Main document tag. no-op. + ACE_DEBUG ((LM_INFO, ACE_TEXT ("ACE_Svc_Conf tag\n"))); + } + else + { + // @@ Error. Perhaps we should relay to user event handler here, if available. + } + + return; + + if (alist != 0) + for (size_t i = 0; i < alist->getLength (); ++i) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT (" %s = \"%s\""), + alist->getQName (i), alist->getValue (i))); + } + ACE_DEBUG ((LM_DEBUG, ACE_TEXT (">"))); +} + +void +Svcconf_Handler::startPrefixMapping (const ACEXML_Char *, + const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. +} + +// *** Methods inherit from ACEXML_DTDHandler. + +void +Svcconf_Handler::notationDecl (const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. +} + +void +Svcconf_Handler::unparsedEntityDecl (const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. +} + +// Methods inherit from ACEXML_EnitityResolver. + +ACEXML_InputSource * +Svcconf_Handler::resolveEntity (const ACEXML_Char *, + const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. + return 0; +} + +// Methods inherit from ACEXML_ErrorHandler. + + /* + * Receive notification of a recoverable error. + */ +void +Svcconf_Handler::error (ACEXML_SAXParseException & ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. +} + +void +Svcconf_Handler::fatalError (ACEXML_SAXParseException & ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. +} + +void +Svcconf_Handler::warning (ACEXML_SAXParseException & ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. +} + +int +Svcconf_Handler::get_stream_id (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL) +{ + + + if (alist != 0) + for (size_t i = 0; i < alist->getLength (); ++i) + { + if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0) + { + this->stream_info_.name (alist->getValue (i)); + } + else + { + // @@ Exception... + return -1; + } + } + return 0; +} + +int +Svcconf_Handler::get_id (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL) +{ + + + if (alist != 0) + for (size_t i = 0; i < alist->getLength (); ++i) + { + if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0) + { + this->parsed_info_.name (alist->getValue (i)); + } + else + { + // @@ Exception... + return -1; + } + } + return 0; +} + +int +Svcconf_Handler::get_dynamic_attrs (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL) +{ + + + if (alist != 0) + { + ACE_Parsed_Info *info = (this->in_stream_def_ == 0 ? + &this->parsed_info_ : + &this->stream_info_); + for (size_t i = 0; i < alist->getLength (); ++i) + { + if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0) + { + info->name (alist->getValue (i)); + } + else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("status")) == 0) + { + if (ACE_OS_String::strcmp (alist->getValue (i), ACE_TEXT ("inactive")) == 0) + { + } + else if (ACE_OS_String::strcmp (alist->getValue (i), ACE_TEXT ("active")) == 0) + { + } + else + { + // @@ error, invalid 'status' value. + } + } + else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("type")) == 0) + { + if (ACE_OS_String::strcmp (alist->getValue (i), ACE_TEXT ("service_object")) == 0) + { + info->service_type (ACE_Parsed_Info::SERVICE_OBJECT_TYPE); + } + else if (ACE_OS_String::strcmp (alist->getValue (i), ACE_TEXT ("stream")) == 0) + { + info->service_type (ACE_Parsed_Info::STREAM_TYPE); + } + else if (ACE_OS_String::strcmp (alist->getValue (i), ACE_TEXT ("module")) == 0) + { + info->service_type (ACE_Parsed_Info::MODULE_TYPE); + } + else + { + // @@ error, invalid 'type' value. + } + } + else + { + // @@ Exception... + return -1; + } + } + } + return 0; +} + +int +Svcconf_Handler::get_initializer_attrs (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL) +{ + + + if (alist != 0) + { + ACE_Parsed_Info *info = (this->in_stream_def_ == 0 ? + &this->parsed_info_ : + &this->stream_info_); + for (size_t i = 0; i < alist->getLength (); ++i) + { + if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("init")) == 0) + { + info->init_func (alist->getValue (i)); + } + else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("path")) == 0) + { + info->path (alist->getValue (i)); + } + else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("params")) == 0) + { + info->init_params (alist->getValue (i)); + } + else + { + // @@ Exception... + return -1; + } + } + } + return 0; +} + +int +Svcconf_Handler::get_static_attrs (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL) +{ + + + if (alist != 0) + { + ACE_Parsed_Info *info = (this->in_stream_def_ == 0 ? + &this->parsed_info_ : + &this->stream_info_); + for (size_t i = 0; i < alist->getLength (); ++i) + { + if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0) + { + info->name (alist->getValue (i)); + } + else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("params")) == 0) + { + info->init_params (alist->getValue (i)); + } + else + { + // @@ Exception... + return -1; + } + } + } + return 0; +} diff --git a/TAO/CIAO/tools/XML_Helpers/Svcconf_Handler.h b/TAO/CIAO/tools/XML_Helpers/Svcconf_Handler.h new file mode 100644 index 00000000000..76932aadf00 --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/Svcconf_Handler.h @@ -0,0 +1,296 @@ +// $Id$ + +//============================================================================= +/** + * @file Svcconf_Handler.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + +#ifndef SVCCONF_HANDLER_H +#define SVCCONF_HANDLER_H + +#include "Cascadable_DocHandler.h" + +class ACE_Parsed_Info +{ +public: + typedef enum { + MODULE_TYPE, + SERVICE_OBJECT_TYPE, + STREAM_TYPE, + INVALID_TYPE + } Service_Type; + + ACE_Parsed_Info (); + ~ACE_Parsed_Info (); + + /** + * Set/get name of a parsed entity. + */ + int name (const ACEXML_Char *n); + const ACEXML_Char *name (void); + + /** + * Set/get type of a dynamic node. + */ + int service_type (Service_Type type); + Service_Type service_type (void); + + /** + * Set/Get active status. + */ + int active (int a); + int active (void); + + /** + * Set/get initializer path. + */ + int path (const ACEXML_Char *n); + const ACEXML_Char *path (void); + + /** + * Set/get initializer init function. + */ + int init_func (const ACEXML_Char *n); + const ACEXML_Char *init_func (void); + + /** + * Set/get initializer init parameter. + */ + int init_params (const ACEXML_Char *n); + const ACEXML_Char *init_params (void); + + /** + * Reset Parsed_Info. + */ + void reset (void); + +protected: + ACEXML_Char *name_; + Service_Type service_type_; + int active_; + ACEXML_Char *path_; + ACEXML_Char *init_func_; + ACEXML_Char *init_params_; +}; + +/** + * @class Svcconf_Handler + * + * @brief Svcconf_Handler is an example SAX event handler. + * + * This SAX event handler try to regenerate the XML document it + * reads with correct indentation. + */ +class Svcconf_Handler : public CIAO::XMLHelpers::Cascadable_DocHandler +{ + + + + +public: + /** + * Default constructor. + */ + Svcconf_Handler (ACEXML_XMLReader *parser, + CIAO::XMLHelpers::Cascadable_DocHandler *parent, + const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) ; + + /* + * Default destructor. + */ + virtual ~Svcconf_Handler (void); + + // Methods inherit from ACEXML_ContentHandler. + + /* + * Receive notification of character data. + */ + virtual void characters (const ACEXML_Char *ch, + int start, + int length ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of the end of a document. + */ + virtual void endDocument (ACEXML_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of the end of an element. + */ + virtual void endElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * End the scope of a prefix-URI mapping. + */ + virtual void endPrefixMapping (const ACEXML_Char *prefix ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of ignorable whitespace in element content. + */ + virtual void ignorableWhitespace (const ACEXML_Char *ch, + int start, + int length ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of a processing instruction. + */ + virtual void processingInstruction (const ACEXML_Char *target, + const ACEXML_Char *data ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive an object for locating the origin of SAX document events. + */ + virtual void setDocumentLocator (ACEXML_Locator *) ; + + /* + * Receive notification of a skipped entity. + */ + virtual void skippedEntity (const ACEXML_Char *name ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of the beginning of a document. + */ + virtual void startDocument (ACEXML_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of the beginning of an element. + */ + virtual void startElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *atts ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Begin the scope of a prefix-URI Namespace mapping. + */ + virtual void startPrefixMapping (const ACEXML_Char *prefix, + const ACEXML_Char *uri ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + // *** Methods inherit from ACEXML_DTDHandler. + + /* + * Receive notification of a notation declaration event. + */ + virtual void notationDecl (const ACEXML_Char *name, + const ACEXML_Char *publicId, + const ACEXML_Char *systemId ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of an unparsed entity declaration event. + */ + virtual void unparsedEntityDecl (const ACEXML_Char *name, + const ACEXML_Char *publicId, + const ACEXML_Char *systemId, + const ACEXML_Char *notationName ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + // Methods inherit from ACEXML_EnitityResolver. + + /* + * Allow the application to resolve external entities. + */ + virtual ACEXML_InputSource *resolveEntity (const ACEXML_Char *publicId, + const ACEXML_Char *systemId ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + // Methods inherit from ACEXML_ErrorHandler. + + /* + * Receive notification of a recoverable error. + */ + virtual void error (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of a non-recoverable error. + */ + virtual void fatalError (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of a warning. + */ + virtual void warning (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + +protected: + /** + * Get the only attribute in <stream> or <streamdef>. + */ + int get_stream_id (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL); + + /** + * Get the only attribute in <resume>, <suspend>, <remove> + */ + int get_id (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL); + + /** + * Get the dynamic tag attributes. + */ + int get_dynamic_attrs (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL); + + /** + * Get the initializer tag attributes. + */ + int get_initializer_attrs (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL); + + /** + * Get the static tag attributes. + */ + int get_static_attrs (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL); + +private: + /// We are parsing a stream definition + int in_stream_def_; + + /// We are defining a steam module + int in_module_; + + ACE_Parsed_Info parsed_info_; + + ACE_Parsed_Info stream_info_; +}; + +#if defined (__ACE_INLINE__) +# include "Svcconf_Handler.i" +#endif /* __ACE_INLINE__ */ +#endif /* SVCCONF_HANDLER_H */ diff --git a/TAO/CIAO/tools/XML_Helpers/Svcconf_Handler.i b/TAO/CIAO/tools/XML_Helpers/Svcconf_Handler.i new file mode 100644 index 00000000000..fb6ea3db2ce --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/Svcconf_Handler.i @@ -0,0 +1,133 @@ +// -*- C++ -*- $Id$ + +ACE_INLINE +ACE_Parsed_Info::ACE_Parsed_Info () + : name_ (0), + service_type_ (INVALID_TYPE), + active_ (1), + path_ (0), + init_func_ (0), + init_params_ (0) +{ +} + +ACE_INLINE +ACE_Parsed_Info::~ACE_Parsed_Info () +{ + delete this->name_; + delete this->path_; + delete this->init_func_; + delete this->init_params_; +} + +ACE_INLINE int +ACE_Parsed_Info::name (const ACEXML_Char *n) +{ + if (this->name_ == 0) + { + this->name_ = ACE::strnew (n); + return 0; + } + return -1; +} + +ACE_INLINE const ACEXML_Char * +ACE_Parsed_Info::name (void) +{ + return this->name_; +} + +ACE_INLINE int +ACE_Parsed_Info::service_type (Service_Type type) +{ + if (this->service_type_ == INVALID_TYPE) + { + this->service_type_ = type; + return 0; + } + return -1; +} + +ACE_INLINE ACE_Parsed_Info::Service_Type +ACE_Parsed_Info::service_type (void) +{ + return this->service_type_; +} + +ACE_INLINE int +ACE_Parsed_Info::active (int a) +{ + this->active_ = a; + return 0; +} + +ACE_INLINE int +ACE_Parsed_Info::active (void) +{ + return this->active_; +} + +ACE_INLINE int +ACE_Parsed_Info::path (const ACEXML_Char *p) +{ + if (this->path_ == 0) + { + this->path_ = ACE::strnew (p); + return 0; + } + return -1; +} + +ACE_INLINE const ACEXML_Char * +ACE_Parsed_Info::path (void) +{ + return this->path_; +} + +ACE_INLINE int +ACE_Parsed_Info::init_func (const ACEXML_Char *n) +{ + if (this->init_func_ == 0) + { + this->init_func_ = ACE::strnew (n); + return 0; + } + return -1; +} + +ACE_INLINE const ACEXML_Char * +ACE_Parsed_Info::init_func (void) +{ + return this->init_func_; +} + +ACE_INLINE int +ACE_Parsed_Info::init_params (const ACEXML_Char *n) +{ + if (this->init_params_ == 0) + { + this->init_params_ = ACE::strnew (n); + return 0; + } + return -1; +} + +ACE_INLINE const ACEXML_Char * +ACE_Parsed_Info::init_params (void) +{ + return this->init_params_; +} + +ACE_INLINE void +ACE_Parsed_Info::reset (void) +{ + delete this->name_; + this->name_ = 0; + this->service_type_ = INVALID_TYPE; + delete this->path_; + this->path_ = 0; + delete this->init_func_; + this->init_func_ = 0; + delete this->init_params_; + this->init_params_ = 0; +} diff --git a/TAO/CIAO/tools/XML_Helpers/XMLHelpers.mpc b/TAO/CIAO/tools/XML_Helpers/XMLHelpers.mpc new file mode 100644 index 00000000000..d73aab62935 --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/XMLHelpers.mpc @@ -0,0 +1,21 @@ +project(XML_Helpers): acelib, acexml { + sharedname=CIAO_XML_Helpers + dllflags += CIAO_XML_HELPERS_BUILD_DLL + + Source_Files { + XML_Utils.cpp + Softpkg_Handlers.cpp + Cascadable_DocHandler.cpp + Assembly_Spec.cpp + Assembly_Handlers.cpp + } +} + +project(Helper_Test): aceexe, acexml { + libs += CIAO_XML_Helpers + depends += XML_Helpers + + Source_Files { + main.cpp + } +} diff --git a/TAO/CIAO/tools/XML_Helpers/XML_Helpers_Export.h b/TAO/CIAO/tools/XML_Helpers/XML_Helpers_Export.h new file mode 100644 index 00000000000..2eca335e6db --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/XML_Helpers_Export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl CIAO_XML_HELPERS +// ------------------------------ +#ifndef CIAO_XML_HELPERS_EXPORT_H +#define CIAO_XML_HELPERS_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (CIAO_XML_HELPERS_HAS_DLL) +# define CIAO_XML_HELPERS_HAS_DLL 1 +#endif /* ! CIAO_XML_HELPERS_HAS_DLL */ + +#if defined (CIAO_XML_HELPERS_HAS_DLL) && (CIAO_XML_HELPERS_HAS_DLL == 1) +# if defined (CIAO_XML_HELPERS_BUILD_DLL) +# define CIAO_XML_HELPERS_Export ACE_Proper_Export_Flag +# define CIAO_XML_HELPERS_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define CIAO_XML_HELPERS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* CIAO_XML_HELPERS_BUILD_DLL */ +# define CIAO_XML_HELPERS_Export ACE_Proper_Import_Flag +# define CIAO_XML_HELPERS_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define CIAO_XML_HELPERS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* CIAO_XML_HELPERS_BUILD_DLL */ +#else /* CIAO_XML_HELPERS_HAS_DLL == 1 */ +# define CIAO_XML_HELPERS_Export +# define CIAO_XML_HELPERS_SINGLETON_DECLARATION(T) +# define CIAO_XML_HELPERS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* CIAO_XML_HELPERS_HAS_DLL == 1 */ + +// Set CIAO_XML_HELPERS_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (CIAO_XML_HELPERS_NTRACE) +# if (ACE_NTRACE == 1) +# define CIAO_XML_HELPERS_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define CIAO_XML_HELPERS_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !CIAO_XML_HELPERS_NTRACE */ + +#if (CIAO_XML_HELPERS_NTRACE == 1) +# define CIAO_XML_HELPERS_TRACE(X) +#else /* (CIAO_XML_HELPERS_NTRACE == 1) */ +# define CIAO_XML_HELPERS_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (CIAO_XML_HELPERS_NTRACE == 1) */ + +#endif /* CIAO_XML_HELPERS_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/tools/XML_Helpers/XML_Utils.cpp b/TAO/CIAO/tools/XML_Helpers/XML_Utils.cpp new file mode 100644 index 00000000000..6506ea3c728 --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/XML_Utils.cpp @@ -0,0 +1,181 @@ +// -*- C++ -*- $Id$ + +#include "XML_Utils.h" +#include "ACEXML/common/FileCharStream.h" +#include "ACEXML/common/StrCharStream.h" +#include "ACEXML/parser/parser/Parser.h" +#include "Assembly_Handlers.h" + +#if !defined (__ACE_INLINE__) +# include "XML_Utils.inl" +#endif /* __ACE_INLINE__ */ + +int +CIAO::XML_Utils::parse_softpkg (CIAO::Softpkg_Handler::Softpkg_Info *info) +{ + if (info == 0) // no way this is going to work. :) + return -1; + + ACEXML_DefaultHandler *handler = 0; + auto_ptr<ACEXML_DefaultHandler> cleanup_handler (handler); + + ACEXML_FileCharStream *fstm = 0; + ACE_NEW_RETURN (fstm, + ACEXML_FileCharStream (), + 1); + + if (fstm->open (info->csd_path_.c_str ()) != 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("Fail to open XML file: %s\n"), + info->csd_path_.c_str ()), + -1); + ACEXML_TRY_NEW_ENV + { + ACEXML_Parser parser; + + ACE_NEW_RETURN (handler, + CIAO::Softpkg_Handler (&parser, + info + ACEXML_ENV_ARG_PARAMETER), + -1); + + ACEXML_InputSource input(fstm); + + parser.setContentHandler (handler); + parser.setDTDHandler (handler); + parser.setErrorHandler (handler); + parser.setEntityResolver (handler); + + parser.parse (&input ACEXML_ENV_ARG_PARAMETER); + ACEXML_TRY_CHECK; + + // delete fstm; + ACE_NEW_RETURN (fstm, + ACEXML_FileCharStream (), + 1); + + if (fstm->open (info->ssd_path_.c_str ()) != 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("Fail to open XML file: %s\n"), + info->ssd_path_.c_str ()), + -1); + + input.setCharStream (fstm); + + parser.parse (&input ACEXML_ENV_ARG_PARAMETER); + ACEXML_TRY_CHECK; + } + ACEXML_CATCH (ACEXML_SAXException, ex) + { + ex.print (); + return -1; + } + ACEXML_CATCHANY + { + ACE_ERROR_RETURN ((LM_ERROR, + "Caught unknown exception.\n"), + -1); + } + ACEXML_ENDTRY; + return 0; +} + +int +CIAO::XML_Utils::parse_componentassembly (const char *filename, + CIAO::Assembly_Spec *spec) +{ + if (spec == 0) // no way this is going to work. :) + return -1; + + ACEXML_DefaultHandler *handler = 0; + auto_ptr<ACEXML_DefaultHandler> cleanup_handler (handler); + + ACEXML_FileCharStream *fstm = 0; + ACE_NEW_RETURN (fstm, + ACEXML_FileCharStream (), + 1); + + if (fstm->open (filename) != 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("Fail to open XML file: %s\n"), + filename), + -1); + ACEXML_TRY_NEW_ENV + { + ACEXML_Parser parser; + + ACE_NEW_RETURN (handler, + CIAO::Assembly_Handler (&parser, + spec + ACEXML_ENV_ARG_PARAMETER), + -1); + + ACEXML_InputSource input(fstm); + + parser.setContentHandler (handler); + parser.setDTDHandler (handler); + parser.setErrorHandler (handler); + parser.setEntityResolver (handler); + + parser.parse (&input ACEXML_ENV_ARG_PARAMETER); + ACEXML_TRY_CHECK; + } + ACEXML_CATCH (ACEXML_SAXException, ex) + { + ex.print (); + return -1; + } + ACEXML_CATCHANY + { + ACE_ERROR_RETURN ((LM_ERROR, + "Caught unknown exception.\n"), + -1); + } + ACEXML_ENDTRY; + return 0; +} + +long +CIAO::XML_Utils::get_id_and_cardinality (const char *&id, + ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + long retv = 1; + + for (size_t i = 0; i < atts->getLength (); ++i) + { + if (ACE_OS_String::strcmp (atts->getQName (i), ACE_TEXT ("id")) == 0) + { + id = atts->getValue (i); + } + else if (ACE_OS_String::strcmp (atts->getQName (i), + ACE_TEXT ("cardinality")) == 0) + { + retv = ACE_OS::atoi (atts->getValue (i)); + } + else + ACEXML_THROW_RETURN + (ACEXML_SAXException + ("Invalid attribute found"), + -1); + } + return retv; +} + +long +CIAO::XML_Utils::get_single_attribute (const char *attname, + const char *&id, + ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + for (size_t i = 0; i < atts->getLength (); ++i) + { + if (ACE_OS_String::strcmp (atts->getQName (i), attname) == 0) + { + id = atts->getValue (i); + } + } + return 0; +} diff --git a/TAO/CIAO/tools/XML_Helpers/XML_Utils.h b/TAO/CIAO/tools/XML_Helpers/XML_Utils.h new file mode 100644 index 00000000000..adba93382f8 --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/XML_Utils.h @@ -0,0 +1,70 @@ +// $Id$ + +//============================================================================= +/** + * @file $Name$ + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + +#ifndef CIAO_XML_UTILS_H +#define CIAO_XML_UTILS_H + +#include "XML_Helpers_Export.h" +#include "Softpkg_Handlers.h" +#include "Assembly_Spec.h" + +namespace CIAO +{ + /** + * @class Utils + * + * @brief Utils contains a collection of utility functions + */ + class CIAO_XML_HELPERS_Export XML_Utils + { + public: + /** + * @brief Parse a set of component softpkg and return the important info + * + * This function parses a set of component softpkg files and + * returns the important information required to intall the + * component in a component server. In CIAO, two different + * DLL are needed for a component installation. One for the + * actual executor implementation and one for the container + * servant implementation. + * + * When calling this function, info->csd_path_ must holds the + * pathname to the component software descriptor the function is + * going to parse. + * + * @retval 0 if all infor are parsed successfully. + * @retval -1 if error occured + */ + static int parse_softpkg (Softpkg_Handler::Softpkg_Info *info); + + static int parse_componentassembly (const char *filename, + Assembly_Spec *spec); + + static long get_id_and_cardinality (const char *&id, + ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) ; + + static long get_single_attribute (const char *attname, + const char *&id, + ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) ; + + }; + +} + +#if defined (__ACE_INLINE__) +# include "XML_Utils.inl" +#endif /* __ACE_INLINE__ */ +#endif /* CIAO_XML_UTILS_H */ diff --git a/TAO/CIAO/tools/XML_Helpers/XML_Utils.inl b/TAO/CIAO/tools/XML_Helpers/XML_Utils.inl new file mode 100644 index 00000000000..cfa1da318d3 --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/XML_Utils.inl @@ -0,0 +1 @@ +// $Id$ diff --git a/TAO/CIAO/tools/XML_Helpers/main.cpp b/TAO/CIAO/tools/XML_Helpers/main.cpp new file mode 100644 index 00000000000..06510f08231 --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/main.cpp @@ -0,0 +1,59 @@ +// $Id$ + +#include "XML_Utils.h" +#include "ace/Get_Opt.h" +#include "ace/Auto_Ptr.h" + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + ACE_TCHAR *softpkg_filename = 0; + ACE_TCHAR *assembly_filename = 0; + + ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("a:s:")); + ACE_TCHAR c; + + while ((c = get_opt ()) != -1) + { + switch (c) + { + case 's': + softpkg_filename = get_opt.opt_arg (); + break; + case 'a': + assembly_filename = get_opt.opt_arg (); + break; + default: + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("Usage: %s [-f <filename>]\n") + ACE_TEXT (" -f: Specify the svcconf filename\n"), + argv[0]), + -1); + } + }; + + if (softpkg_filename == 0 && assembly_filename == 0) + ACE_ERROR_RETURN ((LM_ERROR, "No filename specified\n"), -1); + + if (softpkg_filename != 0) + { + CIAO::Softpkg_Handler::Softpkg_Info info; + info.csd_path_ = softpkg_filename; + + if (CIAO::XML_Utils::parse_softpkg (&info) == 0) + info.dump (); + } + + if (assembly_filename != 0) + { + CIAO::Assembly_Spec assembly_spec; + + if (CIAO::XML_Utils::parse_componentassembly (assembly_filename, + &assembly_spec) == 0) + { + ACE_DEBUG ((LM_DEBUG, "ComponentAssembly Done.\n")); + } + } + + return 0; +} diff --git a/TAO/CIAO/tools/XML_Helpers/svc.conf.xml b/TAO/CIAO/tools/XML_Helpers/svc.conf.xml new file mode 100644 index 00000000000..152f3b44406 --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/svc.conf.xml @@ -0,0 +1,58 @@ +<?xml version="1.0"?> +<!-- This is a test XML file. Most of the stuff here don't make any sense at all --> +<!DOCTYPE ACE_Svc_Conf PUBLIC 'GOODSAM' 'http://ace.cs.wustl.edu/dtd/ACE_SVCCONF.DTD' + [ + <!NOTATION goody PUBLIC 'NBC' 'http://hardcoreace.com/'> + <!NOTATION frodo PUBLIC 'ABC'> + <!NOTATION bilbo SYSTEM "C:/ACE-GUIDELINE"> + <!ENTITY ccm 'CCM_App'> + <!ENTITY pippin PUBLIC 'GOTO' 'http://taozen.com/' NDATA NBC> + <!ENTITY sam PUBLIC 'SHIRE' 'http://taozen.com/'> + <!ENTITY gandolf SYSTEM 'D:/RINGS.DOT'> + <!ELEMENT GOOBEGONE EMPTY> + <!ELEMENT POOPOO ANY> + <!ELEMENT HOHOHO ((BOOBOO, GOOBEGONE)?, (GOOBEGONE|POOPOO)*)+> + <!ELEMENT BOOBOO (#PCDATA | BOOBOO)*> + <!ATTLIST GOOBEGONE + ohmy CDATA #REQUIRED + testing IDREF #IMPLIED> + ]> + +<ACE_Svc_Conf> +<static id="ACE_Service_Manager" params="-d -p 4911"/> + +<dynamic id="Test_Task" type="service_object"> A & + <initializer path="CCM_App" init="_make_Test_Task" params="-p 3000" /> +</dynamic> + +<streamdef> + <dynamic id="CCM_App" type="stream" status="active"> + <initializer path="CCM_App" init="make_stream"/> + </dynamic> + <module> + <dynamic id="Device_Adapter" type="module"> + <initializer path="CCM_App" init="make_da"/> + </dynamic> + <dynamic id="Event_Analyzer" type="module"> + <initializer path="CCM_App" init="make_ea"/> + </dynamic> + <dynamic id="Multicast_Router" type="module"> + <initializer path="CCM_App" init="make_mr" params="-p 3001"/> + </dynamic> + </module> +</streamdef> + +<stream id="&ccm;"> + <module> + <remove id="Device_Adapter"/> + <!-- <remove id="Event_Analyzer"/> --> + <!-- <remove id="Multicast_Router"/> --> + <![CDATA[Only a text string. +Do you &expect something more? A]]> +<!-- Noticed that the "&" in the above CDATA section can not be escaped. --> + </module> +</stream> + +<!-- remove CCM_App --> +<remove id="Test_&Taskabc"/> +</ACE_Svc_Conf> |