text:
<?php
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

 /**
 * CMIS Type Definitions
 *
 * Type definitions for the CMIS object model, to support the Web Services binding for PHP,
 * as published by OASIS (http://www.oasis-open.org/committees/cmis/)
 *
 * @author    Karsten Eberding
 * @package   CMISWebService
 * @version   0.5
 */

class enumDecimalPrecision {
  const value_32 = '32';
  const value_64 = '64';
}

class enumContentStreamAllowed {
  const notallowed = 'notallowed';
  const allowed = 'allowed';
  const required = 'required';
}

class enumCardinality {
  const single = 'single';
  const multi = 'multi';
}

class enumUpdatability {
  const readonly = 'readonly';
  const readwrite = 'readwrite';
  const whencheckedout = 'whencheckedout';
  const oncreate = 'oncreate';
}

class enumDateTimeResolution {
  const year = 'year';
  const date = 'date';
  const time = 'time';
}

class enumPropertyType {
  const boolean = 'boolean';
  const id = 'id';
  const integer = 'integer';
  const datetime = 'datetime';
  const decimal = 'decimal';
  const html = 'html';
  const string = 'string';
  const uri = 'uri';
}

class enumBaseObjectTypeIds {
  const cmis_document = 'cmis:document';
  const cmis_folder = 'cmis:folder';
  const cmis_relationship = 'cmis:relationship';
  const cmis_policy = 'cmis:policy';
}

class enumCapabilityQuery {
  const none = 'none';
  const metadataonly = 'metadataonly';
  const fulltextonly = 'fulltextonly';
  const bothseparate = 'bothseparate';
  const bothcombined = 'bothcombined';
}

class enumCapabilityJoin {
  const none = 'none';
  const inneronly = 'inneronly';
  const innerandouter = 'innerandouter';
}

class enumCapabilityContentStreamUpdates {
  const anytime = 'anytime';
  const pwconly = 'pwconly';
  const none = 'none';
}

class enumVersioningState {
  const none = 'none';
  const checkedout = 'checkedout';
  const minor = 'minor';
  const major = 'major';
}

class enumUnfileObject {
  const unfile = 'unfile';
  const deletesinglefiled = 'deletesinglefiled';
  const delete = 'delete';
}

class enumRelationshipDirection {
  const source = 'source';
  const target = 'target';
  const either = 'either';
}

class enumIncludeRelationships {
  const none = 'none';
  const source = 'source';
  const target = 'target';
  const both = 'both';
}

class enumPropertiesBase {
  const cmis_name = 'cmis:name';
  const cmis_objectId = 'cmis:objectId';
  const cmis_objectTypeId = 'cmis:objectTypeId';
  const cmis_baseTypeId = 'cmis:baseTypeId';
  const cmis_createdBy = 'cmis:createdBy';
  const cmis_creationDate = 'cmis:creationDate';
  const cmis_lastModifiedBy = 'cmis:lastModifiedBy';
  const cmis_lastModificationDate = 'cmis:lastModificationDate';
  const cmis_changeToken = 'cmis:changeToken';
}

class enumPropertiesDocument {
  const cmis_isImmutable = 'cmis:isImmutable';
  const cmis_isLatestVersion = 'cmis:isLatestVersion';
  const cmis_isMajorVersion = 'cmis:isMajorVersion';
  const cmis_isLatestMajorVersion = 'cmis:isLatestMajorVersion';
  const cmis_versionLabel = 'cmis:versionLabel';
  const cmis_versionSeriesId = 'cmis:versionSeriesId';
  const cmis_isVersionSeriesCheckedOut = 'cmis:isVersionSeriesCheckedOut';
  const cmis_versionSeriesCheckedOutBy = 'cmis:versionSeriesCheckedOutBy';
  const cmis_versionSeriesCheckedOutId = 'cmis:versionSeriesCheckedOutId';
  const cmis_checkinComment = 'cmis:checkinComment';
  const cmis_contentStreamLength = 'cmis:contentStreamLength';
  const cmis_contentStreamMimeType = 'cmis:contentStreamMimeType';
  const cmis_contentStreamFileName = 'cmis:contentStreamFileName';
  const cmis_contentStreamId = 'cmis:contentStreamId';
}

class enumPropertiesFolder {
  const cmis_parentId = 'cmis:parentId';
  const cmis_allowedChildObjectTypeIds = 'cmis:allowedChildObjectTypeIds';
  const cmis_path = 'cmis:path';
}

class enumPropertiesRelationship {
  const cmis_sourceId = 'cmis:sourceId';
  const cmis_targetId = 'cmis:targetId';
}

class enumPropertiesPolicy {
  const cmis_policyText = 'cmis:policyText';
}

class cmisObjectType {
  public $properties; // cmisPropertiesType
  public $allowableActions; // cmisAllowableActionsType
  public $relationship; // cmisObjectType
  public $changeEventInfo; // cmisChangeEventType
  public $acl; // cmisAccessControlListType
  public $exactACL; // boolean
  public $policyIds; // cmisListOfIdsType
  public $rendition; // cmisRenditionType
}

class cmisPropertiesType {
  public $propertyBoolean; // cmisPropertyBoolean
  public $propertyId; // cmisPropertyId
  public $propertyInteger; // cmisPropertyInteger
  public $propertyDateTime; // cmisPropertyDateTime
  public $propertyDecimal; // cmisPropertyDecimal
  public $propertyHtml; // cmisPropertyHtml
  public $propertyString; // cmisPropertyString
  public $propertyUri; // cmisPropertyUri
}

class cmisProperty {

    public $value;

    public function __construct($v) {
        if (is_array($v)) $this->value = $v;
        else $this->value = array($v);
    }

    public function __toString() {
        if (isset($this->value[0])) return $this->value[0];
        else return (NULL);
    }

    public function single() {
        if (isset($this->value[0])) return $this->value[0];
        else return (NULL);
    }

    public function multi() {
        if (isset($this->value)) return $this->value;
        else return (NULL);
    }
}

class cmisPropertyBoolean extends cmisProperty {
}

class cmisPropertyId extends cmisProperty {
}

class cmisPropertyInteger extends cmisProperty {
}

class cmisPropertyDateTime extends cmisProperty {
}

class cmisPropertyDecimal extends cmisProperty {
}

class cmisPropertyHtml extends cmisProperty {
}

class cmisPropertyString extends cmisProperty {
}

class cmisPropertyUri extends cmisProperty {
}

class cmisChoice {
}

class cmisChoiceBoolean extends cmisChoice {
  public $value; // boolean
  public $choice; // cmisChoiceBoolean
}

class cmisChoiceId extends cmisChoice {
  public $value; // string
  public $choice; // cmisChoiceId
}

class cmisChoiceInteger extends cmisChoice {
  public $value; // integer
  public $choice; // cmisChoiceInteger
}

class cmisChoiceDateTime extends cmisChoice {
  public $value; // dateTime
  public $choice; // cmisChoiceDateTime
}

class cmisChoiceDecimal extends cmisChoice {
  public $value; // decimal
  public $choice; // cmisChoiceDecimal
}

class cmisChoiceHtml extends cmisChoice {
  public $value; // string
  public $choice; // cmisChoiceHtml
}

class cmisChoiceString extends cmisChoice {
  public $value; // string
  public $choice; // cmisChoiceString
}

class cmisChoiceUri extends cmisChoice {
  public $value; // anyURI
  public $choice; // cmisChoiceUri
}

class cmisAllowableActionsType {
  public $canDeleteObject; // boolean
  public $canUpdateProperties; // boolean
  public $canGetFolderTree; // boolean
  public $canGetProperties; // boolean
  public $canGetObjectRelationships; // boolean
  public $canGetObjectParents; // boolean
  public $canGetFolderParent; // boolean
  public $canGetDescendants; // boolean
  public $canMoveObject; // boolean
  public $canDeleteContentStream; // boolean
  public $canCheckOut; // boolean
  public $canCancelCheckOut; // boolean
  public $canCheckIn; // boolean
  public $canSetContentStream; // boolean
  public $canGetAllVersions; // boolean
  public $canAddObjectToFolder; // boolean
  public $canRemoveObjectFromFolder; // boolean
  public $canGetContentStream; // boolean
  public $canApplyPolicy; // boolean
  public $canGetAppliedPolicies; // boolean
  public $canRemovePolicy; // boolean
  public $canGetChildren; // boolean
  public $canCreateDocument; // boolean
  public $canCreateFolder; // boolean
  public $canCreateRelationship; // boolean
  public $canDeleteTree; // boolean
  public $canGetRenditions; // boolean
  public $canGetACL; // boolean
  public $canApplyACL; // boolean
}

class cmisListOfIdsType {
  public $id; // string
}

class cmisPropertyDefinitionType {
  public $id; // string
  public $localName; // string
  public $localNamespace; // anyURI
  public $displayName; // string
  public $queryName; // string
  public $description; // string
  public $propertyType; // enumPropertyType
  public $cardinality; // enumCardinality
  public $updatability; // enumUpdatability
  public $inherited; // boolean
  public $required; // boolean
  public $queryable; // boolean
  public $orderable; // boolean
  public $openChoice; // boolean
}

class cmisPropertyBooleanDefinitionType extends cmisPropertyDefinitionType {
  public $defaultValue; // cmisPropertyBoolean
  public $choice; // cmisChoiceBoolean
}

class cmisPropertyIdDefinitionType extends cmisPropertyDefinitionType {
  public $defaultValue; // cmisPropertyId
  public $choice; // cmisChoiceId
}

class cmisPropertyIntegerDefinitionType extends cmisPropertyDefinitionType {
  public $defaultValue; // cmisPropertyInteger
  public $maxValue; // integer
  public $minValue; // integer
  public $choice; // cmisChoiceInteger
}

class cmisPropertyDateTimeDefinitionType extends cmisPropertyDefinitionType {
  public $defaultValue; // cmisPropertyDateTime
  public $resolution; // enumDateTimeResolution
  public $choice; // cmisChoiceDateTime
}

class cmisPropertyDecimalDefinitionType extends cmisPropertyDefinitionType {
  public $defaultValue; // cmisPropertyDecimal
  public $maxValue; // decimal
  public $minValue; // decimal
  public $precision; // enumDecimalPrecision
  public $choice; // cmisChoiceDecimal
}

class cmisPropertyHtmlDefinitionType extends cmisPropertyDefinitionType {
  public $defaultValue; // cmisPropertyHtml
  public $choice; // cmisChoiceHtml
}

class cmisPropertyStringDefinitionType extends cmisPropertyDefinitionType {
  public $defaultValue; // cmisPropertyString
  public $maxLength; // integer
  public $choice; // cmisChoiceString
}

class cmisPropertyUriDefinitionType extends cmisPropertyDefinitionType {
  public $defaultValue; // cmisPropertyUri
  public $choice; // cmisChoiceUri
}

class cmisTypeDefinitionType {
  public $id; // string
  public $localName; // string
  public $localNamespace; // anyURI
  public $displayName; // string
  public $queryName; // string
  public $description; // string
  public $baseId; // enumBaseObjectTypeIds
  public $parentId; // string
  public $creatable; // boolean
  public $fileable; // boolean
  public $queryable; // boolean
  public $fulltextIndexed; // boolean
  public $includedInSupertypeQuery; // boolean
  public $controllablePolicy; // boolean
  public $controllableACL; // boolean
  public $propertyBooleanDefinition; // cmisPropertyBooleanDefinitionType
  public $propertyDateTimeDefinition; // cmisPropertyDateTimeDefinitionType
  public $propertyDecimalDefinition; // cmisPropertyDecimalDefinitionType
  public $propertyIdDefinition; // cmisPropertyIdDefinitionType
  public $propertyIntegerDefinition; // cmisPropertyIntegerDefinitionType
  public $propertyHtmlDefinition; // cmisPropertyHtmlDefinitionType
  public $propertyStringDefinition; // cmisPropertyStringDefinitionType
  public $propertyUriDefinition; // cmisPropertyUriDefinitionType
}

