public static WSNUtil getInstance() { if(INSTANCE == null) { INSTANCE = new WSNUtil(); } return INSTANCE; }
public static WsrfbfFactory getInstance() throws WsrfbfException { RefinedWsrfbfFactory singleton = WsrfbfFactoryHolder.INSTANCE; if (singleton.model == null){ throw new WsrfbfException("\n\t/!\\ WARNING /!\\\n" + "The WsrfbfModelFactory have not been initialized !!!\n" + "Please create a \"WsrfbfModelFactory\" instance and \n" + "call the \"getInstance(WsrfbfModelFactory)\" method instead." + "\n\t/!\\ WARNING /!\\\n"); } return singleton; }
public AbsWSStarFault() throws WsrfbfException { super(); try { this.wsnFault = RefinedWsrfbfFactory.getInstance().createBaseFaultType(new Date()); }catch (WsrfbfException e) { throw new WsrfbfException(e); } }
@Override public final BaseFaultType readBaseFaultType(Document document) throws WsrfbfException { BaseFaultType result = null; try { Unmarshaller unmarshaller = this.resourceJaxbContext.createWSBaseFaultsUnmarshaller(); // TODO : Check if it is a Thread safe method JAXBElement<com.ebmwebsourcing.wsstar.jaxb.resource.basefaults.BaseFaultType> schemaBinding = unmarshaller.unmarshal(new DOMSource(document),com.ebmwebsourcing.wsstar.jaxb.resource.basefaults.BaseFaultType.class); if (schemaBinding.getValue() != null){ result = new BaseFaultTypeImpl(schemaBinding.getValue(),null); } } catch (JAXBException e) { throw new WsrfbfException(e); } return result; }
public AbsWSStarFault(Document faultAsDocument) throws WsrfbfException { super(); try { this.wsnFault = RefinedWsrfbfFactory.getInstance().getWsrfbfReader().readBaseFaultType(faultAsDocument); this.init(); } catch (WsrfbfException e) { throw new WsrfbfException(e); } }
@Override public final Document writeBaseFaultTypeAsDOM(BaseFaultType fault) throws WsrfbfException { Document result = null; if (fault instanceof BaseFaultTypeImpl){ try { Marshaller marshaller = this.resourceJaxbContext.createWSBaseFaultsMarshaller(); // result = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); result = WsstarCommonUtils.getNamespaceDocumentBuilder().newDocument(); // TODO : Check if it is a Thread safe method final JAXBElement<com.ebmwebsourcing.wsstar.jaxb.resource.basefaults.BaseFaultType> element = WsrfbfJAXBContext.WSRFBF_JAXB_FACTORY.createBaseFault(BaseFaultTypeImpl.toJaxbModel(fault, null)); // new JAXBElement<com.ebmwebsourcing.wsstar.jaxb.resource.basefaults.BaseFaultType>(WsrfbfConstants.BASE_FAULT_QNAME, // com.ebmwebsourcing.wsstar.jaxb.resource.basefaults.BaseFaultType.class, // ((BaseFaultTypeImpl)fault).getJaxbTypeObj()); marshaller.marshal(element, result); } catch (final JAXBException ex) { throw new WsrfbfException(WsrfbfUtils.getBindingExMessage(fault), ex); // } catch (final ParserConfigurationException ex) { // throw new WsrfException( // "Failed to build XML binding from "+ fault.getClass().getSimpleName() + " Api Java classes", ex); } } return result; }
protected final void init(Locale lang, String descContent) throws WsrfbfException { Description description; try { description = RefinedWsrfbfFactory.getInstance().createBaseFaultTypeDescription(null); } catch (WsrfbfException e) { throw new WsrfbfException(e); } description.setLang(lang); description.setValue(descContent); if (this.wsnFault.getTimestamp() == null) { this.init(); } }