diff options
Diffstat (limited to 'ACE/bin/FOCUS')
17 files changed, 4605 insertions, 0 deletions
diff --git a/ACE/bin/FOCUS/ChangeLog b/ACE/bin/FOCUS/ChangeLog new file mode 100644 index 00000000000..b5323e5e749 --- /dev/null +++ b/ACE/bin/FOCUS/ChangeLog @@ -0,0 +1,250 @@ +Fri Nov 18 17:05:49 2005 Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + + * specializations/Reactor_Family/Select_Reactor_ST.spl: + * specializations/Reactor_Family/Select_Reactor_MT.spl: + + Reverted the include file in ace/Select_Reactor_T.inl as g++ 4.0 + seems to balk when this is not there. This does not seem to + happen with g++ 3.2 or later versions + +Thu Oct 27 09:47:32 2005 Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + + * specializations/iiop.spl: + + Updated specializations file based on changes made to ACE+TAO + +Thu Sep 29 15:57:36 2005 Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + + * FOCUS.pl: + Changed the script to use $ACE_ROOT enviornment variable to + compute the paths to the specialization files. + + * Parser/Parser.pm: + Modified the parser comments and return values. + + * NEWS: Added news file that discusses the current and planned + features. + + * README: Readme file + * INSTALL: Removed install file and moved contents to README + + * docs/FOCUS.html: Documenting the different features of FOCUS and + usage. + +Thu Sep 29 11:15:52 2005 Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + + * specializations/Protocol_Family/IIOP/iiop.spl: + * specializations/Context-Specific-Optimizations/Request-Creation-Optimizations.spl: + Changes required to the rules based on code level changes. + +Wed Sep 7 09:20:30 2005 Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + + * VERSION: + * specializations/Wait_Strategy/Wait_On_Read.spl: + * specializations/Protocol_Family/iiop.spl: + * specializations/Messaging_Strategy/GIOP.spl: + * Parser/Parser.pm: + + Added version file for the first internal release of + FOCUS. Updated the specializations based on recent updates. + +Tue Sep 6 09:07:04 2005 Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + + * specializations/Protocol_Family/iiop.spl: + + Added specialization rules for specializing the pluggable + protocols implementation in TAO with the IIOP protocol + implementation. + +Mon Aug 29 11:55:32 2005 Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + + * specializations/Reactor_Family/Select_Reactor_ST.spl: + * specializations/Reactor_Family/Select_Reactor_MT.spl: + * specializations/Reactor_Family/TP_Reactor.spl: + + Updated the specializations rules for the Reactor specialization + after the commit by Steve Huston. These have been tested and + validated with the code in ACE+TAO. + +Mon Aug 22 13:28:39 2005 Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + + * FOCUS.pl: + * Parser/Parser.pm: + * specializations/Context-Specific-Optimizations/Dispatch-Resolution-Optimitzation.spl: + + Added the specialization that resolves the request processor + only once and uses the cached request processor to service + requests on a specific connection for all other requests. + +Wed Aug 17 14:59:44 2005 Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + + * FOCUS.pl: + + Added new option for specializing the wait strategy at the + client side in ACE+TAO + + * Parser/Parser.pm: + + Added support of <copy-from-source> tag that copies source code + from a source file and inserts it into the destination file + at a particular hook location. + + * specializations/Reactor_Family/Select_Reactor_MT.spl: + * specializations/Reactor_Family/Select_Reactor_ST.spl: + * specializations/Wait_Strategy/Wait_On_Read.spl: + * specializations/Flushing_Strategy/Leader_Follower_Flushing_Strategy.spl: + + Updated the Reactor specializations, after eliminating the + Reactor_Timer_Interface from the Reactor implementation. Added + two specializations for the Wait strategy and the + Leader_Follower_Flushing strategies. Updated the Messaging + specialization based on hooks left in the source code. + +Mon Aug 15 14:59:28 2005 Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + + * Parser/Parser.pm: + + Updated the parser to include the attribute match-line in a + substitute tag. This matches the entire line as opposed to a + word which substitutes default behavior is. + + * specializations/Reactor_Family/Select_Reactor_MT.spl: + * specializations/Reactor_Family/Select_Reactor_ST.spl: + + Updated the rules to include the match-line attribute to match + the entire line as opposed to the a single word. + +Mon Aug 15 09:07:54 2005 Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + + * specializations/Select_Reactor_ST.spl: + * specializations/Select_Reactor_MT.spl: + * specializations/TP_Reactor.spl: + + Updated the specialization rules. In particular, the + specialization rules have been updated as two separate ST rules + and MT rules for select reactor ST and select reactor MT. + + * FOCUS.pl: + + Updated the main script to work with these two rules. + +Thu Aug 11 16:33:47 2005 Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + + * FOCUS.pl: + * Parser/Parser.pm: + + Added option to specify the output path where the specialization + file should be put. + + * specializations/Reactor_Family/TP_Reactor.spl: + Updated the thread-pool reactor specialization file tags based + on the generated code. + +Thu Aug 11 10:54:06 2005 Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + + * FOCUS.pl: + + Updated specialization entry for Thread Pool reactor. + + * Parser/Parser.pm: + + Updated the Visit_Substitute method with the requirement that it + match whole words and not parts of a word. For example, this + problem manifests when one is trying to substitute + Msg_WFMO_Reactor and WFM_Reactor. Both the strings match for + WFMO_Reactor, when only the latter should be matching. Corrected + this issue. + + * specializations/Select_Reactor.spl: + * specializations/TP_Reactor.spl: + + Updated the tags to be consistent and corrected several typos + and made sure that the rules in the specializations are actually + executed. + + * PROBLEM-REPORT-FORM: + + Most important thing added :-) + +Wed Aug 10 15:38:17 2005 Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + + * FOCUS.pl: + Moved the perl script from the Parser module to the top level + directory for convenience. + + * specializations/Reactor_Family/TP_Reactor.spl: + + Added a specialization file for specializing TP_Reactor + implementation. + + * specializations/Reactor_Family/Select_Reactor.spl: + + Updated the specialization file to be in sync with the code + level comment hooks in the ACE+TAO implementation. + +Sun Aug 7 16:15:29 2005 Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + + * Parser/Parser.pm: + + Added Visit_Comment visitor to parse and execute <comment> + tags. Each comment tag contains a start-hook and an end-hook + which can be used to comment blocks of region within the source + code. + + * specializations/Protocol_Family/Pluggable_Messaging.spl: + + A specialization file that completely removes the Pluggable + messaging interface and replaces that with the concrete type + used. + +Thu Aug 4 14:33:42 2005 Arvind Krishna <arvindkr@arvindkr.qualcomm.com> + + * Parser/Parser.pm: + + Added diagnostic messages and updated FOCUS perl script to use + Getopt command line parsing perl module. + +Thu Aug 4 10:57:08 2005 Arvind Krishna <arvindkr@arvindkr.qualcomm.com> + + * Parser/Parser.pm: + * Parser/FOCUS.pl: + Updated the parser module to include a <module> tag, this is + necessary when the specializations have to work across different + directories such as ACE and TAO. + +Wed Jul 27 15:54:02 PDT 2005 Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + + * specializations/Reactor_Family/Select_Reactor.spl: + Added a couple of specialization tags for reactor specialization. + + * Parser/xml-spl-parser.pm: + Parser now capable of executing search, replace, add and comment + functionality for specializations. + +Tue Jul 26 12:38:00 2005 Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + + * specializations/README: + + Added a evolving README file that describes the rules for + integrating different specializations into FOCUS. + +Tue Jul 26 11:23:51 2005 Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + + * Parser/Parser.pm: + * specializations/Reactor_Family/Select_Reactor.spl: + + A simple perl based parser to parse the XML specializations + defined within the various specialization + files. Select_Reactor.spl defines the specialization rules for + effecting the transformations for specializing the Reactor + framework within ACE. + +Tue Jul 26 11:21:44 2005 Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + + * FOCUS: + Birth of "Feature Oriented Customization of Systems" is a + research project that aims at customizing semi complete + applications or frameworks based on features (e.g., type of + protocol, type of reactor) used in an application. FOCUS was + born out of research efforts described in the following paper: + http://www.cs.wustl.edu/~schmidt/PDF/MW-Spl.pdf diff --git a/ACE/bin/FOCUS/FOCUS.pl b/ACE/bin/FOCUS/FOCUS.pl new file mode 100755 index 00000000000..e82acfe63cc --- /dev/null +++ b/ACE/bin/FOCUS/FOCUS.pl @@ -0,0 +1,203 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; +######################################################################### +# FOCUS: A Feature Oriented Customization tool for ACE+TAO. +# +# Usage: +# ====== +# --prefix-path - gives the prefix to the place where ACE+TAO is installed +# --reactor-spl - provide the component that needs to be specialized +# --protocol-spl - provide the concrete protocol to specialize +# --output-prefix-path - +# (Optional) if specified, copies all the files to the +# output prefix. The directory structure is maintained. +# That is if foo/bar.h file was specialized. Then the +# output will be <prefix_output>/foo/bar.h +# +# Adding New Specializations +# =========================== +# (1) Add a new command line option if the specialization belongs to a +# new family of components. For example, Concurrency strategy +# (1.b) If not, then enhance exisiting option with a new value +# (2) Associate a specialization file for the concrete component being +# specialized. +# (3) Update the specializations directory appropriately to add the +# specializations file. +# +# @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu> +# +# $Id$ +# +######################################################################## +use Getopt::Long; + +# This script can be invoked from anywhere. We need to add this to the +# path +use lib "$ENV{ACE_ROOT}/bin"; + +use FOCUS::Parser::FOCUSParser; + +sub usage +{ + + # How to use FOCUS + # Currently FOCUS supports the specialization of reactor and protocol + # families + my $usage = "usage: \n ./FOCUS " + . " \n --prefix-path=<path to module root>" + . " [\n --reactor-spl=<select-mt, select-st, tp-reactor>" + . " \n --protocol-spl=<iiop>" + . " \n --wait-strategy-spl=<rw>" + . " \n --output-prefix=<output path>" + . " \n --messaging-spl=<giop>" + . " \n --context-specific-optimizations=<dispatch>" + . " \n ]" + . "\n"; + print "$usage \n"; +} + +# Global Table that maps the specialization name to the file +# select => "../specializations/Reactor_Family/Select_Reactor.spl +# For each component that one needs to specialize add an entry in +# this simple global table to execute the specializations. + +# Get the ACE_ROOT ENV variable. Then the specializations +# can be accessed via $ACE_ROOT/bin/FOCUS/..... +my $spl_prefix_path = ""; +if (defined $ENV{"ACE_ROOT"}) +{ + $spl_prefix_path = $ENV{"ACE_ROOT"}; + + # Check if the prefix path ends with a / or not + # if it does not then manually add the / to it + my $last = substr ($spl_prefix_path, -1); + if ($last ne "/") + { + $spl_prefix_path = $spl_prefix_path . "/"; + } + + # Add the bin/FOCUS directory to the prefix path + $spl_prefix_path = $spl_prefix_path . "bin/FOCUS/"; + +} +else +{ + print "FOCUS: ACE_ROOT environment variable not defined. Exiting... \n"; + exit 1; +} + +my %specialization_table = ( + "select-mt", $spl_prefix_path . "specializations/Reactor_Family/Select_Reactor_MT.spl", + "select-st", $spl_prefix_path . "specializations/Reactor_Family/Select_Reactor_ST.spl", + "tp-reactor",$spl_prefix_path . "specializations/Reactor_Family/TP_Reactor.spl", + "giop", $spl_prefix_path . "specializations/Messaging_Strategy/GIOP.spl", + "iiop", $spl_prefix_path . "specializations/Protocol_Family/IIOP/iiop.spl", + "rw", $spl_prefix_path . "specializations/Wait_Strategy/Wait_On_Read.spl", + "dispatch", $spl_prefix_path . "specializations/Context-Specific-Optimizations/Dispatch-Resolution-Optimization.spl"); + +# Get the command line options +my $ret = GetOptions ("prefix-path=s" => \$prefix_path, + "reactor-spl=s" => \$reactor_type, + "protocol-spl=s" => \$protocol_type, + "messaging-spl=s" => \$messaging_type, + "wait-strategy-spl=s" => \$wait_strat_type, + "output-prefix:s" => \$output_prefix, + "context-specific-optimizations=s" => \$context_opt); + +# Check if the prefix path is specified +if (!$prefix_path) +{ + usage; + exit 1; +} + +# +# Check if the optional outputpath is specified +# if it not specified then the output_prefix will +# be same as the prefix_path. +# So if the prefix is something like: +# /build/arvindk/ACE_wrappers, then the output_prefix +# will be the same. +# +# Upshot: The source files will be directly replaced. +# +if (! $output_prefix) +{ + $output_prefix = $prefix_path; +} + +# Check if the type of each component specialized is valid! +if ($reactor_type) +{ + my $spl_file = $specialization_table {$reactor_type}; + if (! length ($spl_file)) + { + print "Invalid reactor type specified \n"; + usage; + exit 1; + } + + # specialize the Reactor component + FOCUSParser::Specialize_Components ($prefix_path, $spl_file, $output_prefix); +} + +# protocol specialization +if ($protocol_type) +{ + my $spl_file = $specialization_table {$protocol_type}; + if (! spl_file) + { + print "Invalid reactor type specified \n"; + usage; + exit 1; + } + + # specialize the Protocol component + FOCUSParser::Specialize_Components ($prefix_path, $spl_file, $output_prefix); +} + +# Wait Strategy specialization +if ($wait_strat_type) +{ + my $spl_file = $specialization_table {$wait_strat_type}; + if (! spl_file) + { + print "Invalid specialization for the Wait strategy \n"; + usage; + exit 1; + } + + # specialize the wait strategy + FOCUSParser::Specialize_Components ($prefix_path, $spl_file, $output_prefix); +} + +#Messaging specialization +if ($messaging_type) +{ + my $spl_file = $specialization_table {$messaging_type}; + if (! spl_file) + { + print "Invalid specialization for Messaging strategy \n"; + usage; + exit 1; + } + + # specialize the wait strategy + FOCUSParser::Specialize_Components ($prefix_path, $spl_file, $output_prefix); +} + +# Context specific optimizations present +if ($context_opt) +{ + my $spl_file = $specialization_table {$context_opt}; + if (! spl_file) + { + print "Invalid Context specialization optimization specified\n"; + usage; + exit 1; + } + + # specialize the wait strategy + FOCUSParser::Specialize_Components ($prefix_path, $spl_file, $output_prefix); +} diff --git a/ACE/bin/FOCUS/NEWS b/ACE/bin/FOCUS/NEWS new file mode 100644 index 00000000000..29dd15e6a3d --- /dev/null +++ b/ACE/bin/FOCUS/NEWS @@ -0,0 +1,35 @@ +USER VISIBLE CHANGES AND CAPABILITIES ADDED TO FOCUS: +===================================================== + +. Support for specialization of ACE Reactor Framework + -- Specialization of ACE_Select_Reactor both st and mt + -- Specialization of ACE_TP_Reactor + +. Support for specialization of Pluggable Messaging in TAO + -- Specialization of Pluggable Messaging Interface based on GIOP + +. Support for specializing the Pluggable Protocol framework in TAO + -- Specialization for IIOP protocol implementation in TAO + +FUTURE CAPABILITIES and PLANNED CHANGES +======================================== +ACE+TAO component specialization related capabilities +----------------------------------------------------- +. Support for specialization of the Messaging Framework based on GIOP_Lite +. Support for specialization of Wait Strategy including Leader_Follower wait strategy +. Support for specialization of Flushing Strategy components + +FOCUS Specialization Language Enhancements +------------------------------------------ +. Support for multi line search and replace capabilities +. Support for ensuring source files are not corrupted when multiple + specializations are grouped together when the specializations are + added. + +FOCUS Transformation Related Enhancements +---------------------------------------- +. Support for undo feature for the transformations. This is going to be + really hard. I am not sure if this is doable +. Specifying dependencies between the different specializations. If one + is incompatible with the other, then this needs to be detected before + the specializations are executed. diff --git a/ACE/bin/FOCUS/PROBLEM-REPORT-FORM b/ACE/bin/FOCUS/PROBLEM-REPORT-FORM new file mode 100644 index 00000000000..9538e1d58df --- /dev/null +++ b/ACE/bin/FOCUS/PROBLEM-REPORT-FORM @@ -0,0 +1,45 @@ +To: arvindk@dre.vanderbilt.edu +Subject: [area]: [synopsis] + + TAO VERSION: + ACE VERSION: + + HOST MACHINE and OPERATING SYSTEM: + + + TARGET MACHINE and OPERATING SYSTEM, if different from HOST: + COMPILER NAME AND VERSION (AND PATCHLEVEL): + + FOCUS COMMAND LINE OPTION + [What command line option did you use for FOCUS?] + + AREA/CLASS/EXAMPLE AFFECTED: +[What example failed? What module failed to compile?] + + DOES THE PROBLEM AFFECT: + COMPILATION? + [ What compiler are you using? Please cut n paste the + compilation error.] + + LINKING? + [ On Unix systems, did you run make realclean first?] + EXECUTION? + OTHER (please specify)? + +[Please indicate whether ACE/TAO, your application, or both are affected.] + + SYNOPSIS: +[Brief description of the problem] + + DESCRIPTION: +[Detailed description of problem. Don't just say "<blah> +doesn't work, here's a fix," explain what your program does +to get to the <blah> state. ] + + SAMPLE FIX/WORKAROUND: +[If available ] + + ACE+TAO INSTRUMENTED FILES: + Please if possible attach the ACE+TAO instrumented files (source + files) that affected your application. (Please use a compression + utility for sending the attachments) diff --git a/ACE/bin/FOCUS/Parser/FOCUSParser.pm b/ACE/bin/FOCUS/Parser/FOCUSParser.pm new file mode 100644 index 00000000000..b2061a660a4 --- /dev/null +++ b/ACE/bin/FOCUS/Parser/FOCUSParser.pm @@ -0,0 +1,726 @@ +######################################################################### +# A Simple Parser for automating the specializations crated in FOCUS. +# +# @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu> +# +# $Id$ +# +# This parser, parses the specialization file given as an input argument +# and *individually* visits the tags in a pre-determined order to weave +# in the specializations. +# NOTE: This parser will make N passes over the file, where N equals +# to the number of tags defined in the specialization file. This +# approach is intentional as it servers current needs. Future versions +# may enhance this parser and Visit methods to be more intelligent. +########################################################################### +package FOCUSParser; + +# for MY own preferences! +use strict; + +# XML related operations +use XML::DOM; + +# Generic file operations +use FileHandle; + +# Creating files and renaming them +use File::Copy; + +# Creating directories +use File::Path; + +############################################ +# GLOBAL CONSTANTS +########################################### +my $FOCUS_PREPEND_TAG = "\/\/@@ "; + +#################################################################### +# banner: A function that returns the FOCUS banner transformation +# for just clarity purpose only. +################################################################### +sub FOCUS_banner_start +{ + my $banner_str = "// Code woven by FOCUS:\n"; + return $banner_str; +} + +sub FOCUS_banner_end +{ + my $banner_str = "// END Code woven by FOCUS\n"; + return $banner_str; +} + +######################################################################### +# Visit_ADD: Visit a add element defined in the transform. +# In particular look for the hook defined: search it in the source file +# and add the data in the <data> tags into the file starting from the +# hook, but not including the hook. +########################################################################## +sub Visit_Add +{ + my ($add, $copy_file_name) = @_; + + # Open the copy and transform it + open (IN, "+<". $copy_file_name) || + die "cannot open file: " . $copy_file_name; + + # To update a file in place, we use the temporary + # file idiom. Perl says this is the best way to + # do this! + my $copy_file_tmp = $copy_file_name . "tmp"; + open (OUT, ">". $copy_file_tmp) || + die "cannot open temporary file for modying file:" . $copy_file_name; + + # get the hook element defined in the add element + my $hook = $add->getElementsByTagName ('hook'); + + # ensure length of hook == 1; + if ($hook->getLength != 1) + { + print "Assertion Error: An <add> element can have only \ + one <hook> definition"; + + # clean up + close (IN); + close (OUT); + + # Diagnostic comment + print " [failure]... Reverting changes \n"; + + unlink ($copy_file_name); + unlink ($copy_file_name . "tmp"); + exit (1); + } + + # Check if the hook is present in the file at all + my $hook_str = $hook->item(0)->getFirstChild->getNodeValue; + chomp ($hook_str); + + #//@@ For now, due to problem with the hook string + my $search_str = $hook_str; + + while (<IN>) + { + if (/$search_str/) + { + # Do not remove the hook! It needs to be present + print OUT $_; + + # FOCUS banner start + print OUT FOCUS_banner_start; + + # parse <data> ... </data> elements for this add tag + my @data_list = $add->getElementsByTagName ('data'); + foreach my $data (@data_list) + { + my $data_item = $data->getFirstChild->getNodeValue; + chomp ($data_item); + + # Insert the item + print OUT "$data_item \n"; + } + + # FOCUS banner end + print OUT FOCUS_banner_end; + } + else + { print OUT $_; } + } + + # Everything went well! + close (IN); + close (OUT); + + # replace in place the old file with the new one + rename ($copy_file_tmp, $copy_file_name); +} + +########################################################################### +# Visit_Remove: Visit a <remove> element defined in the transform. +# In particular look for the hook defined: search it in the source file +# and remove the element's value from the source file being searched. +############################################################################ +sub Visit_Remove +{ + my ($remove, $copy_file_name) = @_; + + # obtain the data to be removed + my $search = $remove->getFirstChild->getNodeValue; + chomp ($search); + + # Open the copy and transform it + open (IN, "+<" . $copy_file_name) || + die "cannot open file: " . $copy_file_name; + + # Update the file in place + my $copy_file_name_tmp = $copy_file_name . "tmp"; + open (OUT, ">". $copy_file_name_tmp) || + die "cannot open temporary file for modying file:" . $copy_file_name;; + + # Removing something is same as search and replace. Replace with "" + my $replace = ""; + + foreach my $line (<IN>) + { + if ($line =~/$search/) + { + # We do not print the banner information + # as we have removed something and + # print the banner will be redundant! + + # replace <search> with <replace> + $line =~ s/$search/$replace/; + + print OUT $line; + } + else { print OUT $line; } + } + + # Everything went well! + close (IN); + close (OUT); + + # replace in place the old file with the new one + rename ($copy_file_name_tmp, $copy_file_name); +} + +######################################################################### +# Visit_Substitute: Visit a <substitute> element defined in the transform. +# In particular look for the <search> element and replace it with the +# <replace> element. +######################################################################### +sub Visit_Substitute +{ + my ($substitute, $copy_file_name) = @_; + + # Open the copy and transform it + open (IN, "+<". $copy_file_name) || + die "cannot open file: " . $copy_file_name; + + # To update a file in place, we use the temporary + # file idiom. Perl says this is the best way to + # do this! + my $copy_file_name_tmp = $copy_file_name . "tmp"; + open (OUT, ">". $copy_file_name . "tmp") || + die "cannot open temporary file for modying file:" . $copy_file_name;; + + # check if the match-line keyword is set or not + my $match_line = $substitute->getAttribute('match-line'); + + # <search> .... </search> + my $search_list = $substitute->getElementsByTagName ('search'); + + # ensure length of search == 1; + if ($search_list->getLength != 1 || + $search_list->getLength == 0) + { + print "Assertion Error: A <substitute> element can have only \ + one <search> element"; + close (IN); + close (OUT); + + # Dianostic comment + print " [failure] reverting changes \n"; + + unlink ($copy_file_name); + unlink ($copy_file_name_tmp); + exit (1); + } + + # <replace> .... </replace> + my $replace_list = $substitute->getElementsByTagName ('replace'); + if ($replace_list->getLength != 1 || + $replace_list->getLength == 0) + { + print "Assertion Error: A <substitute> element can have only \ + one <replace> element"; + close (IN); + close (OUT); + unlink ($copy_file_name); + unlink ($copy_file_name_tmp); + exit (1); + } + + # <search> and <replace> element values + my $search = $search_list->item(0)->getFirstChild->getNodeValue; + my $replace = $replace_list->item(0)->getFirstChild->getNodeValue; + + # remove spaces + chomp ($search); + chomp ($replace); + + # Search and replace string in the file + foreach my $line (<IN>) + { + # Check if the match line attribute is set. If so then + # ignore word boundaries. If not, honor word boundaries. + my $line_matched = 0; + if (! $match_line) + { + if ($line =~/\b$search\b/) + { + $line_matched = 1; + } + } + else + { + if ($line =~ /$search/) + { + $line_matched = 1; + } + } + + # Check if the line matched + if ($line_matched) + { + # FOCUS banner start + print OUT FOCUS_banner_start; + + # replace <search> with <replace> + # Caveat: What if <search> occures multiple + # times in the line? Here is how we handle + # it + $line =~ s/$search/$replace/g; + + print OUT $line; + + # FOCUS banner end + print OUT FOCUS_banner_end; + } + else { print OUT $line; } + } + + # everything went well! + close (IN); + close (OUT); + + # replace in place the old file with the new one + rename ($copy_file_name_tmp, $copy_file_name); +} + +######################################################################### +# Visit_Comment: Visit the comment-region hooks defined in the +# source code and comment out all code between start and finish of that +# region +######################################################################### +sub Visit_Comment +{ + my ($comment, $copy_file_name) = @_; + + # check for the comment region tags and + # comment out the region + my $start_hook_tag = $comment->getElementsByTagName ('start-hook'); + my $end_hook_tag = $comment->getElementsByTagName ('end-hook'); + + if ($start_hook_tag->getLength != 1 || + $end_hook_tag->getLength != 1) + { + print "Assertion Error: A <comment> element can have only \ + one pair of <start-hook> and <end-hook> tags"; + unlink ($copy_file_name); + exit (1); + } + + my $start = $start_hook_tag->item(0)->getFirstChild->getNodeValue; + my $end = $end_hook_tag->item(0)->getFirstChild->getNodeValue; + + # What are we looking for: + # We need to start from "//" . FOCUS_PREPEND_TAG . $hook + # i.e. //[[@ <blah blah> + # This will be the format for both start and end + # //@@ Problems with the hook string + my $start_hook = $FOCUS_PREPEND_TAG . $start; + my $end_hook = $FOCUS_PREPEND_TAG . $end; + + # Open the copy and transform it + open (IN, "+<". $copy_file_name) || + die "cannot open file: " . $copy_file_name; + + my $copy_file_name_tmp = $copy_file_name . "tmp"; + open (OUT, ">". $copy_file_name_tmp) || + die "cannot open temporary file for modying file:" . $copy_file_name; + + my $start_commenting = 0; + while (<IN>) + { + if (! /$start_hook/ && + ! /$end_hook/) + { + if ($start_commenting) + { print OUT "// " . $_; } + else + { print OUT $_; } + } + else + { + if (/$start_hook/) + { + $start_commenting = 1; + print OUT $_; # print start hook! + } + else + { + $start_commenting = 0; + print OUT $_; # print end hook! + } + } + } + + # everything went well! + close (IN); + close (OUT); + + rename ($copy_file_name_tmp, $copy_file_name); +} + +############################################################### +# Visit_Copy: visit the <copy> tags and weave the code into the +# source file. In particular, open the source file specified +# in the file-source tag. Search for the start hook and +# copy until the end hook is reached. +############################################################### +sub Visit_Copy +{ + my ($copy_tag, $copy_file_name, $default_module_name, $prefix_path) = @_; + + # Check if a file name has been specified + my $dest_file_tag = $copy_tag->getElementsByTagName ('source'); + + if (! $dest_file_tag) + { + print "Error: <copy-from-source> does not have the <file> tag.."; + print "aborting \n"; + exit 1; + } + + if ($dest_file_tag->getLength != 1) + { + print "Assertion Error: A <copy-from-source> element can have only \ + one <source> tag from which to copy elements"; + exit (1); + } + + my $dest_file_name = $dest_file_tag->item(0)->getFirstChild->getNodeValue; + + #Check if the file exists and one is able to access it + $dest_file_name = $prefix_path . "/" . $default_module_name . "/" . $dest_file_name; + + open (DEST, "<". $dest_file_name) || + die "cannot open $dest_file_name \n Wrong <file> tag within <copy-from-source> exiting" ; + + # check for the start and end tags within the target file where + # one needs to start copying from + my $start_tag = $copy_tag->getElementsByTagName ('copy-hook-start'); + my $end_tag = $copy_tag->getElementsByTagName ('copy-hook-end'); + + if (! $start_tag || ! $end_tag) + { + print "Assertion Error: A <copy> element should have a \ + <copy-hook-start> tag and <copy-hook-end> tag \n"; + exit (1); + } + + # Get the <dest-hook> tag that indicates the destination where the + # code between the start and end tags will be placed. + my $dest_hook_tag = $copy_tag->getElementsByTagName ('dest-hook'); + if (! $dest_hook_tag) + { + print "Assertion Error: <copy-from-source> should have a <dest-hook> \ + tag that dictates where in the source file the code should be \ + placed. \n"; + exit (1); + } + + # Remove any starting and trailing white spaces + chomp ($dest_hook_tag); + + # We have everything we need! Do the copy + my $start_tag_name = $start_tag->item(0)->getFirstChild->getNodeValue; + my $end_tag_name = $end_tag->item(0)->getFirstChild->getNodeValue; + my $dest_tag_name = $dest_hook_tag->item(0)->getFirstChild->getNodeValue; + + # First we add the FOCUS prepend tags + $start_tag_name = $FOCUS_PREPEND_TAG . $start_tag_name; + $end_tag_name = $FOCUS_PREPEND_TAG . $end_tag_name; + $dest_tag_name = $FOCUS_PREPEND_TAG . $dest_tag_name; + + # Step 1: Iterate over the target file till the + # dest-hook is found in that file + my $copy_file_name_tmp = $copy_file_name . "tmp"; + open (OUT, ">". $copy_file_name_tmp) || + die "cannot open temporary file for modying file:" . $copy_file_name; + open (IN, "<" . $copy_file_name) || + die "cannot open file $copy_file_name specified in the <file> tag \n"; + + my $dest_tag_found = 0; #check if tag matched + foreach my $line (<IN>) + { + if ($line =~ /$dest_tag_name/) + { $dest_tag_found = 1; print OUT $line; last; } + + print OUT $line; + } + close (IN); + + # If we reached the end of file before finding the tag! + if (! $dest_tag_found) + { + print "\n Error: <dest-hook> tag missing in file .. aborting \n"; + close (DEST); + close (IN); + close (OUT); + unlink ($copy_file_name_tmp); + exit (1); + } + + # Step 2: Now look in the destination file and look for the hooks + # where one needs to copy. There could be multiple places where the + # hook can be present. E.g. + # ....... + # //@@ COPY_START_HOOK + # .... + # .... + # //@@ COPY_END_HOOK + # .... + # .... + # //@@ COPY_START_HOOK + # .... + # .... + # //@@ COPY_END_HOOK + # Handle this case + + my $line_matched = 0; + my $start_copying = 0; # initially do not copy + foreach my $line (<DEST>) + { + # Check if the line matches the start tag + if ($line =~/$start_tag_name/) + { + $line_matched += 1; + $start_copying = 1; + } + else + { + # Check if the line matches the end tag + if ($line =~/$end_tag_name/) + { + # check if the start tag matched! + if (! $line_matched) + { + print "Assertion error: <copy-hook-end> tag misplaced with \ + the <copy-hoook-source> \n"; + close (DEST); + close (IN); + close (OUT); + unlink ($copy_file_name_tmp); + exit (1); + } + + # decrement the count for nested tags + $line_matched -= 1; + if (! $line_matched ) + { $start_copying = 0; } + } + else + { + # Print out the line + if ($start_copying) + { print OUT $line; } + } + } + } + + # At the end of this loop line_matched should be 0 + if ($line_matched) + { + print "Error: in $dest_file_name, number of <copy-hook-source> tags \ + did not match the number of <copy-hook-end> tags. Reverting \ + changes. \n"; + close (DEST); + close (IN); + close (OUT); + unlink ($copy_file_name_tmp); + exit (1); + } + + # Step 3: Now copy data after the tag in the original file onto the destination + # file. + open (IN, "<" . $copy_file_name) || + die "cannot open file $copy_file_name specified in the <file> tag \n"; + $dest_tag_found = 0; #used as a flag + foreach my $line (<IN>) + { + if ($dest_tag_found) + { print OUT $line; } + + # If the hook is found, then don't write the hook onto OUT + # as it would have been written earlier + if (! $dest_tag_found && + $line =~ /$dest_tag_name/) + { $dest_tag_found = 1; } + } + + # Normal exit path + close (IN); + close (OUT); + close (DEST); + + # Rename the tmp file to the file modified + rename ($copy_file_name_tmp, $copy_file_name); +} + +################################################################# +# commit_files: A procedure to commit all the copy files that +# were specialized back to the orginal files. +################################################################# +sub commit_files +{ + my ($path_name, $output_path_name, @files) = @_; + + # iterate over the file_name_list + foreach my $file (@files) + { + # <file name="...."> + my $file_name = $file->getAttribute('name'); + + # output_path == input_path then do an in place + # substitution. + if ($output_path_name eq $path_name) + { + rename ($path_name . "/" . $file_name . "copy", + $path_name . "/" . $file_name); + } + else + { + # Check if the path_name exists. The path name + # corresponds to a directory. So create it if it does + # not exist. + if (! -d $output_path_name) + { + #@@? Need to revert the *copy files? + mkpath ($output_path_name, 0, 0744) || + die "cannot create $output_path_name: commit files failed! \n"; + } + + # move the specialized file to the output directory + rename ($path_name . "/" . $file_name . "copy", + $output_path_name . "/" . $file_name); + } + } +} + +#### Main ######################################################## +# Specialize_Component +# procedure to execute the transformations specified in the +# specialization file +################################################################## +sub Specialize_Components +{ + # Get the command line arguments + my ($prefix_path, $spl_file, $output_prefix) = @_; + + my $parser = XML::DOM::Parser->new(); + my $doc = $parser->parsefile($spl_file); + + # Check if the prefix path ends with a / or not + # if it does not then manually add the / to it + my $last = substr ($prefix_path, -1); + if ($last ne "/") + { $prefix_path = $prefix_path . "/"; } + + # Entry Point: <transform> element + foreach my $transform ($doc->getElementsByTagName('transform')) + { + # <module tags> + foreach my $module ($transform->getElementsByTagName('module')) + { + # Complete path name to the module + my $module_name = $module->getAttribute('name'); + my $path_name = $prefix_path . $module_name; + + # <file tags> + my @files = $module->getElementsByTagName('file'); + foreach my $file (@files) + { + # <file name="...."> + my $file_name = $file->getAttribute('name'); + + # Rather than modifying the files directly, make a local + # copy of the files and then transform them and commit + # if there is a file called foo we make a file foo_copy + my $file_path_copy = $path_name . "/" . $file_name . "copy"; + my $file_path_name = $path_name . "/" . $file_name; + + copy ($file_path_name, $file_path_copy); + + # Diagnostic comment + print "Instrumenting $file_name .........."; + + # <comment> ... </comment> + my @comment_list = $file->getElementsByTagName ('comment'); + foreach my $comment (@comment_list) + { Visit_Comment ($comment, $file_path_copy); } + + # <copy-from-source> ... </copy-from-source> + my @copy_from_source_files = + $file->getElementsByTagName ('copy-from-source'); + foreach my $copy_from_source (@copy_from_source_files) + { + Visit_Copy ($copy_from_source, + $file_path_copy, + $module_name, + $prefix_path); + } + + # <remove> ... </remove> + my @remove_list = $file->getElementsByTagName ('remove'); + foreach my $remove (@remove_list) + { Visit_Remove ($remove, $file_path_copy); } + + # <substitute ... </substitute> + my @substitute_list = $file->getElementsByTagName ('substitute'); + foreach my $substitute (@substitute_list) + { Visit_Substitute ($substitute, $file_path_copy); } + + # <add> <hook> ...... </hook> <add> + my @add_list = $file->getElementsByTagName ('add'); + foreach my $add (@add_list) + { Visit_Add ($add, $file_path_copy); } + + # Everything went well.. Print success + print " [done] \n"; + } + } + + # At this point all the specializations in all the modules have + # succeeded. It is at this point that we need to commit the + # specializations in each of the modules. That is move the temporary + # file that we created to the main file that was specialized. + # This also means that we need another loop and do the same thing + # as above.... + # <module tags> + foreach my $module ($transform->getElementsByTagName('module')) + { + # Complete path name to the module + my $module_name = $module->getAttribute('name'); + my $path_name = $prefix_path . $module_name; + + # Output path name: append output_prefix to the + # current module name. Append "/" to create a + # directory like /foo/bar/baz/ + my $output_path = $output_prefix . "/" . $module_name; + + # <file tags> + my @files = $module->getElementsByTagName('file'); + + # commit the files + commit_files ($path_name, $output_path, @files); + } + } +} + +#### +# Requiured for a module +#### +1; diff --git a/ACE/bin/FOCUS/README b/ACE/bin/FOCUS/README new file mode 100644 index 00000000000..14f3c804dc9 --- /dev/null +++ b/ACE/bin/FOCUS/README @@ -0,0 +1,76 @@ + + FOCUS README + ============ + +Motivation: +---------- +Middleware is often developed as a set of frameworks that can be +extended and configured with alternative implementations of key +components, such as different types of transport protocols e.g., +TCP/IP, VME, or shared memory), event demultiplexing mechanisms +e.g., reactive-, proactive-, or thread-based), request +demultiplexing strategies (e.g., dynamic hashing, perfect +hashing, or active demuxing), and concurrency models (e.g., +thread-per-connection, thread pool, or thread-pre-request). A +particular DRE application, however, may only use a small subset +of the potential framework alternatives. As a result, general-purpose +middleware may be overly extensible, i.e., contain +unnecessary overhead for indirection and dynamic dispatching that is +not needed for use cases in a particular context. +A challenge is to develop middleware specialization +techniques that can eliminate unnecessary overhead associated with +overly extensible middleware framework implementations for certain +product variants or application-specific contexts. + +Example and Approach: +-------------------- +The reactor framework in ACE allows plug and play of different +reactors such as Select, TP, Devpoll etc. The TAO middleware +implementation and applications that run atop TAO typically use +one particular implementation of the Reactor. For example, a +single-threaded application might use select_* reactors. The +Reactor framework uses the bridge pattern to transparently +invoke operations on the right reactors. When the concrete +Reactor is known, it should be possible to specialize the +framework to use the concrete reactor directly rather than use +the bridge. + +As a part of the Feature Oriented Customizer (FOCUS) tool being +,we are trying to specialize frameworks +when the concrete implementation type is known a priori. FOCUS +provides an XML based transformation engine, where the +specialization transformations are captured in XML file and a +weaver specializes the code. + +To help in this transformation process, FOCUS applies markers +within the source code. These markers are added as special +comments. For example, //@@ REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK +represents a hook where forward declarations and include files are +added by the weaver. As these markers are comments therefore should not +affect normal applications in *any* manner. Additionally, applications +that use multiple reactor implementations not be affected/do not need any +change. Currently, these specializations are targeted for TAO middleware, +where applications know the target reactor a priori and want to +leverage the specialization to improve performance. + +FOCUS Installation +------------------ +. FOCUS is written using Perl and does not require any compilation. Additionally + FOCUS does not depend on any external tools. + +Requirements +------------ +. FOCUS has been tested on Perl version 5.8.0 and uses the following Perl + packages: + -- XML::DOM package --> Perl package for processing XML DTDs + +Sample Usage: +------------- +FOCUS can be invoked from the command line in the following manner: +cmd>$ACE_ROOT/bin/FOCUS/FOCUS.pl --reactor-spl=select-st + --prefix-path=/build/arvindk/ACE_wrappers + --output-prefix=/build/arvindk/spl-files + +More Information: +----------------- +More information about FOCUS should be available from the docs directory. diff --git a/ACE/bin/FOCUS/VERSION b/ACE/bin/FOCUS/VERSION new file mode 100644 index 00000000000..b41df4e4c7b --- /dev/null +++ b/ACE/bin/FOCUS/VERSION @@ -0,0 +1 @@ +This is FOCUS version 0.0.1 alpha diff --git a/ACE/bin/FOCUS/docs/FOCUS.html b/ACE/bin/FOCUS/docs/FOCUS.html new file mode 100644 index 00000000000..6b00dfb020d --- /dev/null +++ b/ACE/bin/FOCUS/docs/FOCUS.html @@ -0,0 +1,165 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<!-- $Id$ --> + <title>FOCUS</title> +</head> +<body bgcolor="#ffffff" link="#000fff" vlink="#ff0f0f" text="#000000"> +<hr> +<p></p> +<h2 align="center">Feature Oriented Customizer for Middleware (FOCUS)</h2> +<h3>Table of Contents</h3> +<ul> + <li><a href="#MOT">Introduction</a> </li> + <li><a href="#FCS-OVR">FOCUS Options overview</a> </li> + <li><a href="#FCS-USAGE">FOCUS Sample Usage</a> </li> + <li><a href="#FCS-ORG">FOCUS Structure & Organization</a> </li> + <li><a href="#FCS-ORG">Extending FOCUS</a> </li> +</ul> + +<hr> +<h3><b><a name="MOT">Introduction</a></b></h3> +TAO is a highly flexible ORB that contains a wide range of ORB +configuration options. One or more of these options can be combined +to meet various application requirements, such as low-latency, +predictable real-time behavior, or small memory footprint. TAO's ORB +configuration options are managed by an object-oriented framework +within the ORB Core. TAO ORB internally uses several objects called +<b>Resources</b>, such +as a <em>reactor</em> framework that demultiplexes new connection and +data requests from a client or <em>pluggable protocol</em> framework +to seamlessly work across different protocols. <b>Strategies</b>, are +objects that use the <b>Resource</b> entities to perform various ORB tasks, +such as connection management, concurrency, and demultiplexing. +The <b>Service Configurator</b> is a framework that can be used +to statically and dynamically configure components into middleware and +applications. + +Most often, applications that run on top of TAO use only one concrete type +of each resource. For example, predominantly TAO applications use the IIOP +protocol for communication. In this case, the underlying framework that +realizes the feature can be specialized to remove dynamic dispatching +overheads. The Feature Oriented Customizer (FOCUS) tool provides a +generic approach to enable middleware developers to specialize middleware +Frameworks when the concrete resource type is known a priori. +FOCUS provides an XML based transformation engine, where the +specialization transformations are captured in XML file and a +weaver specializes the code. Some important points to note about FOCUS +and specialization: +<ul> + <li>It does not modify an interface. So no application level changes are + necessary. + </li> + <li>Once a framework has been customized using FOCUS for a concrete component, + other components do not work. For example, specializing the protocol + framework with IIOP, precludes the ability to plug-in other protocol + implementations. + </li> + <li>It provides a source-to-source transformations that require re-compiling + the source. + </li> +</ul> + +<hr> +<h3><b><a name="FCS-OVR">FOCUS Options Usage</a></b></h3> +<table border="2" cellpadding="0" cellspacing="2"> + <tbody> + <tr> + <th>Option</th> + <th>Description</th> + </tr> + <tr> + <td>--prefix-path</td> + <td>prefix-path to the ACE+TAO source distribution location. For example, + in most situations this path is same as the ACE_ROOT environment + variable. + </td> + </tr> + <tr> + <td>--reactor-spl <em>select-st</em>, <em>select-mt</em>, <em>tp</em></td> + <td>Option to specialize the reactor framework with the + concrete reactor type. + <p>select-st: select reactor which no locking. Single threaded case.</p> + <p>select-mt: select reactor with locking enabled, multi-threaded case. + </p> + <p>tp-reactor: Thread-pool reactor</p> + </td> + </tr> + <tr> + <td>--protocol-spl <em>iiop</em></td> + <td>Option to specialize the pluggable protocol framework in TAO for the + IIOP protocol. + </tr> + <tr> + <td>--messaging-spl <em>giop</em></td> + <td>Option to specialize the messaging strategy in TAO with GIOP + messaging protocol. + </td> + </tr> + <tr> + <td>--wait-strategy <em>rw</em></td> + <td>Specialize the Wait Strategy with the concrete Wait Strategy in TAO. + This specialization corresponds to the <em>-ORBWaitStrategy</em> + option in TAO. + </td> + </tr> + <td>--output-prefix</td> + <td>Option to copy over the specialized files to an output directory. This + option works only when a single specialization is chose. If multiple + specializations are chosen, then this copies the files corresponding + to the last specialization. + </td> + </tbody> +</table> + +<hr> +<h3><b><a name="FCS-USAGE">FOCUS Sample Usage</a></b></h3> +cmd>$ACE_ROOT/bin/FOCUS/FOCUS.pl --reactor-spl=select-st \ + --prefix-path=/build/arvindk/ACE_wrappers + --output-prefix=/build/arvindk/spl-files + +<hr> +<h3><b><a name="FCS-ORG">FOCUS Tool Organization</a></b></h3> +FOCUS tool structure is organized as follows: +<ul> + <li>Parser directory has all parser related modules</li> + <li>specializations: Rules data base that has the XML files required for + performing the individual specialization transformations. For each + specialization we have the following sub directories: + <ul> + <li>Reactor_Family: Specializations for ACE_Reactor family</li> + <li>Protocol_Family: Specializations for TAO's protocol family</li> + <li>Messaging_Strategy: Specializations for TAO's Messaging Strategy</li> + <li>Wait_Strategy: Specializations for TAO's Wait strategies</li> + </ul> + </li> +</ul> + +A detailed overview of the FOCUS specialization language, that specifies the +different types for specialization transformations supported in FOCUS is +discussed here: {To be updated shortly!} + +<hr> +<h3><b><a name="FCS-ORG">Extending FOCUS</a></b></h3> +To add a new specializations, to FOCUS, one needs to do the following: +<ol> + <li>Use the FOCUS specification language to model the different specialization + Transformations required. Add this to the repository under + FOCUS/specializations. Current convention is to use a directory for each + family or specific type of specialization and add specialization files + for each type in the family. + </li> + <li>Annotate the middleware source code where ever applicable to perform the + transformations. + </li> + <li>Modify the FOCUS.pl script to add a specific option similar to --reactor-spl + option for executing the specializations. Also update the specialization + table that maps the command-line option to the appropriate specialization + file within the repository. + </li> +</ol> + +<hr> + +</body> +</html> diff --git a/ACE/bin/FOCUS/specializations/Context-Specific-Optimizations/Dispatch-Resolution-Optimization.spl b/ACE/bin/FOCUS/specializations/Context-Specific-Optimizations/Dispatch-Resolution-Optimization.spl new file mode 100644 index 00000000000..c56543cf54f --- /dev/null +++ b/ACE/bin/FOCUS/specializations/Context-Specific-Optimizations/Dispatch-Resolution-Optimization.spl @@ -0,0 +1,172 @@ +<?xml version="1.0"?> + +<!-- Dispatch Resolution Optimization + * ================================ + * This optimization should be applied with the requests + * from a client are delivered to the same operation in + * an IDL interface. In general this optimization applies + * to IDL interfaces that have a single operation defined + * on them + * + * @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + * $Id$ +--> + +<transform> + +<module name="TAO/tao"> + +<file name="Connection_Handler.h"> + +<!-- Include file to be added for this specialization --> +<add> + <hook>CONNECTION_HANDLER_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook> + <data> + class TAO_Servant_Base; + #include "tao/Abstract_Servant_Base.h" + </data> +</add> + +<!-- Add get and set operations to hold operation signature --> +<add> + <hook>CONNECTION_HANDLER_SPL_PRIVATE_DATA_ADD_HOOK</hook> + <data> +TAO_Skeleton op_signature_; +TAO_Servant_Base *servant_; + </data> +</add> + +<!-- Add get and set public operations for the data --> +<add> + <hook>CONNECTION_HANDLER_SPL_PUBLIC_METHODS_ADD_HOOK</hook> + <data> +void set_op_signature (TAO_Skeleton &skeleton, + TAO_Servant_Base *&servant); +void get_op_signature (TAO_Skeleton &operation_ptr, + TAO_Servant_Base *&servant); + </data> +</add> + +</file> + +<file name="Connection_Handler.inl"> + +<!-- Add operations to get and set the operation signature --> +<add> + <hook>CONNECTION_HANDLER_SPL_METHODS_ADD_HOOK</hook> + <data> + ACE_INLINE void + TAO_Connection_Handler::set_op_signature (TAO_Skeleton &skeleton, + TAO_Servant_Base *&servant) +{ + this->op_signature_ = skeleton; + this->servant_ = servant; +} + +ACE_INLINE void +TAO_Connection_Handler::get_op_signature (TAO_Skeleton &operation_ptr, + TAO_Servant_Base *&servant) +{ + operation_ptr = this->op_signature_; + servant = this->servant_; +} + + </data> +</add> +</file> + +<file name="GIOP_Message_Base.h"> + +<add> +<hook>GIOP_MESSAGE_BASE_DATA_MEMBER_ADD_HOOK</hook> +<data>bool once__;</data> +</add> +</file> + +<file name="GIOP_Message_Base.cpp"> + +<add> + <hook>GIOP_MESSAGE_BASE_INCLUDE_ADD_HOOK</hook> + <data>#include "tao/Connection_Handler.h"</data> +</add> + +<!-- Add a once__ data member to the class that will + only resolve the dispatch once --> +<substitute match-line="yes"> + <search>TAO_DEF_GIOP_MINOR\)</search> + <replace>TAO_DEF_GIOP_MINOR) + , once__ (1) + </replace> +</substitute> + +<!-- Comment code that resolves dispatch normally --> +<comment> + <start-hook>TAO_DISPATCH_RESOLUTION_OPT_COMMENT_HOOK_START</start-hook> + <end-hook>TAO_DISPATCH_RESOLUTION_OPT_COMMENT_HOOK_END</end-hook> +</comment> + +<!-- Add the optimized path code --> +<add> + <hook>TAO_DISPATCH_RESOLUTION_OPT_COMMENT_HOOK_END</hook> + <data> + if (once__) + { + once__ = false; + + // Normal path the first time + this->orb_core_->request_dispatcher ()->dispatch ( + this->orb_core_, + request, + forward_to + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + else + { + // Dispatch directly to the skeleton + TAO_Connection_Handler *handler = + transport->connection_handler (); + TAO_Skeleton skel; + TAO_Servant_Base *skeleton_ptr; + handler->get_op_signature (skel, skeleton_ptr); + + // Convert references to void * + void *upcall_ptr = 0; + skel (request, + upcall_ptr, + (void *)skeleton_ptr + ACE_ENV_ARG_PARAMETER); + if (response_required) + request.tao_send_reply (); + } + </data> +</add> +</file> +</module> + +<module name="TAO/tao/PortableServer"> +<file name="Servant_Base.cpp"> + +<!-- Add necessary include files --> +<add> + <hook>TAO_SERVANT_BASE_INCLUDE_ADD_HOOK</hook> + <data>#include "tao/Transport.h"</data> + <data>#include "tao/Connection_Handler.h"</data> +</add> + +<!-- After processing the first request, set the operation signature on + the connection handler for subsequent request processing --> +<add> + <hook>TAO_DISPATCH_RESOLUTION_OPT_ADD_HOOK</hook> + <data> + TAO_Connection_Handler *handler = + req.transport ()->connection_handler (); + handler->set_op_signature (skel, + static_cast<TAO_Servant_Base *> (derived_this)); + </data> +</add> +</file> + +</module> + +</transform> diff --git a/ACE/bin/FOCUS/specializations/Flushing_Strategy/Leader_Follower_Flushing_Strategy.spl b/ACE/bin/FOCUS/specializations/Flushing_Strategy/Leader_Follower_Flushing_Strategy.spl new file mode 100644 index 00000000000..a33b90ba255 --- /dev/null +++ b/ACE/bin/FOCUS/specializations/Flushing_Strategy/Leader_Follower_Flushing_Strategy.spl @@ -0,0 +1,211 @@ +<?xml version="1.0"?> + +<!-- Leader Follower Flushing Strategy Specializations + * ================================================= + * Details all the specialization transformations necessary + * to specialize the Flushing Strategy with the concrete + * Leader_Follower flushing strategy. + * + * @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + * $Id$ +--> + +<transform> + +<module name="TAO/tao"> + +<!-- Transformations to L/F Flushing Strategy --> +<file name="Leader_Follower_Flushing_Strategy.h"> + +<!-- Comment out Flushing_Strategy include --> +<remove>#include "Flushing_Strategy.h"</remove> + +<!-- Add the forward declarations --> +<add> + <hook>FLUSHING_STRATEGY_SPL_INCLUDE_ADD_HOOK</hook> + <data> +class TAO_Transport; +class TAO_Queued_Message; +class ACE_Time_Value; + +#include "TAO_Export.h" + </data> +</add> + +<!-- Remove all virtual key words --> +<remove>virtual</remove> + +<!-- Remove inheritance from Flushing strategy --> +<remove>: public TAO_Flushing_Strategy</remove> + +</file> + +<!-- Do not build other Flushing Strategies --> +<file name="tao.mpc"> + + <substitute> + <search>Flushing_Strategy.h</search> + <replace>// Flushing_Strategy.h</replace> + </substitute> + <substitute> + <search>Flushing_Strategy.cpp</search> + <replace>// Flushing_Strategy.cpp</replace> + </substitute> + + <substitute> + <search>Block_Flushing_Strategy.h</search> + <replace>// Block_Flushing_Strategy.h</replace> + </substitute> + <substitute> + <search>Block_Flushing_Strategy.cpp</search> + <replace>// Block_Flushing_Strategy.cpp</replace> + </substitute> + + <substitute> + <search>Reactive_Flushing_Strategy.h</search> + <replace>// Reactive_Flushing_Strategy.h</replace> + </substitute> + <substitute> + <search>Reactive_Flushing_Strategy.cpp</search> + <replace>// Reactive_Flushing_Strategy.cpp</replace> + </substitute> + +</file> + +<file name="default_resource.cpp"> + +<substitute match-line="yes"> + <search>#include "tao/Reactive_Flushing_Strategy.h"</search> + <replace> // #include "tao/Reactive_Flushing_Strategy.h"</replace> +</substitute> + +<substitute match-line="yes"> + <search>#include "tao/Block_Flushing_Strategy.h"</search> + <replace>// #include "tao/Block_Flushing_Strategy.h"</replace> +</substitute> + +<!-- Replace all occurences of Flushing_Strategy with + L/F Flushing Strategy --> +<substitute> + <search>TAO_Flushing_Strategy</search> + <replace>TAO_Leader_Follower_Flushing_Strategy</replace> +</substitute> + +<!-- Comment out region specified by comment hooks --> +<comment> + <start-hook>FLUSHING_STRATEGY_SPL_COMMENT_HOOK_START</start-hook> + <end-hook>FLUSHING_STRATEGY_SPL_COMMENT_HOOK_END</end-hook> +</comment> + +<!-- Add the L/F specialization after the hook --> +<add> + <hook>FLUSHING_STRATEGY_SPL_COMMENT_HOOK_END</end-hook> + <data>this->flushing_strategy_type_ = TAO_LEADER_FOLLOWER_FLUSHING; + </data> +</add> + +<!-- Comment out creation of all other flushing strategies --> +<comment> + <start-hook>FLUSHING_STRATEGY_CREATION_SPL_HOOK_START</start-hook> + <end-hook>FLUSHING_STRATEGY_CREATION_SPL_HOOK_END</end-hook> +</comment> + +<!-- Create the L/F flushing strategy directly --> +<add> + <hook>FLUSHING_STRATEGY_CREATION_SPL_HOOK_END</hook> + <data>ACE_NEW_RETURN (strategy, + TAO_Leader_Follower_Flushing_Strategy, + 0); + </data> +</add> + +</file> + +<file name="default_resource.h"> + +<!-- Replace all occurences of Flushing_Strategy with L/F strategy --> +<substitute> + <search>TAO_Flushing_Strategy</search> + <replace>TAO_Leader_Follower_Flushing_Strategy</replace> +</substitute> + +</file> + +<file name="ORB_Core.h"> + +<!-- Replace all occurences of base strategy with most + derived strategy --> +<substitute> + <search>TAO_Flushing_Strategy</search> + <replace>TAO_Leader_Follower_Flushing_Strategy</replace> +</substitute> + +</file> + +<file name="ORB_Core.cpp"> + +<!-- Replace the Flushing Strategy inclue with L/F + flushing include --> +<substitute match-line="yes"> + <search>#include "Flushing_Strategy.h"</search> + <replace>#include "Leader_Follower_Flushing_Strategy</replace> +</substitute> + +</file> + +<file name="ORB_Core.i"> + +<!-- Replace all occurences of base strategy with most + derived strategy --> +<substitute> + <search>TAO_Flushing_Strategy</search> + <replace>TAO_Leader_Follower_Flushing_Strategy</replace> +</substitute> + +</file> + +<file name="Transport.h"> + +<!-- Remove the friend declaration of Reactive_Flushing --> +<substitute match-line="yes"> + <search>friend class TAO_Reactive_Flushing_Strategy;</search> + <replace>// friend class TAO_Reactive_Flushing_Strategy;</replace> +</substitute> + +<!-- Remove friend declaration of Block Flushing --> +<substitute match-line="yes"> + <search>friend class TAO_Block_Flushing_Strategy;</search> + <replace>// friend class TAO_Block_Flushing_Strategy;</replace> +</substitute> + +</file> + +<file name="Transport.cpp"> + +<substitute match-line="yes"> + <search>#include "Flushing_Strategy.h"</search> + <replace>#include "Leader_Follower_Flushing_Strategy.h</replace> +</substitute> + +<!-- Replace all occurences of TAO_Flushing_Strategy with + TAO_Leader_Follower_Flushing --> +<substitute> + <search>TAO_Flushing_Strategy</search> + <replace>TAO_Leader_Follower_Flushing_strategy</replace> +</substitute> + +</file> + +<file name="Resource_Factor.h"> + +<!-- Replace TAO_Flushing_Strategy with L/F version --> +<substitute> + <search>TAO_Flushing_Strategy</search> + <replace>TAO_Leader_Follower_Flushing_Strategy</replace> +</substitute> + +</file> + +</module> + +</transform> diff --git a/ACE/bin/FOCUS/specializations/Messaging_Strategy/GIOP.spl b/ACE/bin/FOCUS/specializations/Messaging_Strategy/GIOP.spl new file mode 100644 index 00000000000..76e27509848 --- /dev/null +++ b/ACE/bin/FOCUS/specializations/Messaging_Strategy/GIOP.spl @@ -0,0 +1,246 @@ +<?xml version="1.0"?> + +<!-- Pluggable Messaging Specializations: + * When the concrete pluggable messaging is selected, + * this specialization removes the need for the Pluggable + * messaging interface completely from within TAO. + * + * @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + * $Id$ +--> + +<transform> + +<!-- Define the module where there are multiple files --> +<module name="TAO/tao"> + +<file name="tao.mpc"> + +<!-- Remove Pluggable messaging include altogether --> +<substitute> + <search>GIOP_Message_Lite.cpp</search> + <replace>// GIOP_Message_Lite.cpp </replace> +</substitute> +<substitute> + <search>GIOP_Message_Lite.h</search> + <replace>// GIOP_Message_Lite.h</replace> +</substitute> +<substitute> + <search>Pluggable_Messaging.h</search> + <replace>// Pluggable_Messaging.h</replace> +</substitute> +<substitute> + <search>Pluggable_Messaging.cpp</search> + <replace>// Pluggable_Messaging.cpp</replace> +</substitute> + +</file> + +<file name="GIOP_Message_Base.h"> + +<!-- Remove Pluggable Messaging include directive --> +<remove>#include "tao/Pluggable_Messaging.h"</remove> + +<!-- Remove all occurences of virtual keyword --> +<remove>virtual</remove> + +<!-- Remove inheritance from Pluggable Messaging replace with + concrete class +--> +<remove>: public TAO_Pluggable_Messaging</remove> + +<!-- Typedef the concrete type, GIOP_Message_Base as the + underlying pluggable messaging type + --> +<add> + <hook>MESSAGING_SPL_EXTERN_ADD_HOOK</hook> + <data>typedef TAO_GIOP_Message_Base TAO_Pluggable_Messaging;</data> +</add> + +<!-- The method is_ready_for_bi_directional_giop is procted, this + should be made public --> +<substitute match-line="yes"> + <!-- Operation signature --> + <search>int is_ready_for_bidirectional \(TAO_OutputCDR &msg\);</search> + <replace> + +public: + int is_ready_for_bidirectional (TAO_OutputCDR &msg); + +protected: + </replace> +</substitute> + +</file> + +<file name="IIOP_Connection_Handler.h"> + +<!-- remove forward decls --> +<remove>class TAO_Pluggable_Messaging;</remove> + +</file> + +<file name="IIOP_Transport.h"> + +<!-- remove forward decls --> +<remove>class TAO_Pluggable_Messaging;</remove> + +</file> + +<file name="TAO_Server_Request.h"> + +<!-- Remove Pluggable messaging include altogether --> +<substitute match-line="yes"> + <search>class TAO_Pluggable_Messaging;</search> + <replace>#include "tao/GIOP_Message_Base.h"</replace> +</substitute> + +</file> + +<file name="TAO_Server_Request.cpp"> + +<!-- Remove Pluggable messaging include altogether --> +<remove>#include "Pluggable_Messaging.h"</remove> + +</file> + +<file name="Transport.h"> +<!-- Remove Pluggable messaging include altogether --> +<substitute match-line="yes"> + <search>class TAO_Pluggable_Messaging;</search> + <replace>#include "tao/GIOP_Message_Base.h"</replace> +</substitute> +</file> + +<file name="Transport.cpp"> + <remove>#include "Pluggable_Messaging.h"</remove> +</file> + +</module> + +<!-- Transformations to the Messaging Directory --> +<module name="TAO/tao/Messaging"> + +<file name="AMH_Response_Handler.h"> + +<substitute match-line="yes"> + <search>class TAO_Pluggable_Messaging;</search> + <replace>#include "tao/GIOP_Message_Base.h"</replace> +</substitute> + +</file> + +<file name="AMH_Response_Handler.cpp"> + <remove>#include "tao/Pluggable_Messaging.h"</remove> +</file> + +<file name="AMH_Response_Handler.cpp"> +<substitute match-line="yes"> + <search>#include "tao/Pluggable_Messaging.h"</search> + <replace>#include "tao/GIOP_Message_Base.h"</replace> +</substitute> +</file> + +<file name="Asynch_Invocation.cpp"> + <remove>#include "tao/Pluggable_Messaging.h"</remove> +</file> + +</module> + +<module name="TAO/tao/Strategies"> + +<file name="DIOP_Connection_Handler.h"> + <remove>class TAO_Pluggable_Messaging;</remove> +</file> + +<file name="DIOP_Transport.h"> + <remove>class TAO_Pluggable_Messaging;</remove> +</file> + +<file name="DIOP_Transport.cpp"> + + <!-- Replace GIOP_Lite with GIOP --> +<comment> + <start-hook>MESSAGING_SPL_COMMENT_HOOK_START</start-hook> + <end-hook>MESSAGING_SPL_COMMENT_HOOK_END</end-hook> +</comment> + +<add> + <hook>MESSAGING_SPL_COMMENT_HOOK_END</hook> + <data> + ACE_NEW (this->messaging_object_, + TAO_GIOP_Message_Base (orb_core, + ACE_MAX_DGRAM_SIZE)); + </data> +</add> + + <remove>#include "tao/GIOP_Message_Lite.h"</remove> + +</file> + +<file name="SHMIOP_Transport.h"> + <remove>class TAO_Pluggable_Messaging;</remove> +</file> + +<file name="SHMIOP_Transport.cpp"> + <remove>#include "tao/GIOP_Message_Lite.h"</remove> + + <!-- Replace GIOP_Lite with GIOP --> +<comment> + <start-hook>MESSAGING_SPL_COMMENT_HOOK_START</start-hook> + <end-hook>MESSAGING_SPL_COMMENT_HOOK_END</end-hook> +</comment> + +<add> + <hook>MESSAGING_SPL_COMMENT_HOOK_END</hook> + <data> + ACE_NEW (this->messaging_object_, + TAO_GIOP_Message_Base (orb_core, + ACE_MAX_DGRAM_SIZE)); + </data> +</add> + +</file> + +<file name="UIOP_Connection_Handler.h"> + <remove>class TAO_Pluggable_Messaging;</remove> +</file> + +<file name="UIOP_Connection_Handler.cpp"> + <remove>#include "tao/GIOP_Message_Lite.h"</remove> +</file> + +<file name="UIOP_Transport.h"> + <remove>class TAO_Pluggable_Messaging;</remove> +</file> + +<file name="UIOP_Transport.cpp"> + + <!-- Replace GIOP_Lite with GIOP --> +<comment> + <start-hook>MESSAGING_SPL_COMMENT_HOOK_START</start-hook> + <end-hook>MESSAGING_SPL_COMMENT_HOOK_END</end-hook> +</comment> + +<add> + <hook>MESSAGING_SPL_COMMENT_HOOK_END</hook> + <data> + ACE_NEW (this->messaging_object_, + TAO_GIOP_Message_Base (orb_core, + ACE_MAX_DGRAM_SIZE)); + </data> +</add> + <remove>#include "tao/GIOP_Message_Lite.h"</remove> +</file> +</module> + +<module name="TAO/tao/DynamicInterface"> + <file name="DII_Invocation_Adapter.cpp"> + <substitute match-line="yes"> + <search>#include "tao/Pluggable_Messaging.h"</search> + <replace>#include "tao/GIOP_Message_Base.h"</replace> + </substitute> + </file> +</module> + +</transform> diff --git a/ACE/bin/FOCUS/specializations/Protocol_Family/IIOP/iiop.spl b/ACE/bin/FOCUS/specializations/Protocol_Family/IIOP/iiop.spl new file mode 100644 index 00000000000..d0da22a42f9 --- /dev/null +++ b/ACE/bin/FOCUS/specializations/Protocol_Family/IIOP/iiop.spl @@ -0,0 +1,995 @@ +<?xml version="1.0"?> + +<!-- IIOP Pluggable Protocol specialization + * ====================================== + * This specializes the pluggable protocol framework within + * TAO for the IIOP concrete protocol implementation. This + * specialization encompasses specializations, such as + * specializations for the Transport, Profile, end-point, + * Acceptor and Connector implementations within ACE+TAO. + * + * @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + * $Id$ +--> +<transform> + +<module name="TAO/tao"> + +<!-- Transformations to Transport implementation in TAO --> +<file name="Transport.h"> + +<!-- Search for TAO_Connection_Handler --> +<substitute match-line="yes"> + <search>class TAO_Connection_Handler;</search> + <replace>#include "tao/Connection_Handler.h"</replace> +</substitute> + +<!-- Add forward declarations and includes specific to + IIOP --> +<add> + <hook>TAO_TRANSPORT_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook> + <data> +namespace IIOP +{ + class ListenPointList; +} + +class TAO_Acceptor; +class TAO_Adapter; + </data> +</add> + +<!-- Remove all virtual and pure virtual methods in this + class --> +<remove>virtual</remove> + +<substitute match-line="yes"> + <search>= 0;</search> + <replace>;</replace> +</substitute> + +<!-- Replace the base class constructor with the derive + classes's constructor --> +<substitute match-line="yes"> + <search>TAO_Transport \(CORBA::ULong tag,</search> + <replace>TAO_Transport (TAO_IIOP_Connection_Handler *, CORBA::ULong tag, + </replace> +</substitute> + +<!-- Add public methods defined in IIOP_Transport --> +<add> + <hook>TAO_TRANSPORT_SPL_PUBLIC_METHODS_ADD_HOOK</hook> + <data> + + /// Bridge method to call a similar method on the connection handler + void update_protocol_properties (int send_buffer_size, + int recv_buffer_size, + int no_delay, + int enable_network_priority); + + /// Generate the request header + int generate_request_header (TAO_Operation_Details &opd, + TAO_Target_Specification &spec, + TAO_OutputCDR &msg); + </data> +</add> + +<!-- Add private methods from IIOP_Transport --> +<add> + <hook>TAO_TRANSPORT_SPL_PRIVATE_METHODS_ADD_HOOK</hook> + <data> + void set_bidir_context_info (TAO_Operation_Details &opdetails); + int get_listen_point (IIOP::ListenPointList &listen_point_list, + TAO_Acceptor *acceptor); + </data> +</add> + +<!-- Add private data from IIOP_Transport --> +<add> + <hook>TAO_TRANSPORT_SPL_DATA_MEMBERS_ADD_HOOK</hook> + <data> + /// The connection service handler used for accessing lower layer + /// communication protocols. + TAO_IIOP_Connection_Handler *connection_handler_; + + /// Our messaging object. + TAO_Pluggable_Messaging *messaging_object_; + </data> +</add> + +<!-- Typedef the TAO_Transport as IIOP_Transport --> +<add> + <hook>TAO_TRANSPORT_SPL_EXTERN_ADD_HOOK</hook> + <data>typedef TAO_Transport TAO_IIOP_Transport;</data> +</add> + +<!-- This method is overridden in the derived class --> +<substitute> + <search>generate_request_header</search> + <replace>generate_request_header_base__</replace> +</substitute> + +</file> + +<file name="Transport.cpp"> + +<!-- Add necessary includes --> +<add> + <hook>TAO_TRANSPORT_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook> + <data> +#include "Transport_Acceptor.h" +#include "IIOPC.h" +#include "Acceptor_Registry.h" +#include "operation_details.h" +#include "GIOP_Message_Base.h" +#include "Protocols_Hooks.h" + </data> +</add> + +<!-- Modify the TAO constructor adding the IIOP Transport's data --> +<substitute match-line="yes"> + <search>TAO_Transport::TAO_Transport \(CORBA::ULong tag,</search> + <replace>TAO_Transport::TAO_Transport (TAO_IIOP_Connection_Handler *handler, + CORBA::ULong tag, + </replace> +</substitute> + +<substitute match-line="yes"> + <search>, partial_message_ \(0\)</search> + <replace> , partial_message_ (0) + , connection_handler_ (handler) + , messaging_object_ (0) + </replace> +</substitute> + +<!-- Within the constructor create/initialize the messaging object --> +<add> + <hook>TAO_TRANSPORT_SPL_CONSTRUCTOR_ADD_HOOK</hook> + <data> + // Use the normal GIOP object + ACE_NEW (this->messaging_object_, + TAO_GIOP_Message_Base (orb_core)); + </data> +</add> + +<add> + <hook>TAO_TRANSPORT_SPL_DESTRUCTOR_ADD_HOOK</hook> + <data>delete this->messaging_object_;</data> +</add> + +<!-- comment out unimplemented base class methods --> +<comment> + <start-hook>TAO_TRANSPORT_SPL_COMMENT_HOOK_START</start-hook> + <end-hook>TAO_TRANSPORT_SPL_COMMENT_HOOK_END</end-hook> +</comment> + +<!-- Add the concrete methods from IIOP_Transport implementation --> +<copy-from-source> + <source>IIOP_Transport.cpp</source> + + <copy-hook-start>TAO_TRANSPORT_SPL_COPY_HOOK_START</copy-hook-start> + <copy-hook-end>TAO_TRANSPORT_SPL_COPY_HOOK_END</copy-hook-end> + + <dest-hook>TAO_TRANSPORT_SPL_METHODS_ADD_HOOK</dest-hook> +</copy-from-source> + +<!-- The derived class calls this method. Override this --> +<substitute> + <search>TAO_Transport::generate_request_header</search> + <replace>TAO_Transport::generate_request_header_base__</replace> +</substitute> + +</file> + +<!-- Transformations to specialize Connection_Handler class --> +<file name="Connection_Handler.h"> + +<!-- Remove the default constructor, NOTE: we use regular expressions + to match the constructor but not the destructor --> +<remove>\s+TAO_Connection_Handler\s*\(void\);</remove> + +<!-- Make sure that Connection_Handler inherits from SVC_HANDLER --> +<substitute match-line="yes"> + <search>: public TAO_LF_CH_Event</search> + <replace>: public TAO_IIOP_SVC_HANDLER, + public TAO_LF_CH_Event + </replace> +</substitute> + +<!-- Forward declarations --> +<add> + <hook>CONNECTION_HANDLER_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook> + <data> +#include "ace/Svc_Handler.h" +#include "ace/SOCK_Stream.h" + +typedef ACE_Svc_Handler < ACE_SOCK_STREAM, ACE_NULL_SYNCH > + TAO_IIOP_SVC_HANDLER; + +namespace IIOP +{ + class ListenPointList; +} + </data> +</add> + +<!-- Public methods from IIOP_Connection_Handler class --> +<add> + <hook>CONNECTION_HANDLER_SPL_PUBLIC_METHODS_ADD_HOOK</hook> + <data> + int open (void *); + int close (u_long = 0); + + int resume_handler (void); + int handle_output (ACE_HANDLE); + int handle_close (ACE_HANDLE, ACE_Reactor_Mask); + int handle_timeout (const ACE_Time_Value &current_time, + const void *act = 0); + + /// Add ourselves to Cache. + int add_transport_to_cache (void); + + /// Process the @a listen_list + int process_listen_point_list (IIOP::ListenPointList &listen_list); + + /// Check if network priority needs to be enabled + int enable_network_priority (void); + + TAO_Connection_Handler (ACE_Thread_Manager * = 0); + + /// Constructor. + TAO_Connection_Handler (TAO_ORB_Core *orb_core, + CORBA::Boolean flag); + </data> +</add> + +<!-- Private data members --> +<add> + <hook>CONNECTION_HANDLER_SPL_PRIVATE_DATA_ADD_HOOK</hook> + <data>int dscp_codepoint_;</data> +</add> + +<!-- Typedef the class --> +<add> + <hook>CONNECTION_HANDLER_SPL_EXTERN_ADD_HOOK</hook> + <data>typedef TAO_Connection_Handler TAO_IIOP_Connection_Handler;</data> +</add> + +<!-- Remove all virtuals and =0; from the code --> +<remove>virtual</remove> + +<substitute match-line="yes"> + <search>= 0;</search> + <replace>;</replace> +</substitute> + +</file> + +<file name="Connection_Handler.cpp"> + +<!-- Add the include hook --> +<add> + <hook>CONNECTION_HANDLER_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook> + <data> +#include "IIOPC.h" +#include "Thread_Lane_Resources.h" +#include "Base_Transport_Property.h" +#include "Protocols_Hooks.h" +#include "Wait_Strategy.h" + +#include "ace/os_include/netinet/os_tcp.h" +#include "ace/os_include/os_netdb.h" + </data> +</add> + +<!-- IIOP_Connection_Handler constructors added --> +<add> + <hook>CONNECTION_HANDLER_SPL_METHODS_ADD_HOOK</hook> + <data> +TAO_Connection_Handler::TAO_Connection_Handler (ACE_Thread_Manager *t) + : TAO_IIOP_SVC_HANDLER (t, 0 , 0), + orb_core_ (0), + dscp_codepoint_ (IPDSFIELD_DSCP_DEFAULT << 2) +{ + ACE_ASSERT (0); +} + +TAO_Connection_Handler::TAO_Connection_Handler ( + TAO_ORB_Core *orb_core, + CORBA::Boolean flag) + : TAO_IIOP_SVC_HANDLER (orb_core->thr_mgr (), 0, 0), + orb_core_ (orb_core), + transport_ (0), + dscp_codepoint_ (IPDSFIELD_DSCP_DEFAULT << 2) +{ + TAO_IIOP_Transport* specific_transport = 0; + ACE_NEW (specific_transport, + TAO_IIOP_Transport (this, IOP::TAG_INTERNET_IOP, orb_core)); + + // store this pointer (indirectly increment ref count) + this->transport (specific_transport); + + // @@todo: We need to have a distinct option/ method in the resource + // factory for this and TAO_Transport. + this->lock_ = + this->orb_core_->resource_factory ()->create_cached_connection_lock (); + + // Put ourselves in the connection wait state as soon as we get + // created + this->state_changed (TAO_LF_Event::LFS_CONNECTION_WAIT, + this->orb_core_->leader_follower ()); +} + </data> +</add> + +<!-- Replace all occurances of IIOP_Connection_Handler with that + of TAO_Connection_Handler --> +<substitute> + <search>TAO_IIOP_Connection_Handler</search> + <replace>TAO_Connection_Handler</replace> +</substitute> + +<!-- Comment out base class methods that are over-ridden in the + derived class --> +<comment> + <start-hook>CONNECTION_HANDLER_SPL_COMMENT_HOOK_START</start-hook> + <end-hook>CONNECTION_HANDLER_SPL_COMMENT_HOOK_END</end-hook> +</comment> + +<!-- Copy operations from IIOP_Connection_Handler class and put them + in the Connection_Handler class --> + +<copy-from-source> + + <source>IIOP_Connection_Handler.cpp</source> + <copy-hook-start>CONNECTION_HANDLER_SPL_COPY_HOOK_START</copy-hook-start> + <copy-hook-end>CONNECTION_HANDLER_SPL_COPY_HOOK_END</copy-hook-end> + <dest-hook>CONNECTION_HANDLER_SPL_METHODS_ADD_HOOK</dest-hook> + +</copy-from-source> + +<add> + <hook>CONNECTION_HANDLER_DESTRUCTOR_ADD_HOOK</hook> + <data>delete this->transport ();</data> +</add> + +</file> + +<!-- Modifications to Acceptor and Connector Components in TAO --> +<file name="Transport_Acceptor.h"> + +<!-- Forward declaration --> +<add> + <hook>TAO_ACCEPTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook> + <data> +#include "tao/Connection_Handler.h" +#include "tao/Acceptor_Impl.h" +#include "tao/GIOP_Message_Version.h" +#include "ace/Acceptor.h" +#include "ace/SOCK_Acceptor.h" + </data> +</add> + +<!-- Methods from IIOP_Acceptor components --> +<copy-from-source> + <source>IIOP_Acceptor.h</source> + <copy-hook-start>TAO_ACCEPTOR_SPL_CONCRETE_METHODS_COPY_HOOK_START</copy-hook-start> + <copy-hook-end>TAO_ACCEPTOR_SPL_CONCRETE_METHODS_COPY_HOOK_END</copy-hook-end> + <dest-hook>TAO_ACCEPTOR_SPL_PUBLIC_METHODS_ADD_HOOK</dest-hook> +</copy-from-source> + +<!-- Typedef hook --> +<add> + <hook>TAO_ACCEPTOR_SPL_EXTERN_ADD_HOOK</hook> + <data>typedef TAO_Acceptor TAO_IIOP_Acceptor; + #if defined(__ACE_INLINE__) + #include "tao/IIOP_Acceptor.i" + #endif /* __ACE_INLINE__ */ + </data> +</add> + +<!-- Private data memeber --> +<copy-from-source> + <source>IIOP_Acceptor.h</source> + + <copy-hook-start>TAO_ACCEPTOR_SPL_DATA_MEMBERS_COPY_HOOK_START</copy-hook-start> + <copy-hook-end>TAO_ACCEPTOR_SPL_DATA_MEMBERS_COPY_HOOK_END</copy-hook-end> + + <dest-hook>TAO_ACCEPTOR_SPL_DATA_MEMBERS_ADD_HOOK</dest-hook> +</copy-from-source> + +<!-- Eliminate the virtual functions --> +<remove>virtual</remove> +<substitute match-line="yes"> + <search>= 0;</search> + <replace>;</replace> +</substitute> + +<!-- Remove destructor --> +<remove>~TAO_IIOP_Acceptor \(void\);</remove> + +<substitute> + <search>TAO_IIOP_Acceptor</search> + <replace>TAO_Acceptor</replace> +</substitute> + +</file> + +<!-- Transformations to Transport_Acceptor.cpp --> +<file name="Transport_Acceptor.cpp"> + +<copy-from-source> + <source>IIOP_Acceptor.cpp</source> + + <copy-hook-start>TAO_ACCEPTOR_SPL_COPY_HOOK_START</copy-hook-start> + <copy-hook-end>TAO_ACCEPTOR_SPL_COPY_HOOK_END</copy-hook-end> + + <dest-hook>TAO_ACCEPTOR_SPL_METHODS_ADD_HOOK</dest-hook> +</copy-from-source> + +<!-- Modify the constructor --> +<substitute match-line="yes"> + <search>: TAO_Acceptor \(IOP::TAG_INTERNET_IOP\),</search> + <replace>: tag_ (IOP::TAG_INTERNET_IOP), + </replace> +</substitute> + +<!-- Add mthods to the destructor --> +<add> + <hook>TAO_ACCEPTOR_DESTRUCTOR_ADD_HOOK</hook> + <data> + this->close (); + delete this->creation_strategy_; + delete this->concurrency_strategy_; + delete this->accept_strategy_; + + delete [] this->addrs_; + + for (CORBA::ULong i = 0; i < this->endpoint_count_; ++i) + CORBA::string_free (this->hosts_[i]); + + delete [] this->hosts_; + </data> +</add> + +<!-- Trasnform IIOP_Acceptor to TAO_Acceptor --> +<substitute match-line="yes"> + <search>#include "tao/IIOP_Acceptor.h"</search> + <replace> </replace> +</substitute> + +<substitute match-line="yes"> + <search>#include "tao/IIOP_Profile.h"</search> + <replace>#include "tao/Profile.h"</replace> +</substitute> + +<substitute> + <search>TAO_IIOP_Acceptor::TAO_IIOP_Acceptor</search> + <replace>TAO_Acceptor::TAO_Acceptor</replace> +</substitute> + +</file> + +<file name="tao.mpc"> + +<!-- Do not build all IIOP_* files as the specializations + are moved to the base classes --> + +<substitute> + <search>IIOP_Transport.cpp</search> + <replace>// IIOP_Transport.cpp </replace> +</substitute> + +<substitute> + <search>IIOP_Transport.h</search> + <replace>// IIOP_Transport.h</replace> +</substitute> + +<substitute> + <search>IIOP_Connection_Handler.cpp</search> + <replace>// IIOP_Connection_Handler.cpp</replace> +</substitute> +<substitute> + <search>IIOP_Connection_Handler.h</search> + <replace>// IIOP_Connection_Handler.h</replace> +</substitute> + +<substitute> + <search>IIOP_Acceptor.cpp</search> + <replace>// IIOP_Acceptor.cpp</replace> +</substitute> +<substitute> + <search>IIOP_Acceptor.h</search> + <replace>// IIOP_Acceptor.h</replace> +</substitute> + +<substitute> + <search>IIOP_Connector.cpp</search> + <replace>// IIOP_Connector.cpp</replace> +</substitute> + +<substitute> + <search>IIOP_Endpoint.cpp</search> + <replace>// IIOP_Endpoint.cpp</replace> +</substitute> + +<substitute> + <search>IIOP_Connector.h</search> + <replace>// IIOP_Connector.h</replace> +</substitute> + +<substitute> + <search>IIOP_Endpoint.h</search> + <replace>// IIOP_Endpoint.h</replace> +</substitute> + +<substitute> + <search>IIOP_Profile.cpp</search> + <replace>// IIOP_Profile.cpp</replace> +</substitute> +<substitute> + <search>IIOP_Profile.h</search> + <replace>// IIOP_Profile.h</replace> +</substitute> + +</file> + +<file name="Endpoint.h"> + +<!-- Include and forward declation add hook --> +<add> + <hook>TAO_ENDPOINT_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook> + <data> +#include "tao/IIOP_EndpointsC.h" +#include "ace/INET_Addr.h" + </data> +</add> + +<!-- Copy the private member declarations from IIOP_Endpoint + implementation --> + +<copy-from-source> + <source>IIOP_Endpoint.h</source> + + <copy-hook-start>TAO_ENDPOINT_SPL_PRIVATE_DATA_COPY_HOOK_START</copy-hook-start> + <copy-hook-end>TAO_ENDPOINT_SPL_PRIVATE_DATA_COPY_HOOK_END</copy-hook-end> + + <dest-hook>TAO_ENDPOINT_SPL_PRIVATE_DATA_ADD_HOOK</dest-hook> +</copy-from-source> + +<copy-from-source> + <source>IIOP_Endpoint.h</source> + <copy-hook-start>TAO_ENDPOINT_SPL_PUBLIC_METHODS_COPY_HOOK_START</copy-hook-start> + <copy-hook-end>TAO_ENDPOINT_SPL_PUBLIC_METHODS_COPY_HOOK_END</copy-hook-end> + <dest-hook>TAO_ENDPOINT_SPL_PUBLIC_METHODS_ADD_HOOK</dest-hook> +</copy-from-source> + +<!-- Remove the unimplemented copy constructor of the base class --> +<remove>ACE_UNIMPLEMENTED_FUNC \(TAO_Endpoint \(const TAO_Endpoint&\)\)</remove> + +<substitute> + <search>TAO_IIOP_Endpoint</search> + <replace>TAO_Endpoint</replace> +</substitute> + +<substitute> + <search>TAO_IIOP_Profile</search> + <replace>TAO_Profile</replace> +</substitute> + +<add> + <hook>TAO_ENDPOINT_SPL_EXTERN_ADD_HOOK</hook> + <data>typedef TAO_Endpoint TAO_IIOP_Endpoint; + #if defined (__ACE_INLINE__) + # include "tao/IIOP_Endpoint.i" + #endif /* __ACE_INLINE__ */ + </data> +</add> + +<!-- Eliminate the virtual functions --> +<remove>virtual</remove> +<substitute match-line="yes"> + <search>= 0;</search> + <replace>;</replace> +</substitute> + +</file> + +<file name="Endpoint.cpp"> + + <copy-from-source> + <source>IIOP_Endpoint.cpp</source> + <copy-hook-start>TAO_ENDPOINT_SPL_COPY_HOOK_START</copy-hook-start> + <copy-hook-end>TAO_ENDPOINT_SPL_COPY_HOOK_END</copy-hook-end> + <dest-hook>TAO_ENDPOINT_SPL_METHODS_ADD_HOOK</dest-hook> + </copy-from-source> + + <!-- In the constructors copied from the derived class, there is a + invocation of the base class constructor. Expand it --> + <substitute match-line="yes"> + <search>: TAO_Endpoint \(IOP::TAG_INTERNET_IOP\)</search> + <replace>: addr_lookup_lock_ () + , hash_val_ (0) + , tag_ (IOP::TAG_INTERNET_IOP) + , priority_ (TAO_INVALID_PRIORITY) + </replace> + </substitute> + + <substitute match-line="yes"> + <search>: TAO_Endpoint \(IOP::TAG_INTERNET_IOP, priority\)</search> + <replace>: addr_lookup_lock_ () + , hash_val_ (0) + , tag_ (IOP::TAG_INTERNET_IOP) + , priority_ (priority) + </replace> + </substitute> + + <substitute match-line="yes"> + <search>: TAO_Endpoint \(rhs.tag_, rhs.priority_\)</search> + <replace>: addr_lookup_lock_ () + , hash_val_ (0) + , tag_ (rhs.tag_) + , priority_ (rhs.priority_) + </replace> + </substitute> + +<substitute> + <search>TAO_IIOP_Endpoint</search> + <replace>TAO_Endpoint</replace> +</substitute> + +<remove>#include "IIOP_Endpoint.h"</remove> + +</file> + +<file name="Transport_Connector.h"> + +<add> + <hook>TAO_CONNECTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook> + <data> +#include "ace/SOCK_Connector.h" +#include "ace/Connector.h" +#include "tao/Connector_Impl.h" +#include "tao/Connection_Handler.h" + </data> +</add> + +<copy-from-source> + <source>IIOP_Connector.h</source> + <copy-hook-start>TAO_CONNECTOR_SPL_PUBLIC_METHODS_COPY_HOOK_START</copy-hook-start> + <copy-hook-end>TAO_CONNECTOR_SPL_PUBLIC_METHODS_COPY_HOOK_END</copy-hook-end> + <dest-hook>TAO_CONNECTOR_SPL_PUBLIC_METHODS_ADD_HOOK</dest-hook> +</copy-from-source> + +<!-- IIOP_Connector's constructor --> +<add> + <hook>TAO_CONNECTOR_SPL_PUBLIC_METHODS_ADD_HOOK</hook> + <data> TAO_Connector (CORBA::Boolean flag = 0);</data> +</add> + +<copy-from-source> + <source>IIOP_Connector.h</source> + <copy-hook-start>TAO_CONNECTOR_SPL_COPY_HOOK_START</copy-hook-start> + <copy-hook-end>TAO_CONNECTOR_SPL_COPY_HOOK_END</copy-hook-end> + <dest-hook>TAO_CONNECTOR_SPL_PRIVATE_DATA_ADD_HOOK</dest-hook> +</copy-from-source> + +<add> + <hook>TAO_CONNECTOR_SPL_EXTERN_ADD_HOOK</hook> + <data>typedef TAO_Connector TAO_IIOP_Connector;</data> +</add> + +<!-- eliminate all virtual methods --> +<remove>virtual</remove> + +<substitute match-line="yes"> + <search>= 0;</search> + <replace>;</replace> +</substitute> + +<substitute match-line="yes"> + <search>class TAO_Endpoint;</search> + <replace>#include "tao/Endpoint.h"</replace> +</substitute> + +</file> + +<file name="Transport_Connector.cpp"> + +<add> + <hook>TAO_CONNECTOR_SPL_INCLUDE_ADD_HOOK</hook> + <data> +#include "ace/OS_NS_strings.h" + </data> +</add> + +<!-- Instrument the constructor --> +<substitute match-line="yes"> + <search>: TAO_Connector \(IOP::TAG_INTERNET_IOP\)</search> + <replace>: active_connect_strategy_ (0) + , tag_ (IOP::TAG_INTERNET_IOP) + , orb_core_ (0) + </replace> +</substitute> + +<copy-from-source> + <source>IIOP_Connector.cpp</source> + + <copy-hook-start>TAO_CONNECTOR_SPL_COPY_HOOK_START</copy-hook-start> + <copy-hook-end>TAO_CONNECTOR_SPL_COPY_HOOK_END</copy-hook-end> + + <dest-hook>TAO_CONNECTOR_SPL_METHODS_ADD_HOOK</dest-hook> +</copy-from-source> + +<!-- replace all IIOP_Connector with TAO_Connector --> +<substitute> + <search>TAO_IIOP_Connector</search> + <replace>TAO_Connector</replace> +</substitute> + +</file> + +<file name="IIOP_Factory.cpp"> + +<substitute match-line="yes"> + <search>#include "IIOP_Acceptor.h"</search> + <replace>#include "Transport_Acceptor.h"</replace> +</substitute> + +<substitute match-line="yes"> + <search>#include "IIOP_Connector.h"</search> + <replace>#include "Transport_Connector.h"</replace> +</substitute> +</file> + +<file name="IIOP_Lite_Factory.cpp"> + +<substitute match-line="yes"> + <search>#include "IIOP_Acceptor.h"</search> + <replace>#include "Transport_Acceptor.h"</replace> +</substitute> + +<substitute match-line="yes"> + <search>#include "IIOP_Connector.h"</search> + <replace>#include "Transport_Connector.h"</replace> +</substitute> +</file> + +<!-- Transformations to Profile class to make it tailored for IIOP + Profile --> +<file name="Profile.h"> + +<!-- include and forward declarations --> +<substitute match-line="yes"> + <search>class TAO_Endpoint;</search> + <replace>#include "tao/Endpoint.h"</replace> +</substitute> + +<!-- Remove all virtual methods --> +<remove>virtual</remove> +<substitute match-line="yes"> + <search>= 0;</search> + <replace>;</replace> +</substitute> + +<!-- Copy all public methods from IIOP_Profile.h --> +<copy-from-source> + <source>IIOP_Profile.h</source> + <copy-hook-start>TAO_PROFILE_SPL_PUBLIC_METHODS_COPY_HOOK_START</copy-hook-start> + <copy-hook-end>TAO_PROFILE_SPL_PUBLIC_METHODS_COPY_HOOK_END</copy-hook-end> + <dest-hook>TAO_PROFILE_SPL_PUBLIC_METHODS_ADD_HOOK</dest-hook> +</copy-from-source> + +<!-- Add proteccted data from IIOP_Profile class --> +<copy-from-source> + <source>IIOP_Profile.h</source> + <copy-hook-start>TAO_PROFILE_SPL_PROTECTED_METHODS_COPY_HOOK_START</copy-hook-start> + <copy-hook-end>TAO_PROFILE_SPL_PROTECTED_METHODS_COPY_HOOK_END</copy-hook-end> + <dest-hook>TAO_PROFILE_SPL_PROTECTED_METHODS_ADD_HOOK</dest-hook> +</copy-from-source> + +<!-- Add all the private data methods --> +<copy-from-source> + <source>IIOP_Profile.h</source> + <copy-hook-start>TAO_PROFILE_SPL_PRIVATE_DATA_COPY_HOOK_START</copy-hook-start> + <copy-hook-end>TAO_PROFILE_SPL_PRIVATE_DATA_COPY_HOOK_END</copy-hook-end> + <dest-hook>TAO_PROFILE_SPL_PRIVATE_DATA_ADD_HOOK</dest-hook> +</copy-from-source> + +<!-- Typedef the Profile class as IIOP_Profile --> +<add> + <hook>TAO_PROFILE_SPL_EXTERN_ADD_HOOK</hook> + <data> +typedef TAO_Profile TAO_IIOP_Profile; + </data> +</add> + +<substitute> + <search>TAO_IIOP_Profile</search> + <replace>TAO_Profile</replace> +</substitute> + + +</file> + +<!-- Transformations to Profile.cpp file specialized with the + IIOP_Profile implementation --> +<file name="Profile.cpp"> + +<!-- comment out virtual methods in the base class that do nothing + but have implementations due to compiler issues --> +<comment> + <start-hook>TAO_PROFILE_SPL_COMMENT_HOOK_START</start-hook> + <end-hook>TAO_PROFILE_SPL_COMMENT_HOOK_END</end-hook> +</comment> + +<copy-from-source> + <source>IIOP_Profile.cpp</source> + + <copy-hook-start>TAO_PROFILE_SPL_COPY_HOOK_START</copy-hook-start> + <copy-hook-end>TAO_PROFILE_SPL_COPY_HOOK_END</copy-hook-end> + + <dest-hook>TAO_PROFILE_SPL_METHODS_ADD_HOOK</dest-hook> +</copy-from-source> + +<!-- Add methods to the constructor of the Profile --> +<!-- Constructors are the exceptional case, we need to add + them specifically --> + +<add> + <hook>TAO_PROFILE_SPL_METHODS_ADD_HOOK</hook> + <data> +TAO_Profile::TAO_Profile (const ACE_INET_Addr &addr, + const TAO::ObjectKey &object_key, + const TAO_GIOP_Message_Version &version, + TAO_ORB_Core *orb_core) + : version_ (version) + , are_policies_parsed_ (false) + , addressing_mode_ (0) + , tagged_profile_ (0) + , ref_object_key_ (0) + , tag_ (IOP::TAG_INTERNET_IOP) + , orb_core_ (orb_core) + , forward_to_ (0) + , refcount_lock_ (0) + , refcount_ (1) + , endpoint_ (addr, + orb_core->orb_params ()->use_dotted_decimal_addresses ()) + , count_ (1) +{ + // @@ NOTE: Need to probably use a different type of lock. + this->refcount_lock_ = + this->orb_core_->client_factory ()->create_profile_lock (); + + (void) this->orb_core_->object_key_table ().bind (object_key, + this->ref_object_key_); +} + +TAO_Profile::TAO_Profile (const char* host, + CORBA::UShort port, + const TAO::ObjectKey &object_key, + const ACE_INET_Addr &addr, + const TAO_GIOP_Message_Version &version, + TAO_ORB_Core *orb_core) + : version_ (version) + , are_policies_parsed_ (false) + , addressing_mode_ (0) + , tagged_profile_ (0) + , ref_object_key_ (0) + , tag_ (IOP::TAG_INTERNET_IOP) + , orb_core_ (orb_core) + , forward_to_ (0) + , refcount_lock_ (0) + , refcount_ (1) + , endpoint_ (host, port, addr) + , count_ (1) +{ + // @@ NOTE: Need to probably use a different type of lock. + this->refcount_lock_ = + this->orb_core_->client_factory ()->create_profile_lock (); + (void) this->orb_core_->object_key_table ().bind (object_key, + this->ref_object_key_); +} + +TAO_Profile::TAO_Profile (TAO_ORB_Core *orb_core) + : version_ (TAO_GIOP_Message_Version (TAO_DEF_GIOP_MAJOR, + TAO_DEF_GIOP_MINOR)) + , are_policies_parsed_ (false) + , addressing_mode_ (0) + , tagged_profile_ (0) + , ref_object_key_ (0) + , tag_ (IOP::TAG_INTERNET_IOP) + , orb_core_ (orb_core) + , forward_to_ (0) + , refcount_lock_ (0) + , refcount_ (1) + , endpoint_ () + , count_ (1) +{ + this->refcount_lock_ = + this->orb_core_->client_factory ()->create_profile_lock (); +} +</data> +</add> + +<add> + <hook>TAO_PROFILE_SPL_DESTRUCTOR_ADD_HOOK</hook> + <data> +TAO_Endpoint *tmp = 0; +for (TAO_Endpoint *next = this->endpoint ()->next (); + next != 0; + next = tmp) +{ + tmp = next->next (); + delete next; +} + </data> +</add> + +<!-- Replace all occurances of IIOP_Profile + with TAO_Profile --> +<substitute> + <search>TAO_IIOP_Profile</search> + <replace>TAO_Profile</replace> +</substitute> + +<!-- remove the dynamic casts, as now there is no + inheritance hiearchy --> +<substitute> + <search>dynamic_cast</search> + <replace>static_cast</replace> +</substitute> + +</file> + +<file name="Invocation_Endpoint_Selectors.cpp"> + +<substitute match-line="yes"> + <search>#include "tao/IIOP_Endpoint.h"</search> + <replace>#include "tao/Endpoint.h"</replace> +</substitute> +</file> + +<file name="orbconf.h"> + +<substitute match-line="yes"> + <search>TAO_HAS_UIOP 1</search> + <replace>TAO_HAS_UIOP 0</replace> +</substitute> + +<substitute match-line="yes"> + <search>TAO_HAS_SHMIOP 1</search> + <replace>TAO_HAS_SHMIOP 0</replace> +</substitute> + +<substitute match-line="yes"> + <search>TAO_HAS_MIOP 1</search> + <replace>TAO_HAS_MIOP 0</replace> +</substitute> + +<substitute match-line="yes"> + <search>TAO_HAS_DIOP 1</search> + <replace>TAO_HAS_DIOP 0</replace> +</substitute> +</file> +</module> + +<module name="/TAO/tao/RTPortableServer"> + +<file name="RT_Servant_Dispatcher.cpp"> + +<substitute> + <search>IIOP_Transport.h</search> + <replace>Transport.h</replace> +</substitute> + +<substitute> + <search>IIOP_Connection_Handler.h</search> + <replace>Connection_Handler.h</replace> +</substitute> + +</file> + +</module> + +</transform> diff --git a/ACE/bin/FOCUS/specializations/README b/ACE/bin/FOCUS/specializations/README new file mode 100644 index 00000000000..e2126bf6566 --- /dev/null +++ b/ACE/bin/FOCUS/specializations/README @@ -0,0 +1,16 @@ +@file README +============ + +This file describes certain common conventions regarding how the +specializations rules are integrated/added to this specialization +database. This directory will serve as a repository that will host all +the specialization rules for the different families/components. At the +moment, all the specialization transformations are specific to the +ACE+TAO middleware. + +For each component framework, the following are the rules for adding +the specializations: + +. Create a directory with the name of the component family, e.g., Reactor_Family +. Within this directory, create the <<Specific_Component>>.spl file that has the + individual transformations defined. diff --git a/ACE/bin/FOCUS/specializations/Reactor_Family/Select_Reactor_MT.spl b/ACE/bin/FOCUS/specializations/Reactor_Family/Select_Reactor_MT.spl new file mode 100644 index 00000000000..6d4ecf6609b --- /dev/null +++ b/ACE/bin/FOCUS/specializations/Reactor_Family/Select_Reactor_MT.spl @@ -0,0 +1,452 @@ +<?xml version="1.0"?> + +<!-- Select Reactor Specializations: + * =============================== + * Details all the specialization transformations necessary + * to specialize the Reactor framework when the target reactor + * is a select reactor. + * + * @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + * $Id$ +--> + +<transform> + +<!-- Define the module where there are multiple files --> +<module name="ace"> + +<!-- File where the transformations happen --> +<file name="Select_Reactor_Base.h"> + +<!-- Add the following lines based on a hook --> +<add> + <hook>REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook> + <data>class ACE_Sig_Handler;</data> + <data>class ACE_Sig_Action;</data> + <data>class ACE_Sig_Set;</data> +</add> + +<add> + <hook>REACTOR_SPL_PUBLIC_METHODS_ADD_HOOK</hook> + <data> +//--- How can we devirtualize these methods? +virtual ~ACE_Select_Reactor_Impl () {} + +virtual int notify (ACE_Event_Handler *event_handler = 0, + ACE_Reactor_Mask mask = ACE_Event_Handler::EXCEPT_MASK, + ACE_Time_Value * = 0) =0; + +virtual int remove_handler (ACE_Event_Handler *eh, + ACE_Reactor_Mask mask) =0; + +virtual int register_handler (ACE_HANDLE handle, + ACE_Event_Handler *eh, + ACE_Reactor_Mask mask) =0; + </data> +</add> + +<!-- Remove what ever is present in the tag from the file --> +<remove>virtual</remove> +<remove>: public ACE_Reactor_Impl</remove> +<remove>#include "ace/Reactor_Impl.h"</remove> + +<!-- Replace a with b --> +<substitute> + <search>public ACE_Reactor_Notify</search> + <replace>public ACE_Event_Handler</replace> +</substitute> + +<!-- Replace the generic versions with the Select specialized versions --> +<substitute> + <search>ACE_Reactor_Notify</search> + <replace>ACE_Select_Reactor_Notify</replace> +</substitute> + +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_Select_Reactor_Impl</replace> +</substitute> + +<!-- After the specialization, the following functions are still virtual --> +<substitute> + <search>void renew</search> + <replace>virtual void renew</replace> +</substitute> +<substitute> + <search>int is_suspended_i</search> + <replace>virtual int is_suspended_i</replace> +</substitute> +<substitute> + <search>void clear_dispatch_mask</search> + <replace>virtual void clear_dispatch_mask</replace> +</substitute> + +</file> + +<file name="Select_Reactor_Base.cpp"> + +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_Select_Reactor_Impl</replace> +</substitute> + +</file> + +<file name="Select_Reactor_Base.inl"> + +<remove>#include "ace/Reactor.h"</remove> + +</file> + +<!-- Transformations to Reactor_Token_T.h --> +<file name="Reactor_Token_T.h"> + +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_Select_Reactor_Impl</replace> +</substitute> + +<substitute match-line="yes"> + <search>#include "ace/Reactor_Impl.h"</search> + <replace>#include "ace/Select_Reactor_Base.h"</replace> +</substitute> + +</file> + +<file name="Reactor_Token_T.cpp"> + +<!-- Search for ACE_Reactor_Impl and replace it with + ACE_Select_Reactor_Impl --> +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_Select_Reactor_Impl</replace> +</substitute> + +</file> + +<file name="Select_Reactor_T.h"> + +<add> +<hook>REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook> +<data>class ACE_Sig_Handler;</data> +<data>class ACE_Sig_Action;</data> +<data>class ACE_Sig_Set;</data> +</add> + +<substitute> + <search>ACE_Reactor_Notify</search> + <replace>ACE_Select_Reactor_Notify</replace> +</substitute> + +<remove>virtual</remove> + +</file> + +<file name="Select_Reactor_T.cpp"> + +<add> + <hook>REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook> + <data>#include "ace/Countdown_Time.h"</data> +</add> + +<substitute> + <search>ACE_Reactor_Notify</search> + <replace>ACE_Select_Reactor_Notify</replace> +</substitute> + +</file> + +<!-- +<file name="Select_Reactor_T.inl"> + +<remove>#include "ace/Reactor.h"</remove> + +</file> +--> + +<file name="Reactor.h"> + +<add> +<hook>REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook> +<data>#include "ace/Select_Reactor.h"</data> +</add> + +<remove>class ACE_Reactor_Impl;</remove> +<remove>virtual</remove> + +<substitute> +<search>ACE_Reactor_Impl</search> +<replace>ACE_Select_Reactor</replace> +</substitute> + +<!-- Remove the Reactor_Timer interface include --> +<remove>: public ACE_Reactor_Timer_Interface</remove> +<remove>#include "ace/Reactor_Timer_Interface.h"</remove> + +</file> + +<file name="Event_Handler.h"> + +<!-- remove the ACE_Event_Handler forware declaration --> +<remove>class ACE_Reactor_Timer_Interface;</remove> + +<!-- substitute ACE_Reactor_Timer operations with ACE_Reactor --> +<substitute> + <search>ACE_Reactor_Timer_Interface</search> + <replace>ACE_Reactor</replace> +</substitute> +</file> + +<file name="Event_Handler.cpp"> + <substitute> + <search>ACE_Reactor_Timer_Interface</search> + <replace>ACE_Reactor</replace> + </substitute> +</file> + +<file name="Timer_Queue_T.cpp"> + +<!-- Remove the Reactor_Timer_Interface include --> +<remove>#include "ace/Reactor_Timer_Interface.h"</remove> + +</file> + + +<file name="Reactor.cpp"> + +<!-- Comment the conditional includes in the file --> +<comment> + <start-hook>REACTOR_SPL_COMMENT_INCLUDE_START_HOOK</start-hook> + <end-hook>REACTOR_SPL_COMMENT_INCLUDE_END_HOOK</end-hook> +</comment> + +<!-- Comment out conditional includes files in the Reactor's + constructor +--> +<comment> + <start-hook>REACTOR_SPL_CONSTRUCTOR_COMMENT_HOOK_START</start-hook> + <end-hook>REACTOR_SPL_CONSTRUCTOR_COMMENT_HOOK_END</end-hook> +</comment> + +<!-- Within the constructor now create the right Reactor --> +<add> + <hook>REACTOR_SPL_CONSTRUCTOR_COMMENT_HOOK_END</hook> + <data> + ACE_NEW (impl, + ACE_Select_Reactor); + </data> +</add> + +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_Select_Reactor</replace> +</substitute> + +</file> + +<file name="Reactor.inl"> + +<add> + <hook>REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook> + <data> +// Check if this is necessary +#include "ace/Select_Reactor.h" + </data> +</add> + +</file> + +<!-- Do not build the other reactors than the Select Reactor! --> +<file name="ace.mpc"> + +<!-- Here is where regular expressions can come handy. Such + a capability is not currently provided + --> +<substitute> + <search>TP_Reactor.h</search> + <replace>// TP_Reactor.h </replace> +</substitute> +<substitute> + <search>TP_Reactor.cpp</search> + <replace>// TP_Reactor.cpp</replace> +</substitute> + +<!-- Do not build the Msg_WFMO_Reactor --> +<substitute> + <search>Msg_WFMO_Reactor.cpp</search> + <replace>// Msg_WFMO_Reactor.cpp</replace> +</substitute> + +<!-- Do not build the WFMO Reactor --> +<substitute> + <search>WFMO_Reactor.cpp</search> + <replace>// WFMO_Reactor.cpp</replace> +</substitute> + +<!-- Do not build the Reactor Impl --> +<substitute> + <search>Reactor_Impl.cpp</search> + <replace>// Reactor_Impl.cpp</replace> +</substitute> +<substitute> + <search>Reactor_Impl.h</search> + <replace>// Reactor_Impl.h</replace> +</substitute> + +<!-- Do not build the Dev Poll Reactor --> +<substitute> + <search>Dev_Poll_Reactor.cpp</search> + <replace>// Dev_Poll_Reactor.cpp</replace> +</substitute> + +<!-- Do not build the priority Reactor --> +<substitute> + <search>Priority_Reactor.cpp</search> + <replace>// Priority_Reactor.cpp</replace> +</substitute> + +<!-- Do not build the Reactor_Timer_Interface --> +<substitute> + <search>Reactor_Timer_Interface.h</search> + <replace>// Reactor_Timer_Interface.h</replace> +</substitute> +<substitute> + <search>Reactor_Timer_Interface.cpp</search> + <replace>// Reactor_Timer_Interface.cpp </replace> +</substitute> + +</file> + +</module> + +<!-- transformations required in TAO to work with a select reactor --> +<module name="TAO/tao"> + +<!-- Changes to default_resource.h --> +<file name="default_resource.h"> + +<!-- Remove the forward declaration of ACE_Reactor_Impl --> +<substitute match-line="yes"> +<search>class ACE_Reactor_Impl;</search> +<replace>#include "ace/Reactor.h"</replace> +</substitute> + +<!-- Replace all occurences of ACE_Reactor_Impl with + ACE_Select_Reactor --> +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_Select_Reactor</replace> +</substitute> + +</file> + +<!-- Changes to default_resource.cpp --> +<file name="default_resource.cpp"> + +<!-- Remove the occurence of TP_Reactor --> +<remove>#include "ace/TP_Reactor.h"</remove> + +<!-- Replace all occurences of ACE_Reactor_Impl with + ACE_Select_Reactor --> +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_Select_Reactor</replace> +</substitute> + +<!-- Comment out the code that creates TP_Reactor --> +<comment> + <start-hook>TAO_REACTOR_SPL_COMMENT_HOOK_START</start-hook> + <end-hook>TAO_REACTOR_SPL_COMMENT_HOOK_END</end-hook> +</comment> + +<!-- Add hook to add code that creates the select reactor + component --> +<add> + <!-- We use the same hook that signifies where the comment code + ended to add the concrete Reactor type --> + <hook>TAO_REACTOR_SPL_COMMENT_HOOK_END</hook> + <data> + ACE_NEW_RETURN (impl, + TAO_REACTOR ((ACE_Sig_Handler*)0, + (ACE_Timer_Queue*)0, + 0, + (ACE_Select_Reactor_Notify*)0, + this->reactor_mask_signals_), + 0); + </data> +</add> +</file> + +<!-- changes to tao.mpc --> +<file name="tao.mpc"> + <substitute> + <search>GUIResource_Factory.cpp</search> + <replace>// GUIResource_Factory.cpp</replace> + </substitute> + <substitute> + <search>GUIResource_Factory.h</search> + <replace>// GUIResource_Factory.h</replace> + </substitute> +</file> + +</module> + +<module name="TAO/tao/Strategies"> + +<file name="advanced_resource.h"> + +<!-- Replace all occurances of ACE_Reactor_Impl with + Select_Reactor + --> +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_Select_Reactor</replace> +</substitute> + +</file> + +<file name="advanced_resource.cpp"> + +<!-- Comment out all other reactor includes --> +<remove>#include "ace/FlReactor.h"</remove> +<remove>#include "ace/TkReactor.h"</remove> +<remove>#include "ace/WFMO_Reactor.h"</remove> +<remove>#include "ace/TP_Reactor.h"</remove> +<remove>#include "ace/Msg_WFMO_Reactor.h"</remove> + +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_Select_Reactor</replace> +</substitute> + +<!-- Replace Select_Reactor.h with Reactor.h --> +<substitute> + <search>ace/Select_Reactor.h</search> + <replace>ace/Reactor.h</replace> +</substitute> + +<!-- Comment out creation code for all other reactors --> +<comment> + <start-hook>TAO_ADVANCED_RESOURCE_REACTOR_SPL_COMMENT_HOOK_START</start-hook> + <end-hook>TAO_ADVANCED_RESOURCE_REACTOR_SPL_COMMENT_HOOK_END</end-hook> +</comment> + +<!-- Use the end hook to insert code that will create right reactor --> +<add> + <hook>TAO_ADVANCED_RESOURCE_REACTOR_SPL_COMMENT_HOOK_END</hook> + <data> + ACE_NEW_RETURN (impl, + TAO_REACTOR ((ACE_Sig_Handler*)0, + (ACE_Timer_Queue*)0, + 0, + (ACE_Select_Reactor_Notify*)0, + this->reactor_mask_signals_), + 0); + </data> +</add> + +</file> + +</module> + +</transform> diff --git a/ACE/bin/FOCUS/specializations/Reactor_Family/Select_Reactor_ST.spl b/ACE/bin/FOCUS/specializations/Reactor_Family/Select_Reactor_ST.spl new file mode 100644 index 00000000000..145136455a2 --- /dev/null +++ b/ACE/bin/FOCUS/specializations/Reactor_Family/Select_Reactor_ST.spl @@ -0,0 +1,468 @@ +<?xml version="1.0"?> + +<!-- Select Reactor Specializations: + * =============================== + * Details all the specialization transformations necessary + * to specialize the Reactor framework when the target reactor + * is a select reactor. + * + * @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + * $Id$ +--> + +<transform> + +<!-- Define the module where there are multiple files --> +<module name="ace"> + +<!-- File where the transformations happen --> +<file name="Select_Reactor_Base.h"> + +<!-- Add the following lines based on a hook --> +<add> + <hook>REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook> + <data>class ACE_Sig_Handler;</data> + <data>class ACE_Sig_Action;</data> + <data>class ACE_Sig_Set;</data> +</add> + +<add> + <hook>REACTOR_SPL_PUBLIC_METHODS_ADD_HOOK</hook> + <data> +//These methods needs to be virtual as they are used by +//Select_Reactor_Notify classes which use the base class +virtual ~ACE_Select_Reactor_Impl () {} + +virtual int notify (ACE_Event_Handler *event_handler = 0, + ACE_Reactor_Mask mask = ACE_Event_Handler::EXCEPT_MASK, + ACE_Time_Value * = 0) =0; + +virtual int remove_handler (ACE_Event_Handler *eh, + ACE_Reactor_Mask mask) =0; + +virtual int register_handler (ACE_HANDLE handle, + ACE_Event_Handler *eh, + ACE_Reactor_Mask mask) =0; + </data> +</add> + +<!-- Remove what ever is present in the tag from the file --> +<remove>virtual</remove> +<remove>: public ACE_Reactor_Impl</remove> +<remove>#include "ace/Reactor_Impl.h"</remove> + +<!-- Replace a with b --> +<substitute> + <search>public ACE_Reactor_Notify</search> + <replace>public ACE_Event_Handler</replace> +</substitute> + +<!-- Replace the generic versions with the Select specialized versions --> +<substitute> + <search>ACE_Reactor_Notify</search> + <replace>ACE_Select_Reactor_Notify</replace> +</substitute> + +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_Select_Reactor_Impl</replace> +</substitute> + +<!-- After the specialization, the following functions are still virtual --> +<substitute> + <search>void renew</search> + <replace>virtual void renew</replace> +</substitute> +<substitute> + <search>int is_suspended_i</search> + <replace>virtual int is_suspended_i</replace> +</substitute> +<substitute> + <search>void clear_dispatch_mask</search> + <replace>virtual void clear_dispatch_mask</replace> +</substitute> + +</file> + +<file name="Select_Reactor_Base.cpp"> + +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_Select_Reactor_Impl</replace> +</substitute> + +</file> + +<file name="Select_Reactor_Base.inl"> + +<remove>#include "ace/Reactor.h"</remove> + +</file> + +<file name="Select_Reactor_T.h"> + +<add> +<hook>REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook> +<data>class ACE_Sig_Handler;</data> +<data>class ACE_Sig_Action;</data> +<data>class ACE_Sig_Set;</data> +</add> + +<substitute> + <search>ACE_Reactor_Notify</search> + <replace>ACE_Select_Reactor_Notify</replace> +</substitute> + +<remove>virtual</remove> + +</file> + +<file name="Select_Reactor_T.cpp"> + +<add> + <hook>REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook> + <data>#include "ace/Countdown_Time.h"</data> +</add> + +<substitute> + <search>ACE_Reactor_Notify</search> + <replace>ACE_Select_Reactor_Notify</replace> +</substitute> + +</file> + +<!-- +<file name="Select_Reactor_T.inl"> + +<remove>#include "ace/Reactor.h"</remove> + +</file> +--> + +<!-- Transformations to Reactor_Token_T.h --> +<file name="Reactor_Token_T.h"> + +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_Select_Reactor_Impl</replace> +</substitute> + +<substitute match-line="yes"> + <search>#include "ace/Reactor_Impl.h"</search> + <replace>#include "ace/Select_Reactor_Base.h"</replace> +</substitute> + +</file> + +<file name="Reactor_Token_T.cpp"> + +<!-- Search for ACE_Reactor_Impl and replace it with + ACE_Select_Reactor_Impl --> +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_Select_Reactor_Impl</replace> +</substitute> + +</file> + +<file name="Reactor.h"> + +<add> +<hook>REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook> +<data>#include "ace/Select_Reactor.h"</data> +</add> + +<remove>class ACE_Reactor_Impl;</remove> +<remove>virtual</remove> + +<substitute> +<search>ACE_Reactor_Impl</search> +<replace>ACE_Select_Reactor</replace> +</substitute> + +<!-- Remove the Reactor_Timer interface include --> +<remove>: public ACE_Reactor_Timer_Interface</remove> +<remove>#include "ace/Reactor_Timer_Interface.h"</remove> + +</file> + +<file name="Event_Handler.h"> + +<!-- remove the ACE_Event_Handler forware declaration --> +<remove>class ACE_Reactor_Timer_Interface;</remove> + +<!-- substitute ACE_Reactor_Timer operations with ACE_Reactor --> +<substitute> + <search>ACE_Reactor_Timer_Interface</search> + <replace>ACE_Reactor</replace> +</substitute> +</file> + +<file name="Event_Handler.cpp"> + <substitute> + <search>ACE_Reactor_Timer_Interface</search> + <replace>ACE_Reactor</replace> + </substitute> +</file> + +<file name="Timer_Queue_T.cpp"> + +<!-- Remove the Reactor_Timer_Interface include --> +<remove>#include "ace/Reactor_Timer_Interface.h"</remove> + +</file> + +<file name="Reactor.cpp"> + +<!-- Comment the conditional includes in the file --> +<comment> + <start-hook>REACTOR_SPL_COMMENT_INCLUDE_START_HOOK</start-hook> + <end-hook>REACTOR_SPL_COMMENT_INCLUDE_END_HOOK</end-hook> +</comment> + +<!-- Comment out conditional includes files in the Reactor's + constructor +--> +<comment> + <start-hook>REACTOR_SPL_CONSTRUCTOR_COMMENT_HOOK_START</start-hook> + <end-hook>REACTOR_SPL_CONSTRUCTOR_COMMENT_HOOK_END</end-hook> +</comment> + +<!-- Within the constructor now create the right Reactor --> +<add> + <hook>REACTOR_SPL_CONSTRUCTOR_COMMENT_HOOK_END</hook> + <data> + ACE_NEW (impl, + ACE_Select_Reactor); + </data> +</add> + +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_Select_Reactor</replace> +</substitute> + +</file> + +<file name="Reactor.inl"> + +<add> + <hook>REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook> + <data> +// Check if this is necessary +#include "ace/Select_Reactor.h" + </data> +</add> + +</file> + +<file name="Select_Reactor.h"> + +<!-- comment out the lock based select reactor, which is a select_mt --> +<comment> + <start-hook>TAO_REACTOR_SPL_COMMENT_HOOK_START</start-hook> + <end-hook>TAO_REACTOR_SPL_COMMENT_HOOK_END</end-hook> +</comment> + +<add> + <hook>TAO_REACTOR_SPL_COMMENT_HOOK_END</hook> + <data> + typedef ACE_Select_Reactor_T <ACE_Reactor_Token_T < ACE_Noop_Token > > ACE_Select_Reactor; + </data> +</add> +</file> + +<!-- Do not build the other reactors than the Select Reactor! --> +<file name="ace.mpc"> + +<!-- Here is where regular expressions can come handy. Such + a capability is not currently provided + --> +<substitute> + <search>TP_Reactor.h</search> + <replace>// TP_Reactor.h </replace> +</substitute> +<substitute> + <search>TP_Reactor.cpp</search> + <replace>// TP_Reactor.cpp</replace> +</substitute> + +<!-- Do not build the Msg_WFMO_Reactor --> +<substitute> + <search>Msg_WFMO_Reactor.cpp</search> + <replace>// Msg_WFMO_Reactor.cpp</replace> +</substitute> + +<!-- Do not build the WFMO Reactor --> +<substitute> + <search>WFMO_Reactor.cpp</search> + <replace>// WFMO_Reactor.cpp</replace> +</substitute> + +<!-- Do not build the Reactor Impl --> +<substitute> + <search>Reactor_Impl.cpp</search> + <replace>// Reactor_Impl.cpp</replace> +</substitute> +<substitute> + <search>Reactor_Impl.h</search> + <replace>// Reactor_Impl.h</replace> +</substitute> + +<!-- Do not build the Dev Poll Reactor --> +<substitute> + <search>Dev_Poll_Reactor.cpp</search> + <replace>// Dev_Poll_Reactor.cpp</replace> +</substitute> + +<!-- Do not build the priority Reactor --> +<substitute> + <search>Priority_Reactor.cpp</search> + <replace>// Priority_Reactor.cpp</replace> +</substitute> + +<!-- Do not build the Reactor_Timer_Interface --> +<substitute> + <search>Reactor_Timer_Interface.h</search> + <replace>// Reactor_Timer_Interface.h</replace> +</substitute> +<substitute> + <search>Reactor_Timer_Interface.cpp</search> + <replace>// Reactor_Timer_Interface.cpp </replace> +</substitute> + +</file> + +</module> + +<!-- transformations required in TAO to work with a select reactor --> +<module name="TAO/tao"> + +<!-- Changes to default_resource.h --> +<file name="default_resource.h"> + +<!-- Remove the forward declaration of ACE_Reactor_Impl --> +<substitute match-line="yes"> +<search>class ACE_Reactor_Impl;</search> +<replace>#include "ace/Reactor.h"</replace> +</substitute> + +<!-- Replace all occurences of ACE_Reactor_Impl with + ACE_Select_Reactor --> +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_Select_Reactor</replace> +</substitute> + +</file> + +<!-- Changes to default_resource.cpp --> +<file name="default_resource.cpp"> + +<!-- Remove the occurence of TP_Reactor --> +<remove>#include "ace/TP_Reactor.h"</remove> + +<!-- Replace all occurences of ACE_Reactor_Impl with + ACE_Select_Reactor --> +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_Select_Reactor</replace> +</substitute> + +<!-- Comment out the code that creates TP_Reactor --> +<comment> + <start-hook>TAO_REACTOR_SPL_COMMENT_HOOK_START</start-hook> + <end-hook>TAO_REACTOR_SPL_COMMENT_HOOK_END</end-hook> +</comment> + +<!-- Add hook to add code that creates the select reactor + component --> +<add> + <!-- We use the same hook that signifies where the comment code + ended to add the concrete Reactor type --> + <hook>TAO_REACTOR_SPL_COMMENT_HOOK_END</hook> + <data> + ACE_NEW_RETURN (impl, + TAO_NULL_LOCK_REACTOR ((ACE_Sig_Handler*)0, + (ACE_Timer_Queue*)0, + 0, + (ACE_Select_Reactor_Notify*)0, + this->reactor_mask_signals_), + 0); + </data> +</add> +</file> + +<!-- changes to tao.mpc --> +<file name="tao.mpc"> + <substitute> + <search>GUIResource_Factory.cpp</search> + <replace>// GUIResource_Factory.cpp</replace> + </substitute> + <substitute> + <search>GUIResource_Factory.h</search> + <replace>// GUIResource_Factory.h</replace> + </substitute> +</file> + +</module> + +<module name="TAO/tao/Strategies"> + +<file name="advanced_resource.h"> + +<!-- Replace all occurances of ACE_Reactor_Impl with + Select_Reactor + --> +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_Select_Reactor</replace> +</substitute> + +</file> + +<file name="advanced_resource.cpp"> + +<!-- Comment out all other reactor includes --> +<remove>#include "ace/FlReactor.h"</remove> +<remove>#include "ace/TkReactor.h"</remove> +<remove>#include "ace/WFMO_Reactor.h"</remove> +<remove>#include "ace/TP_Reactor.h"</remove> +<remove>#include "ace/Msg_WFMO_Reactor.h"</remove> + +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_Select_Reactor</replace> +</substitute> + +<!-- Replace Select_Reactor.h with Reactor.h --> +<substitute> + <search>ace/Select_Reactor.h</search> + <replace>ace/Reactor.h</replace> +</substitute> + +<!-- Comment out creation code for all other reactors --> +<comment> + <start-hook>TAO_ADVANCED_RESOURCE_REACTOR_SPL_COMMENT_HOOK_START</start-hook> + <end-hook>TAO_ADVANCED_RESOURCE_REACTOR_SPL_COMMENT_HOOK_END</end-hook> +</comment> + +<!-- Use the end hook to insert code that will create right reactor --> +<add> + <hook>TAO_ADVANCED_RESOURCE_REACTOR_SPL_COMMENT_HOOK_END</hook> + <data> + ACE_NEW_RETURN (impl, + TAO_NULL_LOCK_REACTOR ((ACE_Sig_Handler*)0, + (ACE_Timer_Queue*)0, + 0, + (ACE_Select_Reactor_Notify*)0, + this->reactor_mask_signals_), + 0); + </data> +</add> + +</file> + +</module> + +</transform> diff --git a/ACE/bin/FOCUS/specializations/Reactor_Family/TP_Reactor.spl b/ACE/bin/FOCUS/specializations/Reactor_Family/TP_Reactor.spl new file mode 100644 index 00000000000..f25c5fe5416 --- /dev/null +++ b/ACE/bin/FOCUS/specializations/Reactor_Family/TP_Reactor.spl @@ -0,0 +1,439 @@ +<?xml version="1.0"?> + +<!-- Thread Pool Reactor Specializations: + * ====================================== + * Thread Pool reactor is a variation of the Select Reactor. + * This specialization includes all of the specializations + * that are present in Select_Reactor.spl + * + * @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + * $Id$ +--> + +<transform> + +<module name="ace"> + +<!-- File where the transformations happen --> +<file name="Select_Reactor_Base.h"> + +<!-- Add the following lines based on a hook --> +<add> + <hook>REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook> + <data>class ACE_Sig_Handler;</data> + <data>class ACE_Sig_Action;</data> + <data>class ACE_Sig_Set;</data> +</add> + +<!-- Remove what ever is present in the tag from the file --> +<remove>#include "ace/Reactor_Impl.h"</remove> +<remove>virtual</remove> +<remove>: public ACE_Reactor_Impl</remove> + +<!-- Replace a with b --> +<substitute> + <search>public ACE_Reactor_Notify</search> + <replace>public ACE_Event_Handler</replace> +</substitute> + +<add> + <hook>REACTOR_SPL_PUBLIC_METHODS_ADD_HOOK</hook> + <data> +//--- How can we devirtualize these methods? +virtual ~ACE_Select_Reactor_Impl () {} + +virtual int notify (ACE_Event_Handler *event_handler = 0, + ACE_Reactor_Mask mask = ACE_Event_Handler::EXCEPT_MASK, + ACE_Time_Value * = 0) = 0; + +virtual int remove_handler (ACE_Event_Handler *eh, + ACE_Reactor_Mask mask) = 0; + +virtual int register_handler (ACE_HANDLE handle, + ACE_Event_Handler *eh, + ACE_Reactor_Mask mask) =0; +//-------------------------------------------- + </data> +</add> + +<substitute> + <search>ACE_Reactor_Notify</search> + <replace>ACE_Select_Reactor_Notify</replace> +</substitute> + +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_Select_Reactor_Impl</replace> +</substitute> + +<!-- After the specialization, the following functions are still virtual --> +<substitute> + <search>void renew</search> + <replace>virtual void renew</replace> +</substitute> +<substitute> + <search>int is_suspended_i</search> + <replace>virtual int is_suspended_i</replace> +</substitute> +<substitute> + <search>void clear_dispatch_mask</search> + <replace>virtual void clear_dispatch_mask</replace> +</substitute> + +</file> + +<file name="Select_Reactor_Base.cpp"> + +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_Select_Reactor_Impl</replace> +</substitute> + +</file> + +<file name="Select_Reactor_Base.inl"> + +<remove>#include "ace/Reactor.h"</remove> + +</file> + +<file name="Select_Reactor_T.h"> + +<add> +<hook>REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook> +<data>class ACE_Sig_Handler;</data> +<data>class ACE_Sig_Action;</data> +<data>class ACE_Sig_Set;</data> +</add> + +<substitute> + <search>ACE_Reactor_Notify</search> + <replace>ACE_Select_Reactor_Notify</replace> +</substitute> +</file> + +<file name="Select_Reactor_T.cpp"> + +<add> + <hook>REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook> + <data>#include "ace/Countdown_Time.h"</data> +</add> + +<substitute> + <search>ACE_Reactor_Notify</search> + <replace>ACE_Select_Reactor_Notify</replace> +</substitute> + +</file> + +<!-- Transformations to Reactor_Token_T.h --> +<file name="Reactor_Token_T.h"> + +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_Select_Reactor_Impl</replace> +</substitute> + +<substitute match-line="yes"> + <search>#include "ace/Reactor_Impl.h"</search> + <replace>#include "ace/Select_Reactor_Base.h"</replace> +</substitute> + +</file> + +<file name="Reactor_Token_T.cpp"> + +<!-- Search for ACE_Reactor_Impl and replace it with + ACE_Select_Reactor_Impl --> +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_Select_Reactor_Impl</replace> +</substitute> + +</file> + +<!-- Starting below is the specialization for TP_Reactor --> + +<!-- Transformations to Reactor.h --> +<file name="Reactor.h"> + +<!-- Replace all occurences of ACE_Reactor_Impl with TP_Reactor --> +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_TP_Reactor</replace> +</substitute> + +<!-- Remove all occurences of the word virtual --> +<remove>virtual</remove> + +<!-- Remove the Reactor_Timer interface include --> +<remove>: public ACE_Reactor_Timer_Interface</remove> +<remove>#include "ace/Reactor_Timer_Interface.h"</remove> + +</file> + +<file name="Event_Handler.h"> + +<!-- remove the ACE_Event_Handler forware declaration --> +<remove>class ACE_Reactor_Timer_Interface;</remove> + +<!-- substitute ACE_Reactor_Timer operations with ACE_Reactor --> +<substitute> + <search>ACE_Reactor_Timer_Interface</search> + <replace>ACE_Reactor</replace> +</substitute> +</file> + +<file name="Event_Handler.cpp"> + <substitute> + <search>ACE_Reactor_Timer_Interface</search> + <replace>ACE_Reactor</replace> + </substitute> +</file> + +<file name="Timer_Queue_T.cpp"> + +<!-- Remove the Reactor_Timer_Interface include --> +<remove>#include "ace/Reactor_Timer_Interface.h"</remove> + +</file> + +<!-- Transformations to Reactor.inl --> +<file name="Reactor.inl"> + +<add> + <hook>REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook> + <data> +// Check if this is necessary +#include "ace/Select_Reactor.h" + </data> +</add> + +</file> + +<file name="Reactor.cpp"> + +<!-- Replace ACE_Reactor_Impl with ACE_TP_Reactor --> +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_TP_Reactor</replace> +</substitute> + +<!-- Comment the conditional includes in the file --> +<comment> + <start-hook>REACTOR_SPL_COMMENT_INCLUDE_START_HOOK</start-hook> + <end-hook>REACTOR_SPL_COMMENT_INCLUDE_END_HOOK</end-hook> +</comment> + +<!-- Comment out conditional includes files in the Reactor's + constructor +--> +<comment> + <start-hook>REACTOR_SPL_CONSTRUCTOR_COMMENT_HOOK_START</start-hook> + <end-hook>REACTOR_SPL_CONSTRUCTOR_COMMENT_HOOK_END</end-hook> +</comment> + +<!-- Add the TP_Reactor include file --> +<add> + <hook>REACTOR_SPL_COMMENT_INCLUDE_END_HOOK</hook> + <data>#include "ace/TP_Reactor.h"</data> +</add> + +<!-- Within the constructor now create the right Reactor --> +<add> + <hook>REACTOR_SPL_CONSTRUCTOR_COMMENT_HOOK_END</hook> + <data> + ACE_NEW (impl, + ACE_TP_Reactor); + </data> +</add> + +</file> + +<!-- Transformations to TP_Reactor.h --> +<file name="TP_Reactor.h"> + +<!-- Remove all occurances of virtual --> +<remove>virtual</remove> + +</file> + +<!-- Transformations to TP_Reactor.cpp --> +<file name="TP_Reactor.cpp"> + +<!-- Comment hook --> +<comment> + <start-hook>REACTOR_SPL_COMMENT_HOOK_START</start-hook> + <end-hook>REACTOR_SPL_COMMENT_HOOK_END</end-hook> +</comment> + +<!-- Add this function to the --> +<add> + <hook>REACTOR_SPL_COMMENT_HOOK_END</hook> + <data> +int +ACE_TP_Reactor::register_handler (int signum, + ACE_Event_Handler *new_sh, + ACE_Sig_Action *new_disp, + ACE_Event_Handler **old_sh, + ACE_Sig_Action *old_disp) +{ + return ACE_Select_Reactor::register_handler (signum, + new_sh, + new_disp, + old_sh, + old_disp); +} + </data> +</add> + +</file> + +<!-- Transformations to Asynch_Pseudo_Task.h --> +<file name="Asynch_Pseudo_Task.h"> + +<!-- Remove the Select_Reacto.h include --> +<remove>#include "ace/Select_Reactor.h"</remove> + +<substitute> + <search>ACE_Select_Reactor</search> + <replace>ACE_TP_Reactor</replace> +</substitute> + +<!-- Add the TP_Reactor which is the concrete reactor --> +<add> + <hook>REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook> + <data>#include "ace/TP_Reactor.h"</data> +</add> + +</file> + +<file name="ace.mpc"> + +<!-- Do not build the WFMO Reactor --> +<substitute> + <search>WFMO_Reactor.cpp</search> + <replace>// WFMO_Reactor.cpp</replace> +</substitute> + +<!-- Do not build the Reactor Impl --> +<substitute> + <search>Reactor_Impl.cpp</search> + <replace>// Reactor_Impl.cpp</replace> +</substitute> +<substitute> + <search>Reactor_Impl.h</search> + <replace>// Reactor_Impl.h</replace> +</substitute> + +<!-- Do not build the Dev Poll Reactor --> +<substitute> + <search>Dev_Poll_Reactor.cpp</search> + <replace>// Dev_Poll_Reactor.cpp</replace> +</substitute> + + +<!-- Do not build the Msg_WFMO_Reactor --> +<substitute> + <search>Msg_WFMO_Reactor.cpp</search> + <replace>// Msg_WFMO_Reactor.cpp</replace> +</substitute> + + +<!-- Do not build the priority Reactor --> +<substitute> + <search>Priority_Reactor.cpp</search> + <replace>// Priority_Reactor.cpp</replace> +</substitute> + +<!-- Do not build the Reactor_Timer_Interface --> +<substitute> + <search>Reactor_Timer_Interface.h</search> + <replace>// Reactor_Timer_Interface.h</replace> +</substitute> +<substitute> + <search>Reactor_Timer_Interface.cpp</search> + <replace>// Reactor_Timer_Interface.cpp </replace> +</substitute> + +</file> + +</module> +<!-- end of Changes to ace --> + +<!-- Transformations to TAO module --> +<module name="TAO/tao"> + +<file name="default_resource.h"> + +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_TP_Reactor</replace> +</substitute> + +</file> + +<file name="default_resource.cpp"> + +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_TP_Reactor</replace> +</substitute> + +</file> + +</module> + +<module name="TAO/tao/Strategies"> + +<file name="advanced_resource.h"> + +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_TP_Reactor</replace> +</substitute> + +</file> + +<file name="advanced_resource.cpp"> + +<!-- Comment out all other reactor includes --> + +<remove>#include "ace/FlReactor.h"</remove> +<remove>#include "ace/TkReactor.h"</remove> +<remove>#include "ace/WFMO_Reactor.h"</remove> +<!-- <remove>#include "ace/Select_Reactor.h"</remove> --> +<remove>#include "ace/Msg_WFMO_Reactor.h"</remove> + +<!-- Substitute ACE_Reactor_Impl with ACE_TP_Reactor --> +<substitute> + <search>ACE_Reactor_Impl</search> + <replace>ACE_TP_Reactor</replace> +</substitute> + +<!-- Comment out creation code for all other reactors --> +<comment> + <start-hook>TAO_ADVANCED_RESOURCE_REACTOR_SPL_COMMENT_HOOK_START</start-hook> + <end-hook>TAO_ADVANCED_RESOURCE_REACTOR_SPL_COMMENT_HOOK_END</end-hook> +</comment> + +<!-- Use the end hook to insert code that will create right reactor --> +<add> + <hook>TAO_ADVANCED_RESOURCE_REACTOR_SPL_COMMENT_HOOK_END</hook> + <data> + ACE_NEW_RETURN (impl, + ACE_TP_Reactor (ACE::max_handles (), + 1, + (ACE_Sig_Handler*)0, + (ACE_Timer_Queue*)0, + this->reactor_mask_signals_, + ACE_Select_Reactor_Token::LIFO), + 0); + </data> +</add> + +</file> + +</module> + +</transform> diff --git a/ACE/bin/FOCUS/specializations/Wait_Strategy/Wait_On_Read.spl b/ACE/bin/FOCUS/specializations/Wait_Strategy/Wait_On_Read.spl new file mode 100644 index 00000000000..ab76b9c8eef --- /dev/null +++ b/ACE/bin/FOCUS/specializations/Wait_Strategy/Wait_On_Read.spl @@ -0,0 +1,105 @@ +<?xml version="1.0"?> + +<!-- Wait Strategy Specialization + * =============================== + * Details all the specialization transformations necessary + * to specialize the Wait_Strategy with the Wait_On_Read strategy + * + * @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + * $Id$ +--> + +<transform> + +<module name="TAO/tao"> + +<file name="Wait_Strategy.cpp"> + +<!-- Copy specialized code from the Wait_On_Read strategy + to this file --> + +<copy-from-source> + + <!-- Name of the source file from which to copy. In this case, this is + the Wait_On_Read source file --> + <source>Wait_On_Read.cpp</source> + + <!-- Copy data between the following hooks defined in the aforementioned + file --> + <copy-hook-start>WAIT_STRATEGY_SPL_COPY_HOOK_START</copy-hook-start> + <copy-hook-end>WAIT_STRATEGY_SPL_COPY_HOOK_END</copy-hook-end> + + <!-- Destination hook in the Wait_Strategy.h file where the code + should be placed --> + <dest-hook>TAO_WAIT_STRATEGY_SPL_ADD_HOOK</dest-hook> + +</copy-from-source> + +<!-- Copy include files to the hook to get the necessary include files --> +<add> + <hook>WAIT_STRATEGY_SPL_COPY_HOOK_START</hook> + <data> +#include "Wait_On_Read.h" +#include "Transport.h" +#include "Resume_Handle.h" +#include "Synch_Reply_Dispatcher.h" +#include "Client_Strategy_Factory.h" +#include "ORB_Core.h" +#include "ace/Reactor.h" +#include "ace/Countdown_Time.h" + </data> +</add> + +<!-- Once this is done, replace all occurences of TAO_Wait_On_Read with + TAO_Wait_Strategy --> +<substitute> + <search>TAO_Wait_On_Read</search> + <replace>TAO_Wait_Strategy</replace> +</substitute> + +</file> + +<file name="tao.mpc"> + +<!-- Do not build the other Wait strategy classes --> +<substitute> + <search>Wait_On_Read.h</search> + <replace>// Wait_On_Read.cpp</replace> +</substitute> +<substitute> + <search>Wait_On_Read.cpp</search> + <replace>// Wait_On_Read.cpp</replace> +</substitute> + +<substitute> + <search>Wait_On_Reactor.h</search> + <replace>// Wait_On_Reactor.cpp</replace> +</substitute> +<substitute> + <search>Wait_On_Reactor.cpp</search> + <replace>// Wait_On_Reactor.cpp</replace> +</substitute> + +<substitute> + <search>Wait_On_Leader_Follower.h</search> + <replace>// Wait_On_Leader_Follower.cpp</replace> +</substitute> +<substitute> + <search>Wait_On_Leader_Follower.cpp</search> + <replace>// Wait_On_Leader_Follower.cpp</replace> +</substitute> + +<substitute> + <search>Wait_On_LF_No_Upcall.h</search> + <replace>// Wait_On_LF_No_Upcall.cpp</replace> +</substitute> +<substitute> + <search>Wait_On_LF_No_Upcall.cpp</search> + <replace>// Wait_On_LF_No_Upcall.cpp</replace> +</substitute> + +</file> + +</module> + +</transform> |