Register new mixin type if does not exists on workspace the add it to the given node

@param session the JCR session
@param node the node where to add the mixin
@param mixin the mixin name to add
@throws RepositoryException
334921
public static void registerAndAddMixinType(Session session, Node node, String mixin) throws RepositoryException {
        registerMixinType(session, mixin);
        if (!Arrays.asList(node.getMixinNodeTypes()).contains(mixin)) {
            node.addMixin(mixin);
        }
    }
830944
@Override
    public boolean add(RepositoryConnection repoConnection) {
        boolean ret = super.add(repoConnection);
        if (repoConnection instanceof RestRepositoryConnection) {
            ((RestRepositoryConnection) repoConnection).setUserAgent(_userAgent);
        }
        return ret;
    }
1080377
public synchronized final void initialize() throws RepositoryException {
        if (!initialized) {
            try {
                doInitialize();
                initialized = true;
            } catch (RuntimeException e) {
                throw new RepositoryException(e);
            }
        }
    }
1252732
private void startElementMixin(final Attributes attributes) {

        LOG.debug("Found mixin declaration");
        try {
            this.addMixin(this.nodeStack.peek(), attributes);
        } catch (final RepositoryException e) {
            throw new AssertionError("Could not add mixin type", e);
        }
    }
115380
private synchronized void registerNamespace(String prefix, String uri, boolean persist) throws NamespaceException, RepositoryException
   {
      if (namespaces.containsKey(prefix))
      {
         unregisterNamespace(prefix);
      }
      else if (prefixes.containsKey(uri))
      {
         unregisterNamespace(prefixes.get(uri));
      }
      if (persister != null && persist)
      {
         persister.addNamespace(prefix, uri);
      }
      final String newPrefix = new String(prefix);
      final String newUri = new String(uri);

      namespaces.put(newPrefix, newUri);
      prefixes.put(newUri, newPrefix);
   }
45613
@Override
    public <E extends Exception> void add(Iteration<? extends Statement, E> statements, Resource... contexts) throws RepositoryException, E {
        while(statements.hasNext()){
            Statement st = statements.next();
            add(st.getSubject(), st.getPredicate(), st.getObject(), mergeResource(st.getContext(), contexts));
        }
    }
1366956
public void addRepository(String url) throws ProjectException {
        List<Repository> repositories = getRepositories();

        if ( repositories == null ) {
            repositories = new ArrayList<Repository>();
        }

        try {
            Repository repository = RepoBuilder.repositoryFromUrl( url );
            repositories.add( repository );
        } catch (MalformedURLException e) {
            throw new ProjectException( e );
        }

        getMavenModel().setRepositories( repositories );
    }
119301
private void createVersion(Node fileNode, InputStream inputStream, String autoVersion, List<String> mixins) throws RepositoryException
   {
      if (!fileNode.isNodeType(VersionHistoryUtils.MIX_VERSIONABLE))
      {
         if (fileNode.canAddMixin(VersionHistoryUtils.MIX_VERSIONABLE))
         {
            fileNode.addMixin(VersionHistoryUtils.MIX_VERSIONABLE);
            fileNode.getSession().save();
         }
         if (!(CHECKIN_CHECKOUT.equals(autoVersion)))
         {
            fileNode.checkin();
            fileNode.getSession().save();
         }
      }
      if (CHECKIN_CHECKOUT.equals(autoVersion))
      {
         fileNode.checkin();
         fileNode.checkout();
         fileNode.getSession().save();
         updateContent(fileNode, inputStream, mixins);
         fileNode.getSession().save();
      }
      else
      {
         createVersion(fileNode, inputStream, mixins);
      }
   }
1350003
private Collection<JcrProperty> getProperties( String repository, String workspace, String path, Node node ) throws RepositoryException {
        ArrayList<PropertyDefinition> names = new ArrayList<>();
        
        NodeType primaryType = node.getPrimaryNodeType();
        PropertyDefinition[] defs = primaryType.getPropertyDefinitions();

        names.addAll(Arrays.asList(defs));
        
        NodeType[] mixinType = node.getMixinNodeTypes();
        for (NodeType type : mixinType) {
            defs = type.getPropertyDefinitions();
            names.addAll(Arrays.asList(defs));
        }

        ArrayList<JcrProperty> list = new ArrayList<>();
        for (PropertyDefinition def :  names) {
            
            String name = def.getName();
            String type = PropertyType.nameFromValue(def.getRequiredType());
            
            Property p = null;
            try {
                p = node.getProperty(def.getName());
            } catch (PathNotFoundException e) {
            }

            String display = values(def, p);
            String value = def.isMultiple() ? multiValue(p)
                    : singleValue(p, def, repository, workspace, path);
            list.add(new JcrProperty(name, type, value, display));
            
        }
        return list;
    }