class cmisTypeDocumentDefinitionType extends cmisTypeDefinitionType {
  public $versionable; // boolean
  public $contentStreamAllowed; // enumContentStreamAllowed
}

class cmisTypeFolderDefinitionType extends cmisTypeDefinitionType {
}

class cmisTypeRelationshipDefinitionType extends cmisTypeDefinitionType {
  public $allowedSourceTypes; // string
  public $allowedTargetTypes; // string
}

class cmisTypePolicyDefinitionType extends cmisTypeDefinitionType {
}

class cmisQueryType {
  public $statement; // string
  public $searchAllVersions; // boolean
  public $includeAllowableActions; // boolean
  public $includeRelationships; // enumIncludeRelationships
  public $renditionFilter; // string
  public $maxItems; // integer
  public $skipCount; // integer
}

class cmisRepositoryInfoType {
  public $repositoryId; // string
  public $repositoryName; // string
  public $repositoryDescription; // string
  public $vendorName; // string
  public $productName; // string
  public $productVersion; // string
  public $rootFolderId; // string
  public $latestChangeLogToken; // string
  public $capabilities; // cmisRepositoryCapabilitiesType
  public $aclCapability; // cmisACLCapabilityType
  public $cmisVersionSupported; // string
  public $thinClientURI; // anyURI
  public $changesIncomplete; // boolean
  public $changesOnType; // enumBaseObjectTypeIds
  public $principalAnonymous; // string
  public $principalAnyone; // string
}

class cmisRepositoryCapabilitiesType {
  public $capabilityACL; // enumCapabilityACL
  public $capabilityAllVersionsSearchable; // boolean
  public $capabilityChanges; // enumCapabilityChanges
  public $capabilityContentStreamUpdatability; // enumCapabilityContentStreamUpdates
  public $capabilityGetDescendants; // boolean
  public $capabilityGetFolderTree; // boolean
  public $capabilityMultifiling; // boolean
  public $capabilityPWCSearchable; // boolean
  public $capabilityPWCUpdatable; // boolean
  public $capabilityQuery; // enumCapabilityQuery
  public $capabilityRenditions; // enumCapabilityRendition
  public $capabilityUnfiling; // boolean
  public $capabilityVersionSpecificFiling; // boolean
  public $capabilityJoin; // enumCapabilityJoin
}

class enumTypeOfChanges {
  const created = 'created';
  const updated = 'updated';
  const deleted = 'deleted';
  const security = 'security';
}

class enumCapabilityChanges {
  const none = 'none';
  const objectidsonly = 'objectidsonly';
  const properties = 'properties';
  const all = 'all';
}

class cmisChangeEventType {
  public $changeType; // enumTypeOfChanges
  public $changeTime; // dateTime
}

class enumACLPropagation {
  const repositorydetermined = 'repositorydetermined';
  const objectonly = 'objectonly';
  const propagate = 'propagate';
}

class enumCapabilityACL {
  const none = 'none';
  const discover = 'discover';
  const manage = 'manage';
}

class enumBasicPermissions {
  const cmis_read = 'cmis:read';
  const cmis_write = 'cmis:write';
  const cmis_all = 'cmis:all';
}

class cmisPermissionDefinition {
  public $permission; // string
  public $description; // string
}

class cmisPermissionMapping {
  public $key; // enumAllowableActionsKey
  public $permission; // string
}

class enumAllowableActionsKey {
  const canGetDescendents_Folder = 'canGetDescendents.Folder';
  const canGetChildren_Folder = 'canGetChildren.Folder';
  const canGetParents_Folder = 'canGetParents.Folder';
  const canGetFolderParent_Object = 'canGetFolderParent.Object';
  const canCreateDocument_Folder = 'canCreateDocument.Folder';
  const canCreateFolder_Folder = 'canCreateFolder.Folder';
  const canCreateRelationship_Source = 'canCreateRelationship.Source';
  const canCreateRelationship_Target = 'canCreateRelationship.Target';
  const canGetProperties_Object = 'canGetProperties.Object';
  const canViewContent_Object = 'canViewContent.Object';
  const canUpdateProperties_Object = 'canUpdateProperties.Object';
  const canMove_Object = 'canMove.Object';
  const canMove_Target = 'canMove.Target';
  const canMove_Source = 'canMove.Source';
  const canDelete_Object = 'canDelete.Object';
  const canDeleteTree_Folder = 'canDeleteTree.Folder';
  const canSetContent_Document = 'canSetContent.Document';
  const canDeleteContent_Document = 'canDeleteContent.Document';
  const canAddToFolder_Object = 'canAddToFolder.Object';
  const canAddToFolder_Folder = 'canAddToFolder.Folder';
  const canRemoveFromFolder_Object = 'canRemoveFromFolder.Object';
  const canRemoveFromFolder_Folder = 'canRemoveFromFolder.Folder';
  const canCheckout_Document = 'canCheckout.Document';
  const canCancelCheckout_Document = 'canCancelCheckout.Document';
  const canCheckin_Document = 'canCheckin.Document';
  const canGetAllVersions_VersionSeries = 'canGetAllVersions.VersionSeries';
  const canGetObjectRelationships_Object = 'canGetObjectRelationships.Object';
  const canAddPolicy_Object = 'canAddPolicy.Object';
  const canAddPolicy_Policy = 'canAddPolicy.Policy';
  const canRemovePolicy_Object = 'canRemovePolicy.Object';
  const canRemovePolicy_Policy = 'canRemovePolicy.Policy';
  const canGetAppliedPolicies_Object = 'canGetAppliedPolicies.Object';
  const canGetACL_Object = 'canGetACL.Object';
  const canApplyACL_Object = 'canApplyACL.Object';
}

class enumUsers {
  const cmis_user = 'cmis:user';
}

class cmisAccessControlPrincipalType {
  public $principalId; // string
}

class cmisAccessControlEntryType {
  public $principal; // cmisAccessControlPrincipalType
  public $permission; // string
  public $direct; // boolean
}

class cmisAccessControlListType {
  public $permission; // cmisAccessControlEntryType
}

class cmisACLCapabilityType {
  public $supportedPermissions; // enumSupportedPermissions
  public $propagation; // enumACLPropagation
  public $permissions; // cmisPermissionDefinition
  public $mapping; // cmisPermissionMapping
}

class enumSupportedPermissions {
  const basic = 'basic';
  const repository = 'repository';
  const both = 'both';
}

class enumCapabilityRendition {
  const none = 'none';
  const read = 'read';
}

class enumRenditionKind {
  const cmis_thumbnail = 'cmis:thumbnail';
}

class cmisRenditionType {
  public $streamId; // string
  public $mimetype; // string
  public $length; // integer
  public $kind; // string
  public $title; // string
  public $height; // integer
  public $width; // integer
  public $renditionDocumentId; // string
}

class cmisFaultType {
  public $type; // enumServiceException
  public $code; // integer
  public $message; // string
}

class enumServiceException {
  const constraint = 'constraint';
  const nameConstraintViolation = 'nameConstraintViolation';
  const contentAlreadyExists = 'contentAlreadyExists';
  const filterNotValid = 'filterNotValid';
  const invalidArgument = 'invalidArgument';
  const notSupported = 'notSupported';
  const objectNotFound = 'objectNotFound';
  const permissionDenied = 'permissionDenied';
  const runtime = 'runtime';
  const storage = 'storage';
  const streamNotSupported = 'streamNotSupported';
  const updateConflict = 'updateConflict';
  const versioning = 'versioning';
}

class cmisExtensionType {
}

class cmisTypeContainer {
  public $type; // cmisTypeDefinitionType
  public $children; // cmisTypeContainer
}

class cmisTypeDefinitionListType {
  public $types; // cmisTypeDefinitionType
  public $hasMoreItems; // boolean
  public $numItems; // integer
}

class cmisObjectInFolderContainerType {
  public $objectInFolder; // cmisObjectInFolderType
  public $children; // cmisObjectInFolderContainerType
}

class cmisObjectListType {
  public $objects; // cmisObjectType
  public $hasMoreItems; // boolean
  public $numItems; // integer
}

class cmisObjectInFolderType {
  public $object; // cmisObjectType
  public $pathSegment; // string
}

class cmisObjectParentsType {
  public $object; // cmisObjectType
  public $relativePathSegment; // string
}

class cmisObjectInFolderListType {
  public $objects; // cmisObjectInFolderType
  public $hasMoreItems; // boolean
  public $numItems; // integer
}

class cmisRepositoryEntryType {
  public $repositoryId; // string
  public $repositoryName; // string
}

class cmisContentStreamType {
  public $length; // integer
  public $mimeType; // string
  public $filename; // string
  public $stream; // base64Binary
}

class cmisACLType {
  public $ACL; // cmisAccessControlListType
  public $exact; // boolean
}

class getRepositories {
  public $extension; // cmisExtensionType
}

class getRepositoriesResponse {
  public $repositories; // cmisRepositoryEntryType
}

class getRepositoryInfo {
  public $repositoryId; // string
  public $extension; // cmisExtensionType
}

class getRepositoryInfoResponse {
  public $repositoryInfo; // cmisRepositoryInfoType
}

class getTypeChildren {
  public $repositoryId; // string
  public $typeId; // string
  public $includePropertyDefinitions; // boolean
  public $maxItems; // integer
  public $skipCount; // integer
  public $extension; // cmisExtensionType
}

class getTypeChildrenResponse {
  public $types; // cmisTypeDefinitionListType
}

class getTypeDescendants {
  public $repositoryId; // string
  public $typeId; // string
  public $depth; // integer
  public $includePropertyDefinitions; // boolean
  public $extension; // cmisExtensionType
}

class getTypeDescendantsResponse {
  public $types; // cmisTypeContainer
}

class getTypeDefinition {
  public $repositoryId; // string
  public $typeId; // string
  public $extension; // cmisExtensionType
}

class getTypeDefinitionResponse {
  public $type; // cmisTypeDefinitionType
}

class getDescendants {
  public $repositoryId; // string
  public $folderId; // string
  public $depth; // integer
  public $filter; // string
  public $includeAllowableActions; // boolean
  public $includeRelationships; // enumIncludeRelationships
  public $renditionFilter; // string
  public $includePathSegment; // boolean
  public $extension; // cmisExtensionType
}

class getDescendantsResponse {
  public $objects; // cmisObjectInFolderContainerType
}

class getFolderTree {
  public $repositoryId; // string
  public $folderId; // string
  public $depth; // integer
  public $filter; // string
  public $includeAllowableActions; // boolean
  public $includeRelationships; // enumIncludeRelationships
  public $renditionFilter; // string
  public $includePathSegment; // boolean
  public $extension; // cmisExtensionType
}

class getFolderTreeResponse {
  public $objects; // cmisObjectInFolderContainerType
}

