Read parameters from RegistryService.

@param sessionProvider
The SessionProvider
@throws RepositoryException
@throws PathNotFoundException
438759
private void readParamsFromRegistryService(SessionProvider sessionProvider) throws PathNotFoundException,
            RepositoryException
   {
      String entryPath = RegistryService.EXO_SERVICES + "/" + SERVICE_NAME + "/" + "workspace";
      RegistryEntry registryEntry = registryService.getEntry(sessionProvider, entryPath);
      Document doc = registryEntry.getDocument();
      Element element = doc.getDocumentElement();
      repoWorkspaceName = getAttributeSmart(element, "value");

      entryPath = RegistryService.EXO_SERVICES + "/" + SERVICE_NAME + "/" + "rootNode";
      registryEntry = registryService.getEntry(sessionProvider, entryPath);
      doc = registryEntry.getDocument();
      element = doc.getDocumentElement();
      rootNodePath = getAttributeSmart(element, "value");

      LOG.info("Workspace from RegistryService: " + repoWorkspaceName);
      LOG.info("RootNode from RegistryService: " + rootNodePath);
   }
187947
private void checkGroup(final SessionProvider sessionProvider, final String groupPath) throws RepositoryException
   {
      String[] groupNames = groupPath.split("/");
      String prefix = "/" + EXO_REGISTRY;
      Session session = session(sessionProvider, repositoryService.getCurrentRepository());
      for (String name : groupNames)
      {
         String path = prefix + "/" + name;
         try
         {
            Node group = (Node)session.getItem(path);
            if (!group.isNodeType(EXO_REGISTRYGROUP_NT))
               throw new RepositoryException("Node at " + path + " should be  " + EXO_REGISTRYGROUP_NT + " type");
         }
         catch (PathNotFoundException e)
         {
            Node parent = (Node)session.getItem(prefix);
            parent.addNode(name, EXO_REGISTRYGROUP_NT);
            parent.save();
         }
         prefix = path;
      }
   }
61274
public final void loadRepository(ClassLoader classLoader, String repositoryPackage, String repositoryName){
        try{
            Class repositoryClass = classLoader.loadClass(repositoryPackage + "." + repositoryName);
            Repository<T> instance = (Repository<T>) repositoryClass.newInstance();
            generatedMap.putAll(instance.get());

        } catch (ClassNotFoundException e) {
            //nothing
        } catch (InstantiationException e) {
            throw new TransfuseRuntimeException("Unable to instantiate generated Repository", e);
        } catch (IllegalAccessException e) {
            throw new TransfuseRuntimeException("Unable to access generated Repository", e);
        }
    }
1269340
protected String getIndexDirParam() throws RepositoryConfigurationException
   {
      String dir = config.getParameterValue(QueryHandlerParams.PARAM_INDEX_DIR, null);
      if (dir == null)
      {
         LOG.warn(QueryHandlerParams.PARAM_INDEX_DIR + " parameter not found. Using outdated parameter name "
            + QueryHandlerParams.OLD_PARAM_INDEX_DIR);
         dir = config.getParameterValue(QueryHandlerParams.OLD_PARAM_INDEX_DIR);
      }
      return dir;
   }
334534
@Override
	public void setBeanProvider(final BeanProvider beanProvider) {
		if (isLocked() && beanProvider != null && !(beanProvider instanceof Serializable)) {
			throw new SystemException(
					"Unable to store bean provider in user's session as it is not serializable: " + beanProvider.
					getClass());
		}

		getOrCreateComponentModel().setBeanProvider(beanProvider);
		String beanProperty = getBeanProperty();

		if (beanProperty == null) {
			setBeanProperty(".");
		}

		// Remove values in scratch map
		removeBeanFromScratchMap();
	}
