summaryrefslogtreecommitdiffstats
path: root/tags/cpp-0.1.incubating-M1-RC3b/sca/runtime/core/src/tuscany/sca/core/SCAEntryPoint.h
blob: 6c1df3e28e01e45a19adfa0509dc9a8ce806c486 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
 *
 *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

/* $Rev$ $Date: 2005/12/22 11:33:21 $ */

#ifndef tuscany_sca_core_scaentrypoint_h
#define tuscany_sca_core_scaentrypoint_h

#include "osoa/sca/export.h"

#include <vector>
using std::vector;
#include "tuscany/sca/core/ServiceWrapper.h"
#include "tuscany/sca/model/WireTarget.h"
#include "tuscany/sca/model/Subsystem.h"
#include "tuscany/sca/model/EntryPoint.h"
#include "tuscany/sca/model/Module.h"
using namespace tuscany::sca::model;
#include "commonj/sdo/SDO.h"
using commonj::sdo::DataObjectPtr;
using commonj::sdo::DataFactoryPtr;

namespace tuscany
{
    namespace sca
    {
        /**
         * A runtime class which is used by external bindings to provide the entry
         * point into the SCA runtime. An entry point will be defined in an SCA
         * module, and a binding class will be provided to service the
         * communication between the external binding (e.g. for web services the
         * SOAP/HTTP communication) and the SCA runtime. The binding class will
         * use SCAEntryPoint to call into the SCA runtime.
         */
        class  SCAEntryPoint
        {
        public:
            /**
             * Constructor to create a new instance which will be associated with
             * a given entry point in an SCA module.
             * @param entryPointName The qualified name of the entry point in an 
             * SCA module. It is of the form 
             * "subsystem name"/"module component name"/"entry point name".
             */
            SCA_API SCAEntryPoint(const char* entryPointName);

            /**
             * Destructor.
             */
            SCA_API virtual    ~SCAEntryPoint();

            /**
             * Invokes an operation on the component to which the SCA entry point
             * is wired in the SCA module.
             * @param operation. The operation request
             */
            SCA_API virtual void invoke(Operation& operation);

            /**
             * Returns a SDO data factory from which all the types associated with the entry point
             * and module can be created.
             */
            SCA_API DataFactoryPtr getDataFactory() {return dataFactory;}

        protected:

        private:
            /**
             * The subsystem in which this entry point is found.
             */ 
            Subsystem* subsystem;

            /**
             * The entry point in the module.
             */
            EntryPoint* entrypoint;

            /**
             * The module component in the subsystem.
             */
            Module* module;

            /**
             * Cached data factory which has all the types defined for the module in which
             * this entry point is found.
             */
            DataFactoryPtr dataFactory;

            typedef vector<ServiceWrapper*> SERVICES;
            /**
             * Vector of all the service wrappers created for this entry point. 
             * Used to destroy the wrappers when this class is destroyed.
             */
            SERVICES services;

            /**
             * Creates and returns the service wrapper for a given target.
             * @param target The target of the wire for which a service wrapper is
             * to be created.
             * @return A service wrapper to be used for invoking the target implementation.
             */
            ServiceWrapper* getServiceWrapper(WireTarget* target);
            
        };
    } // End namespace sca
} // End namespace tuscany

#endif // tuscany_sca_core_scaentrypoint_h