class getChildren {
  public $repositoryId; // string
  public $folderId; // string
  public $filter; // string
  public $orderBy; // string
  public $includeAllowableActions; // boolean
  public $includeRelationships; // enumIncludeRelationships
  public $renditionFilter; // string
  public $includePathSegment; // boolean
  public $maxItems; // integer
  public $skipCount; // integer
  public $extension; // cmisExtensionType
}

class getChildrenResponse {
  public $objects; // cmisObjectInFolderListType
}

class getFolderParent {
  public $repositoryId; // string
  public $folderId; // string
  public $filter; // string
  public $extension; // cmisExtensionType
}

class getFolderParentResponse {
  public $object; // cmisObjectType
}

class getObjectParents {
  public $repositoryId; // string
  public $objectId; // string
  public $filter; // string
  public $includeAllowableActions; // boolean
  public $includeRelationships; // enumIncludeRelationships
  public $renditionFilter; // string
  public $includeRelativePathSegment; // boolean
  public $extension; // cmisExtensionType
}

class getObjectParentsResponse {
  public $parents; // cmisObjectParentsType
}

class getRenditions {
  public $repositoryId; // string
  public $objectId; // string
  public $renditionFilter; // string
  public $maxItems; // integer
  public $skipCount; // integer
  public $extension; // cmisExtensionType
}

class getRenditionsResponse {
  public $renditions; // cmisRenditionType
}

class getCheckedOutDocs {
  public $repositoryId; // string
  public $folderId; // string
  public $filter; // string
  public $orderBy; // string
  public $includeAllowableActions; // boolean
  public $includeRelationships; // enumIncludeRelationships
  public $renditionFilter; // string
  public $maxItems; // integer
  public $skipCount; // integer
  public $extension; // cmisExtensionType
}

class getCheckedOutDocsResponse {
  public $objects; // cmisObjectListType
}

class createDocument {
  public $repositoryId; // string
  public $properties; // cmisPropertiesType
  public $folderId; // string
  public $contentStream; // cmisContentStreamType
  public $versioningState; // enumVersioningState
  public $policies; // string
  public $addACEs; // cmisAccessControlListType
  public $removeACEs; // cmisAccessControlListType
  public $extension; // cmisExtensionType
}

class createDocumentResponse {
  public $objectId; // string
  public $extension; // cmisExtensionType
}

class createDocumentFromSource {
  public $repositoryId; // string
  public $sourceId; // string
  public $properties; // cmisPropertiesType
  public $folderId; // string
  public $versioningState; // enumVersioningState
  public $policies; // string
  public $addACEs; // cmisAccessControlListType
  public $removeACEs; // cmisAccessControlListType
  public $extension; // cmisExtensionType
}

class createDocumentFromSourceResponse {
  public $objectId; // string
  public $extension; // cmisExtensionType
}

class createFolder {
  public $repositoryId; // string
  public $properties; // cmisPropertiesType
  public $folderId; // string
  public $policies; // string
  public $addACEs; // cmisAccessControlListType
  public $removeACEs; // cmisAccessControlListType
  public $extension; // cmisExtensionType
}

class createFolderResponse {
  public $objectId; // string
  public $extension; // cmisExtensionType
}

class createRelationship {
  public $repositoryId; // string
  public $properties; // cmisPropertiesType
  public $policies; // string
  public $addACEs; // cmisAccessControlListType
  public $removeACEs; // cmisAccessControlListType
  public $extension; // cmisExtensionType
}

class createRelationshipResponse {
  public $objectId; // string
  public $extension; // cmisExtensionType
}

class createPolicy {
  public $repositoryId; // string
  public $properties; // cmisPropertiesType
  public $folderId; // string
  public $policies; // string
  public $addACEs; // cmisAccessControlListType
  public $removeACEs; // cmisAccessControlListType
  public $extension; // cmisExtensionType
}

class createPolicyResponse {
  public $objectId; // string
  public $extension; // cmisExtensionType
}

class getAllowableActions {
  public $repositoryId; // string
  public $objectId; // string
  public $extension; // cmisExtensionType
}

class getAllowableActionsResponse {
  public $allowableActions; // cmisAllowableActionsType
}

class getProperties {
  public $repositoryId; // string
  public $objectId; // string
  public $filter; // string
  public $extension; // cmisExtensionType
}

class getPropertiesResponse {
  public $properties; // cmisPropertiesType
}

class getObject {
  public $repositoryId; // string
  public $objectId; // string
  public $filter; // string
  public $includeAllowableActions; // boolean
  public $includeRelationships; // enumIncludeRelationships
  public $renditionFilter; // string
  public $includePolicyIds; // boolean
  public $includeACL; // boolean
  public $extension; // cmisExtensionType
}

class getObjectResponse {
  public $object; // cmisObjectType
}

class getObjectByPath {
  public $repositoryId; // string
  public $path; // string
  public $filter; // string
  public $includeAllowableActions; // boolean
  public $includeRelationships; // enumIncludeRelationships
  public $renditionFilter; // string
  public $includePolicyIds; // boolean
  public $includeACL; // boolean
  public $extension; // cmisExtensionType
}

class getObjectByPathResponse {
  public $object; // cmisObjectType
}

class getContentStream {
  public $repositoryId; // string
  public $objectId; // string
  public $streamId; // string
  public $offset; // integer
  public $length; // integer
  public $extension; // cmisExtensionType
}

class getContentStreamResponse {
  public $contentStream; // cmisContentStreamType
}

class updateProperties {
  public $repositoryId; // string
  public $objectId; // string
  public $changeToken; // string
  public $properties; // cmisPropertiesType
  public $extension; // cmisExtensionType
}

class updatePropertiesResponse {
  public $objectId; // string
  public $changeToken; // string
  public $extension; // cmisExtensionType
}

class moveObject {
  public $repositoryId; // string
  public $objectId; // string
  public $targetFolderId; // string
  public $sourceFolderId; // string
  public $extension; // cmisExtensionType
}

class moveObjectResponse {
  public $objectId; // string
  public $extension; // cmisExtensionType
}

class deleteObject {
  public $repositoryId; // string
  public $objectId; // string
  public $allVersions; // boolean
  public $extension; // cmisExtensionType
}

class deleteObjectResponse {
  public $extension; // cmisExtensionType
}

class deleteTree {
  public $repositoryId; // string
  public $folderId; // string
  public $allVersions; // boolean
  public $unfileObjects; // enumUnfileObject
  public $continueOnFailure; // boolean
  public $extension; // cmisExtensionType
}

class deleteTreeResponse {
  public $failedToDelete; // failedToDelete
}

class failedToDelete {
  public $objectIds; // string
}

class setContentStream {
  public $repositoryId; // string
  public $objectId; // string
  public $overwriteFlag; // boolean
  public $changeToken; // string
  public $contentStream; // cmisContentStreamType
  public $extension; // cmisExtensionType
}

class setContentStreamResponse {
  public $objectId; // string
  public $changeToken; // string
  public $extension; // cmisExtensionType
}

class deleteContentStream {
  public $repositoryId; // string
  public $objectId; // string
  public $changeToken; // string
  public $extension; // cmisExtensionType
}

class deleteContentStreamResponse {
  public $objectId; // string
  public $changeToken; // string
  public $extension; // cmisExtensionType
}

class addObjectToFolder {
  public $repositoryId; // string
  public $objectId; // string
  public $folderId; // string
  public $allVersions; // boolean
  public $extension; // cmisExtensionType
}

class addObjectToFolderResponse {
  public $extension; // cmisExtensionType
}

class removeObjectFromFolder {
  public $repositoryId; // string
  public $objectId; // string
  public $folderId; // string
  public $extension; // cmisExtensionType
}

class removeObjectFromFolderResponse {
  public $extension; // cmisExtensionType
}

class query {
  public $repositoryId; // string
  public $statement; // string
  public $searchAllVersions; // boolean
  public $includeAllowableActions; // boolean
  public $includeRelationships; // enumIncludeRelationships
  public $renditionFilter; // string
  public $maxItems; // integer
  public $skipCount; // integer
  public $extension; // cmisExtensionType
}

class queryResponse {
  public $objects; // cmisObjectListType
}

class getContentChanges {
  public $repositoryId; // string
  public $changeLogToken; // string
  public $includeProperties; // boolean
  public $filter; // string
  public $includePolicyIds; // boolean
  public $includeACL; // boolean
  public $maxItems; // integer
  public $extension; // cmisExtensionType
}

class getContentChangesResponse {
  public $objects; // cmisObjectListType
  public $changeLogToken; // string
}

class checkOut {
  public $repositoryId; // string
  public $objectId; // string
  public $extension; // cmisExtensionType
}

class checkOutResponse {
  public $objectId; // string
  public $contentCopied; // boolean
  public $extension; // cmisExtensionType
}

class cancelCheckOut {
  public $repositoryId; // string
  public $objectId; // string
  public $extension; // cmisExtensionType
}

class cancelCheckOutResponse {
  public $extension; // cmisExtensionType
}

class checkIn {
  public $repositoryId; // string
  public $objectId; // string
  public $major; // boolean
  public $properties; // cmisPropertiesType
  public $contentStream; // cmisContentStreamType
  public $checkinComment; // string
  public $policies; // string
  public $addACEs; // cmisAccessControlListType
  public $removeACEs; // cmisAccessControlListType
  public $extension; // cmisExtensionType
}

class checkInResponse {
  public $objectId; // string
  public $extension; // cmisExtensionType
}

class getPropertiesOfLatestVersion {
  public $repositoryId; // string
  public $objectId; // string
  public $major; // boolean
  public $filter; // string
  public $extension; // cmisExtensionType
}

class getPropertiesOfLatestVersionResponse {
  public $properties; // cmisPropertiesType
}

class getObjectOfLatestVersion {
  public $repositoryId; // string
  public $objectId; // string
  public $major; // boolean
  public $filter; // string
  public $includeAllowableActions; // boolean
  public $includeRelationships; // enumIncludeRelationships
  public $renditionFilter; // string
  public $includePolicyIds; // boolean
  public $includeACL; // boolean
  public $extension; // cmisExtensionType
}

class getObjectOfLatestVersionResponse {
  public $object; // cmisObjectType
}

class getAllVersions {
  public $repositoryId; // string
  public $objectId; // string
  public $filter; // string
  public $includeAllowableActions; // boolean
  public $extension; // cmisExtensionType
}

class getAllVersionsResponse {
  public $objects; // cmisObjectType
}

class getObjectRelationships {
  public $repositoryId; // string
  public $objectId; // string
  public $includeSubRelationshipTypes; // boolean
  public $relationshipDirection; // enumRelationshipDirection
  public $typeId; // string
  public $filter; // string
  public $includeAllowableActions; // boolean
  public $maxItems; // integer
  public $skipCount; // integer
  public $extension; // cmisExtensionType
}

class getObjectRelationshipsResponse {
  public $objects; // cmisObjectListType
}

class applyPolicy {
  public $repositoryId; // string
  public $policyId; // string
  public $objectId; // string
  public $extension; // cmisExtensionType
}

class applyPolicyResponse {
  public $extension; // cmisExtensionType
}

class removePolicy {
  public $repositoryId; // string
  public $policyId; // string
  public $objectId; // string
  public $extension; // cmisExtensionType
}

class removePolicyResponse {
  public $extension; // cmisExtensionType
}

class getAppliedPolicies {
  public $repositoryId; // string
  public $objectId; // string
  public $filter; // string
  public $extension; // cmisExtensionType
}

class getAppliedPoliciesResponse {
  public $objects; // cmisObjectType
}

