Check the container for the SARL behaviors.

@param behavior the behavior.
772226
@Check
	public void checkContainerType(SarlBehavior behavior) {
		final XtendTypeDeclaration declaringType = behavior.getDeclaringType();
		if (declaringType != null) {
			final String name = canonicalName(declaringType);
			assert name != null;
			error(MessageFormat.format(Messages.SARLValidator_29, name),
					behavior,
					null,
					INVALID_NESTED_DEFINITION);
		}
	}
1114899
@Override
  public void onContainerStarted(final ContainerId containerId, final Map<String, ByteBuffer> stringByteBufferMap) {
    final Optional<Container> container = this.containers.getOptional(containerId.toString());
    if (container.isPresent()) {
      this.nodeManager.getContainerStatusAsync(containerId, container.get().getNodeId());
    }
  }
447357
public void setBehaviors(java.util.Collection<Behavior> behaviors) {
        if (behaviors == null) {
            this.behaviors = null;
            return;
        }

        this.behaviors = new java.util.ArrayList<Behavior>(behaviors);
    }
907668
def evaluate_behaviors(text)
      modified_text = text
      if @behavior_objects
        @behavior_objects.each do |b|
          modified_text = b.evaluate(modified_text)
        end
      end
      modified_text
    end
737458
protected void _generate(SarlBehavior behavior, IExtraLanguageGeneratorContext context) {
		final JvmDeclaredType jvmType = getJvmModelAssociations().getInferredType(behavior);
		final PyAppendable appendable = createAppendable(jvmType, context);
		final List<JvmTypeReference> superTypes;
		if (behavior.getExtends() != null) {
			superTypes = Collections.singletonList(behavior.getExtends());
		} else {
			superTypes = Collections.singletonList(getTypeReferences().getTypeForName(Behavior.class, behavior));
		}
		final String qualifiedName = this.qualifiedNameProvider.getFullyQualifiedName(behavior).toString();
		if (generateTypeDeclaration(
				qualifiedName,
				behavior.getName(), behavior.isAbstract(), superTypes,
				getTypeBuilder().getDocumentation(behavior),
				true,
				behavior.getMembers(), appendable, context, (it, context2) -> {
				generateGuardEvaluators(qualifiedName, it, context2);
			})) {
			final QualifiedName name = getQualifiedNameProvider().getFullyQualifiedName(behavior);
			writeFile(name, appendable, context);
		}
	}
691374
def behaviors(behaviors_dir=None):
    
    import os, yaml, string
    global _behaviors
    if _behaviors is None:
        d = behaviors_dir or os.path.dirname(__file__)
        behaviors_yaml = os.path.join(d, 'behaviors.yaml')
        with open(behaviors_yaml) as fin:
            _behaviors = yaml.safe_load(fin)
    return _behaviors
1109597
private static void assertConsumer(InteractionUnit unit, Map<QName, Set<Procedure>> behaviours, IntegrityErrors err) {

        Set<Resource<ResourceType>> producedTypes = unit.getOutputs();

        for (Resource<ResourceType> resource : producedTypes) {
            boolean match = false;

            for(QName id : behaviours.keySet())
            {
                for (Behaviour behaviour : behaviours.get(id)) {

                    if (behaviour.doesConsume(resource)) {
                        match = true;
                        break;
                    }
                }
            }
            if (!match)
                err.add(unit.getId(), "Missing consumer for <<" + resource + ">>");
        }

    }
