示例#1
0
 public void getService(GuiUserEvent event) {
   GuiChangeEvent ce = (GuiChangeEvent) event;
   if (ce.value.equals("native")) {
     sv = ServiceFactory.getLocalService();
   } else if (ce.value.equals("rmi")) {
     sv = ServiceFactory.getSpringService();
     //		} else if (ce.value.equals("soap")) {
     //			sv = ServiceFactory.getSOAP_Service();
     //		} else if (ce.value.equals("remoteSOAP")) {
     //			sv = ServiceFactory.getSOAP_Service("http://pk86.de:8004/bitdemo.wsdl");
   } else if (ce.value.equals("remoteRMI")) {
     sv = ServiceFactory.getSpringService("pk86.de:1098");
   }
 }
 public SetExcludeSiteExample() {
   // Get service factory. Your authentication information will be popped up automatically from
   // baidu-api.properties
   VersionService factory = ServiceFactory.getInstance();
   // Get service stub by given the Service interface.
   // Please see the bean-api.tar.gz to get more details about all the service interfaces.
   this.service = factory.getService(GroupConfigService.class);
 }
 /**
  * sendMessage will send a message represented as a String, over the BLE if server was
  * successfully started and client has connected.
  *
  * @param msg message to be sent
  */
 public void sendMessage(String msg) {
   if (mConnectedDevice != null) {
     BluetoothGattCharacteristic characteristic =
         ServiceFactory.generateService()
             .getCharacteristic(UUID.fromString(Constants.CHAT_CHARACTERISTIC_UUID));
     characteristic.setValue(msg);
     mGattserver.notifyCharacteristicChanged(mConnectedDevice, characteristic, false);
   }
 }
  /** runs a test against the jmanage test application. */
  public static void main(String[] args) {
    RemoteServiceContextFactory.setJManageURL("http://localhost:9090");
    ServiceContext context =
        RemoteServiceContextFactory.getServiceContext(
            "admin", "123456",
            "testApp1", "jmanage:name=DataFormat,type=test");
    MBeanService mbeanService = ServiceFactory.getMBeanService();
    OperationResultData[] result = mbeanService.invoke(context, "retrieveXMLData", new String[] {});
    /* this is not a cluster, so the number of results must be 1 */
    assert result.length == 1;

    System.out.println(result[0].isError() ? "Error" : "OK");
    System.out.println(result[0].getDisplayOutput());
  }
示例#5
0
 private ObjectItemGui() {
   sv = ServiceFactory.getLocalService();
   // sv = ServiceFactory.getSOAP_Service("http://pk86.de:8004/bitdemo.wsdl");
   // sv = ServiceFactory.getSpringService();
   // sv = ServiceFactory.getSOAP_Service("http://localhost:8004/bf.wsdl");
   GuiFactory fact = GuiFactory.getInstance();
   GuiUtil.setUiManager("Nimbus");
   try {
     GuiWindow win = fact.createWindow("gui/Expression.xml");
     win.setController(this);
     win.show();
   } catch (Exception ex) {
     logger.error(ex.getMessage(), ex);
     GuiUtil.showEx(ex);
   }
 }
 public void setContext(@Context ServletContext context) {
   if (dynamicService) {
     taskService = ServiceFactory.getInstance().getTaskDefinitionService();
   }
 }
示例#7
0
 static {
   ServiceFactory.addFactory("GoogleDesktopSearch", new Factory());
 }
  /**
   * startAdvertising will open a Gatt server, add our chat services to it and start advertisement
   * with default settings. Advertising won't start if bluetooth is disabled or device doesn't
   * support the Peripheral mode.
   */
  public void startAdvertising() {
    if (mBluetoothManager.getAdapter().isEnabled()) {
      if (mBluetoothManager.getAdapter().isMultipleAdvertisementSupported()) {
        mGattserver =
            mBluetoothManager.openGattServer(
                mContext,
                new BluetoothGattServerCallback() {
                  @Override
                  public void onConnectionStateChange(
                      BluetoothDevice device, int status, int newState) {
                    super.onConnectionStateChange(device, status, newState);
                    if (newState == BluetoothProfile.STATE_CONNECTED) {
                      if (mLogger != null) {
                        mLogger.log("Client connected: " + device.getAddress());
                      }
                      mConnectedDevice = device;
                    } else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
                      if (mLogger != null) {
                        mLogger.log("Client disconnected: " + device.getAddress());
                      }
                      mConnectedDevice = null;
                    }
                  }

                  @Override
                  public void onCharacteristicReadRequest(
                      BluetoothDevice device,
                      int requestId,
                      int offset,
                      BluetoothGattCharacteristic characteristic) {
                    super.onCharacteristicReadRequest(device, requestId, offset, characteristic);
                    if (mLogger != null) {
                      mLogger.log("onCharacteristicReadRequest");
                    }
                  }

                  @Override
                  public void onServiceAdded(int status, BluetoothGattService service) {
                    super.onServiceAdded(status, service);
                    BleAdvertiser.this.onServiceAdded();
                  }

                  @Override
                  public void onNotificationSent(BluetoothDevice device, int status) {
                    super.onNotificationSent(device, status);
                    if (mLogger != null) {
                      mLogger.log("onNotificationSent");
                    }
                  }

                  @Override
                  public void onCharacteristicWriteRequest(
                      BluetoothDevice device,
                      int requestId,
                      BluetoothGattCharacteristic characteristic,
                      boolean preparedWrite,
                      boolean responseNeeded,
                      int offset,
                      byte[] value) {
                    super.onCharacteristicWriteRequest(
                        device,
                        requestId,
                        characteristic,
                        preparedWrite,
                        responseNeeded,
                        offset,
                        value);
                    if (characteristic
                        .getUuid()
                        .equals(UUID.fromString(Constants.CHAT_CHARACTERISTIC_UUID))) {
                      String msg = "";
                      if (value != null) {
                        msg = new String(value);
                      }
                      mLogger.log("onCharacteristicWriteRequest: " + msg);
                    }
                  }
                });
        mGattserver.addService(ServiceFactory.generateService());
      } else {
        mLogger.log("Central mode not supported by the device!");
      }
    } else {
      mLogger.log("Bluetooth is disabled!");
    }
  }
示例#9
0
 public EventLimiter(Runnable runnable, long pollingTimeMillis) {
   mPollingTimeMillis = pollingTimeMillis;
   mRunnable = runnable;
   mSchedulerService = ServiceFactory.getSchedulerService();
 }
 static {
   ServiceFactory.init(ServiceFactory.MODE_REMOTE);
 }
示例#11
0
 public static void serviceConsumer(ServiceFactory fact) {
   Service s = fact.getService();
   s.method1();
   s.method2();
 }