class getACL {
  public $repositoryId; // string
  public $objectId; // string
  public $onlyBasicPermissions; // boolean
  public $extension; // cmisExtensionType
}

class getACLResponse {
  public $ACL; // cmisACLType
}

class applyACL {
  public $repositoryId; // string
  public $objectId; // string
  public $addACEs; // cmisAccessControlListType
  public $removeACEs; // cmisAccessControlListType
  public $ACLPropagation; // enumACLPropagation
  public $extension; // cmisExtensionType
}

class applyACLResponse {
  public $ACL; // cmisACLType
}

class anyURI {
}

?>


text:
#ifndef MST_DETECTOR_H_
#define MST_DETECTOR_H_

#include "monosat/utils/System.h"

#include "GraphTheoryTypes.h"
#include "monosat/dgl/DynamicGraph.h"
#include "monosat/dgl/MinimumSpanningTree.h"

#include "monosat/core/SolverTypes.h"
#include "monosat/mtl/Map.h"

#include "monosat/dgl/alg/DisjointSets.h"
#include "monosat/utils/System.h"
#include "Detector.h"

using namespace dgl;
namespace Monosat {
template<typename Weight>
class GraphTheorySolver;

template<typename Weight = int, typename Graph = DynamicGraph<Weight>>
class MSTDetector : public Detector {
public:
    GraphTheorySolver<Weight>* outer;

    Graph& g_under;
    Graph& g_over;

    double rnd_seed;
    CRef underprop_marker;
    CRef overprop_marker;
    CRef underprop_edge_marker;
    CRef overprop_edge_marker;

    MinimumSpanningTree<Weight>* underapprox_detector = nullptr;
    MinimumSpanningTree<Weight>* overapprox_detector = nullptr;
    MinimumSpanningTree<Weight>* underapprox_conflict_detector = nullptr;
    MinimumSpanningTree<Weight>* overapprox_conflict_detector = nullptr;

    Weight lowest_weight_lit = -1;
    Weight highest_weight_lit = -1;

    vec<int> force_reason;

    struct MSTWeightLit {
        Lit l;
        bool inclusive;
        Weight min_weight;

        MSTWeightLit() :
                l(lit_Undef), inclusive(false), min_weight(-1){
        }
    };

    bool checked_unique;
    bool all_unique;
    vec<MSTWeightLit> weight_lits;

    struct MSTEdgeLit {
        Lit l;
        int edgeID;

        MSTEdgeLit() :
                l(lit_Undef), edgeID(-1){
        }
    };

    vec<int> tree_edge_lits_map;
    vec<MSTEdgeLit> tree_edge_lits;
    Var first_reach_var;

    struct ChangedEdge {
        Var v;
        int edgeID;
    };
    vec<bool> is_edge_changed;
    vec<ChangedEdge> changed_edges;

    vec<Var> tmp_nodes;
    vec<bool> seen;
    vec<bool> black;
    vec<int> ancestors;

    vec<Lit> tmp_conflict;
    vec<int> visit;
    DisjointSets sets;

    struct MSTStatus {
        MSTDetector& detector;
        bool polarity;

        void setMinimumSpanningTree(Weight& weight, bool connected);

        void inMinimumSpanningTree(int edgeID, bool in_tree);

        MSTStatus(MSTDetector& _outer, bool _polarity) :
                detector(_outer), polarity(_polarity){
        }
    };

    MSTStatus* positiveReachStatus;
    MSTStatus* negativeReachStatus;

    void unassign(Lit l) override{
        Detector::unassign(l);
        int index = var(l) - first_reach_var;
        if(index >= 0 && index < tree_edge_lits_map.size() && tree_edge_lits_map[index] != -1){
            int edgeID = tree_edge_lits_map[index];
            if(!is_edge_changed[edgeID]){
                changed_edges.push({var(l), edgeID});
                is_edge_changed[edgeID] = true;
            }
        }
    }

    void preprocess() override;

    bool propagate(vec<Lit>& conflict) override;

    void buildMinWeightTooSmallReason(Weight& weight, vec<Lit>& conflict);

    void buildMinWeightTooLargeReason(Weight& weight, vec<Lit>& conflict);

    void buildEdgeInTreeReason(int edge, vec<Lit>& conflict);

    void buildEdgeNotInTreeReason(int edge, vec<Lit>& conflict);

    void buildReason(Lit p, vec<Lit>& reason, CRef marker) override;

    bool checkSatisfied() override;

    Lit decide(CRef& decision_reason) override;

    void addTreeEdgeLit(int edge_id, Var reach_var);

    void addWeightLit(Var weight_var, Weight& min_weight, bool inclusive);

    void printSolution(std::ostream& write_to) override;

    MSTDetector(int _detectorID, GraphTheorySolver<Weight>* _outer, Graph& _g, Graph& _antig,
                double seed = 1); //:Detector(_detectorID),outer(_outer),within(-1),source(_source),rnd_seed(seed),positive_reach_detector(NULL),negative_reach_detector(NULL),positive_path_detector(NULL),positiveReachStatus(NULL),negativeReachStatus(NULL){}
    ~MSTDetector() override{
        if(positiveReachStatus)
            delete positiveReachStatus;
        if(negativeReachStatus)
            delete negativeReachStatus;

        if(underapprox_conflict_detector && underapprox_conflict_detector != underapprox_detector)
            delete underapprox_conflict_detector;

        if(overapprox_conflict_detector && overapprox_conflict_detector != overapprox_detector)
            delete overapprox_conflict_detector;

        if(underapprox_detector)
            delete underapprox_detector;
        if(overapprox_detector)
            delete overapprox_detector;

    }

    std::string getName() override{
        return "MST Detector";
    }

    Weight getModel_SpanningTreeWeight(){
        return underapprox_detector->weight();
    }

private:
    void TarjanOLCA(int node, vec<Lit>& conflict);

    bool walkback(Weight& weight, int from, int to);

    void TarjanOLCA_edge(int node, int edgeid, int lowest_endpoint, vec<Lit>& conflict);

    Weight walkback_edge(Weight& weight, int edgeid, int from, int to, bool& found);
};
};

#endif /* DistanceDetector_H_ */

redpajama_set_name: RedPajamaGithub


text:
// Code generated by client-gen. DO NOT EDIT.

package v1alpha2

type FluxHelmReleaseExpansion interface{}


text:
#include "McRouteHandleProvider.h"

#include <memory>

#include <folly/Range.h>

#include "mcrouter/config.h"
#include "mcrouter/lib/fbi/cpp/ParsingUtil.h"
#include "mcrouter/lib/fbi/cpp/util.h"
#include "mcrouter/lib/WeightedCh3HashFunc.h"
#include "mcrouter/McrouterInstance.h"
#include "mcrouter/McrouterLogFailure.h"
#include "mcrouter/PoolFactory.h"
#include "mcrouter/proxy.h"
#include "mcrouter/ProxyDestinationMap.h"
#include "mcrouter/routes/ExtraRouteHandleProviderIf.h"
#include "mcrouter/routes/RateLimiter.h"
#include "mcrouter/routes/ShadowRouteIf.h"
#include "mcrouter/routes/ShardHashFunc.h"
#include "mcrouter/routes/ShardSplitter.h"
#include "mcrouter/routes/SlowWarmUpRouteSettings.h"

