Package com.webobjects.foundation

Examples of com.webobjects.foundation.NSSelector


            if (context.component().parent() != null) {
              extraInfo.setObjectForKey(ERXWOContext.componentPath(context), "CurrentComponentHierarchy");
            }
          }
        // If this is a D2W component, get its D2W-related information from ERDirectToWeb.
        NSSelector d2wSelector = new NSSelector("d2wContext");
        if (d2wSelector.implementedByObject(context.page())) {
          try {
            Class erDirectToWebClazz = Class.forName("er.directtoweb.ERDirectToWeb");
            NSSelector infoSelector = new NSSelector("informationForContext", new Class [] {WOContext.class});
            NSDictionary d2wExtraInfo = (NSDictionary)infoSelector.invoke(erDirectToWebClazz, context);
            extraInfo.addEntriesFromDictionary(d2wExtraInfo);
          } catch (Exception e) {
          }
        }
      }
View Full Code Here


    _queueThread = new Thread(_queue);
    _queueThread.setName("ERXOSCProcessChanges");
    _queueThread.setDaemon(true);
    _queueThread.start();
    NSNotificationCenter.defaultCenter().addObserver(this, new NSSelector("objectStoreWasAdded", ERXConstant.NotificationClassArray), EOObjectStoreCoordinator.CooperatingObjectStoreWasAddedNotification, null);
    NSNotificationCenter.defaultCenter().addObserver(this, new NSSelector("objectStoreWasRemoved", ERXConstant.NotificationClassArray), EOObjectStoreCoordinator.CooperatingObjectStoreWasRemovedNotification, null);
    NSNotificationCenter.defaultCenter().addObserver(this, new NSSelector("startRemoteSynchronizer", ERXConstant.NotificationClassArray), WOApplication.ApplicationDidFinishLaunchingNotification, null);
    NSNotificationCenter.defaultCenter().addObserver(this, new NSSelector("stopRemoteSynchronizer", ERXConstant.NotificationClassArray), ERXApplication.ApplicationWillTerminateNotification, null);
  }
View Full Code Here

  public void addObjectStore(EOObjectStoreCoordinator osc) {
    synchronized (_coordinators) {
      if (!_coordinators.containsObject(osc)) {
        _coordinators.addObject(osc);
        NSSelector sel = new NSSelector("publishChange", new Class[] { NSNotification.class });
        NSNotificationCenter.defaultCenter().addObserver(this, sel, EOObjectStore.ObjectsChangedInStoreNotification, osc);
        NSSelector snapshotCacheChanged = new NSSelector("snapshotCacheChanged", new Class[] { NSNotification.class });
        NSNotificationCenter.defaultCenter().addObserver(this, snapshotCacheChanged, ERXDatabase.SnapshotCacheChanged, null);
      }
    }
  }
View Full Code Here

            }
            addEntriesToCache(dict);
            if (!WOApplication.application().isCachingEnabled()) {
              synchronized (monitoredFiles) {
                if (!monitoredFiles.containsObject(path)) {
                  ERXFileNotificationCenter.defaultCenter().addObserver(observer, new NSSelector("fileDidChange", ERXConstant.NotificationClassArray), path.getFile());
                  monitoredFiles.addObject(path);
                }
              }
            }
          }
View Full Code Here

            target = c.valueForKeyPath((String)value.objectAtIndex(0));
            if ( target != null ) {
                final int numberOfArguments = valueCount - 2;
                final String selectorName = (String)value.objectAtIndex(1);
                final NSSelector selector;
                Object[] arguments = null;

                if ( numberOfArguments > 0 ) {
                    arguments = new Object[numberOfArguments];

                    for ( int i = 2; i < valueCount; i++ )
                        arguments[i-2] = c.valueForKeyPath((String)value.objectAtIndex(i));
                }

                if ( _log.isDebugEnabled() ) {
                    final StringBuilder sb = new StringBuilder('(');

                    if ( arguments != null ) {
                        for ( int i = 0; i < arguments.length; i++ ) {
                            if ( i > 0)
                                sb.append(", ");
                            sb.append(arguments[i]);
                        }
                    }
                    sb.append(')');

                    _log.debug("Going to fire " + selectorName + " on object " + target + " with " + numberOfArguments + " arguments: " + sb);
                }

                selector = new NSSelector(selectorName, _parameterTypesForNumberOfArguments(numberOfArguments));

                result = ERXSelectorUtilities.invoke(selector, target, arguments);
            }

            return result;