747539
public static final void getActivitySessions(ActivitySessionAttribute[] asAttrs,
                                                 int type,
                                                 String[] methodNames,
                                                 Class<?>[][] methodParamTypes,
                                                 List<ActivitySessionMethod> asAttrList,
                                                 String ejbName,
                                                 boolean usesBeanManagedAS)
    {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "getActivitySessions", (Object[])asAttrs);

        if (!usesBeanManagedAS) { // d127328

            if (isTraceOn && tc.isDebugEnabled())
                Tr.debug(tc, "Bean is CMAS");

            if (asAttrList != null) {
                if (isTraceOn && tc.isDebugEnabled())
                    Tr.debug(tc, "asAttrList non-null");

                // array to keep track of what kind of style last set the method-specific behavior
                int[] highestStyleOnMethod = new int[methodNames.length];

                // Elements of highestStyleOnMethod[] are initialized to zero by Java rules.

                // i : asAttrList loop
                // j : MethodElements loop
                // k : Method loop

                for (int i = 0; i < asAttrList.size(); ++i) {
                    ActivitySessionMethod asMethod = asAttrList.get(i);
                    ActivitySessionAttribute asAttr = asMethod.getActivitySessionAttribute();
                    @SuppressWarnings("unchecked")
                    List<com.ibm.ws.javaee.dd.ejb.Method> methodElements = asMethod.getMethodElements();
                    for (int j = 0; j < methodElements.size(); ++j) {
                        com.ibm.ws.javaee.dd.ejb.Method me = methodElements.get(j);
                        if (isTraceOn && tc.isDebugEnabled()) {
                            trace(me, me.getInterfaceTypeValue() == com.ibm.ws.javaee.dd.ejb.Method.INTERFACE_TYPE_UNSPECIFIED ?
                                            "Interface type unspecified" :
                                            "Interface type: " + me.getInterfaceTypeValue());
                        }
                        // Is this method element for the bean we are processing?
                        if ((me.getEnterpriseBeanName()).equals(ejbName)) {
                            String meName = me.getMethodName().trim();
                            int meType = me.getInterfaceTypeValue();

                            if (meName.equals("*")) {
                                if (meType == com.ibm.ws.javaee.dd.ejb.Method.INTERFACE_TYPE_UNSPECIFIED) {
                                    // style type 1 -- wildcard on all bean methods
                                    if (isTraceOn && tc.isDebugEnabled())
                                        Tr.debug(tc, "Style type 1 - all bean methods:", asAttr);
                                    for (int k = 0; k < methodNames.length; ++k) {
                                        if (highestStyleOnMethod[k] <= 1) {
                                            asAttrs[k] = asAttr;
                                            highestStyleOnMethod[k] = 1;
                                        }
                                    }

                                } else if (meType == type) { //LIDB2257.19
                                    // style type 2 -- wildcard on home or remote interface methods
                                    if (isTraceOn && tc.isDebugEnabled())
                                        Tr.debug(tc, "Style type 2 - home/remote methods only:", asAttr);
                                    for (int k = 0; k < methodNames.length; ++k) {
                                        if (highestStyleOnMethod[k] <= 2) {
                                            asAttrs[k] = asAttr;
                                            highestStyleOnMethod[k] = 2;
                                        }
                                    }
                                }
                            } else if (meType == com.ibm.ws.javaee.dd.ejb.Method.INTERFACE_TYPE_UNSPECIFIED || meType == type) { //LIDB2257.19
                                // It is not a wildcard, and either has an unspecified
                                // type, or is of the right type (Remote/Home/Local),
                                // so check for a method name match.             d123321
                                for (int k = 0; k < methodNames.length; ++k) {
                                    if (meName.equals(methodNames[k])) {
                                        List<String> meParms = me.getMethodParamList();
                                        if (meParms == null) {
                                            // style type 3 - matching method name, no signature
                                            //                specified
                                            if (isTraceOn && tc.isDebugEnabled())
                                                Tr.debug(tc, "Style type 3 - method name only:", asAttr);
                                            if (highestStyleOnMethod[k] <= 3) {
                                                asAttrs[k] = asAttr;
                                                highestStyleOnMethod[k] = 3;
                                            }
                                        } else {
                                            if (DDUtil.methodParamsMatch(meParms, methodParamTypes[k])) {
                                                // style type 4 - matching method name and signature
                                                if (isTraceOn && tc.isDebugEnabled())
                                                    Tr.debug(tc, "Style type 4 - method name and signature:", asAttr);
                                                asAttrs[k] = asAttr;
                                                highestStyleOnMethod[k] = 4;
                                            } // method parms match specified parms
                                        } // method parms were specified
                                    } // methodExtension name matches method name
                                } // method loop (k)
                            } // if/then/else for meName='*'
                        } // enterpriseBean name matches parm in methodExtension
                    } // methodElements loop (j)
                } // asAttrList loop (i)
            } // asAttrList != null

        } else if (usesBeanManagedAS) {
            if (isTraceOn && tc.isDebugEnabled())
                Tr.debug(tc, "Bean is BMAS -- all methods will be set to AS_BEAN_MANAGED");
            for (int i = 0; i < asAttrs.length; i++) {
                asAttrs[i] = ActivitySessionAttribute.AS_BEAN_MANAGED;
            }
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "getActivitySessions");

        return;
    }
