Load StatsStorage via provider, or return "not found"
@param sessionId session ID to look fo with provider
@param targetPath one of overview / model / system, or null
@return temporaryRedirect, ok, or notFound
490310
private Result sessionNotFound(String sessionId, String targetPath) {
        if (sessionLoader != null && sessionLoader.apply(sessionId)) {
            if (targetPath != null) {
                return temporaryRedirect("./" + targetPath);
            } else {
                return ok();
            }

        } else {
            return notFound("Unknown session ID: " + sessionId);
        }
    }
350283
@GET
	@Path("getReport")
	public ReportMetaData getReport(@QueryParam("path") String path) {
		String absolutePath = StorageConstants.NEXT_SERVER_ROOT + path;
		if (!storageService.entityExists(absolutePath)) {
			throw new WebApplicationException(new Exception("No report at '"+  path + "'"), 
					ErrorCodes.NOT_FOUND);			
		}
		Report report;
		try {
			report = (Report) storageService.getEntity(absolutePath);
		} catch (NotFoundException e) {
			throw new WebApplicationException(new Exception("No report at '"+  path + "'"), 
					ErrorCodes.NOT_FOUND);
		}
		if (!ReportConstants.NEXT.equals(report.getType())) {
			throw new WebApplicationException(new Exception("No report at '"+  path + "'"), 
					ErrorCodes.NOT_FOUND);
		}
		
		return createReportMetaData(report);
	}
1252289
@Override
  public IRfSessionData getAppSessionData(Class<? extends AppSession> clazz, String sessionId) {
    if (clazz.equals(ClientRfSession.class)) {
      ClientRfSessionDataLocalImpl data = new ClientRfSessionDataLocalImpl();
      data.setSessionId(sessionId);
      return data;
    }
    else if (clazz.equals(ServerRfSession.class)) {
      ServerRfSessionDataLocalImpl data = new ServerRfSessionDataLocalImpl();
      data.setSessionId(sessionId);
      return data;
    }
    throw new IllegalArgumentException(clazz.toString());
  }
692064
private String getPath(CmsObject cms, HttpSession session) {

        CmsQuickLaunchLocationCache locationCache = CmsQuickLaunchLocationCache.getLocationCache(session);
        String page = locationCache.getPageEditorLocation(cms.getRequestContext().getSiteRoot());
        if (page == null) {
            try {
                CmsResource mainDefaultFile = cms.readDefaultFile("/");
                if (mainDefaultFile != null) {
                    page = cms.getSitePath(mainDefaultFile);
                }
            } catch (CmsException e) {
                LOG.error(e.getLocalizedMessage(), e);
            }
        }
        return page;
    }
967891
public function load($configPath, $targetPath)
  {
    $mapper = new AssetMapper();
    $configDir = dirname($configPath);

    $parameters = $this->parser->load($configPath);
    foreach ($parameters as $key => $value) {
      if (in_array($key, $this->dirs)) {
        $mapper->map(
          $configDir . "/" . $value,
          $targetPath . "/" . $value
        );
      }
    }

    return $mapper;
  }
1051444
@Override
    public T addAsLibrary(File resource, ArchivePath target) throws IllegalArgumentException {
        Validate.notNull(resource, "Resource must be specified");
        Validate.notNull(target, "Target must be specified");

        if (resource.isFile()) {
            return addAsLibrary(new FileAsset(resource), target);
        }

        if (resource.listFiles().length == 0) {
            return addAsLibrary(new FileAsset(resource), target);
        }

        for (File file : resource.listFiles()) {
            addAsLibrary(file, new BasicPath(target, file.getName()));
        }
        return covarientReturn();
    }
352944
@Override
    public T addAsModule(final URL resource, final String targetPath) throws IllegalArgumentException {
        Validate.notNull(resource, "Resource must be specified");
        Validate.notNull(targetPath, "Target Path must be specified");

        return addAsModule(resource, new BasicPath(targetPath));
    }
734560
@Programmatic
    public ApplicationTenancy findByPathCached(final String path) {
        return queryResultsCache.execute(new Callable<ApplicationTenancy>() {
            @Override
            public ApplicationTenancy call() throws Exception {
                return findByPath(path);
            }
        }, ApplicationTenancyRepository.class, "findByPathCached", path);
    }