namespace facebook { namespace memcache { namespace mcrouter {

using McRouteHandleFactory = RouteHandleFactory<McrouterRouteHandleIf>;

std::vector<McrouterRouteHandlePtr> makeShadowRoutes(
    RouteHandleFactory<McrouterRouteHandleIf>& factory,
    const folly::dynamic& json,
    std::vector<McrouterRouteHandlePtr> destinations,
    proxy_t& proxy,
    ExtraRouteHandleProviderIf& extraProvider);

std::vector<McrouterRouteHandlePtr> makeShadowRoutes(
    RouteHandleFactory<McrouterRouteHandleIf>& factory,
    const folly::dynamic& json,
    proxy_t& proxy,
    ExtraRouteHandleProviderIf& extraProvider);

McrouterRouteHandlePtr makeAllAsyncRoute(McRouteHandleFactory& factory,
                                         const folly::dynamic& json);

McrouterRouteHandlePtr makeAllFastestRoute(McRouteHandleFactory& factory,
                                           const folly::dynamic& json);

McrouterRouteHandlePtr makeAllInitialRoute(McRouteHandleFactory& factory,
                                           const folly::dynamic& json);

McrouterRouteHandlePtr makeAllMajorityRoute(McRouteHandleFactory& factory,
                                            const folly::dynamic& json);

McrouterRouteHandlePtr makeAllSyncRoute(McRouteHandleFactory& factory,
                                        const folly::dynamic& json);

McrouterRouteHandlePtr makeAsynclogRoute(McrouterRouteHandlePtr rh,
                                         std::string asynclogName);

McrouterRouteHandlePtr makeDevNullRoute(McRouteHandleFactory& factory,
                                        const folly::dynamic& json);

McrouterRouteHandlePtr makeHostIdRoute(McRouteHandleFactory& factory,
                                       const folly::dynamic& json);

McrouterRouteHandlePtr makeDestinationRoute(
  std::shared_ptr<ProxyDestination> destination,
  std::string poolName,
  size_t indexInPool,
  std::chrono::milliseconds timeout,
  bool keepRoutingPrefix);

McrouterRouteHandlePtr makeErrorRoute(McRouteHandleFactory& factory,
                                      const folly::dynamic& json);

McrouterRouteHandlePtr makeFailoverRoute(McRouteHandleFactory& factory,
                                         const folly::dynamic& json);

McrouterRouteHandlePtr makeFailoverWithExptimeRoute(
  McRouteHandleFactory& factory,
  const folly::dynamic& json);

McrouterRouteHandlePtr makeHashRoute(const folly::dynamic& json,
                                     std::vector<McrouterRouteHandlePtr> rh,
                                     size_t threadId);

McrouterRouteHandlePtr makeHashRoute(McRouteHandleFactory& factory,
                                     const folly::dynamic& json);

McrouterRouteHandlePtr makeL1L2CacheRoute(McRouteHandleFactory& factory,
                                          const folly::dynamic& json);

McrouterRouteHandlePtr makeLatestRoute(McRouteHandleFactory& factory,
                                       const folly::dynamic& json);

McrouterRouteHandlePtr makeLoggingRoute(McRouteHandleFactory& factory,
                                        const folly::dynamic& json);

McrouterRouteHandlePtr makeMigrateRoute(McRouteHandleFactory& factory,
                                        const folly::dynamic& json);

McrouterRouteHandlePtr makeMissFailoverRoute(McRouteHandleFactory& factory,
                                             const folly::dynamic& json);

McrouterRouteHandlePtr makeModifyExptimeRoute(McRouteHandleFactory& factory,
                                              const folly::dynamic& json);

McrouterRouteHandlePtr makeModifyKeyRoute(McRouteHandleFactory& factory,
                                          const folly::dynamic& json);

McrouterRouteHandlePtr makeNullRoute(McRouteHandleFactory& factory,
                                     const folly::dynamic& json);

McrouterRouteHandlePtr makeOperationSelectorRoute(McRouteHandleFactory& factory,
                                                  const folly::dynamic& json);

McrouterRouteHandlePtr makeOutstandingLimitRoute(
  McrouterRouteHandlePtr normalRoute,
  size_t maxOutstanding);

McrouterRouteHandlePtr makeRateLimitRoute(McrouterRouteHandlePtr normalRoute,
                                          RateLimiter rateLimiter);

McrouterRouteHandlePtr makeRateLimitRoute(McRouteHandleFactory& factory,
                                          const folly::dynamic& json);

McrouterRouteHandlePtr makeRandomRoute(McRouteHandleFactory& factory,
                                       const folly::dynamic& json);

McrouterRouteHandlePtr makeShardSplitRoute(McrouterRouteHandlePtr rh,
                                           ShardSplitter);

McrouterRouteHandlePtr makeWarmUpRoute(McRouteHandleFactory& factory,
                                       const folly::dynamic& json);

McrouterRouteHandlePtr makeSlowWarmUpRoute(
    McrouterRouteHandlePtr target,
    McrouterRouteHandlePtr failoverTarget,
    std::shared_ptr<SlowWarmUpRouteSettings> settings);

std::pair<McrouterRouteHandlePtr, std::string> parseAsynclogRoute(
    RouteHandleFactory<McrouterRouteHandleIf>& factory,
    const folly::dynamic& json);

McRouteHandleProvider::McRouteHandleProvider(
  proxy_t& proxy,
  PoolFactory& poolFactory)
    : proxy_(proxy),
      poolFactory_(poolFactory),
      extraProvider_(createExtraRouteHandleProvider()),
      routeMap_{
        { "AllAsyncRoute", &makeAllAsyncRoute },
        { "AllFastestRoute", &makeAllFastestRoute },
        { "AllInitialRoute", &makeAllInitialRoute },
        { "AllMajorityRoute", &makeAllMajorityRoute },
        { "AllSyncRoute", &makeAllSyncRoute },
        {
          "AsynclogRoute",
          [this](McRouteHandleFactory& factory, const folly::dynamic& json) {
            auto p = parseAsynclogRoute(factory, json);
            return createAsynclogRoute(std::move(p.first), std::move(p.second));
          }
        },
        { "DevNullRoute", &makeDevNullRoute },
        { "ErrorRoute", &makeErrorRoute },
        { "FailoverRoute", &makeFailoverRoute },
        { "FailoverWithExptimeRoute", &makeFailoverWithExptimeRoute },
        {
          "HashRoute",
          [](McRouteHandleFactory& factory, const folly::dynamic& json) {
            return makeHashRoute(factory, json);
          }
        },
        { "HostIdRoute", &makeHostIdRoute },
        { "L1L2CacheRoute", &makeL1L2CacheRoute },
        { "LatestRoute", &makeLatestRoute },
        { "LoggingRoute", &makeLoggingRoute },
        { "MigrateRoute", &makeMigrateRoute },
        { "MissFailoverRoute", &makeMissFailoverRoute },
        { "ModifyExptimeRoute", &makeModifyExptimeRoute },
        { "ModifyKeyRoute", &makeModifyKeyRoute },
        { "NullRoute", &makeNullRoute },
        { "OperationSelectorRoute", &makeOperationSelectorRoute },
        {
          "PoolRoute",
          [this](McRouteHandleFactory& factory, const folly::dynamic& json) {
            return makePoolRoute(factory, json);
          }
        },
        { "PrefixPolicyRoute", &makeOperationSelectorRoute },
        { "RandomRoute", &makeRandomRoute },
        {
          "RateLimitRoute",
          [](McRouteHandleFactory& factory, const folly::dynamic& json) {
            return makeRateLimitRoute(factory, json);
          }
        },
        { "WarmUpRoute", &makeWarmUpRoute },
      } {
}

McRouteHandleProvider::~McRouteHandleProvider() {
  /* Needed for forward declaration of ExtraRouteHandleProviderIf in .h */
}

McrouterRouteHandlePtr
McRouteHandleProvider::createAsynclogRoute(McrouterRouteHandlePtr target,
                                           std::string asynclogName) {
  if (!proxy_.router().opts().asynclog_disable) {
    target = makeAsynclogRoute(std::move(target), asynclogName);
  }
  asyncLogRoutes_.emplace(std::move(asynclogName), target);
  return target;
}

const std::vector<McrouterRouteHandlePtr>&
McRouteHandleProvider::makePool(McRouteHandleFactory& factory,
                                const PoolFactory::PoolJson& jpool) {
  auto existingIt = pools_.find(jpool.name);
  if (existingIt != pools_.end()) {
    return existingIt->second;
  }

  auto name = jpool.name.str();
  const auto& json = jpool.json;
  auto& opts = proxy_.router().opts();
  // region & cluster
  folly::StringPiece region, cluster;
  if (auto jregion = json.get_ptr("region")) {
    if (!jregion->isString()) {
      MC_LOG_FAILURE(opts, memcache::failure::Category::kInvalidConfig,
                     "Pool {}: pool_region is not a string", name);
    } else {
      region = jregion->stringPiece();
    }
  }
  if (auto jcluster = json.get_ptr("cluster")) {
    if (!jcluster->isString()) {
      MC_LOG_FAILURE(opts, memcache::failure::Category::kInvalidConfig,
                     "Pool {}: pool_cluster is not a string", name);
    } else {
      cluster = jcluster->stringPiece();
    }
  }

  try {
    std::chrono::milliseconds timeout{opts.server_timeout_ms};
    if (auto jTimeout = json.get_ptr("server_timeout")) {
      timeout = parseTimeout(*jTimeout, "server_timeout");
    }

    if (!region.empty() && !cluster.empty()) {
      auto& route = opts.default_route;
      if (region == route.getRegion() && cluster == route.getCluster()) {
        if (opts.within_cluster_timeout_ms != 0) {
          timeout = std::chrono::milliseconds(opts.within_cluster_timeout_ms);
        }
      } else if (region == route.getRegion()) {
        if (opts.cross_cluster_timeout_ms != 0) {
          timeout = std::chrono::milliseconds(opts.cross_cluster_timeout_ms);
        }
      } else {
        if (opts.cross_region_timeout_ms != 0) {
          timeout = std::chrono::milliseconds(opts.cross_region_timeout_ms);
        }
      }
    }

    mc_protocol_t protocol = mc_ascii_protocol;
    if (auto jProtocol = json.get_ptr("protocol")) {
      auto str = parseString(*jProtocol, "protocol");
      if (equalStr("ascii", str, folly::AsciiCaseInsensitive())) {
        protocol = mc_ascii_protocol;
      } else if (equalStr("caret", str, folly::AsciiCaseInsensitive())) {
        protocol = mc_caret_protocol;
      } else if (equalStr("umbrella", str, folly::AsciiCaseInsensitive())) {
        protocol = mc_umbrella_protocol;
      } else {
        throwLogic("Unknown protocol '{}'", str);
      }
    }

    bool enableCompression = proxy_.router().opts().enable_compression;
    if (auto jCompression = json.get_ptr("enable_compression")) {
      enableCompression = parseBool(*jCompression, "enable_compression");
    }

    bool keepRoutingPrefix = false;
    if (auto jKeepRoutingPrefix = json.get_ptr("keep_routing_prefix")) {
      keepRoutingPrefix = parseBool(*jKeepRoutingPrefix, "keep_routing_prefix");
    }

    uint64_t qosClass = opts.default_qos_class;
    uint64_t qosPath = opts.default_qos_path;
    if (auto jQos = json.get_ptr("qos")) {
      checkLogic(jQos->isObject(), "qos must be an object.");
      if (auto jClass = jQos->get_ptr("class")) {
        qosClass = parseInt(*jClass, "qos.class", 0, 4);
      }
      if (auto jPath = jQos->get_ptr("path")) {
        qosPath = parseInt(*jPath, "qos.path", 0, 3);
      }
    }

    bool useSsl = false;
    if (auto jUseSsl = json.get_ptr("use_ssl")) {
      useSsl = parseBool(*jUseSsl, "use_ssl");
    }

    // default to 0, which doesn't override
    uint16_t port = 0;
    if (auto jPort = json.get_ptr("port_override")) {
      port = parseInt(*jPort, "port_override", 1, 65535);
    }
    // servers
    auto jservers = json.get_ptr("servers");
    checkLogic(jservers, "servers not found");
    checkLogic(jservers->isArray(), "servers is not an array");
    std::vector<McrouterRouteHandlePtr> destinations;
    destinations.reserve(jservers->size());
    for (size_t i = 0; i < jservers->size(); ++i) {
      const auto& server = jservers->at(i);
      checkLogic(server.isString() || server.isObject(),
                 "server #{} is not a string/object", i);
      if (server.isObject()) {
        destinations.push_back(factory.create(server));
        continue;
      }
      auto ap = AccessPoint::create(server.stringPiece(), protocol, useSsl,
                                    port, enableCompression);
      checkLogic(ap != nullptr, "invalid server {}", server.stringPiece());

      if (ap->compressed() && proxy_.router().getCodecManager() == nullptr) {
        if (!initCompression(proxy_.router())) {
          MC_LOG_FAILURE(
              opts,
              failure::Category::kBadEnvironment,
              "Pool {}: Failed to initialize compression. "
              "Disabling compression for host: {}",
              name,
              server.stringPiece());

          ap->disableCompression();
        }
      }

      accessPoints_[name].push_back(ap);

      auto pdstn = proxy_.destinationMap->find(*ap, timeout);
      if (!pdstn) {
        pdstn = proxy_.destinationMap->emplace(
          std::move(ap), timeout, qosClass, qosPath
        );
      }
      pdstn->updatePoolName(name);
      pdstn->updateShortestTimeout(timeout);

      destinations.push_back(makeDestinationRoute(
        std::move(pdstn), name, i, timeout, keepRoutingPrefix));
    } // servers

    return pools_.emplace(name, std::move(destinations)).first->second;
  } catch (const std::exception& e) {
    throwLogic("Pool {}: {}", name, e.what());
  }
}

McrouterRouteHandlePtr
McRouteHandleProvider::makePoolRoute(McRouteHandleFactory& factory,
                                     const folly::dynamic& json) {
  checkLogic(json.isObject() || json.isString(),
             "PoolRoute should be object or string");
  const folly::dynamic* jpool;
  if (json.isObject()) {
    jpool = json.get_ptr("pool");
    checkLogic(jpool, "PoolRoute: pool not found");
  } else { // string
    jpool = &json;
  }

  auto poolJson = poolFactory_.parsePool(*jpool);
  auto destinations = makePool(factory, poolJson);

  try {
    if (json.isObject()) {
      if (auto maxOutstandingPtr = json.get_ptr("max_outstanding")) {
        auto v = parseInt(*maxOutstandingPtr, "max_outstanding", 0, 1000000);
        if (v) {
          for (auto& destination: destinations) {
            destination = makeOutstandingLimitRoute(std::move(destination), v);
          }
        }
      }
      if (auto slowWarmUpJson = json.get_ptr("slow_warmup")) {
        checkLogic(slowWarmUpJson->isObject(),
                   "slow_warmup must be a json object");

        auto failoverTargetJson = slowWarmUpJson->get_ptr("failoverTarget");
        checkLogic(failoverTargetJson,
                   "couldn't find 'failoverTarget' property in slow_warmup");
        auto failoverTarget = factory.create(*failoverTargetJson);

        std::shared_ptr<SlowWarmUpRouteSettings> slowWarmUpSettings;
        if (auto settingsJson = slowWarmUpJson->get_ptr("settings")) {
          checkLogic(settingsJson->isObject(),
                     "'settings' in slow_warmup must be a json object.");
          slowWarmUpSettings =
            std::make_shared<SlowWarmUpRouteSettings>(*settingsJson);
        } else {
          slowWarmUpSettings = std::make_shared<SlowWarmUpRouteSettings>();
        }

        for (size_t i = 0; i < destinations.size(); ++i) {
          destinations[i] = makeSlowWarmUpRoute(std::move(destinations[i]),
              failoverTarget, slowWarmUpSettings);
        }
      }

      if (json.count("shadows")) {
        destinations = makeShadowRoutes(
            factory, json, std::move(destinations), proxy_, *extraProvider_);
      }
    }

    // add weights and override whatever we have in PoolRoute::hash
    folly::dynamic jhashWithWeights = folly::dynamic::object();
    if (auto jWeights = poolJson.json.get_ptr("weights")) {
      jhashWithWeights = folly::dynamic::object
        ("hash_func", WeightedCh3HashFunc::type())
        ("weights", *jWeights);
    }

    if (json.isObject()) {
      if (auto jhash = json.get_ptr("hash")) {
        checkLogic(jhash->isObject() || jhash->isString(),
                   "hash is not object/string");
        if (jhash->isString()) {
          jhashWithWeights["hash_func"] = *jhash;
        } else { // object
          for (const auto& it : jhash->items()) {
            jhashWithWeights[it.first] = it.second;
          }
        }
      }
    }
    auto route = makeHashRoute(jhashWithWeights, std::move(destinations),
                               factory.getThreadId());

    auto asynclogName = poolJson.name;
    bool needAsynclog = true;
    if (json.isObject()) {
      if (auto jrates = json.get_ptr("rates")) {
        route = makeRateLimitRoute(std::move(route), RateLimiter(*jrates));
      }
      if (auto jsplits = json.get_ptr("shard_splits")) {
        route = makeShardSplitRoute(std::move(route), ShardSplitter(*jsplits));
      }
      if (auto jasynclog = json.get_ptr("asynclog")) {
        needAsynclog = parseBool(*jasynclog, "asynclog");
      }
      if (auto jname = json.get_ptr("name")) {
        asynclogName = parseString(*jname, "name");
      }
    }
    if (needAsynclog) {
      route = createAsynclogRoute(std::move(route), asynclogName.str());
    }

    return route;
  } catch (const std::exception& e) {
    throwLogic("PoolRoute {}: {}", poolJson.name, e.what());
  }
}

std::vector<McrouterRouteHandlePtr> McRouteHandleProvider::create(
    McRouteHandleFactory& factory,
    folly::StringPiece type,
    const folly::dynamic& json) {

  if (type == "Pool") {
    return makePool(factory, poolFactory_.parsePool(json));
  } else if (type == "ShadowRoute") {
    return makeShadowRoutes(factory, json, proxy_, *extraProvider_);
  }

  auto it = routeMap_.find(type);
  if (it != routeMap_.end()) {
    return { it->second(factory, json) };
  }

  /* returns empty vector if type is unknown */
  auto ret = extraProvider_->tryCreate(factory, type, json);
  if (!ret.empty()) {
    return ret;
  }

  throwLogic("Unknown RouteHandle: {}", type);
}

}}} // facebook::memcache::mcrouter


