org.openmobster.core.common.XMLUtilities类的使用及代码示例

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

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

XMLUtilities介绍

暂无

代码示例

代码示例来源:origin: org.openmobster.core/moblet-management

private List<MobletApp> parseMobletApps(String deploymentUrl,InputStream is) throws Exception
{
  List<MobletApp> apps = new ArrayList<MobletApp>();
  
  Document root = XMLUtilities.parse(is);
  
  NodeList mobletAppNodes = root.getElementsByTagName("moblet-app");
  if(mobletAppNodes != null && mobletAppNodes.getLength()>0)
  {
    int size = mobletAppNodes.getLength();
    for(int i=0; i<size; i++)
    {
      Element mobletAppElem = (Element)mobletAppNodes.item(i);
      MobletApp app = this.parseMobletApp(mobletAppElem);
      app.setDeploymentUrl(deploymentUrl);
      apps.add(app);
    }
  }
  
  return apps;
}

代码示例来源:origin: org.openmobster.core/synchronizer

/**
 * 
 * @param data
 * @return
 */
protected long getDataSize(String data)
{
  long dataSize = 0;
      
  dataSize = XMLUtilities.cleanupXML(data).length();
          
  return dataSize;
}

代码示例来源:origin: org.openmobster.core/dataService

private String prepareServiceResponse(Response beanResponse)
  {
    Map<String, String> responseAttributes = new HashMap<String, String>();
    
    if(beanResponse != null)
    {
      String[] cour = beanResponse.getNames();
      if(cour != null)
      {
        for(String name: cour)
        {
          responseAttributes.put(name, beanResponse.getAttribute(name));
        }
      }
    }
    
    return XMLUtilities.marshal(responseAttributes);
  }
}

代码示例来源:origin: org.openmobster.core/synchronizer

public String parseId(String xml) throws SyncException
{
  String recordId = null;
  Document document = XMLUtilities.parse(xml);
  Element id = (Element) document.getElementsByTagName("recordId").item(0);
  recordId = XMLUtilities.restoreXML(id.getTextContent());
  
  //Perform any local id to server side id mappings if applies
  recordId = mapEngine.mapFromLocalToServer(recordId);
  
  return recordId;
}

代码示例来源:origin: org.openmobster.core/device-agent-simulator

buffer.append("<"+SyncXMLTags.LocURI+">"+XMLUtilities.cleanupXML(item.getSource()));
buffer.append("</"+SyncXMLTags.LocURI+">\n");
buffer.append("</"+SyncXMLTags.Source+">\n");
buffer.append("<"+SyncXMLTags.LocURI+">"+XMLUtilities.cleanupXML(item.getTarget()));
buffer.append("</"+SyncXMLTags.LocURI+">\n");
buffer.append("</"+SyncXMLTags.Target+">\n");
XMLUtilities.addCData(item.getData())+
"</"+SyncXMLTags.Data+">\n");
buffer.append("<"+SyncXMLTags.Meta+">"+XMLUtilities.cleanupXML(item.getMeta())+"</"+SyncXMLTags.Meta+">\n");

代码示例来源:origin: org.openmobster.core/dataService

private Request parseServiceRequest(String payload)
{
  Request beanRequest = null;
  
  Map<String, String> requestAttributes = (Map<String, String>)XMLUtilities.unmarshal(payload);
  String serviceName = requestAttributes.get("servicename");
  if(serviceName == null || serviceName.trim().length() == 0)
  {
    throw new RuntimeException("InvocationException: MobileBeanService not provided!!!");
  }
  requestAttributes.remove("servicename");
  
  beanRequest = new Request(serviceName);			
  Set<String> names = requestAttributes.keySet();
  for(String name: names)
  {
    beanRequest.setAttribute(name, requestAttributes.get(name));
  }
  
  return beanRequest;
}

代码示例来源:origin: org.openmobster.core/location

buffer.append("<response-payload>"+XMLUtilities.addCData(responsePayload)+"</response-payload>\n");
buffer.append("<location-payload>"+XMLUtilities.addCData(locationPayload)+"</location-payload>\n");
buffer.append("</location-response>\n");

代码示例来源:origin: org.openmobster.core/synchronizer

/**
 * 
 * @param message
 * @param syncHeader
 * @throws Exception
 */
private void processMessage(SyncMessage message,Element syncHeader) throws Exception
{
  Element msgId = (Element)syncHeader.getElementsByTagName(SyncXMLTags.MsgID).item(0);
  message.setMessageId(msgId.getFirstChild().getNodeValue());
      
  if(XMLUtilities.contains(syncHeader, SyncXMLTags.MaxMsgSize))
  {
    Element maxMsgSize = (Element)syncHeader.getElementsByTagName(SyncXMLTags.MaxMsgSize).item(0);
    message.setMaxClientSize(Integer.parseInt(maxMsgSize.getFirstChild().getNodeValue()));
  }
  
  if(XMLUtilities.contains(syncHeader, SyncXMLTags.Cred))
  {
    Element credElem = (Element)syncHeader.getElementsByTagName(SyncXMLTags.Cred).item(0);
    Element typeElem = (Element)credElem.getElementsByTagName(SyncXMLTags.Type).item(0);
    Element dataElem = (Element)credElem.getElementsByTagName(SyncXMLTags.Data).item(0);
    
    String type = typeElem.getTextContent();
    String data = dataElem.getTextContent();
    message.setCredential(new Credential(type, data));
  }
}

