Compose unique workspace name in global JCR instance.
174067
private String composeWorkspaceUniqueName(String repositoryName, String workspaceName)
   {
      StringBuilder builder = new StringBuilder();
      builder.append(repositoryName);
      builder.append('/');
      builder.append(workspaceName);
      builder.append('/');

      return builder.toString();
   }
223232
def ensure_default_namespace(self) -> Namespace:
        """"""
        namespace = self.get_namespace_by_keyword_version(BEL_DEFAULT_NAMESPACE, BEL_DEFAULT_NAMESPACE_VERSION)

        if namespace is None:
            namespace = Namespace(
                name='BEL Default Namespace',
                contact='charles.hoyt@scai.fraunhofer.de',
                keyword=BEL_DEFAULT_NAMESPACE,
                version=BEL_DEFAULT_NAMESPACE_VERSION,
                url=BEL_DEFAULT_NAMESPACE_URL,
            )

            for name in set(chain(pmod_mappings, gmod_mappings, activity_mapping, compartment_mapping)):
                entry = NamespaceEntry(name=name, namespace=namespace)
                self.session.add(entry)

            self.session.add(namespace)
            self.session.commit()

        return namespace
829669
private void addCodeToRequireSoyNamespaces(SoyFileNode soyFile) {

    String prevCalleeNamespace = null;
    Set<String> calleeNamespaces = new TreeSet<>();
    for (CallBasicNode node : new FindCalleesNotInFileVisitor().exec(soyFile)) {
      String calleeNotInFile = node.getCalleeName();
      int lastDotIndex = calleeNotInFile.lastIndexOf('.');
      calleeNamespaces.add(calleeNotInFile.substring(0, lastDotIndex));
    }

    for (String calleeNamespace : calleeNamespaces) {
      if (calleeNamespace.length() > 0 && !calleeNamespace.equals(prevCalleeNamespace)) {
        jsCodeBuilder.addGoogRequire(GoogRequire.create(calleeNamespace));
        prevCalleeNamespace = calleeNamespace;
      }
    }
  }
1211312
private NamespaceContext buildNamespaceContext(Node node) {
        SimpleNamespaceContext simpleNamespaceContext = new SimpleNamespaceContext();
        Map<String, String> namespaces = XMLUtils.lookupNamespaces(node.getOwnerDocument());

        // add default namespace mappings
        namespaces.putAll(namespaceContextBuilder.getNamespaceMappings());

        simpleNamespaceContext.setBindings(namespaces);

        return simpleNamespaceContext;
    }
480458
public EjbJarDescriptor addNamespace(String name, String value)
   {
      model.attribute(name, value);
      return this;
   }
171848
public PersistenceDescriptor addNamespace(String name, String value)
   {
      model.attribute(name, value);
      return this;
   }
53572
public void setWorkspaceNames(String[] values) {
        col2.combo.setValueMap(values);
        if (values.length > 0) {
            col2.combo.setValue(values[0]);
        }
    }
303766
def ensure_workspace(self, name, layout, workspace_id):
        
        workspace = next((workspace for workspace in self.document_model.workspaces if workspace.workspace_id == workspace_id), None)
        if not workspace:
            workspace = self.new_workspace(name=name, layout=layout, workspace_id=workspace_id)
        self._change_workspace(workspace)
35399
public synchronized static String getUniqueFile(TaskAttemptContext context,
                                                  String name,
                                                  String extension) {
    TaskID taskId = context.getTaskAttemptID().getTaskID();
    int partition = taskId.getId();
    StringBuilder result = new StringBuilder();
    result.append(name);
    result.append('-');
    result.append(taskId.isMap() ? 'm' : 'r');
    result.append('-');
    result.append(NUMBER_FORMAT.format(partition));
    result.append(extension);
    return result.toString();
  }
174381
public PortletDescriptor addNamespace(String name, String value)
   {
      model.attribute(name, value);
      return this;
   }
836786
public static JClass localForName(String name)
  {
    JClassLoaderWrapper jLoader = JClassLoaderWrapper.create();
    
    return jLoader.forName(name);
  }