text:
namespace AgileObjects.AgileMapper.UnitTests.Orms.EfCore1.Configuration
{
    using System.Threading.Tasks;
    using Infrastructure;
    using Orms.Configuration;
    using Xunit;

    public class WhenMappingToNull : WhenMappingToNull<EfCore1TestDbContext>
    {
        public WhenMappingToNull(InMemoryEfCore1TestContext context)
            : base(context)
        {
        }

        [Fact]
        public Task ShouldApplyAUserConfiguration() => RunShouldApplyAUserConfiguration();
    }
}


text:
@interface FTCTHTMLSyntaxExampleViewController : FTCTBasicExampleViewController

@end


text:
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs.Host.Executors;
using Microsoft.Azure.WebJobs.Host.Protocols;
using Microsoft.Extensions.DependencyInjection;

namespace Microsoft.Azure.WebJobs.Host.Triggers
{
    internal class TriggeredFunctionInstanceFactory<TTriggerValue> : ITriggeredFunctionInstanceFactory<TTriggerValue>
    {
        private readonly ITriggeredFunctionBinding<TTriggerValue> _binding;
        private readonly IFunctionInvokerEx _invoker;
        private readonly FunctionDescriptor _descriptor;
        private readonly IServiceScopeFactory _serviceScopeFactory;

        public TriggeredFunctionInstanceFactory(ITriggeredFunctionBinding<TTriggerValue> binding,
            IFunctionInvokerEx invoker, FunctionDescriptor descriptor, IServiceScopeFactory serviceScopeFactory)
        {
            _binding = binding;
            _invoker = invoker;
            _descriptor = descriptor;
            _serviceScopeFactory = serviceScopeFactory;
        }

        public IFunctionInstance Create(FunctionInstanceFactoryContext<TTriggerValue> context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            IBindingSource bindingSource = new TriggerBindingSource<TTriggerValue>(_binding, context.TriggerValue);
            var invoker = CreateInvoker(context);

            return new FunctionInstance(Guid.NewGuid(), context.TriggerDetails, context.ParentId, ExecutionReason.AutomaticTrigger, bindingSource, invoker, _descriptor, _serviceScopeFactory);
        }

        public IFunctionInstance Create(FunctionInstanceFactoryContext context)
        {
            IBindingSource bindingSource = new BindingSource(_binding, context.Parameters);
            var invoker = CreateInvoker(context);

            return new FunctionInstance(context.Id, context.TriggerDetails, context.ParentId, context.ExecutionReason, bindingSource, invoker, _descriptor, _serviceScopeFactory);
        }

        private IFunctionInvokerEx CreateInvoker(FunctionInstanceFactoryContext context)
        {
            if (context.InvokeHandler != null)
            {
                return new InvokeWrapper(_invoker, context.InvokeHandler);
            }
            else
            {
                return _invoker;
            }
        }

        private class InvokeWrapper : IFunctionInvokerEx
        {
            private readonly IFunctionInvokerEx _inner;
            private readonly Func<Func<Task<object>>, Task<object>> _handler;

            public InvokeWrapper(IFunctionInvokerEx inner, Func<Func<Task<object>>, Task<object>> handler)
            {
                _inner = inner;
                _handler = handler;
            }
            public IReadOnlyList<string> ParameterNames => _inner.ParameterNames;

            public Task<object> InvokeAsync(object instance, object[] arguments)
            {
                Func<Task<object>> inner = () => _inner.InvokeAsync(instance, arguments);
                return _handler(inner);
            }

            public object CreateInstance(IFunctionInstanceEx functionInstance)
            {
                return _inner.CreateInstance(functionInstance);
            }

            public object CreateInstance()
            {
                throw new NotSupportedException($"{nameof(CreateInstance)} is not supported. Please use the overload that accepts an instance of an {nameof(IFunctionInstance)}");
            }
        }
    }
}


text:
/**
 * @fileoverview Definitions for W3C's EventSource API.
 * @see http://www.w3.org/TR/eventsource/
 *
 * @externs
 */

/** @record */
function EventSourceInit() {};

/** @type {(boolean|undefined)} */
EventSourceInit.prototype.withCredentials;

/**
 * @constructor
 * @implements {EventTarget}
 * @param {string} url
 * @param {EventSourceInit=} opt_eventSourceInitDict
 */
function EventSource(url, opt_eventSourceInitDict) {}

/** @override */
EventSource.prototype.addEventListener = function(type, listener, opt_options) {
};

/** @override */
EventSource.prototype.removeEventListener = function(
    type, listener, opt_options) {};

/** @override */
EventSource.prototype.dispatchEvent = function(evt) {};

/**
 * @type {string}
 * @const
 */
EventSource.prototype.url;

/** @type {boolean} */
EventSource.prototype.withCredentials;

/**
 * @type {number}
 * @const
 */
EventSource.prototype.CONNECTING = 0;

/**
 * @type {number}
 * @const
 */
EventSource.prototype.OPEN = 1;

/**
 * @type {number}
 * @const
 */
EventSource.prototype.CLOSED = 2;

/**
 * @type {number}
 * @const
 */
EventSource.prototype.readyState;

/**
 * @type {?function(!Event)}
 */
EventSource.prototype.onopen = function(e) {};

/**
 * @type {?function(!MessageEvent<*>)}
 */
EventSource.prototype.onmessage = function(e) {};

/**
 * @type {?function(!Event)}
 */
EventSource.prototype.onerror = function(e) {};

/**
 * @type {function()}
 */
EventSource.prototype.close = function() {};


text:
from shared_schema_tenants.helpers.tenants import get_current_tenant, set_current_tenant
from shared_schema_tenants.helpers.tenant_extra_data import TenantExtraDataHelper
from shared_schema_tenants.helpers.tenant_settings import TenantSettingsHelper


text:
Apache Camel 3 Migration Guide
==============================

This document is intended for helping you migrate your Apache Camel applications
from version 2.x to 3.0.

Before you start
----------------

// TODO when we drop Java8
// TODO Apache Camel 3 requires Java 11. Java 8 are no longer supported.

Modularization of camel-core
----------------------------

One of the biggest change is the modularization of camel-core.
In Camel 2.x camel-core was one JAR file, which now has been splitup into many JARs as follows:

- camel-api
- camel-base
- camel-caffeine-lrucache
- camel-cloud
- camel-core
- camel-jaxp
- camel-main
- camel-management-api
- camel-management-impl
- camel-support
- camel-util
- camel-util-json

Maven users of Apache Camel can keep using the dependency *camel-core* which will have transitive dependency on all of its modules, and therefore no migration is needed.
However users whom wants to trim the size of the classes on the classpath, can use fine grained Maven dependency on only the modules needed.
You may find how to do that in the examples.

We have also modularized many of the core components and moved them out of `camel-core` to individual components:

- camel-attachments
- camel-bean
- camel-browse
- camel-controlbus
- camel-dataformat
- camel-dataset
- camel-direct
- camel-directvm
- camel-file
- camel-language
- camel-log
- camel-mock
- camel-properties
- camel-ref
- camel-rest
- camel-saga
- camel-scheduler
- camel-seda
- camel-stub
- camel-timer
- camel-validator
- camel-vm
- camel-xpath
- camel-xslt
- camel-zip-deflater

Migrating custom components
---------------------------

You should depend on `camel-support` and not `camel-core` directly.

The classes from `org.apache.camel.impl` that was intended to support Camel developers building custom components has been moved out of `camel-core` into `camel-support` into the `org.apache.camel.support` package. For example classes such as `DefaultComponent`, `DefaultEndpoint` etc has been moved and migration is necessary.

// TODO: Should we create a camel2-support JAR with an adapter to bridge between 2.x and 3.0

Migrating custom languages
--------------------------

The `LanguageAnnotation` annotation class has been moved from package `org.apache.camel.language` to `org.apache.camel.support.language`.

Deprecated APIs and Components
------------------------------

All deprecated APIs and components from Camel 2.x has been removed in Camel 3.

Migrating Camel applications
----------------------------

### Main class

The Camel `Main` class has been moved out of `camel-core` into `camel-main` so you should add that as dependency if you use Main.

### Properties component

The `properties` component has some advanced options removed: `propertyPrefix`, `propertySuffix`, and `fallbackToUnaugmented`; these options was never really useable for end users anyway. The option `propertiesResolver` has also been removed as you should use `PropertiesSource` instead.

### Removed components

We have removed all deprecated components from Camel 2.x, also including the old `camel-http` component. Instead you can use `camel-http4`.