319497
@Override
   public synchronized void retain() throws RepositoryException
   {
      try
      {
         if (!isRetainable())
            throw new RepositoryException("Unsupported  configuration place "
               + configurationService.getURL(param.getValue())
               + " If you want to save configuration, start repository from standalone file."
               + " Or persister-class-name not configured");

         OutputStream saveStream = null;

         if (configurationPersister != null)
         {
            saveStream = new ByteArrayOutputStream();
         }
         else
         {
            URL filePath = configurationService.getURL(param.getValue());
            final File sourceConfig = new File(filePath.toURI());
            final File backUp = new File(sourceConfig.getAbsoluteFile() + "." + indexBackupFile++);

            if (indexBackupFile > maxBackupFiles)
            {
               indexBackupFile = 1;
            }

            try
            {
               SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
               {
                  public Void run() throws IOException
                  {
                     DirectoryHelper.deleteDstAndRename(sourceConfig, backUp);
                     return null;
                  }
               });
            }
            catch (IOException ioe)
            {
               throw new RepositoryException("Can't back up configuration on path "
                  + PrivilegedFileHelper.getAbsolutePath(sourceConfig), ioe);
            }

            saveStream = PrivilegedFileHelper.fileOutputStream(sourceConfig);
         }

         IBindingFactory bfact;
         try
         {
            bfact = SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction<IBindingFactory>()
            {
               public IBindingFactory run() throws Exception
               {
                  return BindingDirectory.getFactory(RepositoryServiceConfiguration.class);
               }
            });
         }
         catch (PrivilegedActionException pae)
         {
            Throwable cause = pae.getCause();
            if (cause instanceof JiBXException)
            {
               throw (JiBXException)cause;
            }
            else if (cause instanceof RuntimeException)
            {
               throw (RuntimeException)cause;
            }
            else
            {
               throw new RuntimeException(cause);
            }
         }
         
         IMarshallingContext mctx = bfact.createMarshallingContext();

         mctx.marshalDocument(this, "ISO-8859-1", null, saveStream);
         saveStream.close();

         // writing configuration in to the persister
         if (configurationPersister != null)
         {
            configurationPersister.write(new ByteArrayInputStream(((ByteArrayOutputStream)saveStream).toByteArray()));
         }
      }
      catch (JiBXException e)
      {
         throw new RepositoryException(e);
      }
      catch (FileNotFoundException e)
      {
         throw new RepositoryException(e);
      }
      catch (IOException e)
      {
         throw new RepositoryException(e);
      }
      catch (RepositoryConfigurationException e)
      {
         throw new RepositoryException(e);
      }
      catch (Exception e)
      {
         throw new RepositoryException(e);
      }
   }
430313
Node getUsersStorageNode(Session session) throws PathNotFoundException, RepositoryException
   {
      return (Node)session.getItem(service.getStoragePath() + "/" + JCROrganizationServiceImpl.STORAGE_JOS_USERS);
   }
941642
@SuppressWarnings({ "unchecked", "rawtypes" })
	@Deprecated
	public <T, I extends Serializable> ResourceRepositoryStub<T, I> getQueryParamsRepository(Class<T> resourceClass) {
		init();

		RegistryEntry entry = resourceRegistry.findEntry(resourceClass);

		// TODO fix this in katharsis, should be able to get original resource
		ResourceRepositoryAdapter repositoryAdapter = entry.getResourceRepository(null);
		return (ResourceRepositoryStub<T, I>) repositoryAdapter.getResourceRepository();
	}
1145171
public static void setRegistry(Registry registry) {
    SpectatorContext.registry = registry;
    if (registry instanceof NoopRegistry) {
      initStacktrace = null;
    } else {
      Exception cause = initStacktrace;
      Exception e = new IllegalStateException(
          "called SpectatorContext.setRegistry(" + registry.getClass().getName() + ")",
          cause);
      e.fillInStackTrace();
      initStacktrace = e;
      if (cause != null) {
        LOGGER.warn("Registry used with Servo's SpectatorContext has been overwritten. This could "
            + "result in missing metrics.", e);
      }
    }
  }
702869
private void readConfiguration( Map<String, String> parameters ) {
        String mountPath = parameters.get(MOUNT_PATH_CONFIG);
        this.mountPath = mountPath != null ? mountPath : DEFAULT_MOUNT_PATH;
        this.jcrConfig = RepositoryConfig.load(parameters);
    }
