View Javadoc
1   /**
2    * This Source Code Form is subject to the terms of the Mozilla Public
3    * License, v. 2.0. If a copy of the MPL was not distributed with this
4    * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5    *
6    * If it is not possible or desirable to put the notice in a particular
7    * file, then You may include the notice in a location (such as a LICENSE
8    * file in a relevant directory) where a recipient would be likely to look
9    * for such a notice.
10  
11   * 
12   */
13   
14  /*  ---------------------------------------------------------------------------
15   *  U.S. Government, Department of the Army
16   *  Army Materiel Command
17   *  Research Development Engineering Command
18   *  Communications Electronics Research Development and Engineering Center
19   *  ---------------------------------------------------------------------------
20   */
21  
22  package org.miloss.fgsms.wsn.broker;
23  
24  import javax.annotation.Resource;
25  import javax.jws.*;
26  import javax.jws.soap.SOAPBinding;
27  import javax.xml.bind.annotation.XmlSeeAlso;
28  import javax.xml.datatype.DatatypeFactory;
29  import javax.xml.ws.WebServiceContext;
30  import org.apache.log4j.Logger;
31  import org.oasis_open.docs.wsn.b_2.*;
32  import org.oasis_open.docs.wsn.brw_2.ResourceUnknownFault;
33  import org.oasis_open.docs.wsn.brw_2.UnableToDestroyPullPointFault;
34  import org.oasis_open.docs.wsn.brw_2.UnableToGetMessagesFault;
35  
36  /**
37   *
38   * @author Administrator
39   *  {http://docs.oasis-open.org/wsn/brw-2}PullPointService
40   */
41  @WebService(name = "PullPoint", targetNamespace = "http://docs.oasis-open.org/wsn/brw-2", serviceName = "PullPointService", portName = "PullPointBindingPort"
42  ,wsdlLocation = "brw-2impl.wsdl")
43  @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
44  @XmlSeeAlso({
45      org.oasis_open.docs.wsrf.r_2.ObjectFactory.class,
46      org.oasis_open.docs.wsrf.bf_2.ObjectFactory.class,
47      org.oasis_open.docs.wsn.t_1.ObjectFactory.class,
48      org.oasis_open.docs.wsn.b_2.ObjectFactory.class,
49      org.oasis_open.docs.wsn.br_2.ObjectFactory.class
50  })
51  public class PullPointService implements org.oasis_open.docs.wsn.brw_2.PullPoint {
52  
53        private DatatypeFactory df = null;
54      @Resource
55      private WebServiceContext ctx;
56      final static Logger log = Logger.getLogger("WS-NotificationBroker");
57      
58      /**
59       *
60       * @param getMessagesRequest
61       * @return returns org.oasis_open.docs.wsn.b_2.GetMessagesResponse
62       * @throws UnableToGetMessagesFault
63       * @throws ResourceUnknownFault
64       */
65      @WebMethod(operationName = "GetMessages", action = "GetMessages")
66      @WebResult(name = "GetMessagesResponse", targetNamespace = "http://docs.oasis-open.org/wsn/b-2", partName = "GetMessagesResponse")
67      public GetMessagesResponse getMessages(
68              @WebParam(name = "GetMessages", targetNamespace = "http://docs.oasis-open.org/wsn/b-2", partName = "GetMessagesRequest") GetMessages getMessagesRequest)
69              throws ResourceUnknownFault, UnableToGetMessagesFault {
70          SingletonBroker.getInstance();
71          return SingletonBroker.GetMessages(getMessagesRequest);
72          
73      }
74  
75      /**
76       *
77       * @param destroyPullPointRequest
78       * @return returns org.oasis_open.docs.wsn.b_2.DestroyPullPointResponse
79       * @throws UnableToDestroyPullPointFault
80       * @throws ResourceUnknownFault
81       */
82      @WebMethod(operationName = "DestroyPullPoint", action = "DestroyPullPoint")
83      @WebResult(name = "DestroyPullPointResponse", targetNamespace = "http://docs.oasis-open.org/wsn/b-2", partName = "DestroyPullPointResponse")
84      public DestroyPullPointResponse destroyPullPoint(
85              @WebParam(name = "DestroyPullPoint", targetNamespace = "http://docs.oasis-open.org/wsn/b-2", partName = "DestroyPullPointRequest") DestroyPullPoint destroyPullPointRequest)
86              throws ResourceUnknownFault, UnableToDestroyPullPointFault {
87          //authorize request
88          SingletonBroker.getInstance();
89          SingletonBroker.DestroyMailBox(destroyPullPointRequest.getAny());
90          DestroyPullPointResponse res = new DestroyPullPointResponse();
91          return res;
92      }
93  
94      /**
95       *
96       * @param notify
97       */
98      @WebMethod(operationName = "Notify", action = "Notify")
99      @Oneway
100     public void notify(
101             @WebParam(name = "Notify", targetNamespace = "http://docs.oasis-open.org/wsn/b-2", partName = "Notify") Notify notify) {
102         //authorize client
103 
104         //inbound notification
105         SingletonBroker.getInstance();
106         SingletonBroker.Dispatch(notify);
107     }
108 }