com.ebmwebsourcing.wsstar.common.utils.WsstarCommonUtils类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(15.2k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中com.ebmwebsourcing.wsstar.common.utils.WsstarCommonUtils类的一些代码示例,展示了WsstarCommonUtils类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WsstarCommonUtils类的具体详情如下:
包路径:com.ebmwebsourcing.wsstar.common.utils.WsstarCommonUtils
类名称:WsstarCommonUtils

WsstarCommonUtils介绍

暂无

代码示例

代码示例来源:origin: com.ebmwebsourcing.wsstar/wsn-b-datatypes-jaxbimpl

@Override
public final Document writeGetCurrentMessageResponseAsDOM(
    GetCurrentMessageResponse value) throws WsnbException {
  Document result = null;    
  try {
    Marshaller marshaller = this.wsnbJaxbContext.createWSNotificationMarshaller();
        
    
    result = WsstarCommonUtils.getNamespaceDocumentBuilder().newDocument(); 
    
    // TODO : Check if it is a Thread safe method
    final JAXBElement<com.ebmwebsourcing.wsstar.jaxb.notification.base.GetCurrentMessageResponse> element = 
      new JAXBElement<com.ebmwebsourcing.wsstar.jaxb.notification.base.GetCurrentMessageResponse>(WsnbConstants.GET_CURRENT_MESSAGE_RESPONSE_QNAME,
          com.ebmwebsourcing.wsstar.jaxb.notification.base.GetCurrentMessageResponse.class,((GetCurrentMessageResponseImpl)value).getJaxbTypeObj());

    marshaller.marshal(element, result);            
      } catch (final JAXBException ex) {
    throw new WsnbException(WsrfbfUtils.getBindingExMessage(value), ex);
  }
  
  return result;
}

代码示例来源:origin: com.ebmwebsourcing.wsstar/wsn-b-datatypes-jaxbimpl

@Override
public final SubscriptionManagerRP readSubscriptionManagerRP(File file)
    throws WsnbException {
  SubscriptionManagerRP subscriptionObj=null;
  try {
    Document subscriptionAsDoc = WsstarCommonUtils.convertFromFiletoDocument(file);
    subscriptionObj = this.readSubscriptionManagerRP(subscriptionAsDoc);
  } catch (WsstarCommonException e) {
    throw new WsnbException(e);
  }
  return subscriptionObj;
}

代码示例来源:origin: com.ebmwebsourcing.wsstar/wsstar-libraries-common-utils

/**
 * parse the xml Document and return it pretty-printed (with correct
 * indentations, etc..).
 * Use the encoding defined at the parsing or in the document 
 * (utf8 is used if no encoding is defined)
 * @param xmlDocument
 *            the xml document to pretty print. Must be non null
 * @returnpretty printed string if no error occurs. If an error occurs,
 *               return an empty String
 */
public static String prettyPrint(final Document xmlDocument) {
  
  return prettyPrint(xmlDocument,getEncoding(xmlDocument));
}

代码示例来源:origin: com.ebmwebsourcing.wsstar/wsn-b-datatypes-jaxbimpl

Transformer xformer = WsstarCommonUtils.getDefaultTransformerFactoryThreadLocal();
xformer.transform(source, result);

代码示例来源:origin: com.ebmwebsourcing.wsstar/wsstar-libraries-common-utils

/**
 * Prettify the node into the output stream.
 *
 * @param node
 * @param out
 * @throws TransformerException 
 * @throws Exception
 */
public static void prettify(Node node, OutputStream out,String encoding) throws TransformerException {
  Source source = new DOMSource(node);
  Source stylesheetSource = getStyleSheetSource();
  TransformerFactory tf = TRANSFORMER_FACTORY_THREAD_LOCAL.get();
  Templates templates = tf.newTemplates(stylesheetSource);
  Transformer transformer = templates.newTransformer();
  transformer.setOutputProperty(OutputKeys.ENCODING,encoding);
  transformer.transform(source, new StreamResult(out));
}

代码示例来源:origin: com.ebmwebsourcing.wsstar/wsstar-libraries-common-utils

/**
 * parse the xml String and return it pretty-printed (with correct
 * indentations, etc..)
 * 
 * @param xmlDocument
 *            the xml document to pretty print. Must be non null
 * @param encoding
 *            the encoding to use
 *   
 * @returnpretty printed string if no error occurs. If an error occurs,
 *               return an empty String
 */
public static String prettyPrint(final Document xmlDocument,String encoding) {
  String result = "";
  try {
    ByteArrayOutputStream outStream = new ByteArrayOutputStream();
    WsstarCommonUtils.prettify(xmlDocument, outStream,encoding);
    result = outStream.toString(encoding);
  } catch (final Exception e) {
    WsstarCommonUtils.logger.log(Level.SEVERE, "write_dom failed:" + e);
    //System.err.println("write_dom failed:" + e);
    // if an error occurs, the result will be the original string
  }
  return result;
}

代码示例来源:origin: com.ebmwebsourcing.wsstar/wsa-datatypes-jaxbimpl

xformer = WsstarCommonUtils.getDefaultTransformerFactoryThreadLocal();
xformer.transform(source, result);

代码示例来源:origin: com.ebmwebsourcing.wsstar/wsn-b-datatypes-jaxbimpl

@Override
public final Document writeSubscribeResponseAsDOM(SubscribeResponse value)
    throws WsnbException {
  Document result = null;    
  try {
    Marshaller marshaller = this.wsnbJaxbContext.createWSNotificationMarshaller();
        
    result = WsstarCommonUtils.getNamespaceDocumentBuilder().newDocument(); 
    
    // TODO : Check if it is a Thread safe method
    final JAXBElement<com.ebmwebsourcing.wsstar.jaxb.notification.base.SubscribeResponse> element =
     new JAXBElement<com.ebmwebsourcing.wsstar.jaxb.notification.base.SubscribeResponse>(WsnbConstants.SUBSCRIBE_RESPONSE_QNAME,
          com.ebmwebsourcing.wsstar.jaxb.notification.base.SubscribeResponse.class, SubscribeResponseImpl.toJaxbModel(value));     
    marshaller.marshal(element, result);                        
      } catch (final JAXBException ex) {
    throw new WsnbException(WsrfbfUtils.getBindingExMessage(value), ex);
  }                    
  return result;
}

代码示例来源:origin: com.ebmwebsourcing.wsstar/wsa-datatypes-jaxbimpl

/**
 * Read a EndpointReferanceType XML definition from a {@link File} object
 * into a WS-Addressing JAXB model {@link EndpointReferenceType} instance. (used by persistence feature)
 * 
 * @param file 
 *         the {@link File} object which the 
 *         {@link EndpointReferenceType} object must be read from 
 * @return a {@link EndpointReferenceType} Java object instance
 * 
 * @throws WsaException
 */
@Override
public final EndpointReferenceType readEndpointReferenceType(File file) throws WsaException{
  EndpointReferenceType edpRefObj=null;
  try {
    Document endpointRefAsDoc = WsstarCommonUtils.convertFromFiletoDocument(file);
    edpRefObj = this.readEndpointReferenceType(endpointRefAsDoc);
  } catch (WsstarCommonException e) {
    throw new WsaException(e);
  }
  return edpRefObj;
}

代码示例来源:origin: com.ebmwebsourcing.wsstar/wstop-datatypes-jaxbimpl

@Override
public final Document writeTopicTypeAsDOM(TopicType value) throws WstopException {
  Document result = null;
  if (value instanceof TopicTypeImpl){
    try {
      Marshaller marshaller = this.topicsJaxbContext.createWSTopicsMarshaller();
      result = WsstarCommonUtils.getNamespaceDocumentBuilder().newDocument();
      // TODO : Check if it is a Thread safe method
      final JAXBElement<com.ebmwebsourcing.wsstar.jaxb.notification.topics.TopicType> element =
        new JAXBElement<com.ebmwebsourcing.wsstar.jaxb.notification.topics.TopicType>(WstopConstants.TOPIC_QNAME,
            com.ebmwebsourcing.wsstar.jaxb.notification.topics.TopicType.class,((TopicTypeImpl)value).getJaxbTypeObj());
        
      marshaller.marshal(element, result);            
    } catch (final JAXBException ex) {
      throw new WstopException(WstopUtils.getBindingExMessage(value), ex);
    } 
  }
  return result;			
}

代码示例来源:origin: com.ebmwebsourcing.wsstar/wstop-datatypes-jaxbimpl

@Override
public final Document writeMessagePatternAsDOM(QueryExpressionType value) throws WstopException {
  
  Document result = null;
  if (value instanceof QueryExpressionTypeImpl){
    try {
      Marshaller marshaller = this.topicsJaxbContext.createWSTopicsMarshaller();
      result = WsstarCommonUtils.getNamespaceDocumentBuilder().newDocument();
      // TODO : Check if it is a Thread safe method
      final JAXBElement<com.ebmwebsourcing.wsstar.jaxb.notification.topics.QueryExpressionType> element =
        new JAXBElement<com.ebmwebsourcing.wsstar.jaxb.notification.topics.QueryExpressionType>(WstopConstants.MESSAGE_PATTERN_QNAME,
            com.ebmwebsourcing.wsstar.jaxb.notification.topics.QueryExpressionType.class,((QueryExpressionTypeImpl)value).getJaxbTypeObj());
        
      marshaller.marshal(element, result);            
    } catch (final JAXBException ex) {
      throw new WstopException(WstopUtils.getBindingExMessage(value), ex);
    } 
  }
  return result;			
}

代码示例来源:origin: com.ebmwebsourcing.wsstar/wsn-b-datatypes-jaxbimpl

@Override
public final Document writeUseRawAsDOM(UseRaw value) throws WsnbException {
  Document result = null;
  if (value instanceof UseRawImpl){
    try {
      Marshaller marshaller = this.wsnbJaxbContext.createWSNotificationMarshaller();
      result = WsstarCommonUtils.getNamespaceDocumentBuilder().newDocument();
      // TODO : Check if it is a Thread safe method
      final JAXBElement<com.ebmwebsourcing.wsstar.jaxb.notification.base.UseRaw> element = 
        new JAXBElement<com.ebmwebsourcing.wsstar.jaxb.notification.base.UseRaw>(WsnbConstants.USERAW_QNAME,
            com.ebmwebsourcing.wsstar.jaxb.notification.base.UseRaw.class,((UseRawImpl)value).getJaxbTypeObj());
      marshaller.marshal(element, result);            
    } catch (final JAXBException ex) {
      throw new WsnbException(WsrfbfUtils.getBindingExMessage(value), ex);
    } 
  }
  return result;	
}

代码示例来源:origin: com.ebmwebsourcing.wsstar/wsn-b-datatypes-jaxbimpl

@Override
public final Document writeRenewAsDOM(Renew value) throws WsnbException {
  Document result = null;
  if (value instanceof RenewImpl){
    try {
      Marshaller marshaller = this.wsnbJaxbContext.createWSNotificationMarshaller();
      result = WsstarCommonUtils.getNamespaceDocumentBuilder().newDocument();
      // TODO : Check if it is a Thread safe method
      final JAXBElement<com.ebmwebsourcing.wsstar.jaxb.notification.base.Renew> element = 
        new JAXBElement<com.ebmwebsourcing.wsstar.jaxb.notification.base.Renew>(WsnbConstants.RENEW_QNAME,
            com.ebmwebsourcing.wsstar.jaxb.notification.base.Renew.class,((RenewImpl)value).getJaxbTypeObj());
      marshaller.marshal(element, result);            
    } catch (final JAXBException ex) {
      throw new WsnbException(WsrfbfUtils.getBindingExMessage(value), ex);
    } 
  }
  return result;	
  
}

代码示例来源:origin: com.ebmwebsourcing.wsstar/wsrf-rl-datatypes-jaxbimpl

@Override
public final Document writeDestroyAsDOM(Destroy value) throws WsrfrlException {
  Document result = null;
  if (value instanceof DestroyImpl){
    try {
      Marshaller marshaller = this.resourceLifetimeJaxbContext.createWSResourceLifetimeMarshaller();
      result = WsstarCommonUtils.getNamespaceDocumentBuilder().newDocument();
      // TODO : Check if it is a Thread safe method
      final JAXBElement<com.ebmwebsourcing.wsstar.jaxb.resource.resourcelifetime.Destroy> element = 
        new JAXBElement<com.ebmwebsourcing.wsstar.jaxb.resource.resourcelifetime.Destroy>(WsrfrlConstants.DESTROY_QNAME,
            com.ebmwebsourcing.wsstar.jaxb.resource.resourcelifetime.Destroy.class,
            ((DestroyImpl)value).getJaxbTypeObj());
      marshaller.marshal(element, result);            
    } catch (final JAXBException ex) {
      throw new WsrfrlException(WsrfbfUtils.getBindingExMessage(value), ex);
    } 
  }
  return result;	
}

代码示例来源:origin: com.ebmwebsourcing.wsstar/wsn-b-datatypes-jaxbimpl

@Override
public final Document writeUnsubscribeAsDOM(Unsubscribe value)
    throws WsnbException {
  Document result = null;
  if (value instanceof UnsubscribeImpl){
    try {
      Marshaller marshaller = this.wsnbJaxbContext.createWSNotificationMarshaller();
      result = WsstarCommonUtils.getNamespaceDocumentBuilder().newDocument();
      // TODO : Check if it is a Thread safe method
      final JAXBElement<com.ebmwebsourcing.wsstar.jaxb.notification.base.Unsubscribe> element = 
        new JAXBElement<com.ebmwebsourcing.wsstar.jaxb.notification.base.Unsubscribe>(WsnbConstants.UNSUBSCRIBE_QNAME,
            com.ebmwebsourcing.wsstar.jaxb.notification.base.Unsubscribe.class,((UnsubscribeImpl)value).getJaxbTypeObj());
      marshaller.marshal(element, result);            
    } catch (final JAXBException ex) {
      throw new WsnbException(WsrfbfUtils.getBindingExMessage(value), ex);
    } 
  }
  return result;	
}

代码示例来源:origin: com.ebmwebsourcing.wsstar/wsn-b-datatypes-jaxbimpl

@Override
public final Document writeUnsubscribeResponseAsDOM(UnsubscribeResponse value)
    throws WsnbException {
  Document result = null;
  if (value instanceof UnsubscribeResponseImpl){
    try {
      Marshaller marshaller = this.wsnbJaxbContext.createWSNotificationMarshaller();
      result = WsstarCommonUtils.getNamespaceDocumentBuilder().newDocument();
      // TODO : Check if it is a Thread safe method
      final JAXBElement<com.ebmwebsourcing.wsstar.jaxb.notification.base.UnsubscribeResponse> element = 
        new JAXBElement<com.ebmwebsourcing.wsstar.jaxb.notification.base.UnsubscribeResponse>(WsnbConstants.UNSUBSCRIBE_RESPONSE_QNAME,
            com.ebmwebsourcing.wsstar.jaxb.notification.base.UnsubscribeResponse.class,((UnsubscribeResponseImpl)value).getJaxbTypeObj());
      marshaller.marshal(element, result);            
    } catch (final JAXBException ex) {
      throw new WsnbException(WsrfbfUtils.getBindingExMessage(value), ex);
    } 
  }
  return result;	
}

代码示例来源:origin: com.ebmwebsourcing.wsstar/wsn-b-datatypes-jaxbimpl

@Override
public final Document writeRenewResponseAsDOM(RenewResponse value)
    throws WsnbException {
  Document result = null;
  if (value instanceof RenewResponseImpl){
    try {
      Marshaller marshaller = this.wsnbJaxbContext.createWSNotificationMarshaller();
      result = WsstarCommonUtils.getNamespaceDocumentBuilder().newDocument();
      // TODO : Check if it is a Thread safe method
      final JAXBElement<com.ebmwebsourcing.wsstar.jaxb.notification.base.RenewResponse> element = 
        new JAXBElement<com.ebmwebsourcing.wsstar.jaxb.notification.base.RenewResponse>(WsnbConstants.RENEW_RESPONSE_QNAME,
            com.ebmwebsourcing.wsstar.jaxb.notification.base.RenewResponse.class,((RenewResponseImpl)value).getJaxbTypeObj());
      marshaller.marshal(element, result);            
    } catch (final JAXBException ex) {
      throw new WsnbException(WsrfbfUtils.getBindingExMessage(value), ex);
    } 
  }
  return result;	
}

代码示例来源:origin: com.ebmwebsourcing.wsstar/wsrf-rl-datatypes-jaxbimpl

@Override
public final Document writeScheduledResourceTerminationRPAsDOM(
    ScheduledResourceTerminationRP value) throws WsrfrlException {
  Document result = null;
  if (value instanceof ScheduledResourceTerminationRPImpl){
    try {
      Marshaller marshaller = this.resourceLifetimeJaxbContext.createWSResourceLifetimeMarshaller();
      result = WsstarCommonUtils.getNamespaceDocumentBuilder().newDocument();
      // TODO : Check if it is a Thread safe method
      final JAXBElement<com.ebmwebsourcing.wsstar.jaxb.resource.resourcelifetime.ScheduledResourceTerminationRP> element = 
        new JAXBElement<com.ebmwebsourcing.wsstar.jaxb.resource.resourcelifetime.ScheduledResourceTerminationRP>(WsrfrlConstants.SCHEDULED_RESOURCE_TERMINATION_RP_QNAME,
            com.ebmwebsourcing.wsstar.jaxb.resource.resourcelifetime.ScheduledResourceTerminationRP.class,
            ((ScheduledResourceTerminationRPImpl)value).getJaxbTypeObj());
      marshaller.marshal(element, result);            
    } catch (final JAXBException ex) {
      throw new WsrfrlException(WsrfbfUtils.getBindingExMessage(value), ex);
    } 
  }
  return result;	
}

代码示例来源:origin: com.ebmwebsourcing.wsstar/wsrf-rl-datatypes-jaxbimpl

@Override
public final Document writeCurrentTimeAsDOM(CurrentTime value)
    throws WsrfrlException {
  Document result = null;
  if (value instanceof CurrentTimeImpl){
    try {
      Marshaller marshaller = this.resourceLifetimeJaxbContext.createWSResourceLifetimeMarshaller();
      result = WsstarCommonUtils.getNamespaceDocumentBuilder().newDocument();
      // TODO : Check if it is a Thread safe method
      final JAXBElement<com.ebmwebsourcing.wsstar.jaxb.resource.resourcelifetime.CurrentTime> element = 
        new JAXBElement<com.ebmwebsourcing.wsstar.jaxb.resource.resourcelifetime.CurrentTime>(WsrfrlConstants.CURRENT_TIME_QNAME,
            com.ebmwebsourcing.wsstar.jaxb.resource.resourcelifetime.CurrentTime.class,
            ((CurrentTimeImpl)value).getJaxbTypeObj());
      marshaller.marshal(element, result);            
    } catch (final JAXBException ex) {
      throw new WsrfrlException(WsrfbfUtils.getBindingExMessage(value), ex);
    } 
  }
  return result;	
}

代码示例来源:origin: com.ebmwebsourcing.wsstar/wsrf-rl-datatypes-jaxbimpl

@Override
public final Document writeDestroyResponseAsDOM(DestroyResponse value)
    throws WsrfrlException {
  Document result = null;
  if (value instanceof DestroyResponseImpl){
    try {
      Marshaller marshaller = this.resourceLifetimeJaxbContext.createWSResourceLifetimeMarshaller();
      result = WsstarCommonUtils.getNamespaceDocumentBuilder().newDocument();
      // TODO : Check if it is a Thread safe method
      final JAXBElement<com.ebmwebsourcing.wsstar.jaxb.resource.resourcelifetime.DestroyResponse> element = 
        new JAXBElement<com.ebmwebsourcing.wsstar.jaxb.resource.resourcelifetime.DestroyResponse>(WsrfrlConstants.DESTROY_RESPONSE_QNAME,
            com.ebmwebsourcing.wsstar.jaxb.resource.resourcelifetime.DestroyResponse.class,
            ((DestroyResponseImpl)value).getJaxbTypeObj());
      marshaller.marshal(element, result);            
    } catch (final JAXBException ex) {
      throw new WsrfrlException(WsrfbfUtils.getBindingExMessage(value), ex);
    } 
  }
  return result;	
}

相关文章