org.cybergarage.util.Debug.isOn()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(10.6k)|赞(0)|评价(0)|浏览(202)

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

Debug.isOn介绍

暂无

代码示例

代码示例来源:origin: i2p/i2p.i2p

public boolean subscribe(Service service, String uuid, long timeout)
{
  SubscriptionRequest subReq = new SubscriptionRequest();
  subReq.setRenewRequest(service, uuid, timeout);
  if (Debug.isOn() == true)
    subReq.print();    
  SubscriptionResponse subRes = subReq.post();
  if (Debug.isOn() == true)
    subRes.print();    
  if (subRes.isSuccessful() == true) {
    service.setSID(subRes.getSID());
    service.setTimeout(subRes.getTimeout());
    return true;
  }
  service.clearSID();
  return false;
}

代码示例来源:origin: i2p/i2p.i2p

public boolean postQuerylAction()
{
  QueryRequest queryReq = new QueryRequest();
  queryReq.setRequest(this);
  if (Debug.isOn() == true)
    queryReq.print();
  QueryResponse queryRes = queryReq.post();
  if (Debug.isOn() == true)
    queryRes.print();
  setQueryResponse(queryRes);
  // Thanks for Dimas <cyberrate@users.sourceforge.net> and Stefano Lenzi <kismet-sl@users.sourceforge.net> (07/09/04)
  if (queryRes.isSuccessful() == false) {
    setValue(queryRes.getReturnValue());
    return false;
  }
  setValue(queryRes.getReturnValue());
  return true;
}

代码示例来源:origin: i2p/i2p.i2p

private void deviceQueryControlRecieved(QueryRequest ctlReq, Service service) {
  if (Debug.isOn() == true)
    ctlReq.print();
  String varName = ctlReq.getVarName();
  if (service.hasStateVariable(varName) == false) {
    invalidActionControlRecieved(ctlReq);
    return;
  }
  StateVariable stateVar = getStateVariable(varName);
  if (stateVar.performQueryListener(ctlReq) == false)
    invalidActionControlRecieved(ctlReq);
}

代码示例来源:origin: i2p/i2p.i2p

private void deviceEventUnsubscriptionRecieved(Service service,
    SubscriptionRequest subReq) {
  String sid = subReq.getSID();
  Subscriber sub = service.getSubscriber(sid);
  if (sub == null) {
    upnpBadSubscriptionRecieved(subReq, HTTPStatus.PRECONDITION_FAILED);
    return;
  }
  service.removeSubscriber(sub);
  SubscriptionResponse subRes = new SubscriptionResponse();
  subRes.setStatusCode(HTTPStatus.OK);
  subReq.post(subRes);
  if (Debug.isOn() == true)
    subRes.print();
}

代码示例来源:origin: i2p/i2p.i2p

private void deviceEventNewSubscriptionRecieved(Service service,
    SubscriptionRequest subReq) {
  String callback = subReq.getCallback();
  try {
    new URL(callback);
  } catch (Exception e) {
    upnpBadSubscriptionRecieved(subReq, HTTPStatus.PRECONDITION_FAILED);
    return;
  }
  long timeOut = subReq.getTimeout();
  String sid = Subscription.createSID();
  Subscriber sub = new Subscriber();
  sub.setDeliveryURL(callback);
  sub.setTimeOut(timeOut);
  sub.setSID(sid);
  service.addSubscriber(sub);
  SubscriptionResponse subRes = new SubscriptionResponse();
  subRes.setStatusCode(HTTPStatus.OK);
  subRes.setSID(sid);
  subRes.setTimeout(timeOut);
  if (Debug.isOn() == true)
    subRes.print();
  subReq.post(subRes);
  if (Debug.isOn() == true)
    subRes.print();
  service.notifyAllStateVariables();
}

代码示例来源:origin: i2p/i2p.i2p

public boolean postControlAction()
{
  // Thanks for Giordano Sassaroli <sassarol@cefriel.it> (08/30/03)
  ArgumentList actionArgList = getArgumentList();
  ArgumentList actionInputArgList = getInputArgumentList();        
  ActionRequest ctrlReq = new ActionRequest();
  ctrlReq.setRequest(this, actionInputArgList);
  if (Debug.isOn() == true)
    ctrlReq.print();
  ActionResponse ctrlRes = ctrlReq.post();
  if (Debug.isOn() == true)
    ctrlRes.print();
  setControlResponse(ctrlRes);
  // Thanks for Dimas <cyberrate@users.sourceforge.net> and Stefano Lenzi <kismet-sl@users.sourceforge.net> (07/09/04)
  int statCode = ctrlRes.getStatusCode();
  setStatus(statCode);
  if (ctrlRes.isSuccessful() == false)
    return false;
  ArgumentList outArgList = ctrlRes.getResponse();
  try {
    actionArgList.setResArgs(outArgList);
  } catch (IllegalArgumentException ex){
    setStatus(UPnPStatus.INVALID_ARGS,"Action succesfully delivered but invalid arguments returned.");
    return false;
  }
  return true;
}