41639
function( behavior ){

            var behaviors = this._behaviors;

            if (behavior){

                for ( var i = 0, l = behaviors.length; i < l; ++i ){

                    if (behavior === behaviors[ i ]){

                        behaviors.splice( i, 1 );
                        behavior.setWorld( null );

                        this.emit( 'remove:behavior', {
                            behavior: behavior
                        });

                        break;
                    }
                }
            }

            return this;
        }
672078
def autoBehavior(self, cascade=False):
        
        parentBehavior = self.parentBehavior
        if parentBehavior is not None:
            knownChildTup = parentBehavior.knownChildren.get(self.name, None)
            if knownChildTup is not None:
                behavior = getBehavior(self.name, knownChildTup[2])
                if behavior is not None:
                    self.setBehavior(behavior, cascade)
                    if isinstance(self, ContentLine) and self.encoded:
                        self.behavior.decode(self)
            elif isinstance(self, ContentLine):
                self.behavior = parentBehavior.defaultBehavior
                if self.encoded and self.behavior:
                    self.behavior.decode(self)
72343
function(viewOptions) {
      var view = this;
      if (!_.isEmpty(this.behaviors)) {
        view.__behaviorInstances = {};
        _.each(this.behaviors, function(behaviorDefinition, alias) {
          if (!_.has(behaviorDefinition, 'behavior')) {
            behaviorDefinition = {behavior: behaviorDefinition};
          }
          var BehaviorClass = behaviorDefinition.behavior;
          if (!(BehaviorClass && _.isFunction(BehaviorClass))) {
            throw new Error('Incorrect behavior definition. Expected key "behavior" to be a class but instead got ' +
              String(BehaviorClass));
          }

          var behaviorOptions = _.pick(behaviorDefinition, function(value, key) {
            return key !== 'behavior';
          });
          behaviorOptions.view = view;
          behaviorOptions.alias = alias;
          var behaviorAttributes = behaviorDefinition.attributes || {};
          var behaviorInstance = view.__behaviorInstances[alias] = new BehaviorClass(behaviorAttributes, behaviorOptions, viewOptions);
          // Add the behavior's mixin fields to the view's public API
          if (behaviorInstance.mixin) {
            var mixin = _.result(behaviorInstance, 'mixin');
            _.each(mixin, function(field, fieldName) {
              // Default to a view's field over a behavior mixin
              if (_.isUndefined(view[fieldName])) {
                if (_.isFunction(field)) {
                  // Behavior mixin functions will be behavior-scoped - the context will be the behavior.
                  view[fieldName] = _.bind(field, behaviorInstance);
                } else {
                  view[fieldName] = field;
                }
              }
            });
          }
        });
      }
    }