We removed `camel-jibx` component which wasn't working on JDK 8.

The `camel-zookeeper` has its route policy functionality removed, instead use `ZooKeeperClusterService` or the `camel-zookeeper-master` component.

The `camel-jetty` component no longer supports producer (eg to) which has been removed, instead use `camel-http4` component instead.

### Renamed components

The `test` component has been renamed to `dataset-test` and moved out of `camel-core` into `camel-dataset` JAR.

We have also renamed `camel-jetty9` to `camel-jetty`.

### Properties component

The properties component will now use OS environment variables as perferred value. This means you can set an OS environment variable which will override any property values that has been set in property files, JVM system properties etc. You can configure this with the `environmentVariableMode` option on the properties component.

### <setHeader> and <setProperty> in XML DSL

We have renamed the attribute `headerName` and `propertyName` in the XML DSL for the `<setHeader>` and `<setProperty`> EIPs, to be just `name`.

So migrate

    <setHeader headerName="foo"><simple>Hello ${body}</simple></setHeader>

To

    <setHeader name="foo"><simple>Hello ${body}</simple></setHeader>

And the same for `<setProperty>`.

### javax.script

The `camel-script` component has been removed and there is no support for javax.script, which is also deprecated in the JDK and to be removed from Java 11 onwards.

### Attachments API on Message

The attachments API (javax.activation) has been moved out of `org.apache.camel.message` into an extension `org.apache.camel.attachment.AttachmentMessage` from the `camel-attachments` JAR.

To use this API you can get it via the `getMessage` method on `Exchange`:

    AttachmentMessage am = exchange.getMessage(AttachmentMessage.class);
    am.addAttachment("myAtt", new DataHandler(...));

### Mock component

The `mock` component has been moved out of `camel-core` and as part of this work, we had to remove a number of methods on its _assertion clause builder_ that were seldom in use.

### ActiveMQ

If you are using the `activemq-camel` component, then you should migrate to use `camel-activemq` component, where the component name has changed from `org.apache.activemq.camel.component.ActiveMQComponent` to `org.apache.camel.component.activemq.ActiveMQComponent`.

### AWS

The component `camel-aws` has been splitted in multiple components:

- camel-aws-cw
- camel-aws-ddb (which contains both ddb and ddbstreams components)
- camel-aws-ec2
- camel-aws-ecs
- camel-aws-eks
- camel-aws-iam
- camel-aws-kinesis (which contains both kinesis and kinesis-firehose components)
- camel-aws-kms
- camel-aws-lambda
- camel-aws-mq
- camel-aws-s3
- camel-aws-sdb
- camel-aws-ses
- camel-aws-sns
- camel-aws-sqs
- camel-aws-swf

So you'll have to add explicitly the dependencies for these components. From the OSGi perspective, there is still a `camel-aws` Karaf feature, which includes all the components features.

### JMX

If you run Camel standalone with just `camel-core` as dependency, and you want JMX enabled out of the box, then you need to add `camel-management-impl` as dependency.

For using `ManagedCamelContext` you now need to get this an extension from `CamelContext` as follows:

    ManagedCamelContext managed = camelContext.getExtension(ManagedCamelContext.class);

### Configuring global options on CamelContext

In Camel 2.x we have deprecated `getProperties` on `CamelContext` in favour of `getGlobalOptions`, so you should migrate to:

    context.getGlobalOptions().put("CamelJacksonEnableTypeConverter", "true");
    context.getGlobalOptions().put("CamelJacksonTypeConverterToPojo", "true");

... and in XML:

    <globalOptions>
      <globalOption key="CamelJacksonEnableTypeConverter" value="true"/>
      <globalOption key="CamelJacksonTypeConverterToPojo" value="true"/>
    </globalOptions>

### Extended CamelContext

The APIs on `CamelContext` has been reducded a bit to focus on relevant API for Camel end users. The advanced use-cases and for SPI and component developers, then some of the APIs from `CamelContext` has been moved to `ExtendedCamelContext` which you can access via adapt:

    ExtendedCamelContext ecc = context.adapt(ExtendedCamelContext.class);

### Main class

The `Main` class from `camel-core`, `camel-spring` and `camel-cdi` has been modified to only support a single `CamelContext` which was really its intention, but there was some old crufy code for multiple Camels. The method `getCamelContextMap` has been removed, and there is just a `getCamelContext` method now.

### POJO annotations

The `ref` attribute on `@Consume`, `@Produce` and `@EndpointInject` has been removed. Instead use the ref component in the `uri` attribute, eg `uri = "ref:myName"`.

The uri attribute has been deprecated, instead use value, which allows a shorthand style, from using `@Consume(uri = "jms:cheese")` to `@Consume("jms:cheese")`.

### Routes with multiple inputs

In Camel 2.x you could have 2 or more inputs to Camel routes, however this was not supported in all use-cases in Camel, and this functionality is seldom in use. This has
also been deprecated in Camel 2.x. In Camel 3 we have removed the remaining code for specifying multiple inputs to routes, and its now only possible to specify exactly only 1 input to a route.

### JSon DataFormat

The default JSon library with the JSon dataformat has changed from `XStream` to `Jackson`.

### Zip and GZip DataFormat

The zip and gzip dataformat has been renamed to zipdeflater and gzipdeflater as they are for deflating using the zip/gzip compression; and not for working with zip/gzip files. Instead use camel-zipfile dataformat. Also these dataformats has been moved out of `camel-core` into `camel-zip-deflater` JAR. The XML and Java DSL has also been modified so you should migrate there too to use their new names. And if you use these data formats you need to add the `camel-zip-deflater` as dependency as they are no longer included as transitive dependency with `camel-core`.

### Simple language

The functionality to change the simple language tokens for start/end functions has been removed. The default tokens with `${xxx}` and `$simple{xxx}` is now hardcoded (optimized). The functionality to change these tokens was never really in use and would only confuse Camel users if a new syntax are in use.

### Moved APIs

The following API changes may affect your existing Camel applications, which needs to be migrated.

#### CamelContext

The methods on `CamelContext` that are related to catalog has been moved into a new `CatalogCamelContext` interface, which you can access by adapting:

    CatalogCamelContext ccc = context.adapt(CatalogCamelContext.class);

The `loadRouteDefinitions` and `loadRestDefinitions` on `ModelCamelContext` has been changed to `addRouteDefinitions` and `addRestDefinitions` to be aligned with the other methods. You can find loader methods on the `ModelHelper` utility class.

#### Checked vs unchecked exceptions

Most of the Camel exception classes has been migrated to be unchecked (eg extends `RuntimeException`).

Also the lifecycle of the `start`, `stop` and `suspend`, `resume` methods on `Service` and `SuspendableService` has been changed to not throw checked exceptions.

#### Generic Information

The class `SimpleRegistry` is moved from `org.apache.camel.impl` to `org.apache.camel.support`. Also you should favour using the `org.apache.camel.support.DefaultRegistry` instead. Also you should use the `bind` operation instead of `put` to add entries to the `SimpleRegistry` or `DefaultRegistry`.

The class `CompositeRegistry` and `PropertyPlaceholderDelegateRegistry` has been deleted. Instead use `DefaultRegistry`.

The classes from `org.apache.camel.impl` that was intended to support Camel developers building custom components has been moved out of `camel-core` into `camel-support` into the `org.apache.camel.support` package. If you have built custom Camel components that may have used some of these APIs you would then need to migrate.  A large part of classes from the `org.apache.camel.impl` package have been moved to the `org.apache.camel.impl.engine` package in `camel-base`.

All the classes in `org.apache.camel.util.component` has been moved from the camel-core JAR to the package `org.apache.camel.support.component` in the `camel-support` JAR.

The method `xslt` has been removed from `org.apache.camel.builder.AggregationStrategies`. Instead use the `XsltAggregationStrategy` from `camel-xslt` JAR directly.

The getter/setter for `bindingMode` on `RestEndpoint` has been changed to use type `org.apache.camel.spi.RestConfiguration.RestBindingMode` from `camel-api` JAR. Instead of using this type class you can also call the setter method with string type instead.

The `activemq-camel` component has been moved from ActiveMQ into Camel and it is now called `camel-activemq`, the package has been changed accordingly to `org.apache.camel.component.activemq`

The method `includeRoutes` on `RouteBuilder` has been removed. This functionality was not fully in use and was deprecated in Camel 2.x.

The exception `PredicateValidationException` has been moved from package `org.apache.camel.processor.validation` to `org.apache.camel.support.processor.validation.PredicateValidationException`.

The class `org.apache.camel.util.toolbox.AggregationStrategies` has been moved to `org.apache.camel.builder.AggregationStrategies`.

The class `org.apache.camel.processor.aggregate.AggregationStrategy` has been moved to `org.apache.camel.AggregationStrategy`.

The class `org.apache.camel.processor.loadbalancer.SimpleLoadBalancerSupport` has been removed, instead use `org.apache.camel.processor.loadbalancer.LoadBalancerSupport`.

The class `org.apache.camel.management.JmxSystemPropertyKeys` has been moved to `org.apache.camel.api.management.JmxSystemPropertyKeys`.

The class `org.apache.camel.builder.xml.XPathBuilder` has been moved to `org.apache.camel.language.xpath.XPathBuilder` and in the `camel-xpath` JAR.

The annotation `org.apache.camel.language.XPath` has been moved to `org.apache.camel.language.xpath.XPath` and in the `camel-xpath` JAR.

The exception `org.apache.camel.builder.xml.InvalidXPathExpression` has been renamed to `org.apache.camel.language.xpath.InvalidXPathException` and in the `camel-xpath` JAR.

The annotation `org.apache.camel.language.Bean` has been moved to `org.apache.camel.language.bean.Bean` and in the `camel-bean` JAR.

The annotation `org.apache.camel.language.Simple` has been moved to `org.apache.camel.language.simple.Simple`.

The annotation `org.apache.camel.Constant` has been removed, use `@Simple` instead.

The annotation `org.apache.camel.language.SpEL` has been moved to `org.apache.camel.language.spel.SpEL` and in the `camel-spring` JAR.

Rename various APIs in camel-core to fix the typo `chiper` to `cipher`.

The classes `ReloadStrategySupport` and `FileWatcherReloadStrategy` has been removed.

The `MessageHistoryFactory` interface has some options to filter and copy the message and a slight change in its API.

Removed `TypeConverterAware` as you shoudld instead use `Exchange` as parameter to the type converter method.

The `Component` and `DataFormat` interfaces now extend `Service` as components and data formats should also have service contract to manage their lifecycle. The default base classes already implements these interfaces.

#### camel-test

If you are using camel-test and override the `createRegistry` method, for example to register beans from the `JndiRegisty` class, then this is no longer necessary, and instead
you should just use the `bind` method from the `Registry` API which you can call directly from `CamelContext`, such as:

    context.getRegistry().bind("myId", myBean);

#### Controlling routes

The `startRoute`, `stopRoute`, `suspendRoute`, `resumeRoute`, `getRouteStatus`, and other related methods on `CamelContext` has been moved to the `RouteController` as shown below:

    context.getRouteController().startRoute("myRoute");

#### JMX events

All the events from package `org.apache.camel.management.event` has been moved to the class `org.apache.camel.spi.CamelEvent` as sub-classes, for example the event for CamelContext started would be `CamelEvent.CamelContextStartedEvent`.

#### AdviceWith

