Logo Search packages:      
Sourcecode: dbus-java version File versions  Download package

void org::freedesktop::dbus::DBusConnection::requestBusName ( String  busname  )  throws DBusException [inline]

Request a bus name. Request the well known name that this should respond to on the Bus.

Parameters:
busname The name to respond to. MUST be in dot-notation like "org.freedesktop.local"
Exceptions:
DBusException If the register name failed, or our name already exists on the bus. or if busname is incorrectly formatted.

Definition at line 257 of file DBusConnection.java.

References org::freedesktop::dbus::UInt32::intValue().

Referenced by org::freedesktop::dbus::test::test::main().

   {
      if (!busname.matches(BUSNAME_REGEX)||busname.length() > MAX_NAME_LENGTH)
         throw new DBusException(_("Invalid bus name"));
      synchronized (this.busnames) {
         UInt32 rv;
         try { 
            rv = _dbus.RequestName(busname, 
                  new UInt32(DBus.DBUS_NAME_FLAG_REPLACE_EXISTING |
                     DBus.DBUS_NAME_FLAG_DO_NOT_QUEUE));
         } catch (DBusExecutionException DBEe) {
            if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, DBEe);
            throw new DBusException(DBEe.getMessage());
         }
         switch (rv.intValue()) {
            case DBus.DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER: break;
            case DBus.DBUS_REQUEST_NAME_REPLY_IN_QUEUE: throw new DBusException(_("Failed to register bus name"));
            case DBus.DBUS_REQUEST_NAME_REPLY_EXISTS: throw new DBusException(_("Failed to register bus name"));
            case DBus.DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER: break;
            default: break;
         }
         this.busnames.add(busname);
      }
   }


Generated by  Doxygen 1.6.0   Back to index