442913
private void suppressBehavior(Node behaviorValue, Node reportNode) {
    if (behaviorValue == null) {
      compiler.report(JSError.make(reportNode, PolymerPassErrors.POLYMER_UNQUALIFIED_BEHAVIOR));
      return;
    }

    if (behaviorValue.isArrayLit()) {
      for (Node child : behaviorValue.children()) {
        suppressBehavior(child, behaviorValue);
      }
    } else if (behaviorValue.isObjectLit()) {
      stripPropertyTypes(behaviorValue);
      addBehaviorSuppressions(behaviorValue);
    }
  }
103663
private boolean investigateHandlesTypes(ServletContainerInitializer sci, HashMap<ServletContainerInitializer, Class[]> handleTypesHashMap, HashMap<ServletContainerInitializer, HashSet<Class<?>>> onStartupHashMap){
        boolean needToScan = false;
        try {
            HandlesTypes handles = sci.getClass().getAnnotation(HandlesTypes.class);
            //handles is the classes which we are to look for and find all implementing classes.
            if (handles!=null) {
                Class[] classes = handles.value();
                needToScan=true;
                if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
                    for (Class c:classes) {
                        logger.logp(Level.FINE, CLASS_NAME, "initializeServletContainerInitializers","Handles class to look contains " + c);
                    }
                }
                handleTypesHashMap.put(sci, classes);
                onStartupHashMap.put(sci, new HashSet<Class<?>>());
            }
        } catch (RuntimeException e) {
            //the HandlesTypes class wasn't found in the classloader
            if (WCCustomProperties.LOG_SERVLET_CONTAINER_INITIALIZER_CLASSLOADER_ERRORS) {
                logger.logp(Level.WARNING, CLASS_NAME,"initializeServletContainerInitializers", "exception.occurred.while.initializing.ServletContainerInitializers.HandlesTypes", new Object[] {sci.getClass().getName(), this.config.getDisplayName()});
            } else {
                if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)){
                    logger.logp(Level.FINE, CLASS_NAME,"initializeServletContainerInitializers", "exception.occurred.while.initializing.ServletContainerInitializers.HandlesTypes", new Object[] {sci.getClass().getName(), this.config.getDisplayName()});
                }
            }
        }
        return needToScan;
    }
344930
public void check()
    {
        for (AnnotationTypeDeclaration atd : _atds)
        {
            Collection<Declaration> decls = getAnnotationProcessorEnvironment().getDeclarationsAnnotatedWith(atd);
            for (Declaration decl : decls)
            {
                check(decl);
            }
        }
    }
1061728
public void addPagingBehavior(PagingBehavior pagingBehavior) {
		checkInitialized();

		// avoid adding the same type(!) of behavior twice, error out if that's the case
		boolean behaviorTypeAdded = pagingBehaviors
				.stream()
				.anyMatch(pbh -> pbh.getClass().equals(pagingBehavior.getClass()));

		if (!behaviorTypeAdded) {
			pagingBehaviors.add(pagingBehavior);
		}
		else {
			throw new IllegalArgumentException(
					"PagingBehavior of same type already added. Type:"
							+ pagingBehavior.getClass().getSimpleName());
		}
	}
1058138
public function applyBehaviors()
    {
        foreach ($this->behaviors as $behavior) {
            if (!$behavior->isTableModified()) {
                $behavior->getTableModifier()->modifyTable();
                $behavior->setTableModified(true);
            }
        }
    }
796274
public void addCommand(final ICommandBehavior behavior) throws DevFailed {
        final String cmdName = behavior.getConfiguration().getName();
        xlogger.entry("adding dynamic command {}", cmdName);
        final CommandImpl commandImpl = new CommandImpl(behavior, deviceImpl.getName());
        commandImpl.setStateMachine(behavior.getStateMachine());
        deviceImpl.addCommand(commandImpl);
        dynamicCommands.put(cmdName.toLowerCase(Locale.ENGLISH), commandImpl);
        deviceImpl.pushInterfaceChangeEvent(false);
        xlogger.exit();
    }