977986
@Override
  public ICCASessionData getAppSessionData(Class<? extends AppSession> clazz, String sessionId) {
    if (clazz.equals(ClientCCASession.class)) {
      ClientCCASessionDataLocalImpl data = new ClientCCASessionDataLocalImpl();
      data.setSessionId(sessionId);
      return data;
    }
    else if (clazz.equals(ServerCCASession.class)) {
      ServerCCASessionDataLocalImpl data = new ServerCCASessionDataLocalImpl();
      data.setSessionId(sessionId);
      return data;
    }
    throw new IllegalArgumentException(clazz.toString());
  }
1243174
def varify_user_lock(repository_path, session_token):
    

    with open(cpjoin(repository_path, 'user_file'), 'r') as fd2:
        content = fd2.read()
        if len(content) == 0: return False
        try: res = json.loads(content)
        except ValueError: return False
        return res['session_token'] == session_token and int(time.time()) < int(res['expires'])
    return False
1024442
protected void recoverRegistryData() {

        for (ProviderConfig providerConfig : providerUrls.keySet()) {
            registerProviderUrls(providerConfig);
        }

        for (ConsumerConfig consumerConfig : consumerUrls.keySet()) {
            subscribeConsumerUrls(consumerConfig);
        }

    }
1249043
public synchronized IGenericSessionManager getSessionManager(Object registryKey) {
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[GET_SESSION_MANAGER], "registryKey= " + registryKey);
        }
        IGenericSessionManager sessionManager = (IGenericSessionManager) _genericSessionManagers.get(registryKey);
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[GET_SESSION_MANAGER], "sessionManager= " + sessionManager);
        }
        return sessionManager;
    }
389939
@Override
	public void registerOsgiProviders (Collection<Object> providers) throws FhirConfigurationException {
		if (null == providers) {
			throw new NullPointerException("FHIR Provider list cannot be null");
		}
		try {
			super.registerProviders(providers);
			for (Object provider : providers) {
				log.trace("registered provider. class ["+provider.getClass().getName()+"]");
				this.serverProviders.add(provider);
			}
		} catch (Exception e) {
			log.error("Error registering FHIR Providers", e);
			throw new FhirConfigurationException("Error registering FHIR Providers", e);
		}
	}
830306
protected void writeParamsToRegistryService(SessionProvider sessionProvider) throws IOException, SAXException,
      ParserConfigurationException, RepositoryException
   {
      if (LOG.isDebugEnabled())
      {
         LOG.debug(">>> Save init parametrs in registry service.");
      }

      Document doc;
      try
      {
         doc = SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction<Document>()
         {
            public Document run() throws ParserConfigurationException
            {
               return DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
            }
         });
      }
      catch (PrivilegedActionException e)
      {
         throw (ParserConfigurationException)e.getCause();
      }

      Element root = doc.createElement(SERVICE_NAME);
      doc.appendChild(root);

      Element element = doc.createElement("nodeType");
      setAttributeSmart(element, "value", getNodeType());
      root.appendChild(element);

      StringBuffer sb = new StringBuffer();
      for (String workspace : observationListenerConfiguration.getWorkspaces())
      {
         if (sb.length() > 0)
         {
            sb.append(';');
         }
         sb.append(workspace);
      }
      element = doc.createElement("workspaces");
      setAttributeSmart(element, "value", sb.toString());
      root.appendChild(element);

      element = doc.createElement("repository");
      setAttributeSmart(element, "value", observationListenerConfiguration.getRepository());
      root.appendChild(element);

      RegistryEntry serviceEntry = new RegistryEntry(doc);
      registryService.createEntry(sessionProvider, RegistryService.EXO_SERVICES, serviceEntry);
   }
1081006
@Override
	public void unregisterOsgiProviders (Collection<Object> providers) throws FhirConfigurationException {
		if (null == providers) {
			throw new NullPointerException("FHIR Provider list cannot be null");
		}
		try {
			for (Object provider : providers) {
				log.trace("unregistered provider. class ["+provider.getClass().getName()+"]");
				this.serverProviders.remove(provider);
			}
			super.unregisterProvider(providers);
		} catch (Exception e) {
			log.error("Error unregistering FHIR Providers", e);
			throw new FhirConfigurationException("Error unregistering FHIR Providers", e);
		}
	}