424417
public ParallelTaskBuilder setTargetHostsFromJsonPath(String jsonPath,
            String sourcePath, HostsSourceType sourceType)
            throws TargetHostsLoadException {

        this.targetHosts = targetHostBuilder.setTargetHostsFromJsonPath(jsonPath, sourcePath,
                sourceType);
        return this;

    }
1040355
@Override
  public IRxSessionData getAppSessionData(Class<? extends AppSession> clazz, String sessionId) {
    if (clazz.equals(ClientRxSession.class)) {
      ClientRxSessionDataLocalImpl data = new ClientRxSessionDataLocalImpl();
      data.setSessionId(sessionId);
      return data;
    }
    else if (clazz.equals(ServerRxSession.class)) {
      ServerRxSessionDataLocalImpl data = new ServerRxSessionDataLocalImpl();
      data.setSessionId(sessionId);
      return data;
    }
    throw new IllegalArgumentException(clazz.toString());
  }
423063
public void autoAttachStatsStorageBySessionId(Function<String, StatsStorage> statsStorageProvider) {
        if (statsStorageProvider != null) {
            this.statsStorageLoader = new StatsStorageLoader(statsStorageProvider);
        }
    }
1363046
private MappingTarget toMappingTarget(Entity mappingTargetEntity) {
    List<EntityMapping> entityMappings = Collections.emptyList();
    String identifier = mappingTargetEntity.getString(MappingTargetMetadata.IDENTIFIER);

    if (!dataService.hasRepository(mappingTargetEntity.getString(MappingTargetMetadata.TARGET))) {
      return null;
    }

    EntityType target =
        dataService.getEntityType(mappingTargetEntity.getString(MappingTargetMetadata.TARGET));

    if (mappingTargetEntity.getEntities(MappingTargetMetadata.ENTITY_MAPPINGS) != null) {
      List<Entity> entityMappingEntities =
          Lists.newArrayList(
              mappingTargetEntity.getEntities(MappingTargetMetadata.ENTITY_MAPPINGS));
      entityMappings = entityMappingRepository.toEntityMappings(entityMappingEntities);
    }

    return new MappingTarget(identifier, target, entityMappings);
  }
911940
public static String readString(Path targetPath) {
        try {
            return new String(Files.readAllBytes(targetPath));
        } catch (IOException e) {
            return JMExceptionManager.handleExceptionAndReturnNull(log, e,
                    "readString", targetPath);
        }
    }
903218
private String getTargetSiteRoot(CmsObject cms, String path, String basePath) {

        if (OpenCms.getSiteManager().startsWithShared(path) || path.startsWith(CmsWorkplace.VFS_PATH_SYSTEM)) {
            return null;
        }
        String targetSiteRoot = OpenCms.getSiteManager().getSiteRoot(path);
        if ((targetSiteRoot == null) && (basePath != null)) {
            targetSiteRoot = OpenCms.getSiteManager().getSiteRoot(basePath);
        }
        if (targetSiteRoot == null) {
            targetSiteRoot = cms.getRequestContext().getSiteRoot();
        }
        return targetSiteRoot;
    }
1235468
public GetSessionSourceInfoResponse getSessionSourceInfo(String sessionId) {
        checkStringNotEmpty(sessionId, "The parameter sessionId should NOT be null or empty string.");
        GetSessionSourceInfoRequest request = new GetSessionSourceInfoRequest();
        InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, LIVE_SESSION, sessionId);
        internalRequest.addParameter(SOURCE_INFO, null);
        return invokeHttpClient(internalRequest, GetSessionSourceInfoResponse.class);
    }
197133
public User loadUserBySession (String sessionKey)
        throws PersistenceException
    {
        User user = load(_utable, "sessions", "where authcode = '" + sessionKey + "' " +
                         "AND sessions.userId = users.userId");
        if (user != null) {
            user.setDirtyMask(_utable.getFieldMask());
        }
        return user;
    }
681204
public function baseUrl($targetPath = null)
    {
        if (!isset($this->baseUrl)) {
            throw new RuntimeException(sprintf(
                'The base URI is not defined for [%s]',
                get_class($this)
            ));
        }

        if ($targetPath !== null) {
            return $this->createAbsoluteUrl($this->baseUrl, $targetPath);
        }

        return rtrim($this->baseUrl, '/').'/';
    }