Package com.sun.sgs.app

Examples of com.sun.sgs.app.ManagedObject


     *    specified {@code bindingName} has been removed
     */
    private static void removeValue(String bindingName) {
  DataService dataService =
      BindingKeyedCollectionsImpl.getDataService();
  ManagedObject v = dataService.getServiceBinding(bindingName);
  if (v instanceof Wrapper) {
      dataService.removeObject(v);
  }
    }
View Full Code Here


     * @param  key a key
     * @param  value a value
     */
    private static void putKeyValue(String bindingName, Object value) {
  assert value != null && value instanceof Serializable;
  ManagedObject v =
      value instanceof ManagedObject ?
      (ManagedObject) value :
      new Wrapper<Object>(value);
  BindingKeyedCollectionsImpl.getDataService().
      setServiceBinding(bindingName, v);
View Full Code Here

     * Returns the value associated with the specified {@code bindingName}.
     * removing the wrapper if applicable.
     */
    @SuppressWarnings("unchecked")
    private V getValue(String bindingName) {
  ManagedObject v =
      BindingKeyedCollectionsImpl.getDataService().
          getServiceBinding(bindingName);
  return
      v instanceof Wrapper ?
      (V) ((Wrapper) v).get() :
View Full Code Here

    /** Obtains the object associated with the specified internal name. */
    ManagedObject getBinding(String internalName, boolean forUpdate) {
  long id = store.getBinding(txn, internalName);
  assert id >= 0 : "Object ID must not be negative";
  ManagedObject result;
  if (forUpdate) {
      result = (ManagedObject) getReference(id).getForUpdate(false);
  } else {
      result = (ManagedObject) getReference(id).get(false);
  }
View Full Code Here

    /** Adds a new managed reference to this table. */
    void add(ManagedReferenceImpl<?> ref) {
  assert !oids.containsKey(ref.oid)
      : "Found existing reference for oid:" + ref.oid;
  oids.put(ref.oid, ref);
  ManagedObject object = ref.getObject();
  if (object != null) {
      assert !objects.containsKey(object)
    : "Found existing reference for object with oid:" + ref.oid;
      objects.put(object, ref);
  }
View Full Code Here

    /** Removes a managed reference from this table. */
    void remove(ManagedReferenceImpl<?> ref) {
  Object existing = oids.remove(ref.oid);
  assert existing == ref
      : "Found duplicate reference for oid:" + ref.oid;
  ManagedObject object = ref.getObject();
  if (object != null) {
      existing = objects.remove(object);
      assert existing == ref
    : "Found duplicate reference for oid:" + ref.oid;
  }
View Full Code Here

         *
         * @return the {@code AppListener} for the application
         */
        @SuppressWarnings("unchecked")
        private AppListener getAppListener() {
            ManagedObject obj = dataService.getServiceBinding(
                    StandardProperties.APP_LISTENER);
            return (obj instanceof AppListener) ?
                (AppListener) obj :
                ((ManagedSerializable<AppListener>) obj).get();
        }
View Full Code Here

  }
    }

    @Test
    public void testAddWithRemovedObject() {
  ManagedObject obj = new Managed();
  dataService.removeObject(obj);
  try {
      collectionsFactory.newSet("x.").add(obj);
      fail("expected ObjectNotFoundException");
  } catch (ObjectNotFoundException e) {
View Full Code Here

  checkKey("key", key);
  DataService dataService = BindingKeyedCollectionsImpl.getDataService();
  String bindingName = getBindingName((String) key);
  V value = null;
  try {
      ManagedObject v = dataService.getServiceBinding(bindingName);
      if (v instanceof Wrapper) {
    value = (V) ((Wrapper) v).get();
    dataService.removeObject(v);
      } else {
    value = (V) v;
View Full Code Here

     *    specified {@code bindingName} has been removed
     */
    private static void removeValue(String bindingName) {
  DataService dataService =
      BindingKeyedCollectionsImpl.getDataService();
  ManagedObject v = dataService.getServiceBinding(bindingName);
  if (v instanceof Wrapper) {
      dataService.removeObject(v);
  }
    }
View Full Code Here

TOP

Related Classes of com.sun.sgs.app.ManagedObject

Copyright © 2018 www.massapicom. 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.