代码示例来源:origin: org.apache.felix/org.apache.felix.upnp.basedriver

public boolean getCyberDebug(){
  return Debug.isOn();
}
//////////////////////////// end programmatic interface ////////////////////////////

代码示例来源:origin: apache/felix

public boolean getCyberDebug(){
  return Debug.isOn();
}
//////////////////////////// end programmatic interface ////////////////////////////

代码示例来源:origin: i2p/i2p.i2p

private void deviceActionControlRecieved(ActionRequest ctlReq,
    Service service) {
  if (Debug.isOn() == true)
    ctlReq.print();
  String actionName = ctlReq.getActionName();
  Action action = service.getAction(actionName);
  if (action == null) {
    invalidActionControlRecieved(ctlReq);
    return;
  }
  ArgumentList actionArgList = action.getArgumentList();
  ArgumentList reqArgList = ctlReq.getArgumentList();
  try {
    actionArgList.setReqArgs(reqArgList);
  } catch (IllegalArgumentException ex) {
    invalidArgumentsControlRecieved(ctlReq);
    return;
  }
  if (action.performActionListener(ctlReq) == false)
    invalidActionControlRecieved(ctlReq);
}

代码示例来源:origin: i2p/i2p.i2p

public boolean performActionListener(ActionRequest actionReq)
{
  ActionListener listener = (ActionListener)getActionListener();
  if (listener == null)
    return false;
  ActionResponse actionRes = new ActionResponse();
  setStatus(UPnPStatus.INVALID_ACTION);
  clearOutputAgumentValues();
  if (listener.actionControlReceived(this) == true) {
    actionRes.setResponse(this);
  }
  else {
    UPnPStatus upnpStatus = getStatus();
    actionRes.setFaultResponse(upnpStatus.getCode(), upnpStatus.getDescription());
  }
  if (Debug.isOn() == true)
    actionRes.print();
  actionReq.post(actionRes);
  return true;
}

代码示例来源:origin: i2p/i2p.i2p

private void deviceEventRenewSubscriptionRecieved(Service service,
    SubscriptionRequest subReq) {
  String sid = subReq.getSID();
  Subscriber sub = service.getSubscriber(sid);
  if (sub == null) {
    upnpBadSubscriptionRecieved(subReq, HTTPStatus.PRECONDITION_FAILED);
    return;
  }
  long timeOut = subReq.getTimeout();
  sub.setTimeOut(timeOut);
  sub.renew();
  SubscriptionResponse subRes = new SubscriptionResponse();
  subRes.setStatusCode(HTTPStatus.OK);
  subRes.setSID(sid);
  subRes.setTimeout(timeOut);
  subReq.post(subRes);
  if (Debug.isOn() == true)
    subRes.print();
}

代码示例来源:origin: i2p/i2p.i2p

public void httpRequestRecieved(HTTPRequest httpReq)
{
  if (Debug.isOn() == true)
    httpReq.print();
  
  // Thanks for Giordano Sassaroli <sassarol@cefriel.it> (09/08/03)
  if (httpReq.isNotifyRequest() == true) {
    NotifyRequest notifyReq = new NotifyRequest(httpReq);
    String uuid = notifyReq.getSID();
    long seq = notifyReq.getSEQ();
    PropertyList props = notifyReq.getPropertyList();
    int propCnt = props.size();
    for (int n = 0; n < propCnt; n++) {
      Property prop = props.getProperty(n);
      String varName = prop.getName();
      String varValue = prop.getValue();
      performEventListener(uuid, seq, varName, varValue);
    }
    httpReq.returnOK();
    return;
   }
  
  httpReq.returnBadRequest();
}

代码示例来源:origin: i2p/i2p.i2p

public void httpRequestRecieved(HTTPRequest httpReq) {
  if (Debug.isOn() == true)
    httpReq.print();
  if (hasPresentationListener() && isPresentationRequest(httpReq)) {
    PresentationListener listener = getPresentationListener();
    listener.httpRequestRecieved(httpReq);
    return;
  }
  if (httpReq.isGetRequest() == true || httpReq.isHeadRequest() == true) {
    httpGetRequestRecieved(httpReq);
    return;
  }
  if (httpReq.isPostRequest() == true) {
    httpPostRequestRecieved(httpReq);
    return;
  }
  if (httpReq.isSubscribeRequest() == true
      || httpReq.isUnsubscribeRequest() == true) {
    SubscriptionRequest subReq = new SubscriptionRequest(httpReq);
    deviceEventSubscriptionRecieved(subReq);
    return;
  }
  httpReq.returnBadRequest();
}

代码示例来源:origin: i2p/i2p.i2p

