org.alfresco.util.ParameterCheck Java Examples
The following examples show how to use
org.alfresco.util.ParameterCheck.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CustomModelServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Override public boolean isNamespaceUriExists(String modelNamespaceUri) { ParameterCheck.mandatoryString("modelNamespaceUri", modelNamespaceUri); Collection<String> uris = namespaceDAO.getURIs(); if (uris.contains(modelNamespaceUri)) { return true; } for (CompiledModel model : getAllCustomM2Models(false)) { if (modelNamespaceUri.equals(getModelNamespaceUriPrefix(model.getM2Model()).getFirst())) { return true; } } return false; }
Example #2
Source File: MultiFileDumper.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Constructor with all available arguments. * * @param dbPrefixes String[] * @param directory File * @param fileNameTemplate String * @param dbToXMLFactory DbToXMLFactory * @param defaultSchemaName String */ public MultiFileDumper(String[] dbPrefixes, File directory, String fileNameTemplate, DbToXMLFactory dbToXMLFactory, String defaultSchemaName) { ParameterCheck.mandatory("dbPrefixes", dbPrefixes); ParameterCheck.mandatory("directory", directory); ParameterCheck.mandatory("fileNameTemplate", fileNameTemplate); ParameterCheck.mandatory("dbToXMLFactory", dbToXMLFactory); if (dbPrefixes.length == 0) { throw new IllegalArgumentException("At least one database object prefix is required."); } this.dbPrefixes = dbPrefixes; this.directory = directory; this.fileNameTemplate = fileNameTemplate; this.dbToXMLFactory = dbToXMLFactory; this.defaultSchemaName = defaultSchemaName; }
Example #3
Source File: EncryptingContentWriterFacade.java From alfresco-simple-content-stores with Apache License 2.0 | 6 votes |
protected EncryptingContentWriterFacade(final ContentWriter delegate, final ContentContext context, final Key key, final ContentReader existingContentReader) { super(delegate, existingContentReader); ParameterCheck.mandatory("context", context); ParameterCheck.mandatory("key", key); this.addListener(() -> { EncryptingContentWriterFacade.this.completedWrite = true; if (EncryptingContentWriterFacade.this.guessMimetype) { EncryptingContentWriterFacade.this.guessMimetype(EncryptingContentWriterFacade.this.guessFileName); } if (EncryptingContentWriterFacade.this.guessEncoding) { EncryptingContentWriterFacade.this.guessEncoding(); } }); this.context = context; this.key = key; }
Example #4
Source File: MultiTServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Override public boolean isTenantName(String name) { ParameterCheck.mandatory("name", name); int idx1 = name.indexOf(SEPARATOR); if (idx1 == 0) { int idx2 = name.indexOf(SEPARATOR, 1); if (idx2 != -1) { return true; } } return false; }
Example #5
Source File: MultiTServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * @return String */ public static String getMultiTenantDomainName(String name) { // Check that all the passed values are not null ParameterCheck.mandatory("name", name); int idx1 = name.indexOf(SEPARATOR); if (idx1 == 0) { int idx2 = name.indexOf(SEPARATOR, 1); if (idx2 != -1) { return name.substring(1, idx2); } } return DEFAULT_DOMAIN; }
Example #6
Source File: CustomModelServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Override public NodeRef getModelNodeRef(String modelName) { ParameterCheck.mandatoryString("modelName", modelName); StringBuilder builder = new StringBuilder(120); builder.append(repoModelsLocation.getPath()).append("//.[@cm:name='").append(modelName).append("' and ") .append(RepoAdminServiceImpl.defaultSubtypeOfDictionaryModel).append(']'); List<NodeRef> nodeRefs = searchService.selectNodes(getRootNode(), builder.toString(), null, namespaceDAO, false); if (nodeRefs.size() == 0) { return null; } else if (nodeRefs.size() > 1) { // unexpected: should not find multiple nodes with same name throw new CustomModelException(MSG_MULTIPLE_MODELS, new Object[] { modelName }); } return nodeRefs.get(0); }
Example #7
Source File: CompressingContentWriter.java From alfresco-simple-content-stores with Apache License 2.0 | 6 votes |
protected CompressingContentWriter(final String contentUrl, final ContentContext context, final ContentStore temporaryContentStore, final ContentWriter backingWriter, final String compressionType, final Collection<String> mimetypesToCompress) { super(backingWriter.getContentUrl() != null ? backingWriter.getContentUrl() : context.getContentUrl(), context.getExistingContentReader()); ParameterCheck.mandatory("context", context); ParameterCheck.mandatory("temporaryContentStore", temporaryContentStore); ParameterCheck.mandatory("backingWriter", backingWriter); this.context = context; this.temporaryContentStore = temporaryContentStore; this.backingWriter = backingWriter; this.compressionType = compressionType; this.mimetypesToCompress = mimetypesToCompress; // we are the first real listener (DoGuessingOnCloseListener always is first) super.addListener(this); final ContentContext temporaryContext = new ContentContext(context.getExistingContentReader(), null); this.temporaryWriter = this.temporaryContentStore.getWriter(temporaryContext); }
Example #8
Source File: NonLockingJob.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void execute(final JobExecutionContext jobExecutionContext) throws JobExecutionException { final JobDataMap dataMap = jobExecutionContext.getJobDetail().getJobDataMap(); final HBBaseDataCollector collector = (HBBaseDataCollector) dataMap.get(COLLECTOR_KEY); final HBDataSenderService hbDataSenderService = (HBDataSenderService) dataMap.get(DATA_SENDER_SERVICE_KEY); ParameterCheck.mandatory( COLLECTOR_KEY, collector); ParameterCheck.mandatory( DATA_SENDER_SERVICE_KEY, hbDataSenderService); try { List<HBData> data = collector.collectData(); hbDataSenderService.sendData(data); if (logger.isDebugEnabled()) { logger.debug("Finished collector job. ID:" + collector.getCollectorId()); } } catch (final Exception e) { // Log the error but don't rethrow, collector errors are non fatal logger.error("Heartbeat failed to collect data for collector ID: " + collector.getCollectorId(), e); } }
Example #9
Source File: Authorization.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Construct * * @param authorization String */ public Authorization(String authorization) { ParameterCheck.mandatoryString("authorization", authorization); if (authorization.length() == 0) { throw new IllegalArgumentException("authorization does not consist of username and password"); } int idx = authorization.indexOf(':'); if (idx == -1) { setUser(null, authorization); } else { setUser(authorization.substring(0, idx), authorization.substring(idx + 1)); } }
Example #10
Source File: SearchMapper.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 6 votes |
/** * Sets the Range Parameters object on search parameters * @param sp SearchParameters * @param rangeParams RangeParameters */ public void fromRange(SearchParameters sp, List<RangeParameters> ranges) { if(ranges != null && !ranges.isEmpty()) { for(RangeParameters rangeParams : ranges) { ParameterCheck.mandatory("ranges", rangeParams); ParameterCheck.mandatory("field", rangeParams.getField()); ParameterCheck.mandatory("start", rangeParams.getStart()); ParameterCheck.mandatory("end", rangeParams.getEnd()); ParameterCheck.mandatory("gap", rangeParams.getGap()); } sp.setRanges(ranges); } }
Example #11
Source File: PropertyRestrictableRoutingContentStore.java From alfresco-simple-content-stores with Apache License 2.0 | 6 votes |
private void afterPropertiesSet_setupRouteContentProperties() { if (this.routeContentPropertyNames != null && !this.routeContentPropertyNames.isEmpty()) { this.routeContentPropertyQNames = new HashSet<>(); for (final String routePropertyName : this.routeContentPropertyNames) { final QName routePropertyQName = QName.resolveToQName(this.namespaceService, routePropertyName); ParameterCheck.mandatory("routePropertyQName", routePropertyQName); final PropertyDefinition contentPropertyDefinition = this.dictionaryService.getProperty(routePropertyQName); if (contentPropertyDefinition == null || !DataTypeDefinition.CONTENT.equals(contentPropertyDefinition.getDataType().getName())) { throw new IllegalStateException(routePropertyName + " is not a valid content model property of type d:content"); } this.routeContentPropertyQNames.add(routePropertyQName); } } }
Example #12
Source File: FileFolderServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Override public NodeRef searchSimple(NodeRef contextNodeRef, String name) { ParameterCheck.mandatory("name", name); ParameterCheck.mandatory("contextNodeRef", contextNodeRef); NodeRef childNodeRef = nodeService.getChildByName(contextNodeRef, ContentModel.ASSOC_CONTAINS, name); if (logger.isTraceEnabled()) { logger.trace( "Simple name search results: \n" + " parent: " + contextNodeRef + "\n" + " name: " + name + "\n" + " result: " + childNodeRef); } return childNodeRef; }
Example #13
Source File: ContentDataDAOImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void getContentUrlsOrphaned( final ContentUrlHandler contentUrlHandler, final Long maxOrphanTimeExclusive, final int maxResults) { ParameterCheck.mandatory("maxOrphanTimeExclusive", maxOrphanTimeExclusive); ContentUrlOrphanQuery query = new ContentUrlOrphanQuery(); query.setMaxOrphanTimeExclusive(maxOrphanTimeExclusive); List<ContentUrlEntity> results = template.selectList(SELECT_CONTENT_URLS_ORPHANED, query, new RowBounds(0, maxResults)); // Pass the result to the callback for (ContentUrlEntity result : results) { contentUrlHandler.handle( result.getId(), result.getContentUrl(), result.getOrphanTime()); } }
Example #14
Source File: CompositePasswordEncoder.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Does the password match? * @param rawPassword mandatory password * @param encodedPassword mandatory hashed version * @param salt optional salt * @param encodingChain mandatory encoding chain * @return true if they match */ public boolean matchesPassword(String rawPassword, String encodedPassword, Object salt, List<String> encodingChain) { ParameterCheck.mandatoryString("rawPassword", rawPassword); ParameterCheck.mandatoryString("encodedPassword", encodedPassword); ParameterCheck.mandatoryCollection("encodingChain", encodingChain); if (encodingChain.size() > 1) { String lastEncoder = encodingChain.get(encodingChain.size() - 1); String encoded = encodePassword(rawPassword,salt, encodingChain.subList(0,encodingChain.size()-1)); return matches(lastEncoder,encoded,encodedPassword,salt); } if (encodingChain.size() == 1) { return matches(encodingChain.get(0), rawPassword, encodedPassword, salt); } return false; }
Example #15
Source File: FileFolderServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Auditable(parameters = {"contextNodeRef", "files", "folders", "ignoreQNames", "sortProps", "pagingRequest"}) @Override @Extend(traitAPI = FileFolderServiceTrait.class, extensionAPI = FileFolderServiceExtension.class) public PagingResults<FileInfo> list(NodeRef contextNodeRef, boolean files, boolean folders, Set<QName> ignoreQNames, List<Pair<QName, Boolean>> sortProps, PagingRequest pagingRequest) { ParameterCheck.mandatory("contextNodeRef", contextNodeRef); ParameterCheck.mandatory("pagingRequest", pagingRequest); Pair<Set<QName>,Set<QName>> pair = buildSearchTypesAndIgnoreAspects(files, folders, ignoreQNames); Set<QName> searchTypeQNames = pair.getFirst(); Set<QName> ignoreAspectQNames = pair.getSecond(); // execute query final CannedQueryResults<NodeRef> results = listImpl(contextNodeRef, null, searchTypeQNames, ignoreAspectQNames, sortProps, pagingRequest); return getPagingResults(pagingRequest, results); }
Example #16
Source File: MultiTServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
public String getDomainUser(String baseUsername, String tenantDomain) { ParameterCheck.mandatory("baseUsername", baseUsername); if ((tenantDomain == null) || (tenantDomain.equals(DEFAULT_DOMAIN))) { return baseUsername; } else { if (baseUsername.contains(SEPARATOR)) { throw new AlfrescoRuntimeException("Invalid base username: " + baseUsername); } if (tenantDomain.contains(SEPARATOR)) { throw new AlfrescoRuntimeException("Invalid tenant domain: " + tenantDomain); } tenantDomain = getTenantDomain(tenantDomain); return baseUsername + SEPARATOR + tenantDomain; } }
Example #17
Source File: AdminUserPatch.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void afterPropertiesSet() throws Exception { ParameterCheck.mandatory("authenticationContextManager", authenticationContextManager); //Attempt to get RepositoryAuthenticationDao from the subsystem for(String contextName : authenticationContextManager.getInstanceIds()) { ApplicationContext ctx = authenticationContextManager.getApplicationContext(contextName); try { authenticationDao = (RepositoryAuthenticationDao) ctx.getBean(RepositoryAuthenticationDao.class); } catch(NoSuchBeanDefinitionException e) {} } }
Example #18
Source File: EmailUserNotifier.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
protected void notifyUser(NodeRef personNodeRef, String subjectText, Object[] subjectParams, Map<String, Object> model, String templateNodeRef) { ParameterCheck.mandatory("personNodeRef", personNodeRef); Map<QName, Serializable> personProps = nodeService.getProperties(personNodeRef); String emailAddress = (String)personProps.get(ContentModel.PROP_EMAIL); String userName = (String)personProps.get(ContentModel.PROP_USERNAME); Locale locale = emailHelper.getUserLocaleOrDefault(userName); Action mail = actionService.createAction(MailActionExecuter.NAME); mail.setParameterValue(MailActionExecuter.PARAM_TO, emailAddress); mail.setParameterValue(MailActionExecuter.PARAM_SUBJECT, subjectText); mail.setParameterValue(MailActionExecuter.PARAM_SUBJECT_PARAMS, subjectParams); mail.setParameterValue(MailActionExecuter.PARAM_LOCALE, locale); //mail.setParameterValue(MailActionExecuter.PARAM_TEXT, buildMailText(emailTemplateRef, model)); mail.setParameterValue(MailActionExecuter.PARAM_TEMPLATE, templateNodeRef); mail.setParameterValue(MailActionExecuter.PARAM_TEMPLATE_MODEL, (Serializable)model); actionService.executeAction(mail, null); }
Example #19
Source File: SearchMapper.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 5 votes |
public void fromStats(SearchParameters sp, List<StatsRequestParameters> stats) { if (stats != null && !stats.isEmpty()) { for (StatsRequestParameters aStat:stats) { ParameterCheck.mandatory("stats field", aStat.getField()); List<Float> perc = aStat.getPercentiles(); if (perc != null && !perc.isEmpty()) { for (Float percentile:perc) { if (percentile == null || percentile < 0 || percentile > 100) { throw new IllegalArgumentException("Invalid percentile "+percentile); } } } if (aStat.getCardinality() && (aStat.getCardinalityAccuracy() < 0 || aStat.getCardinalityAccuracy() > 1)) { throw new IllegalArgumentException("Invalid cardinality accuracy "+aStat.getCardinalityAccuracy() + " It must be between 0 and 1."); } } sp.setStats(stats); } }
Example #20
Source File: NotificationServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * @see org.alfresco.service.cmr.notification.NotificationService#exists(java.lang.String) */ @Override public boolean exists(String notificationProvider) { // Check the mandatory params ParameterCheck.mandatory("notificationProvider", notificationProvider); return providers.containsKey(notificationProvider); }
Example #21
Source File: TaggingServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
public Pair<List<String>, Integer> getPagedTags(StoreRef storeRef, String filter, int fromTag, int pageSize) { ParameterCheck.mandatory("storeRef", storeRef); ParameterCheck.mandatory("fromTag", fromTag); ParameterCheck.mandatory("pageSize", pageSize); if (filter == null || filter.length() == 0) { return getPagedTags(storeRef, fromTag, pageSize); } else { Collection<ChildAssociationRef> rootCategories = this.categoryService.getRootCategories(storeRef, ContentModel.ASPECT_TAGGABLE, filter); final int totalCount = rootCategories.size(); final int startIndex = Math.max(fromTag, 0); final int endIndex = Math.min(fromTag + pageSize, totalCount); List<String> result = new ArrayList<String>(pageSize); int index = 0; // paging for not sorted tag names for (ChildAssociationRef rootCategory : rootCategories) { if (startIndex > index++) { continue; } String name = (String)this.nodeService.getProperty(rootCategory.getChildRef(), ContentModel.PROP_NAME); result.add(name); if (index == endIndex) { break; } } return new Pair<List<String>, Integer> (result, totalCount); } }
Example #22
Source File: MultiTServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override public NodeRef getRootNode(NodeService nodeService, SearchService searchService, NamespaceService namespaceService, String rootPath, NodeRef rootNodeRef) { ParameterCheck.mandatory("NodeService", nodeService); ParameterCheck.mandatory("SearchService", searchService); ParameterCheck.mandatory("NamespaceService", namespaceService); ParameterCheck.mandatory("RootPath", rootPath); ParameterCheck.mandatory("RootNodeRef", rootNodeRef); // String username = AuthenticationUtil.getFullyAuthenticatedUser(); StoreRef storeRef = rootNodeRef.getStoreRef(); AuthenticationUtil.RunAsWork<NodeRef> action = new GetRootNode(nodeService, searchService, namespaceService, rootPath, rootNodeRef, storeRef); return getBaseName(AuthenticationUtil.runAs(action, AuthenticationUtil.getSystemUserName())); }
Example #23
Source File: SolrAdminHTTPClient.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
public void init() { ParameterCheck.mandatory("baseUrl", baseUrl); StringBuilder sb = new StringBuilder(); sb.append(baseUrl + "/admin/cores"); this.adminUrl = sb.toString(); httpClient = httpClientFactory.getHttpClient(); HttpClientParams params = httpClient.getParams(); params.setBooleanParameter(HttpClientParams.PREEMPTIVE_AUTHENTICATION, true); httpClient.getState().setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT), new UsernamePasswordCredentials("admin", "admin")); }
Example #24
Source File: SolrSuggesterResult.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * Parses the json returned from the suggester * * @param json the JSON object * @throws JSONException */ @SuppressWarnings("rawtypes") protected void processJson(JSONObject json) throws JSONException { ParameterCheck.mandatory("json", json); if (logger.isDebugEnabled()) { logger.debug("Suggester JSON response: " + json); } JSONObject suggest = json.getJSONObject("suggest"); for (Iterator suggestIterator = suggest.keys(); suggestIterator.hasNext(); /**/) { String dictionary = (String) suggestIterator.next(); JSONObject dictionaryJsonObject = suggest.getJSONObject(dictionary); for (Iterator dicIterator = dictionaryJsonObject.keys(); dicIterator.hasNext(); /**/) { String termStr = (String) dicIterator.next(); JSONObject termJsonObject = dictionaryJsonObject.getJSONObject(termStr); // number found this.numberFound = termJsonObject.getLong("numFound"); // the suggested terms JSONArray suggestion = termJsonObject.getJSONArray("suggestions"); for (int i = 0, length = suggestion.length(); i < length; i++) { JSONObject data = suggestion.getJSONObject(i); this.suggestions.add(new Pair<String, Integer>(data.getString("term"), data.getInt("weight"))); } } } }
Example #25
Source File: DownloadServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void cancelDownload(NodeRef downloadNodeRef) { ParameterCheck.mandatory("downloadNodeRef", downloadNodeRef); downloadStorage.cancelDownload(downloadNodeRef); }
Example #26
Source File: ChildByNameKey.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
ChildByNameKey(Long parentNodeId, QName assocTypeQName, String childNodeName) { ParameterCheck.mandatory("childNodeName", childNodeName); ParameterCheck.mandatory("assocTypeQName", assocTypeQName); ParameterCheck.mandatory("parentNodeId", parentNodeId); this.parentNodeId = parentNodeId; this.assocTypeQName = assocTypeQName; this.childNodeName = childNodeName; }
Example #27
Source File: GetCalendarEntriesCannedQueryFactory.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
public CannedQuery<CalendarEntry> getCannedQuery(NodeRef[] containerNodes, Date fromDate, Date toDate, PagingRequest pagingReq) { ParameterCheck.mandatory("containerNodes", containerNodes); ParameterCheck.mandatory("pagingReq", pagingReq); int requestTotalCountMax = pagingReq.getRequestTotalCountMax(); Long[] containerIds = new Long[containerNodes.length]; for(int i=0; i<containerIds.length; i++) { containerIds[i] = getNodeId(containerNodes[i]); } //FIXME Need tenant service like for GetChildren? GetCalendarEntriesCannedQueryParams paramBean = new GetCalendarEntriesCannedQueryParams( containerIds, getQNameId(ContentModel.PROP_NAME), getQNameId(CalendarModel.TYPE_EVENT), getQNameId(CalendarModel.PROP_FROM_DATE), getQNameId(CalendarModel.PROP_TO_DATE), getQNameId(CalendarModel.PROP_RECURRENCE_RULE), getQNameId(CalendarModel.PROP_RECURRENCE_LAST_MEETING), fromDate, toDate ); CannedQueryPageDetails cqpd = createCQPageDetails(pagingReq); CannedQuerySortDetails cqsd = createCQSortDetails(); // create query params holder CannedQueryParameters params = new CannedQueryParameters(paramBean, cqpd, cqsd, requestTotalCountMax, pagingReq.getQueryExecutionId()); // return canned query instance return getCannedQuery(params); }
Example #28
Source File: AttributeServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * Formalize the shape of the variable-size array. * * @param keys the variable-size array of 1 to 3 keys * @return an array of exactly 3 keys (incl. <tt>null</tt> values) */ private Serializable[] normalizeKeys(Serializable ... keys) { if (keys.length < 1 || keys.length > 3) { ParameterCheck.mandatory("keys", null); } return new Serializable[] { keys[0], keys.length > 1 ? keys[1] : null, keys.length > 2 ? keys[2] : null }; }
Example #29
Source File: QuickShareLinkExpiryActionPersisterImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void deleteQuickShareLinkExpiryAction(QuickShareLinkExpiryAction linkExpiryAction) { ParameterCheck.mandatory("linkExpiryAction", linkExpiryAction); NodeRef actionNodeRef = findOrCreateActionNode(linkExpiryAction); if (actionNodeRef != null) { nodeService.deleteNode(actionNodeRef); } }
Example #30
Source File: DeduplicatingContentWriter.java From alfresco-simple-content-stores with Apache License 2.0 | 5 votes |
protected DeduplicatingContentWriter(final String contentUrl, final ContentContext context, final ContentStore temporaryContentStore, final ContentStore backingContentStore, final String digestAlgorithm, final String digestAlgorithmProvider, final int pathSegments, final int bytesPerPathSegment) { super(contentUrl, context.getExistingContentReader()); ParameterCheck.mandatory("context", context); ParameterCheck.mandatory("temporaryContentStore", temporaryContentStore); ParameterCheck.mandatory("backingContentStore", backingContentStore); if (pathSegments < 0 || bytesPerPathSegment <= 0) { throw new IllegalArgumentException( "Only non-negative number of path segments and positive number of bytes per path segment are allowed"); } this.context = context; this.temporaryContentStore = temporaryContentStore; this.backingContentStore = backingContentStore; this.digestAlgorithm = digestAlgorithm; this.digestAlgorithmProvider = digestAlgorithmProvider; this.pathSegments = pathSegments; this.bytesPerPathSegment = bytesPerPathSegment; this.originalContentUrl = contentUrl; // we are the first real listener (DoGuessingOnCloseListener always is first) super.addListener(this); final ContentContext temporaryContext = new ContentContext(context.getExistingContentReader(), null); this.temporaryWriter = this.temporaryContentStore.getWriter(temporaryContext); }