View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  
20  package org.apache.myfaces.push;
21  
22  import java.util.Collection;
23  import java.util.Iterator;
24  import javax.faces.component.UIOutput;
25  import javax.faces.component.behavior.ClientBehaviorHolder;
26  import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
27  import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
28  
29  /**
30   * This component hold f:websocket client behavior and other properties.
31   */
32  @JSFComponent(
33          clazz = "org.apache.myfaces.push.WebsocketComponent",
34          family = "javax.faces.Output",
35          type = "org.apache.myfaces.WebsocketComponent",
36          defaultRendererType="org.apache.myfaces.WebsocketComponent")
37  public abstract class AbstractWebsocketComponent extends UIOutput implements ClientBehaviorHolder
38  {
39      
40      @JSFProperty
41      public abstract String getChannel();
42      
43      @JSFProperty
44      public abstract String getScope();
45      
46      @JSFProperty
47      public abstract String getUser();
48      
49      @JSFProperty
50      public abstract String getOnopen();
51      
52      @JSFProperty
53      public abstract String getOnmessage();
54      
55      @JSFProperty
56      public abstract String getOnclose();
57      
58      @JSFProperty(defaultValue = "true")
59      public abstract boolean isConnected();
60  
61      /**
62       * Return the id used by the component used to render the markup at the end of body section.
63       * 
64       * @return 
65       */
66      @JSFProperty(tagExcluded = true)
67      public abstract String getInitComponentId();
68  
69      @Override
70      public Collection<String> getEventNames()
71      {
72          return new Collection<String>(){
73  
74              @Override
75              public int size()
76              {
77                  return 0;
78              }
79  
80              @Override
81              public boolean isEmpty()
82              {
83                  return false;
84              }
85  
86              @Override
87              public boolean contains(Object o)
88              {
89                  return true;
90              }
91  
92              @Override
93              public Iterator<String> iterator()
94              {
95                  throw new UnsupportedOperationException("Not supported yet.");
96              }
97  
98              @Override
99              public Object[] toArray()
100             {
101                 throw new UnsupportedOperationException("Not supported yet.");
102             }
103 
104             @Override
105             public <T> T[] toArray(T[] a)
106             {
107                 throw new UnsupportedOperationException("Not supported yet.");
108             }
109 
110             @Override
111             public boolean add(String e)
112             {
113                 throw new UnsupportedOperationException("Not supported yet.");
114             }
115 
116             @Override
117             public boolean remove(Object o)
118             {
119                 throw new UnsupportedOperationException("Not supported yet.");
120             }
121 
122             @Override
123             public boolean containsAll(Collection<?> c)
124             {
125                 return true;
126             }
127 
128             @Override
129             public boolean addAll(Collection<? extends String> c)
130             {
131                 throw new UnsupportedOperationException("Not supported yet.");
132             }
133 
134             @Override
135             public boolean removeAll(Collection<?> c)
136             {
137                 throw new UnsupportedOperationException("Not supported yet.");
138             }
139 
140             @Override
141             public boolean retainAll(Collection<?> c)
142             {
143                 throw new UnsupportedOperationException("Not supported yet.");
144             }
145 
146             @Override
147             public void clear()
148             {
149                 throw new UnsupportedOperationException("Not supported yet.");
150             }
151         };
152     }
153     
154 }