View Javadoc
1   /*
2    * JBoss, Home of Professional Open Source
3    * Copyright 2014, Red Hat, Inc. and/or its affiliates, and individual
4    * contributors by the @authors tag. See the copyright.txt in the
5    * distribution for a full listing of individual contributors.
6    *
7    * Licensed under the Apache License, Version 2.0 (the "License");
8    * you may not use this file except in compliance with the License.
9    * You may obtain a copy of the License at
10   * http://www.apache.org/licenses/LICENSE-2.0
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.jboss.as.quickstarts.interapp.appB;
18  
19  import javax.inject.Inject;
20  import javax.inject.Named;
21  
22  import org.jboss.as.quickstarts.interapp.shared.Bar;
23  import org.jboss.as.quickstarts.interapp.shared.Foo;
24  
25  /**
26   * <p>
27   * JSF Controller class that allows manipulation of Foo and Bar.
28   * </p>
29   * <p>
30   * Note that whilst EJBs are used to provide inter application communication, this is not apparent to consumers of Foo and Bar,
31   * which use CDI style injection.
32   * </p>
33   * 
34   * @author Pete Muir
35   * 
36   */
37  @Named
38  public class ControllerB {
39  
40      @Inject
41      private Foo foo;
42  
43      @Inject
44      private Bar bar;
45  
46      public String getFoo() {
47          return foo.getName();
48      }
49  
50      public void setFoo(String name) {
51          foo.setName(name);
52      }
53  
54      public String getBar() {
55          return bar.getName();
56      }
57  
58      public void setBar(String name) {
59          bar.setName(name);
60      }
61  
62      public void sendAndUpdate() {
63          // No-op
64      }
65  }