Package org.apache.jetspeed.components.persistence.store

Examples of org.apache.jetspeed.components.persistence.store.Transaction


     *
     * @param store
     */
    protected void prepareTransaction( PersistenceStore store )
    {
        Transaction tx = store.getTransaction();
        if (!tx.isOpen())
        {
            tx.begin();
        }
    }
View Full Code Here


    }
   
   
    public void setRuleForPrincipal(Principal principal, ProfilingRule rule, String locatorName)
    {
        Transaction tx = persistentStore.getTransaction();
        tx.begin();
 
        Filter filter = persistentStore.newFilter();
        filter.addEqualTo("principalName", principal);
        filter.addEqualTo("locatorName", locatorName);
        Object query = persistentStore.newQuery(principalRuleClass, filter);
        PrincipalRule pr = (PrincipalRule) persistentStore.getObjectByQuery(query);
        if (pr == null)
        {
            pr = new PrincipalRuleImpl(); // TODO: factory
            pr.setPrincipalName(principal.getName());
            pr.setLocatorName(locatorName);
            pr.setProfilingRule(rule);
        }
        try
        {
            pr.setProfilingRule(rule);
            persistentStore.lockForWrite(pr);
        }
        catch (LockFailedException e)
        {
            tx.rollback();
            e.printStackTrace();
            // TODO: throw appropriate exception
        }
        persistentStore.getTransaction().commit();
        principalRules.put(makePrincipalRuleKey(principal.getName(), locatorName), pr);
View Full Code Here

    public void storeProfilingRule(ProfilingRule rule)
    throws ProfilerException
    {
        try
        {
            Transaction tx = persistentStore.getTransaction();
            tx.begin();
            persistentStore.makePersistent(rule);
            persistentStore.lockForWrite(rule);
            tx.commit();           
        }
        catch (Exception e)
        {
            throw new ProfilerException("failed to store: " + rule.getId(), e);
        }
View Full Code Here

    public void deleteProfilingRule(ProfilingRule rule)
    throws ProfilerException   
    {
        try
        {
            Transaction tx = persistentStore.getTransaction();
            tx.begin();
            persistentStore.deletePersistent(rule);
            tx.commit();
        }
        catch (Exception e)
        {
            throw new ProfilerException("failed to delete: " + rule.getId(), e);
        }
View Full Code Here

    public void storePrincipalRule(PrincipalRule rule)
    throws ProfilerException
    {
        try
        {
            Transaction tx = persistentStore.getTransaction();
            tx.begin();
            persistentStore.makePersistent(rule);
            persistentStore.lockForWrite(rule);
            tx.commit();           
        }
        catch (Exception e)
        {
            throw new ProfilerException("failed to store: " + rule.getLocatorName(), e);
        }       
View Full Code Here

    public void deletePrincipalRule(PrincipalRule rule)
    throws ProfilerException
    {
        try
        {
            Transaction tx = persistentStore.getTransaction();
            tx.begin();
            persistentStore.deletePersistent(rule);
            tx.commit();
        }
        catch (Exception e)
        {
            throw new ProfilerException("failed to delete: " + rule.getLocatorName(), e);
        }       
View Full Code Here

     *
     * @param store
     */
    protected void prepareTransaction( PersistenceStore store )
    {
        Transaction tx = store.getTransaction();
        if (!tx.isOpen())
        {
            tx.begin();
        }
    }
View Full Code Here

     *
     * @param store
     */
    protected void prepareTransaction( PersistenceStore store )
    {
        Transaction tx = store.getTransaction();
        if (!tx.isOpen())
        {
            tx.begin();
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.components.persistence.store.Transaction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.