View Full Code Here

      }
    }
   
    NSNotificationCenter.defaultCenter().postNotification(ModelGroupAddedNotification, this);
    if (!patchModelsOnLoad) {
      NSNotificationCenter.defaultCenter().addObserver(this, new NSSelector("modelAddedHandler", ERXConstant.NotificationClassArray), EOModelGroup.ModelAddedNotification, null);
    }

    checkForMismatchedJoinTypes();
  }
View Full Code Here

  private Integer _numberOfStatementsToCollect; 
 
  public static void setupDelegate() {
    NSNotificationCenter.defaultCenter().addObserver(ERXAdaptorChannelDelegate.class,
        new NSSelector("dataBaseChannelNeeded", ERXConstant.NotificationClassArray),
        EODatabaseContext.DatabaseChannelNeededNotification, null);
  }
View Full Code Here

      if (result == null) {
        result = new NSMutableDictionary();
        session.setObjectForKey(result, "ERCoreUserPreferences");
      }
    } else {
      NSSelector s = new NSSelector("userPreferences", new Class[] {});
      result = (NSKeyValueCoding) ERXSelectorUtilities.invoke(s, prefClass);
    }
    return result;
  }
View Full Code Here

    return _valueFactoryMethod;
  }

  public Object adaptorValueByConvertingAttributeValue(Object value) {
    Object convertedValue = value;
    NSSelector conversionMethod = adaptorValueConversionMethod();
    Class conversionClass = adaptorValueConversionClass();
    if (conversionMethod != null)
      try {
        if (conversionClass != null) {
          convertedValue = conversionMethod.invoke(conversionClass,new Object[]{value});
        } else {
          convertedValue = conversionMethod.invoke(value);
        }
      } catch (NoSuchMethodException e) {
        throw NSForwardException._runtimeExceptionForThrowable(e);
      } catch (InvocationTargetException e) {
        throw NSForwardException._runtimeExceptionForThrowable(e);
      } catch (IllegalAccessException e) {
        throw NSForwardException._runtimeExceptionForThrowable(e);
      } catch (IllegalArgumentException e) {
        throw NSForwardException._runtimeExceptionForThrowable(e);
      }
    int valueType = adaptorValueType();
   
    //To preserve the illusion of consistency, convert the byte[] to an NSData here
    if(FactoryMethodArgumentIsBytes == factoryMethodArgumentType() && valueFactoryMethod() != null) {
      byte[] bytes = (byte[])convertedValue;
      convertedValue = new NSData(bytes);
    }
   
    //Make an additional check here to support custom date types.
    if(!(AdaptorDateType == valueType && conversionMethod != null && Date.class.isInstance(convertedValue))) {
      if (!valueClasses[valueType].isInstance(convertedValue) && (valueClasses[valueType] != Number.class || !(convertedValue instanceof Boolean))) {
        EOEntity parentEntity = (EOEntity) parent();
        String entityName = parentEntity == null ? "<unspecified>" : parentEntity.name();
        throw new IllegalArgumentException(new StringBuilder().append("EOAttribute adaptorValueByConvertingAttributeValue(Object): Unable to convert value of class ").append(convertedValue.getClass().getName()).append(" for attribute '").append(name()).append("' in entity '").append(entityName).append("' to adaptor type EOAttribute.Adaptor").append(valueTypeNames[valueType]).append("Type.  Check the signature of the conversion method ").append(className()).append('.').append(conversionMethod == null ? "NotFound" : conversionMethod.name()).append("().").toString());
      }
    }
    return convertedValue;
  }
View Full Code Here

  }

  private void _setFactoryMethodArgumentType(int argumentType) {
    _argumentType = argumentType;
    if (_valueFactoryMethodName != null)
      _valueFactoryMethod = new NSSelector(_valueFactoryMethodName, _classForArgumentType());
  }
View Full Code Here

TOP

Related Classes of com.webobjects.foundation.NSSelector

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.