KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > servicemix > sca > builder > ExternalJbiServiceWireBuilder


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.servicemix.sca.builder;
18
19 import org.apache.servicemix.sca.config.ExternalJbiServiceContextFactory;
20 import org.apache.servicemix.sca.handler.ExternalJbiServiceTargetInvoker;
21 import org.apache.tuscany.core.builder.BuilderConfigException;
22 import org.apache.tuscany.core.builder.WireBuilder;
23 import org.apache.tuscany.core.context.ScopeContext;
24 import org.apache.tuscany.core.invocation.InvocationConfiguration;
25 import org.apache.tuscany.core.invocation.spi.ProxyFactory;
26 import org.apache.tuscany.core.runtime.RuntimeContext;
27 import org.apache.tuscany.core.system.annotation.Autowire;
28 import org.osoa.sca.annotations.Init;
29 import org.osoa.sca.annotations.Scope;
30
31 @Scope("MODULE")
32 public class ExternalJbiServiceWireBuilder implements WireBuilder {
33
34     private RuntimeContext runtimeContext;
35
36     /**
37      * Constructs a new ExternalWebServiceWireBuilder.
38      */

39     public ExternalJbiServiceWireBuilder() {
40         super();
41     }
42
43     @Autowire
44     public void setRuntimeContext(RuntimeContext context) {
45         runtimeContext = context;
46     }
47
48     @Init(eager=true)
49     public void init() {
50         runtimeContext.addBuilder(this);
51     }
52
53     public void connect(ProxyFactory sourceFactory, ProxyFactory targetFactory, Class JavaDoc targetType, boolean downScope, ScopeContext targetScopeContext) throws BuilderConfigException {
54         if (!(ExternalJbiServiceContextFactory.class.isAssignableFrom(targetType))) {
55             return;
56         }
57         for (InvocationConfiguration sourceInvocationConfig : sourceFactory.getProxyConfiguration().getInvocationConfigurations().values()) {
58             ExternalJbiServiceTargetInvoker invoker = new ExternalJbiServiceTargetInvoker(sourceFactory.getProxyConfiguration().getTargetName(), sourceInvocationConfig.getMethod(), targetScopeContext);
59             sourceInvocationConfig.setTargetInvoker(invoker);
60         }
61     }
62
63     public void completeTargetChain(ProxyFactory targetFactory, Class JavaDoc targetType, ScopeContext targetScopeContext)
64             throws BuilderConfigException {
65         //TODO implement
66
}
67
68 }
69
Popular Tags