Examples of UPnPAction


Examples of org.osgi.service.upnp.UPnPAction

  private volatile LocationService m_ls;
  private volatile Map<String, UPnPAction> m_actions;

  public UPnPLocationServiceWrapper() {
    m_actions = new HashMap<String, UPnPAction>();
    UPnPAction location = new GetLocationAction(this);
    m_actions.put(location.getName(), location);
    UPnPAction type = new GetServerTypeAction(this);
    m_actions.put(type.getName(), type);
    UPnPAction load = new GetServerLoadAction(this);
    m_actions.put(load.getName(), load);
  }
View Full Code Here

Examples of org.osgi.service.upnp.UPnPAction

  public String getId() {
    return SERVICE_ID;
  }

  public UPnPStateVariable getStateVariable(String id) {
    UPnPAction action = m_actions.get(id);
    if (action != null) {
      return action.getStateVariable(null);
    }
    return null;
  }
View Full Code Here

Examples of org.osgi.service.upnp.UPnPAction

        return null;
    }

    private URL getLocation() {
        UPnPAction action = getAction(ACTION_GET_LOCATION);
        try {
            Dictionary dict = action.invoke(null);
            String location = (String)dict.get(action.getOutputArgumentNames()[0]);
            return new URL(location);
        }
        catch (Exception e) {}
        return null;
    }
View Full Code Here

Examples of org.osgi.service.upnp.UPnPAction

        return null;
    }

    @SuppressWarnings("unused")
    private String getType() {
        UPnPAction action = getAction(ACTION_GET_TYPE);
        try {
            Dictionary dict = action.invoke(null);
            return (String)dict.get(action.getOutputArgumentNames()[0]);
        }
        catch (Exception e) {}
        return "Unknown";
    }
View Full Code Here

Examples of org.osgi.service.upnp.UPnPAction

        return "Unknown";
    }

    @SuppressWarnings("unused")
    private int getLoad() {
        UPnPAction action = getAction(ACTION_GET_LOAD);
        try {
            Dictionary dict = action.invoke(null);
            Integer val = (Integer)dict.get(action.getOutputArgumentNames()[0]);
            return val.intValue();
        }
        catch (Exception e) {
            //ignore, just report worst case
        }
View Full Code Here

Examples of org.osgi.service.upnp.UPnPAction

    }catch(Exception ignored){}
   
    if(osgiServ==null)
      return exiting(false);
   
    UPnPAction osgiAct = osgiServ.getAction(upnpAct.getName());
    Properties inArgs = null;
    ArgumentList alIn = upnpAct.getInputArgumentList();
    ArgumentList alOut = upnpAct.getOutputArgumentList();
    String[] inArg = osgiAct.getInputArgumentNames();
    boolean invalidAction=false;
    if(inArg!=null){
      inArgs = new Properties();
      Argument arg;
      for (int j = 0; j < inArg.length; j++) {
        arg=alIn.getArgument(inArg[j]);
        try {
          inArgs.put(
              inArg[j],
              Converter.parseString(
                  arg.getValue(),
                  arg.getRelatedStateVariable().getDataType()
                  /*osgiServ.getStateVariable(arg.getRelatedStateVariableName()).getUPnPDataType()*/
              )
          );
        } catch (Exception e) {
          invalidAction=true;
          break;
        }
      }
    }
    Dictionary outArgs=null;
    try {
      outArgs=osgiAct.invoke(inArgs);
    } catch (UPnPException e) {
      //TODO Activator.logger.log()
      upnpAct.setStatus(e.getUPnPError_Code(),e.getMessage());
      invalidAction=true;
    } catch (Exception e){
      //TODO Activator.logger.log()
      upnpAct.setStatus(UPnPStatus.ACTION_FAILED);
      invalidAction=true;
    }   
    if(invalidAction)
      return exiting(false);
    String[] outArg = osgiAct.getOutputArgumentNames();
    if(outArg!=null){
      Argument arg;
      for (int j = 0; j < outArg.length; j++) {
        arg = alOut.getArgument(outArg[j]);               
        try {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.