Testing using `adviceWith` currently needs to be changed from:

    context.getRouteDefinition("start").adviceWith(context, new RouteBuilder() {
       ...
    }

to using style:

    RouteReifier.adviceWith(context.getRouteDefinition("start"), context, new RouteBuilder() {
        ...
    }

We are planning on making this easier in 3.0.0-M2 onwards.

#### Generic Classes

The class `JNDIContext` has been moved from `org.apache.camel.util.jndi.JNDIContext` in the camel-core JAR to `org.apache.camel.support.jndi.JNDIContext` and moved to the `camel-support` JAR.

#### EIPs

The `circuitBreaker` load-balancer EIP was deprecated in Camel 2.x, and has been removed. Instead use Hystrix EIP as the load-balancer.

The class `ThreadPoolRejectedPolicy` has been moved from `org.apache.camel.ThreadPoolRejectedPolicy` to `org.apache.camel.util.concurrent.ThreadPoolRejectedPolicy`.

#### Languages

The simple language `property` function was deprecated in Camel 2.x and has been removed. Use `exchangeProperty` as function name.

The terser language has been renamed from terser to hl7terser.

#### JSSE

The classes from `org.apache.camel.util.jsse` has been moved to `org.apache.camel.support.jsse`.

#### Helpers and support

The class `AsyncProcessorHelper` has been moved from `org.apache.camel.util.AsyncProcessorHelper` in the camel-core JAR to `org.apache.camel.support.AsyncProcessorHelper` and moved to the `camel-support` JAR.

The class `AsyncProcessorConverterHelper` has been moved from `org.apache.camel.util.AsyncProcessorConverterHelper` in the camel-core JAR to `org.apache.camel.support.AsyncProcessorConverterHelper` and moved to the `camel-support` JAR.

The class `CamelContextHelper` has been moved from `org.apache.camel.util.CamelContextHelper` in the camel-core JAR to `org.apache.camel.support.CamelContextHelper` and moved to the `camel-support` JAR.

The class `EndpointHelper` has been moved from `org.apache.camel.util.EndpointHelper` in the camel-core JAR to `org.apache.camel.support.EndpointHelper` and moved to the `camel-support` JAR.

The class `EventHelper` has been moved from `org.apache.camel.util.EventHelper` in the camel-core JAR to `org.apache.camel.support.EventHelper` and moved to the `camel-support` JAR.

The class `ExchangeHelper` has been moved from `org.apache.camel.util.ExchangeHelper` in the camel-core JAR to `org.apache.camel.support.ExchangeHelper` and moved to the `camel-support` JAR.

The class `GZIPHelper` has been moved from `org.apache.camel.util.GZIPHelper` in the camel-core JAR to `org.apache.camel.support.GZIPHelper` and moved to the `camel-support` JAR.

The class `JsonSchemaHelper` has been moved from `org.apache.camel.util.JsonSchemaHelper` in the camel-core JAR to `org.apache.camel.support.JsonSchemaHelper` and moved to the `camel-support` JAR.

The class `MessageHelper` has been moved from `org.apache.camel.util.MessageHelper` in the camel-core JAR to `org.apache.camel.support.MessageHelper` and moved to the `camel-support` JAR.

The class `ObjectHelper` has been moved from `org.apache.camel.util.ObjectHelper` in the camel-core JAR and splitted into `org.apache.camel.support.ObjectHelper` and moved to the `camel-support` JAR and into `org.apache.camel.util.ObjectHelper` and moved to the `camel-util` JAR. This has been done to isolate the methods using `camel-api` JAR: those method are in the `camel-support` JAR, the other in the `camel-util` JAR.

The class `PlatformHelper` has been moved from `org.apache.camel.util.PlatformHelper` in the camel-core JAR to `org.apache.camel.support.PlatformHelper` and moved to the `camel-support` JAR.

The class `PredicateAssertHelper` has been moved from `org.apache.camel.util.PredicateAssertHelper` in the camel-core JAR to `org.apache.camel.support.PredicateAssertHelper` and moved to the `camel-support` JAR.

The class `ResolverHelper` has been moved from `org.apache.camel.util.ResolverHelper` in the camel-core JAR to `org.apache.camel.support.ResolverHelper` and moved to the `camel-support` JAR.

The class `ResourceHelper` has been moved from `org.apache.camel.util.ResourceHelper` in the camel-core JAR to `org.apache.camel.support.ResourceHelper` and moved to the `camel-support` JAR.

The class `RestProducerFactoryHelper` has been moved from `org.apache.camel.spi.RestProducerFactoryHelper` in the camel-core JAR to `org.apache.camel.support.RestProducerFactoryHelper` and moved to the `camel-support` JAR.

The class `ServiceHelper` has been moved from `org.apache.camel.util.ServiceHelper` in the camel-core JAR to `org.apache.camel.support.service.ServiceHelper` and moved to the `camel-api` JAR.

The class `UnitOfWorkHelper` has been moved from `org.apache.camel.util.UnitOfWorkHelper` in the camel-core JAR to `org.apache.camel.support.UnitOfWorkHelper` and moved to the `camel-support` JAR.

#### Idempotent Repositories

The class `FileIdempotentRepository` has been moved from `org.apache.camel.processor.idempotent.FileIdempotentRepository` in the camel-core JAR to `org.apache.camel.support.processor.idempotent.FileIdempotentRepository` and moved to the `camel-suppor` JAR.

The class `MemoryIdempotentRepository` has been moved from `org.apache.camel.processor.idempotent.MemoryIdempotentRepository` in the camel-core JAR to `org.apache.camel.support.processor.idempotent.MemoryIdempotentRepository` and moved to the `camel-suppor` JAR.

#### Route Policies

The class `org.apache.camel.impl.RoutePolicySupport` has been moved to `org.apache.camel.support.RoutePolicySupport`. The return type from `startConsumer` and `stopConsumer` has been changed from `boolean` to `void` as they always returned `true` before.

The class `org.apache.camel.impl.ThrottlingInflightRoutePolicy` has been moved to `org.apache.camel.throttling.ThrottlingInflightRoutePolicy`

#### Aggregation

The class `XsltAggregationStrategy` has been moved from `org.apache.camel.builder.XsltAggregationStrategy` in the camel-core JAR to `org.apache.camel.component.xslt.XsltAggregationStrategy` and moved to the `camel-xslt` JAR.

When using the option `groupedExchange` on the aggregator EIP then the output of the aggregation is now longer also stored in the exchange property `Exchange.GROUPED_EXCHANGE`. This behaviour was already deprecated from Camel 2.13 onwards.

### Fallback type converters

The `@FallbackConverter` annotation has been removed, and you should use `@Converter(fallback = true)` instead. Also you can set `@Converter(loader = true)` on the converter class to allow Camel to generate source code for loading type converters in a faster way.

### Removed JMX APIs for explaining EIPs, components, etc.

The APIs that could find, and explain EIPs, components, endpoints etc has been removed. These APIs have little value for production runtimes, and you can obtain this kind of information via the `camel-catalog`. Also the related Camel Karaf commands that used these APIs has been removed.

### Other changes

The default for use breadcrumbs has been changed from `true` to `false`.

The `ProducerTemplate` and `ConsumerTemplate` now fails when being used, if `CamelContext` has not been started first.

### XML DSL Migration

The XML DSL has been changed slightly.

The custom load balancer EIP has changed from `<custom>` to `<customLoadBalancer>`

The XMLSecurity data format has renamed the attribute `keyOrTrustStoreParametersId` to `keyOrTrustStoreParametersRef` in the `<secureXML>` tag.

The `<zipFile>` data format has been renamed to `<zipfile>`.

Migrating Camel Maven Plugins
-----------------------------

The `camel-maven-plugin` has been splitup into two maven plugins:

- camel-maven-plugin
- camel-report-maven-plugin

The former has the `run` goal, which is intended for quickly running Camel applications standalone.

The `camel-report-maven-plugin` has the `validate` and `route-coverage` goals which is used for generating reports of your Camel projects such as validating Camel endpoint URIs and route coverage reports, etc.

Known Issues
------------

There is an issue with MDC logging and correctly transfering the Camel breadscrumb id's under certain situations with routing over asynchronous endpoints, due to the internal routing engine refactorings. This change also affects the `camel-zipkin` component, which may not correctly transfer the span id's when using MDC logging as well.

The tracer feature does not work (the implementation from Camel 2.x was deprecated), and we plan to implement a new and improved tracer.


text:
/**
 * Module dependencies.
 */

var Q           = require('q');
var http        = require('http');
var extend      = require('util')._extend;
var querystring = require("querystring");

/**
 * Module variables.
 */
// Constants
var APIKEY;
// Variables
var self = this;

/**
 * Exports.
 */
exports.init = function(apikey) {
	APIKEY = apikey;
	return self;
};

exports.Volumes = function() {
	var url = new ApiURL(APIKEY);

	/**
	 * Search volumes given the title.
	 */
	this.search = function(query, page, limit) {
		var deferred = Q.defer();

		if (query) {

			url.path = "search";
			url.params = {
				'resource_type': 'volume',
				'resources': 'volume',
				'limit': limit || 100,
				'page': page || 1,
				'query': query
			};

			// console.log(url.getURL());
			_get(url.getURL())
				.then(function (data) {
					deferred.resolve(data);
				}, function (err) {
					deferred.reject(err);
				});
		} else {
			deferred.reject('No query specified.');
		}

        return deferred.promise;
	};

	/**
	 * Get all the volumes.
	 */
	this.getAll = function (page, limit) {
		url.path = "volumes";
		url.params = {
			'limit': limit || 100,
			'page': page || 1
		};

        var deferred = Q.defer();

        _get(url.getURL())
            .then(function (data) {
                deferred.resolve(data);
            }, function (err) {
                deferred.reject(err);
            });

        return deferred.promise;
	};

	/**
	 * Get volume.
	 */
	this.getByID = function (id) {
		var url = new ApiURL(APIKEY);
		url.path = "volume/4050-" + id;

        var deferred = Q.defer();

        // console.log(url.getURL());
        _get(url.getURL())
            .then(function (data) {
                deferred.resolve(data);
            }, function (err) {
                deferred.reject(err);
            });

        return deferred.promise;
	};
};

// ############################################
// # UTILS
// ############################################
var ApiURL = function(apikey) {
	var self = this;

	if (!apikey)
		throw new Error("API key not found.");

	var key = apikey;
	var url = 'http://www.comicvine.com/api/';

	this.path = "characters";
	this.params = {};

	this.getURL = function() {

		var p = extend({}, self.params);

		p.api_key = apikey;
		p.format = 'json';

		return url + self.path + "/?" + querystring.stringify(p);
	};
};

var _get = function(url, callback) {
    var deferred = Q.defer();
	var result = '';
	http.get(url, function(httpres) {
		httpres.on('data', function(chunk) {
			result += chunk;
		});

		httpres.on('end', function() {
            deferred.resolve(JSON.parse(result));
		});

	}).on('error', function(e) {
        console.log('problem with request: ' + e.message);
        deferred.reject(err);
	});

    return deferred.promise;
};


text:
package org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions;

import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement;

/**
 * Represents lValue of tuple assignment.<br/>
 * Example: {@code (a, b)} in {@code (a, b) = c}.
 */
public interface GrTuple extends GroovyPsiElement {

  @Nullable
  @Override
  GrTupleAssignmentExpression getParent();

  int indexOf(@NotNull PsiElement element);

  @NotNull
  GrReferenceExpression[] getExpressions();
}


text:
xtools
======

Cross platform dev tools