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


Java IndexerException类代码示例

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


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

示例1: buildXPath

import org.alfresco.repo.search.IndexerException; //导入依赖的package包/类
private String buildXPath(Path path)
{
    StringBuilder pathBuffer = new StringBuilder(64);
    for (Iterator<Path.Element> elit = path.iterator(); elit.hasNext(); /**/)
    {
        Path.Element element = elit.next();
        if (!(element instanceof Path.ChildAssocElement))
        {
            throw new IndexerException("Confused path: " + path);
        }
        Path.ChildAssocElement cae = (Path.ChildAssocElement) element;
        if (cae.getRef().getParentRef() != null)
        {
            pathBuffer.append("/");
            pathBuffer.append(getPrefix(cae.getRef().getQName().getNamespaceURI()));
            pathBuffer.append(ISO9075.encode(cae.getRef().getQName().getLocalName()));
        }
    }
    return pathBuffer.toString();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:LuceneCategoryServiceImpl.java

示例2: rollback

import org.alfresco.repo.search.IndexerException; //导入依赖的package包/类
/**
 * Roll back the transaction
 */
@SuppressWarnings("unchecked")
public void rollback()
{
    Map<StoreRef, LuceneIndexer> indexers = (Map<StoreRef, LuceneIndexer>) AlfrescoTransactionSupport.getResource(indexersKey);

    if (indexers != null)
    {
        for (LuceneIndexer indexer : indexers.values())
        {
            try
            {
                indexer.rollback();
            }
            catch (IndexerException e)
            {

            }
        }
        indexers.clear();
        AlfrescoTransactionSupport.unbindResource(indexersKey);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:AbstractLuceneIndexerAndSearcherFactory.java

示例3: getDeltaIndexReader

import org.alfresco.repo.search.IndexerException; //导入依赖的package包/类
/**
 * This method should only be called from one thread as it is bound to a transaction.
 * 
 * @param id String
 * @return IndexReader
 * @throws IOException
 */
public IndexReader getDeltaIndexReader(String id) throws IOException
{
    if (id == null)
    {
        throw new IndexerException("\"null\" is not a valid identifier for a transaction");
    }

    // No read lock required as the delta should be bound to one thread only
    // Index readers are simply thread safe
    IndexReader reader = indexReaders.get(id);
    if (reader == null)
    {
        // close index writer if required
        closeDeltaIndexWriter(id);
        // Check the index knows about the transaction
        reader = buildAndRegisterDeltaReader(id);
        indexReaders.put(id, reader);
    }
    return reader;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:28,代码来源:IndexInfo.java

示例4: getDeltaIndexWriter

import org.alfresco.repo.search.IndexerException; //导入依赖的package包/类
/**
 * Manage getting a lucene index writer for transactional data - looks after registration and checking there is no
 * active reader.
 * 
 * @param id String
 * @param analyzer Analyzer
 * @return IndexWriter
 * @throws IOException
 */
public IndexWriter getDeltaIndexWriter(String id, Analyzer analyzer) throws IOException
{
    if (id == null)
    {
        throw new IndexerException("\"null\" is not a valid identifier for a transaction");
    }

    // No read lock required as the delta should be bound to one thread only
    IndexWriter writer = indexWriters.get(id);
    if (writer == null)
    {
        // close index writer if required
        closeDeltaIndexReader(id);
        File location = ensureDeltaIsRegistered(id);
        writer = makeDeltaIndexWriter(location, analyzer);
        indexWriters.put(id, writer);
    }
    return writer;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:29,代码来源:IndexInfo.java

示例5: closeDeltaIndexReader

import org.alfresco.repo.search.IndexerException; //导入依赖的package包/类
/**
 * Manage closing and unregistering an index reader.
 * 
 * @param id String
 * @throws IOException
 */
public void closeDeltaIndexReader(String id) throws IOException
{
    if (id == null)
    {
        throw new IndexerException("\"null\" is not a valid identifier for a transaction");
    }

    // No lock required as the delta applied to one thread. The delta is
    // still active.
    IndexReader reader = indexReaders.remove(id);
    if (reader != null)
    {
        reader.close();
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:IndexInfo.java

示例6: closeDeltaIndexWriter

import org.alfresco.repo.search.IndexerException; //导入依赖的package包/类
/**
 * Manage closing and unregistering an index writer .
 * 
 * @param id String
 * @throws IOException
 */
public void closeDeltaIndexWriter(String id) throws IOException
{
    if (id == null)
    {
        throw new IndexerException("\"null\" is not a valid identifier for a transaction");
    }

    // No lock required as the delta applied to one thread. The delta is
    // still active.
    IndexWriter writer = indexWriters.remove(id);
    if (writer != null)
    {
        writer.close();
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:IndexInfo.java

示例7: persistDeletions

import org.alfresco.repo.search.IndexerException; //导入依赖的package包/类
/**
 * @param id String
 * @param toDelete Set<String>
 * @param fileName String
 * @throws IOException
 * @throws FileNotFoundException
 */
private void persistDeletions(String id, Set<String> toDelete, String fileName) throws IOException, FileNotFoundException
{
    File location = new File(indexDirectory, id).getCanonicalFile();
    if (!location.exists())
    {
        if (!location.mkdirs())
        {
            throw new IndexerException("Failed to make index directory " + location);
        }
    }
    // Write deletions
    DataOutputStream os = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(new File(location, fileName).getCanonicalFile())));
    os.writeInt(toDelete.size());
    for (String ref : toDelete)
    {
        os.writeUTF(ref);
    }
    os.flush();
    os.close();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:28,代码来源:IndexInfo.java

示例8: transition

import org.alfresco.repo.search.IndexerException; //导入依赖的package包/类
public void transition(String id, Set<Term> toDelete, Set<Term> read) throws IOException
{
    IndexEntry entry = indexEntries.get(id);
    if (entry == null)
    {
        throw new IndexerException("Unknown transaction " + id);
    }

    if (TransactionStatus.PREPARING.follows(entry.getStatus()))
    {
        entry.setStatus(TransactionStatus.PREPARING);
    }
    else
    {
        throw new IndexerException("Invalid transition for " + id + " from " + entry.getStatus() + " to " + TransactionStatus.PREPARING);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:IndexInfo.java

示例9: setRollbackOnly

import org.alfresco.repo.search.IndexerException; //导入依赖的package包/类
/**
 * Mark this index for roll back only. This action can not be reversed. It will reject all other work and only allow
 * roll back.
 */
public void setRollbackOnly()
{
    switch (getStatus().getStatus())
    {
    case Status.STATUS_COMMITTING:
        throw new IndexerException("Unable to mark for rollback: Transaction is committing");
    case Status.STATUS_COMMITTED:
        throw new IndexerException("Unable to mark for rollback: Transaction is committed");
    default:
        try
        {
            doSetRollbackOnly();
            setStatus(TransactionStatus.MARKED_ROLLBACK);
        }
        catch (IOException e)
        {
            throw new LuceneIndexException("Set rollback only failed ", e);
        }
        break;
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:AbstractLuceneIndexerImpl.java

示例10: getParents

import org.alfresco.repo.search.IndexerException; //导入依赖的package包/类
private ArrayList<NodeRef> getParents(Path path)
{
    ArrayList<NodeRef> parentsInDepthOrderStartingWithSelf = new ArrayList<NodeRef>(8);
    for (Iterator<Path.Element> elit = path.iterator(); elit.hasNext(); /**/)
    {
        Path.Element element = elit.next();
        if (!(element instanceof Path.ChildAssocElement))
        {
            throw new IndexerException("Confused path: " + path);
        }
        Path.ChildAssocElement cae = (Path.ChildAssocElement) element;
        parentsInDepthOrderStartingWithSelf.add(0, tenantService.getName(cae.getRef().getChildRef()));

    }
    return parentsInDepthOrderStartingWithSelf;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:ADMLuceneIndexerImpl.java

示例11: getAncestors

import org.alfresco.repo.search.IndexerException; //导入依赖的package包/类
private ArrayList<NodeRef> getAncestors(Path path)
{
    ArrayList<NodeRef> ancestors = new ArrayList<NodeRef>(8);
    for (Iterator<Path.Element> elit = path.iterator(); elit.hasNext(); /**/)
    {
        Path.Element element = elit.next();
        if (!(element instanceof Path.ChildAssocElement))
        {
            throw new IndexerException("Confused path: " + path);
        }
        Path.ChildAssocElement cae = (Path.ChildAssocElement) element;
        NodeRef parentRef = cae.getRef().getParentRef();
        if(parentRef != null)
        {
            ancestors.add(0, parentRef);
        }

    }
    return ancestors;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:21,代码来源:NodesMetaDataGet.java

示例12: getTransaction

import org.alfresco.repo.search.IndexerException; //导入依赖的package包/类
/**
 * Get the local transaction - may be null oif we are outside a transaction.
 * 
 * @return - the transaction
 * @throws IndexerException
 */
private SimpleTransaction getTransaction() throws IndexerException
{
    try
    {
        return SimpleTransactionManager.getInstance().getTransaction();
    }
    catch (SystemException e)
    {
        throw new IndexerException("Failed to get transaction", e);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:AbstractLuceneIndexerAndSearcherFactory.java

示例13: prepare

import org.alfresco.repo.search.IndexerException; //导入依赖的package包/类
/**
 * Prepare the transaction TODO: Store prepare results
 * 
 * @return - the tx code
 */
@SuppressWarnings("unchecked")
public int prepare() throws IndexerException
{
    boolean isPrepared = true;
    boolean isModified = false;
    Map<StoreRef, LuceneIndexer> indexers = (Map<StoreRef, LuceneIndexer>) AlfrescoTransactionSupport.getResource(indexersKey);
    if (indexers != null)
    {
        for (LuceneIndexer indexer : indexers.values())
        {
            try
            {
                isModified |= indexer.isModified();
                indexer.prepare();
            }
            catch (IndexerException e)
            {
                isPrepared = false;
                throw new IndexerException("Failed to prepare: requires rollback", e);
            }
        }
    }
    if (isPrepared)
    {
        if (isModified)
        {
            return XAResource.XA_OK;
        }
        else
        {
            return XAResource.XA_RDONLY;
        }
    }
    else
    {
        throw new IndexerException("Failed to prepare: requires rollback");
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:44,代码来源:AbstractLuceneIndexerAndSearcherFactory.java

示例14: getIndexInfo

import org.alfresco.repo.search.IndexerException; //导入依赖的package包/类
/**
 * Get the IndexInfo object based in the given directory. There is only one object per directory per JVM.
 * 
 * @param file File
 * @param config LuceneConfig
 * @return IndexInfo
 * @throws IndexerException
 */
public static synchronized IndexInfo getIndexInfo(File file, LuceneConfig config) throws IndexerException
{
    File canonicalFile;
    try
    {
        canonicalFile = file.getCanonicalFile();
        IndexInfo indexInfo = indexInfos.get(canonicalFile);
        if (indexInfo == null)
        {
            indexInfo = new IndexInfo(canonicalFile, config);
            indexInfos.put(canonicalFile, indexInfo);
            if (s_logger.isDebugEnabled())
            {
                s_logger.debug("Made " + indexInfo + " for " + file.getAbsolutePath());
            }
        }

        if (s_logger.isDebugEnabled())
        {
            s_logger.debug("Got " + indexInfo + " for " + file.getAbsolutePath());
        }
        return indexInfo;
    }
    catch (IOException e)
    {
        throw new IndexerException("Failed to transform a file into is canonical form", e);
    }

}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:38,代码来源:IndexInfo.java

示例15: closeDelta

import org.alfresco.repo.search.IndexerException; //导入依赖的package包/类
/**
 * Make sure the writer and reader for TX data are closed.
 * 
 * @param id String
 * @throws IOException
 */
public void closeDelta(String id) throws IOException
{
    if (id == null)
    {
        throw new IndexerException("\"null\" is not a valid identifier for a transaction");
    }
    closeDeltaIndexReader(id);
    closeDeltaIndexWriter(id);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:16,代码来源:IndexInfo.java


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