代码示例来源:origin: org.openmobster.core/synchronizer

buffer.append("<"+SyncXMLTags.LocURI+">"+XMLUtilities.cleanupXML(item.getSource()));
buffer.append("</"+SyncXMLTags.LocURI+">\n");
buffer.append("</"+SyncXMLTags.Source+">\n");
buffer.append("<"+SyncXMLTags.LocURI+">"+XMLUtilities.cleanupXML(item.getTarget()));
buffer.append("</"+SyncXMLTags.LocURI+">\n");
buffer.append("</"+SyncXMLTags.Target+">\n");
XMLUtilities.addCData(item.getData())+
"</"+SyncXMLTags.Data+">\n");
buffer.append("<"+SyncXMLTags.Meta+">"+XMLUtilities.cleanupXML(item.getMeta())+"</"+SyncXMLTags.Meta+">\n");

代码示例来源:origin: org.openmobster.core/services

public void messageIncoming(BusMessage busMessage) 
  Object event = XMLUtilities.unmarshal(eventState);

代码示例来源:origin: org.openmobster.core/synchronizer

if(XMLUtilities.contains(itemElement, SyncXMLTags.Source))
if(XMLUtilities.contains(itemElement, SyncXMLTags.Target))
if(XMLUtilities.contains(itemElement, SyncXMLTags.Data))
if(XMLUtilities.contains(itemElement, SyncXMLTags.Meta))
item.setMoreData(XMLUtilities.contains(itemElement, SyncXMLTags.MoreData));

代码示例来源:origin: org.openmobster.core/synchronizer

/**
 * 
 * @param xml
 * @return
 */
public Anchor parseAnchor(String xml)
{
  Anchor anchor = new Anchor();
  
  Document document = XMLUtilities.parse(xml);
  
  Element lastSync = (Element)document.getElementsByTagName(SyncXMLTags.Last).item(0);
  Element nextSync = (Element)document.getElementsByTagName(SyncXMLTags.Next).item(0);
  
  anchor.setLastSync(lastSync.getFirstChild().getNodeValue());
  anchor.setNextSync(nextSync.getFirstChild().getNodeValue());
  
  return anchor;
}
//-------------------------------------------------------------------------------------------------

代码示例来源:origin: org.openmobster.core/device-agent-simulator

private String marshalId(String id)
{
  String xml = null;
  
  StringBuffer buffer = new StringBuffer();	
  
  buffer.append("<mobileObject>\n");		
  buffer.append("<recordId>"+XMLUtilities.cleanupXML(id)+"</recordId>\n");		
  buffer.append("</mobileObject>\n");
  
  xml = buffer.toString();
  
  return xml;
}

代码示例来源:origin: org.openmobster.core/push-apn

encode(notification.getMetaDataAsString(Constants.message),"UTF-8"));
Map<String,String> extras = (Map<String,String>)notification.getMetaData(Constants.extras);
String extrasStr = XMLUtilities.marshal(extras);
commandBuilder.append(Constants.separator+Constants.extras+"="+URLEncoder.encode(extrasStr,"UTF-8"));

代码示例来源:origin: org.openmobster.core/common

BusMessage busMessage = (BusMessage)XMLUtilities.unmarshal(msg.toString());
busMessage.setAttribute("hornetq-message", message);

代码示例来源:origin: org.openmobster.core/synchronizer

cour.setCmdId(cmdId.getFirstChild().getNodeValue());
if(XMLUtilities.contains(replaceElement, SyncXMLTags.Meta))

代码示例来源:origin: org.openmobster.core/dataService

Document document = XMLUtilities.parse(payload);

代码示例来源:origin: org.openmobster.core/synchronizer

public String marshalId(String recordId) throws SyncException
{
  StringBuffer buffer = new StringBuffer();
  recordId = mapEngine.mapFromServerToLocal(recordId);
  String id = XMLUtilities.cleanupXML(recordId);
  
  buffer.append("<mobileObject>\n");
  buffer.append("<recordId>"+id+"</recordId>\n");
  buffer.append("</mobileObject>\n");
  
  return buffer.toString();
}    
//------------------------------------------------------------------------------------------------

代码示例来源:origin: org.openmobster.core/services

private void sendChannelEvent(List<ChannelBeanMetaData> allUpdates)
  {
    String channel = this.channelRegistration.getUri();
    
    BusMessage message = new BusMessage();
    message.setBusUri(channel);
    message.setSenderUri(channel);
                                            
    ChannelEvent event = new ChannelEvent();
    event.setChannel(channel);                    
    event.setAttribute(ChannelEvent.metadata, allUpdates);
    message.setAttribute(ChannelEvent.event, XMLUtilities.marshal(event));
                
    Bus.sendMessage(message);
  }
}

代码示例来源:origin: org.openmobster.core/synchronizer

cour.setCmdId(cmdId.getFirstChild().getNodeValue());
if(XMLUtilities.contains(addElement, SyncXMLTags.Meta))

相关文章