当前位置: 首页>>代码示例>>Java>>正文


Java FileContentStore类代码示例

本文整理汇总了Java中org.alfresco.repo.content.filestore.FileContentStore的典型用法代码示例。如果您正苦于以下问题:Java FileContentStore类的具体用法?Java FileContentStore怎么用?Java FileContentStore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FileContentStore类属于org.alfresco.repo.content.filestore包,在下文中一共展示了FileContentStore类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkAndGetStore

import org.alfresco.repo.content.filestore.FileContentStore; //导入依赖的package包/类
/**
 * Check that the given store name is in the list. 
 * Also check it's an instance of {@link FileContentStore}. If it's not, output a warning
 * as non-file-based implementations have not been tested and may be unsupported.
 * 
 * @param storeName	the store name to check
 */
public ContentStore checkAndGetStore(String storeName)
{
	ContentStore store = storeMap.get(storeName);
   	if(store == null)
   	{
   		String validStores ="";
        	Iterator<String> it = storeMap.keySet().iterator();
        	while (it.hasNext()) 
        	{
        		validStores += "'" + it.next() + "'" + (it.hasNext() ? " , " : "");
        	}
        	throw new IllegalArgumentException("given store name : '" + storeName + "' is not part of the registered stores : " + validStores);
        }
        if(!(store instanceof FileContentStore))
        {
       	 // letting you off with a warning :)
       	 // some people may have a custom content store for which the import could work in this case too ...
       	 if(logger.isWarnEnabled())
       	 {
       		 logger.warn("selected store '" + storeName + "' is not a FileContentStore. Is the implementation based on local files ?");
       	 }
        }
        
        return store;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:33,代码来源:AbstractContentStoreMapProvider.java

示例2: init

import org.alfresco.repo.content.filestore.FileContentStore; //导入依赖的package包/类
/**
 * Service initialise 
 */
public void init()
{
    // Set up a temporary store
    this.tempStore = new FileContentStore(this.applicationContext, TempFileProvider.getTempDir().getAbsolutePath());

    // Bind on update properties behaviour
    this.policyComponent.bindClassBehaviour(
            NodeServicePolicies.OnUpdatePropertiesPolicy.QNAME,
            this,
            new JavaBehaviour(this, "onUpdateProperties"));
    
    // Register on content update policy
    this.onContentUpdateDelegate = this.policyComponent.registerClassPolicy(OnContentUpdatePolicy.class);
    this.onContentPropertyUpdateDelegate = this.policyComponent.registerClassPolicy(OnContentPropertyUpdatePolicy.class);
    this.onContentReadDelegate = this.policyComponent.registerClassPolicy(OnContentReadPolicy.class);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:ContentServiceImpl.java

示例3: initContentStore

import org.alfresco.repo.content.filestore.FileContentStore; //导入依赖的package包/类
protected ContentStore initContentStore(ApplicationContext ctx, String contentRoot)
{
	Map<String, Serializable> extendedEventParams = new HashMap<String, Serializable>();
	if (!TenantService.DEFAULT_DOMAIN.equals(tenantService.getCurrentUserDomain()))
	{
	    extendedEventParams.put("Tenant", tenantService.getCurrentUserDomain());
	}

    FileContentStore fileContentStore = new FileContentStore(ctx, new File(contentRoot), extendedEventParams);
    
    // Set the content filesize limiter if there is one.
    if (this.contentLimitProvider != null)
    {
        fileContentStore.setContentLimitProvider(contentLimitProvider);
    }
    
    if(fileContentUrlProvider != null)
    {
        fileContentStore.setFileContentUrlProvider(fileContentUrlProvider);
    }
    return fileContentStore;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:TenantRoutingFileContentStore.java

示例4: before

import org.alfresco.repo.content.filestore.FileContentStore; //导入依赖的package包/类
@Before
public void before() throws Exception
{
    File tempDir = TempFileProvider.getTempDir();
    // create a primary file store
    String storeDir = tempDir.getAbsolutePath() + File.separatorChar + GUID.generate();
    primaryStore = new FileContentStore(ctx, storeDir);
    // create some secondary file stores
    secondaryStores = new ArrayList<ContentStore>(3);
    for (int i = 0; i < 4; i++)
    {
        storeDir = tempDir.getAbsolutePath() + File.separatorChar + GUID.generate();
        FileContentStore store = new FileContentStore(ctx, storeDir);
        secondaryStores.add(store);
    }
    // Create the aggregating store
    aggregatingStore = new AggregatingContentStore();
    aggregatingStore.setPrimaryStore(primaryStore);
    aggregatingStore.setSecondaryStores(secondaryStores);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:AggregatingContentStoreTest.java

示例5: before

import org.alfresco.repo.content.filestore.FileContentStore; //导入依赖的package包/类
@Before
public void before() throws Exception
{
    File tempDir = TempFileProvider.getTempDir();
    // Create a subdirectory for A
    File storeADir = new File(tempDir, "A");
    storeA = new FileContentStore(ctx, storeADir);
    // Create a subdirectory for B
    File storeBDir = new File(tempDir, "B");
    storeB = new FileContentStore(ctx, storeBDir);
    // Create a subdirectory for C
    File storeCDir = new File(tempDir, "C");
    storeC = new DumbReadOnlyFileStore(new FileContentStore(ctx, storeCDir));
    // No subdirectory for D
    storeD = new SupportsNoUrlFormatStore();
    // Create the routing store
    routingStore = new RandomRoutingContentStore(storeA, storeB, storeC, storeD);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:RoutingContentStoreTest.java

示例6: testMissingUrl

import org.alfresco.repo.content.filestore.FileContentStore; //导入依赖的package包/类
/**
 * Checks that requests for missing content URLs are served.
 */
@Test
public void testMissingUrl()
{
    String missingContentUrl = FileContentStore.createNewFileStoreUrl();
    
    ContentReader reader = routingStore.getReader(missingContentUrl);
    assertNotNull("Missing URL should not return null", reader);
    assertFalse("Empty reader should say content doesn't exist.", reader.exists());
    try
    {
        reader.getContentString();
        fail("Empty reader cannot return content.");
    }
    catch (Throwable e)
    {
        // Expected
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:RoutingContentStoreTest.java

示例7: writeToCacheWithExistingReader

import org.alfresco.repo.content.filestore.FileContentStore; //导入依赖的package包/类
@Test
public void writeToCacheWithExistingReader()
{   
    ContentWriter oldWriter = store.getWriter(ContentContext.NULL_CONTEXT);
    oldWriter.putContent("Old content for " + getClass().getSimpleName());
    ContentReader existingReader = oldWriter.getReader();
    
    // Write through the caching content store - cache during the process.
    final String proposedUrl = FileContentStore.createNewFileStoreUrl();
    ContentWriter writer = store.getWriter(new ContentContext(existingReader, proposedUrl));
    final String content = makeContent();
    writer.putContent(content);
    assertEquals("Writer should have correct URL", proposedUrl, writer.getContentUrl());
    
    assertFalse("Old and new writers must have different URLs",
                oldWriter.getContentUrl().equals(writer.getContentUrl()));
    
    ContentReader reader = store.getReader(writer.getContentUrl());
    assertEquals("Reader and writer should have same URLs", writer.getContentUrl(), reader.getContentUrl());
    assertEquals("Reader should get correct content", content, reader.getContentString());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:FullTest.java

示例8: createNewUrl

import org.alfresco.repo.content.filestore.FileContentStore; //导入依赖的package包/类
public static String createNewUrl() {

		Calendar calendar = new GregorianCalendar();
		int year = calendar.get(Calendar.YEAR);
		int month = calendar.get(Calendar.MONTH) + 1; // 0-based
		int day = calendar.get(Calendar.DAY_OF_MONTH);
		int hour = calendar.get(Calendar.HOUR_OF_DAY);
		int minute = calendar.get(Calendar.MINUTE);
		// create the URL
		StringBuilder sb = new StringBuilder(20);
		sb.append(FileContentStore.STORE_PROTOCOL)
				.append(ContentStore.PROTOCOL_DELIMITER).append(year)
				.append('/').append(month).append('/').append(day).append('/')
				.append(hour).append('/').append(minute).append('/')
				.append(GUID.generate()).append(".bin");
		String newContentUrl = sb.toString();
		// done
		return newContentUrl;

	}
 
开发者ID:EisenVault,项目名称:ev-alfresco-azure-adapter,代码行数:21,代码来源:AzureContentStore.java

示例9: isInContentStore

import org.alfresco.repo.content.filestore.FileContentStore; //导入依赖的package包/类
/**
 * Determines whether the given file is located in the given file content store.
 * @param fileContentStore The file content store to check <i>(must not be null)</i>.
 * @param source           The file to check <i>(must not be null)</i>.
 * @return True if the given file is in an Alfresco managed content store, false otherwise.
 */
private final boolean isInContentStore(final FileContentStore fileContentStore, final File source)
{
    boolean result            = false;
    String  storeRootLocation = fileContentStore.getRootLocation();
    String  sourcePath        = source.getAbsolutePath();   // Note: we don't use getCanonicalPath here because it dereferences symlinks (which we don't want)
    
    // Case insensitive comparison on Windows
    if (SystemUtils.IS_OS_WINDOWS)
    {
        result = sourcePath.toLowerCase().startsWith(storeRootLocation.toLowerCase());
    }
    else
    {
        result = sourcePath.startsWith(storeRootLocation);
    }
    
    return(result);
}
 
开发者ID:pmonks,项目名称:alfresco-bulk-filesystem-import,代码行数:25,代码来源:AbstractBulkFilesystemImporter.java

示例10: initContentStore

import org.alfresco.repo.content.filestore.FileContentStore; //导入依赖的package包/类
protected ContentStore initContentStore(ApplicationContext ctx, String contentRoot)
{
	Map<String, Serializable> extendedEventParams = new HashMap<String, Serializable>();
	if (!TenantService.DEFAULT_DOMAIN.equals(tenantService.getCurrentUserDomain()))
	{
	    extendedEventParams.put("Tenant", tenantService.getCurrentUserDomain());
	}

    FileContentStore fileContentStore = new FileContentStore(ctx, new File(contentRoot), extendedEventParams);
    
    // Set the content filesize limiter if there is one.
    if (this.contentLimitProvider != null)
    {
        fileContentStore.setContentLimitProvider(contentLimitProvider);
    }
    
    return fileContentStore;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:19,代码来源:TenantRoutingFileContentStore.java

示例11: setUp

import org.alfresco.repo.content.filestore.FileContentStore; //导入依赖的package包/类
@Override
public void setUp() throws Exception
{
    super.setUp();
    
    // Create a dummy context for message broadcasting
    StaticApplicationContext ctx = new StaticApplicationContext();
    ctx.refresh();
    
    File tempDir = TempFileProvider.getTempDir();
    // create the source file store
    String storeDir = tempDir.getAbsolutePath() + File.separatorChar + getName() + File.separatorChar + GUID.generate();
    sourceStore = new FileContentStore(ctx, storeDir);
    // create the target file store
    storeDir = tempDir.getAbsolutePath() + File.separatorChar + getName() + File.separatorChar + GUID.generate();
    targetStore = new FileContentStore(ctx, storeDir);
    
    // create the replicator 
    replicator = new ContentStoreReplicator();
    replicator.setSourceStore(sourceStore);
    replicator.setTargetStore(targetStore);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:23,代码来源:ContentStoreReplicatorTest.java

示例12: createNewUrl

import org.alfresco.repo.content.filestore.FileContentStore; //导入依赖的package包/类
/**
 * Creates a new content URL.  This must be supported by all
 * stores that are compatible with Alfresco.
 *
 * @return Returns a new and unique content URL
 */
public static String createNewUrl() {
	final Calendar calendar = new GregorianCalendar();
	final int year = calendar.get(Calendar.YEAR);
	final int month = calendar.get(Calendar.MONTH) + 1; // 0-based
	final int day = calendar.get(Calendar.DAY_OF_MONTH);
	final int hour = calendar.get(Calendar.HOUR_OF_DAY);
	final int minute = calendar.get(Calendar.MINUTE);
	// create the URL
	final StringBuffer urlStr = new StringBuffer();
	urlStr.append(FileContentStore.STORE_PROTOCOL)
			.append(ContentStore.PROTOCOL_DELIMITER).append(year)
			.append('/').append(month).append('/').append(day).append('/')
			.append(hour).append('/').append(minute).append('/')
			.append(GUID.generate()).append(".bin");
	
	return urlStr.toString();
}
 
开发者ID:abhinavmishra14,项目名称:alfresco-amazon-s3-content-store-integration,代码行数:24,代码来源:S3ContentStore.java

示例13: exists

import org.alfresco.repo.content.filestore.FileContentStore; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * <p>
 * For {@link #SPOOF_PROTOCOL spoofed} URLs, the URL always exists.
 */
@Override
public boolean exists(String contentUrl)
{
    if (contentUrl.startsWith(FileContentStore.SPOOF_PROTOCOL))
    {
        return true;
    }
    else
    {
        return backingStore.exists(contentUrl);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:CachingContentStore.java

示例14: getReader

import org.alfresco.repo.content.filestore.FileContentStore; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * <p>
 * This store handles the {@link FileContentStore#SPOOF_PROTOCOL} so that underlying stores do not need
 * to implement anything <a href="https://issues.alfresco.com/jira/browse/ACE-4516">related to spoofing</a>.
 */
@Override
public ContentReader getReader(String contentUrl)
{
    // Handle the spoofed URL
    if (contentUrl.startsWith(FileContentStore.SPOOF_PROTOCOL))
    {
        return new SpoofedTextContentReader(contentUrl);
    }

    // Use pool of locks - which one is determined by a hash of the URL.
    // This will stop the content from being read/cached multiple times from the backing store
    // when it should only be read once - cached versions should be returned after that.
    ReadLock readLock = readWriteLock(contentUrl).readLock();
    readLock.lock();
    try
    {
        if (cache.contains(contentUrl))
        {
            return cache.getReader(contentUrl);
        }
    }
    catch(CacheMissException e)
    {
        // Fall through to cacheAndRead(url);
    }
    finally
    {
        readLock.unlock();
    }
    
    return cacheAndRead(contentUrl);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:39,代码来源:CachingContentStore.java

示例15: loadData

import org.alfresco.repo.content.filestore.FileContentStore; //导入依赖的package包/类
private void loadData(final int maxCount)
{
    final MutableInt doneCount = new MutableInt(0);
    // Batches of 1000 objects
    RetryingTransactionCallback<Integer> makeNodesCallback = new RetryingTransactionCallback<Integer>()
    {
        public Integer execute() throws Throwable
        {
            for (int i = 0; i < 1000; i++)
            {
                // We don't need to write anything
                String contentUrl = FileContentStore.createNewFileStoreUrl();
                ContentData contentData = new ContentData(contentUrl, MimetypeMap.MIMETYPE_TEXT_PLAIN, 10, "UTF-8");
                nodeHelper.makeNode(contentData);
                
                int count = doneCount.intValue();
                count++;
                doneCount.setValue(count);
                
                // Do some reporting
                if (count % 1000 == 0)
                {
                    System.out.println(String.format("   " + (new Date()) + "Total created: %6d", count));
                }
                
                // Double check for shutdown
                if (vmShutdownListener.isVmShuttingDown())
                {
                    break;
                }
            }
            return maxCount;
        }
    };
    int repetitions = (int) Math.floor((double)maxCount / 1000.0);
    for (int i = 0; i < repetitions; i++)
    {
        transactionService.getRetryingTransactionHelper().doInTransaction(makeNodesCallback);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:41,代码来源:ContentStoreCleanerScalabilityRunner.java


注:本文中的org.alfresco.repo.content.filestore.FileContentStore类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。