217719
public void registerWorkspace(final WorkspaceEntry wsConfig) throws RepositoryException,
      RepositoryConfigurationException
   {
      // Need privileges to manage repository.
      SecurityManager security = System.getSecurityManager();
      if (security != null)
      {
         security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
      }

      try
      {
         SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction<Void>()
         {
            public Void run() throws RepositoryException, RepositoryConfigurationException
            {
               final boolean isSystem = config.getSystemWorkspaceName().equals(wsConfig.getName());

               if (getWorkspaceContainer(wsConfig.getName()) != null)
                  throw new RepositoryException("Workspace " + wsConfig.getName() + " already registered");

               final WorkspaceContainer workspaceContainer = new WorkspaceContainer(RepositoryContainer.this, wsConfig);
               registerComponentInstance(wsConfig.getName(), workspaceContainer);

               workspaceContainer.registerComponentInstance(wsConfig);

               workspaceContainer.registerComponentImplementation(StandaloneStoragePluginProvider.class);
               try
               {
                  final Class<?> containerType =
                     ClassLoading.forName(wsConfig.getContainer().getType(), RepositoryContainer.class);
                  workspaceContainer.registerComponentImplementation(containerType);
                  if (isSystem)
                  {
                     registerComponentInstance(new SystemDataContainerHolder((WorkspaceDataContainer)workspaceContainer
                        .getComponentInstanceOfType(WorkspaceDataContainer.class)));
                  }
               }
               catch (ClassNotFoundException e)
               {
                  throw new RepositoryConfigurationException("Class not found for workspace data container "
                     + wsConfig.getUniqueName() + " : " + e, e);
               }

               // cache type
               try
               {
                  String className = wsConfig.getCache().getType();
                  if (className != null && className.length() > 0)
                  {
                     workspaceContainer.registerComponentImplementation(ClassLoading.forName(className,
                        RepositoryContainer.class));
                  }
                  else
                     workspaceContainer.registerComponentImplementation(LinkedWorkspaceStorageCacheImpl.class);
               }
               catch (ClassNotFoundException e)
               {
                  log.warn("Workspace cache class not found " + wsConfig.getCache().getType()
                     + ", will use default. Error : " + e.getMessage());
                  workspaceContainer.registerComponentImplementation(LinkedWorkspaceStorageCacheImpl.class);
               }

               if (workspaceContainer.getComponentInstanceOfType(RPCService.class) != null)
               {
                  workspaceContainer.registerComponentImplementation(WorkspaceResumer.class);
               }

               if (workspaceContainer.getComponentInstanceOfType(QuotaManager.class) != null)
               {
                  workspaceContainer.registerComponentImplementation(WorkspaceQuotaManager.class);
               }

               workspaceContainer.registerComponentImplementation(CacheableWorkspaceDataManager.class);
               workspaceContainer.registerComponentImplementation(LocalWorkspaceDataManagerStub.class);
               workspaceContainer.registerComponentImplementation(ObservationManagerRegistry.class);

               if (wsConfig.getLockManager() != null && wsConfig.getLockManager().getType() != null)
               {
                  try
                  {
                     final Class<?> lockManagerType =
                        ClassLoading.forName(wsConfig.getLockManager().getType(), RepositoryContainer.class);
                     workspaceContainer.registerComponentImplementation(lockManagerType);
                  }
                  catch (ClassNotFoundException e)
                  {
                     throw new RepositoryConfigurationException("Class not found for workspace lock manager "
                        + wsConfig.getLockManager().getType() + ", container " + wsConfig.getUniqueName() + " : " + e,
                        e);
                  }
               }
               else
               {
                  throw new RepositoryConfigurationException(
                     "The configuration of lock manager is expected in container " + wsConfig.getUniqueName());
               }

               // Query handler
               if (wsConfig.getQueryHandler() != null)
               {
                  workspaceContainer.registerComponentImplementation(SearchManager.class);
                  workspaceContainer.registerComponentImplementation(QueryManager.class);
                  workspaceContainer.registerComponentImplementation(QueryManagerFactory.class);
                  workspaceContainer.registerComponentInstance(wsConfig.getQueryHandler());
                  if (isSystem)
                  {
                     workspaceContainer.registerComponentImplementation(SystemSearchManager.class);
                  }
               }

               // access manager
               if (wsConfig.getAccessManager() != null && wsConfig.getAccessManager().getType() != null)
               {
                  try
                  {
                     final Class<?> am = ClassLoading.forName(wsConfig.getAccessManager().getType(), RepositoryContainer.class);
                     workspaceContainer.registerComponentImplementation(am);
                  }
                  catch (ClassNotFoundException e)
                  {
                     throw new RepositoryConfigurationException(
                        "Class not found for workspace access manager " + wsConfig.getAccessManager().getType()
                           + ", container " + wsConfig.getUniqueName() + " : " + e, e);
                  }
               }

               // initializer
               final Class<?> initilizerType;
               if (wsConfig.getInitializer() != null && wsConfig.getInitializer().getType() != null)
               {
                  // use user defined
                  try
                  {
                     initilizerType = ClassLoading.forName(wsConfig.getInitializer().getType(), RepositoryContainer.class);
                  }
                  catch (ClassNotFoundException e)
                  {
                     throw new RepositoryConfigurationException("Class not found for workspace initializer "
                        + wsConfig.getInitializer().getType() + ", container " + wsConfig.getUniqueName() + " : " + e,
                        e);
                  }
               }
               else
               {
                  // use default
                  initilizerType = ScratchWorkspaceInitializer.class;
               }
               workspaceContainer.registerComponentImplementation(initilizerType);
               workspaceContainer.registerComponentImplementation(TransactionableResourceManager.class);
               workspaceContainer.registerComponentImplementation(SessionFactory.class);
               final LocalWorkspaceDataManagerStub wsDataManager =
                  (LocalWorkspaceDataManagerStub)workspaceContainer
                     .getComponentInstanceOfType(LocalWorkspaceDataManagerStub.class);

               if (isSystem)
               {
                  // system workspace
                  systemDataManager = wsDataManager;
                  registerComponentInstance(systemDataManager);
               }

               wsDataManager.setSystemDataManager(systemDataManager);

               if (!config.getWorkspaceEntries().contains(wsConfig))
                  config.getWorkspaceEntries().add(wsConfig);
               return null;
            }
         });

      }
      catch (PrivilegedActionException pae)
      {
         Throwable cause = pae.getCause();
         if (cause instanceof RepositoryConfigurationException)
         {
            throw (RepositoryConfigurationException)cause;
         }
         else if (cause instanceof RepositoryException)
         {
            throw (RepositoryException)cause;
         }
         else if (cause instanceof RuntimeException)
         {
            RuntimeException e = (RuntimeException)cause;
            int depth = 0;
            Throwable retval = e;
            while (retval.getCause() != null && depth < 100)
            {
               retval = retval.getCause();
               if (retval instanceof RepositoryException)
               {
                  throw new RepositoryException(retval.getMessage(), e);
               }
               else if (retval instanceof RepositoryConfigurationException)
               {
                  throw new RepositoryConfigurationException(retval.getMessage(), e);
               }
               else if (retval instanceof NameNotFoundException)
               {
                  throw new RepositoryException(retval.getMessage(), e);
               }
               depth++;
            }
            throw e;            
         }
         else
         {
            throw new RepositoryException(cause);
         }
      }      
   }