23469
public void addNamespaces(Map<String, String> namespaceMap) throws RepositoryException
   {
      if (!started)
      {
         log.warn("Unable save namespaces in to the storage. Storage not initialized");
         return;
      }

      PlainChangesLog changesLog = new PlainChangesLogImpl();
      for (Map.Entry<String, String> entry : namespaceMap.entrySet())
      {
         String prefix = entry.getKey();
         String uri = entry.getValue();

         if (prefix != null)
         {
            if (log.isDebugEnabled())
               log.debug("Namespace " + uri + ":" + prefix);
            internallAdd(changesLog, prefix, uri);
         }
      }
      dataManager.save(new TransactionChangesLog(changesLog));

   }
1184886
public function registerNodeTypes(SessionInterface $session)
    {
        $cnd = <<<CND
// register phpcr_locale namespace
<$this->localeNamespace='$this->localeNamespaceUri'>
// register phpcr namespace
<$this->phpcrNamespace='$this->phpcrNamespaceUri'>
[phpcr:managed]
mixin
- phpcr:class (STRING)
- phpcr:classparents (STRING) multiple
CND;

        $nodeTypeManager = $session->getWorkspace()->getNodeTypeManager();
        $nodeTypeManager->registerNodeTypesCnd($cnd, true);
    }
112412
public void initRegistryEntry(String groupName, String entryName) throws RepositoryException,
      RepositoryConfigurationException
   {

      String relPath = EXO_REGISTRY + "/" + groupName + "/" + entryName;
      for (RepositoryEntry repConfiguration : repConfigurations())
      {
         String repName = repConfiguration.getName();
         SessionProvider sysProvider = SessionProvider.createSystemProvider();
         Node root = session(sysProvider, repositoryService.getRepository(repName)).getRootNode();
         if (!root.hasNode(relPath))
         {
            root.addNode(relPath, EXO_REGISTRYENTRY_NT);
            root.save();
         }
         else
         {
            LOG.info("The RegistryEntry " + relPath + "is already initialized on repository " + repName);
         }
         sysProvider.close();
      }
   }
760592
@Process(actionType = AddJdbcRepository.class)
    public void addJdbcRepository(final AddJdbcRepository action, final Channel channel) {
        operationDelegate.onCreateResource(JDBC_REPOSITORY_ADDRESS,
                action.getProperty().getName(), action.getProperty().getValue(),
                new ChannelCallback(statementContext, channel));
    }
859163
void createStructure() throws RepositoryException
   {
      Session session = getStorageSession();
      try
      {
         Node storage = session.getRootNode().addNode(storagePath.substring(1), STORAGE_NODETYPE);

         storage.addNode(STORAGE_JOS_USERS, STORAGE_JOS_USERS_NODETYPE);
         storage.addNode(STORAGE_JOS_GROUPS, STORAGE_JOS_GROUPS_NODETYPE);
         Node storageTypesNode = storage.addNode(STORAGE_JOS_MEMBERSHIP_TYPES, STORAGE_JOS_MEMBERSHIP_TYPES_NODETYPE);
         Node anyNode = storageTypesNode.addNode(JOS_MEMBERSHIP_TYPE_ANY);
         anyNode.setProperty(MembershipTypeHandlerImpl.MembershipTypeProperties.JOS_DESCRIPTION, JOS_DESCRIPTION_TYPE_ANY);

         session.save(); // storage done configure
      }
      finally
      {
         session.logout();
      }
   }
1125520
@Override
    public void addedStatement(final Statement input) {
        if (Operation.ADD == statements.get(input)) {
            return;
        }
        try {
            final Resource subject = input.getSubject();
            validateSubject(subject);
            LOGGER.debug(">> adding statement {}", input);

            final Statement s = jcrRdfTools.skolemize(idTranslator, input, topic.toString());

            final FedoraResource resource = idTranslator.convert(s.getSubject());
            final FedoraResource description = resource.getDescription();

            // special logic for handling rdf:type updates.
            // if the object is an already-existing mixin, update
            // the node's mixins. If it isn't, just treat it normally.
            final Property property = s.getPredicate();
            final RDFNode objectNode = s.getObject();
            if (property.equals(RDF.type) && objectNode.isResource()) {
                final Resource mixinResource = objectNode.asResource();
                jcrRdfTools.addMixin(description, mixinResource, input.getModel().getNsPrefixMap());
                statements.put(input, Operation.ADD);
                return;
            }

            jcrRdfTools.addProperty(description, property, objectNode, input.getModel().getNsPrefixMap());
            statements.put(input, Operation.ADD);
        } catch (final ConstraintViolationException e) {
            throw e;
        } catch (final javax.jcr.AccessDeniedException e) {
            throw new AccessDeniedException(e);
        } catch (final RepositoryException | RepositoryRuntimeException e) {
            exceptions.add(e);
        }

    }
450721
public static boolean hasMixin(final Node node) {
        try {
            return node.isNodeType(FEDORA_WEBAC_ACL);
        } catch (final RepositoryException e) {
            throw new RepositoryRuntimeException(e);
        }
    }
310929
function addInitiatedOnce(name, mixin, params) {
            mixin = mixin.call(this, params || []);
            // find the name placeholder in the return arr and replace it with the mixin
            var index = rtn.indexOf(name);
            rtn.splice(index, 1, mixin);
        }