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.WebMethod;
26  import javax.jws.WebParam;
27  import javax.jws.WebResult;
28  import javax.jws.WebService;
29  import javax.jws.soap.SOAPBinding;
30  import javax.xml.bind.annotation.XmlSeeAlso;
31  import javax.xml.datatype.DatatypeFactory;
32  import javax.xml.ws.WebServiceContext;
33  import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
34  import org.apache.log4j.Logger;
35  import org.oasis_open.docs.wsn.b_2.CreatePullPointResponse;
36  import org.oasis_open.docs.wsn.brw_2.UnableToCreatePullPointFault;
37  
38  /**
39   *
40   * @author Administrator
41   */
42  
43  @WebService(name = "CreatePullPoint", targetNamespace = "http://docs.oasis-open.org/wsn/brw-2", serviceName = "CreatePullPointService", portName = "CreatePullPointBindingPort"
44  	,wsdlLocation = "brw-2impl.wsdl")
45  @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
46  @XmlSeeAlso({
47      org.oasis_open.docs.wsrf.r_2.ObjectFactory.class,
48      org.oasis_open.docs.wsrf.bf_2.ObjectFactory.class,
49      org.oasis_open.docs.wsn.t_1.ObjectFactory.class,
50      org.oasis_open.docs.wsn.b_2.ObjectFactory.class,
51      org.oasis_open.docs.wsn.br_2.ObjectFactory.class
52  })
53  public class CreatePullPointService implements
54          org.oasis_open.docs.wsn.brw_2.CreatePullPoint {
55  
56      private DatatypeFactory df = null;
57      @Resource
58      private WebServiceContext ctx;
59      final static Logger log = Logger.getLogger("WS-NotificationBroker");
60  
61      /**
62       *
63       * @param createPullPointRequest
64       * @return returns org.oasis_open.docs.wsn.b_2.CreatePullPointResponse
65       * @throws UnableToCreatePullPointFault
66       */
67      @WebMethod(operationName = "CreatePullPoint", action = "CreatePullPoint")
68      @WebResult(name = "CreatePullPointResponse", targetNamespace = "http://docs.oasis-open.org/wsn/b-2", partName = "CreatePullPointResponse")
69      public CreatePullPointResponse createPullPoint(
70              @WebParam(name = "CreatePullPoint", targetNamespace = "http://docs.oasis-open.org/wsn/b-2", partName = "CreatePullPointRequest") org.oasis_open.docs.wsn.b_2.CreatePullPoint createPullPointRequest)
71              throws UnableToCreatePullPointFault {
72          CreatePullPointResponse res = new CreatePullPointResponse();
73  
74  
75          SingletonBroker.getInstance();
76          W3CEndpointReferenceBuilder b = new W3CEndpointReferenceBuilder();
77          //TODO replace with user principle
78          String AddSubscription = SingletonBroker.CreateMailBox(createPullPointRequest, "anonymous");
79          b.address(AddSubscription);
80          res.setPullPoint(b.build());
81          return res;
82  
83      }
84  }