public boolean postSearchResponse(SSDPPacket ssdpPacket, String st,
    String usn) {
  String localAddr = ssdpPacket.getLocalAddress();
  Device rootDev = getRootDevice();
  String rootDevLocation = rootDev.getLocationURL(localAddr);
  SSDPSearchResponse ssdpRes = new SSDPSearchResponse();
  ssdpRes.setLeaseTime(getLeaseTime());
  ssdpRes.setDate(cal);
  ssdpRes.setST(st);
  ssdpRes.setUSN(usn);
  ssdpRes.setLocation(rootDevLocation);
  ssdpRes.setBootId(getBootId());
  // Thanks for Brent Hills (10/20/04)
  ssdpRes.setMYNAME(getFriendlyName());
  int mx = ssdpPacket.getMX();
  TimerUtil.waitRandom(mx * 1000);
  String remoteAddr = ssdpPacket.getRemoteAddress();
  int remotePort = ssdpPacket.getRemotePort();
  SSDPSearchResponseSocket ssdpResSock = new SSDPSearchResponseSocket();
  if (Debug.isOn() == true)
    ssdpRes.print();
  int ssdpCount = getSSDPAnnounceCount();
  for (int i = 0; i < ssdpCount; i++)
    ssdpResSock.post(remoteAddr, remotePort, ssdpRes);
  return true;
}

代码示例来源:origin: cybergarage/cybergarage-upnp

public boolean subscribe(Service service, String uuid, long timeout)
{
  SubscriptionRequest subReq = new SubscriptionRequest();
  subReq.setRenewRequest(service, uuid, timeout);
  if (Debug.isOn() == true)
    subReq.print();    
  SubscriptionResponse subRes = subReq.post();
  if (Debug.isOn() == true)
    subRes.print();    
  if (subRes.isSuccessful() == true) {
    service.setSID(subRes.getSID());
    service.setTimeout(subRes.getTimeout());
    return true;
  }
  service.clearSID();
  return false;
}

代码示例来源:origin: geniusgithub/MediaPlayer

private void deviceQueryControlRecieved(QueryRequest ctlReq, Service service) {
  if (Debug.isOn() == true)
    ctlReq.print();
  String varName = ctlReq.getVarName();
  if (service.hasStateVariable(varName) == false) {
    invalidActionControlRecieved(ctlReq);
    return;
  }
  StateVariable stateVar = getStateVariable(varName);
  if (stateVar.performQueryListener(ctlReq) == false)
    invalidActionControlRecieved(ctlReq);
}

代码示例来源:origin: cybergarage/cybergarage-upnp

private void deviceQueryControlRecieved(QueryRequest ctlReq, Service service) {
  if (Debug.isOn() == true)
    ctlReq.print();
  String varName = ctlReq.getVarName();
  if (service.hasStateVariable(varName) == false) {
    invalidActionControlRecieved(ctlReq);
    return;
  }
  StateVariable stateVar = getStateVariable(varName);
  if (stateVar.performQueryListener(ctlReq) == false)
    invalidActionControlRecieved(ctlReq);
}

代码示例来源:origin: geniusgithub/MediaPlayer

private void deviceEventUnsubscriptionRecieved(Service service,
    SubscriptionRequest subReq) {
  String sid = subReq.getSID();
  Subscriber sub = service.getSubscriber(sid);
  if (sub == null) {
    upnpBadSubscriptionRecieved(subReq, HTTPStatus.PRECONDITION_FAILED);
    return;
  }
  service.removeSubscriber(sub);
  SubscriptionResponse subRes = new SubscriptionResponse();
  subRes.setStatusCode(HTTPStatus.OK);
  subReq.post(subRes);
  if (Debug.isOn() == true)
    subRes.print();
}

代码示例来源:origin: cybergarage/cybergarage-upnp

private void deviceEventUnsubscriptionRecieved(Service service,
    SubscriptionRequest subReq) {
  String sid = subReq.getSID();
  Subscriber sub = service.getSubscriber(sid);
  if (sub == null) {
    upnpBadSubscriptionRecieved(subReq, HTTPStatus.PRECONDITION_FAILED);
    return;
  }
  service.removeSubscriber(sub);
  SubscriptionResponse subRes = new SubscriptionResponse();
  subRes.setStatusCode(HTTPStatus.OK);
  subReq.post(subRes);
  if (Debug.isOn() == true)
    subRes.print();
}

代码示例来源:origin: cybergarage/cybergarage-upnp

private boolean browseMetadataActionReceived(BrowseAction action)
{
  String objID = action.getObjectID();
  ContentNode node = findContentNodeByID(objID);
  if (node == null)
    return false;
  DIDLLite didlLite = new DIDLLite();
  didlLite.setContentNode(node);
  String result = didlLite.toString();
  
  action.setArgumentValue(BrowseAction.RESULT, result);
  action.setArgumentValue(BrowseAction.NUMBER_RETURNED, 1);
  action.setArgumentValue(BrowseAction.TOTAL_MACHES, 1);
  action.setArgumentValue(BrowseAction.UPDATE_ID, getSystemUpdateID());
  
  if (Debug.isOn())
    action.print();
  
  return true;
}

相关文章