443807
function Workspace(args) {
  if (false === (this instanceof Workspace)) throw new Error('new operator required');
  args = args || {};
  if (!args.attributes) {
    args.attributes = [];
  }
  var userModelID = new Attribute.ModelID(new User());
  args.attributes.push(new Attribute({name: 'user', type: 'Model', value: userModelID}));
  args.attributes.push(new Attribute({name: 'deltas', type: 'Object', value: {}}));

//  var delta
//  this.deltas = [];

  Model.call(this, args);
  this.modelType = "Workspace";
}
1104028
public static void makeNameSpaceDataDir(Collection<File> dataDirs) throws IOException {
    for (File data : dataDirs) {
      try {
        DiskChecker.checkDir(data);
      } catch ( IOException e ) {
        LOG.warn("Invalid directory in: " + data.getCanonicalPath() + ": "
            + e.getMessage());
      }
    }
  }
437013
def write_namespaces(self, namespaces):
        """"""
        self.printer.writelines(
            "def _mako_get_namespace(context, name):",
                "try:",
                    "return context.namespaces[(__name__, name)]",
                "except KeyError:",
                    "_mako_generate_namespaces(context)",
                "return context.namespaces[(__name__, name)]",
            None, None
        )
        self.printer.writeline("def _mako_generate_namespaces(context):")


        for node in namespaces.values():
            if 'import' in node.attributes:
                self.compiler.has_ns_imports = True
            self.printer.start_source(node.lineno)
            if len(node.nodes):
                self.printer.writeline("def make_namespace():")
                export = []
                identifiers = self.compiler.identifiers.branch(node)
                self.in_def = True
                class NSDefVisitor(object):
                    def visitDefTag(s, node):
                        s.visitDefOrBase(node)

                    def visitBlockTag(s, node):
                        s.visitDefOrBase(node)

                    def visitDefOrBase(s, node):
                        if node.is_anonymous:
                            raise exceptions.CompileException(
                                "Can't put anonymous blocks inside "
                                "<%namespace>",
                                **node.exception_kwargs
                            )
                        self.write_inline_def(node, identifiers, nested=False)
                        export.append(node.funcname)
                vis = NSDefVisitor()
                for n in node.nodes:
                    n.accept_visitor(vis)
                self.printer.writeline("return [%s]" % (','.join(export)))
                self.printer.writeline(None)
                self.in_def = False
                callable_name = "make_namespace()"
            else:
                callable_name = "None"

            if 'file' in node.parsed_attributes:
                self.printer.writeline(
                                "ns = runtime.TemplateNamespace(%r,"
                                " context._clean_inheritance_tokens(),"
                                " templateuri=%s, callables=%s, "
                                " calling_uri=_template_uri)" %
                                (
                                    node.name,
                                    node.parsed_attributes.get('file', 'None'),
                                    callable_name,
                                )
                            )
            elif 'module' in node.parsed_attributes:
                self.printer.writeline(
                                "ns = runtime.ModuleNamespace(%r,"
                                " context._clean_inheritance_tokens(),"
                                " callables=%s, calling_uri=_template_uri,"
                                " module=%s)" %
                                (
                                    node.name,
                                    callable_name,
                                    node.parsed_attributes.get(
                                                'module', 'None')
                                )
                            )
            else:
                self.printer.writeline(
                                "ns = runtime.Namespace(%r,"
                                " context._clean_inheritance_tokens(),"
                                " callables=%s, calling_uri=_template_uri)" %
                                (
                                    node.name,
                                    callable_name,
                                )
                            )
            if eval(node.attributes.get('inheritable', "False")):
                self.printer.writeline("context['self'].%s = ns" % (node.name))

            self.printer.writeline(
                "context.namespaces[(__name__, %s)] = ns" % repr(node.name))
            self.printer.write_blanks(1)
        if not len(namespaces):
            self.printer.writeline("pass")
        self.printer.writeline(None)
265123
async function mapComponentNameToTwigNamespace() {
  const twigNamespaces = {};
  const manifest = await getBoltManifest();
  const allComponents = [
    ...manifest.components.global,
    ...manifest.components.individual,
  ];
  allComponents.forEach(component => {
    if (component.twigNamespace) {
      twigNamespaces[component.twigNamespace] = component.name;
    }
  });
  return twigNamespaces;
}
72073
def _run_namespace(self, doc):
        """"""
        for receiver in self.receivers[doc['ns']]:
            params = self.receivers[doc['ns']][receiver]
            if params[doc['op']]:
                if params[doc['op']] is True or str(doc['o']['_id']) in params[doc['op']]:
                    notification_id = self._notify_receiver(receiver, params, doc)
                    if params['reliable'] and self._max_attempts > 1:
                        self.notifications[notification_id] = {
                            'receiver': receiver,
                            'params': dict(params),
                            'doc': dict(doc),
                            'ts': datetime.datetime.utcnow(),
                            'attempts': 1}