Java Code Examples for org.apache.ivy.core.IvyContext#popContext()

The following examples show how to use org.apache.ivy.core.IvyContext#popContext() . 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: DefaultIvyContextManager.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public <T> T withIvy(Transformer<? extends T, ? super Ivy> action) {
    Integer currentDepth = depth.get();

    if (currentDepth != null) {
        depth.set(currentDepth + 1);
        try {
            return action.transform(IvyContext.getContext().getIvy());
        } finally {
            depth.set(currentDepth);
        }
    }

    IvyContext.pushNewContext();
    try {
        depth.set(1);
        try {
            Ivy ivy = getIvy();
            try {
                IvyContext.getContext().setIvy(ivy);
                return action.transform(ivy);
            } finally {
                releaseIvy(ivy);
            }
        } finally {
            depth.set(null);
        }
    } finally {
        IvyContext.popContext();
    }
}
 
Example 2
Source File: DefaultIvyContextManager.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public <T> T withIvy(Transformer<? extends T, ? super Ivy> action) {
    Integer currentDepth = depth.get();

    if (currentDepth != null) {
        depth.set(currentDepth + 1);
        try {
            return action.transform(IvyContext.getContext().getIvy());
        } finally {
            depth.set(currentDepth);
        }
    }

    IvyContext.pushNewContext();
    try {
        depth.set(1);
        try {
            Ivy ivy = getIvy();
            try {
                IvyContext.getContext().setIvy(ivy);
                return action.transform(ivy);
            } finally {
                releaseIvy(ivy);
            }
        } finally {
            depth.set(null);
        }
    } finally {
        IvyContext.popContext();
    }
}
 
Example 3
Source File: DefaultIvyContextManager.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public <T> T withIvy(Transformer<? extends T, ? super Ivy> action) {
    Integer currentDepth = depth.get();

    if (currentDepth != null) {
        depth.set(currentDepth + 1);
        try {
            return action.transform(IvyContext.getContext().getIvy());
        } finally {
            depth.set(currentDepth);
        }
    }

    IvyContext.pushNewContext();
    try {
        depth.set(1);
        try {
            Ivy ivy = getIvy();
            try {
                IvyContext.getContext().setIvy(ivy);
                return action.transform(ivy);
            } finally {
                releaseIvy(ivy);
            }
        } finally {
            depth.set(null);
        }
    } finally {
        IvyContext.popContext();
    }
}
 
Example 4
Source File: DefaultIvyContextManager.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public <T> T withIvy(Transformer<? extends T, ? super Ivy> action) {
    Integer currentDepth = depth.get();

    if (currentDepth != null) {
        depth.set(currentDepth + 1);
        try {
            return action.transform(IvyContext.getContext().getIvy());
        } finally {
            depth.set(currentDepth);
        }
    }

    IvyContext.pushNewContext();
    try {
        depth.set(1);
        try {
            Ivy ivy = getIvy();
            try {
                IvyContext.getContext().setIvy(ivy);
                return action.transform(ivy);
            } finally {
                releaseIvy(ivy);
            }
        } finally {
            depth.set(null);
        }
    } finally {
        IvyContext.popContext();
    }
}
 
Example 5
Source File: IvyTask.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
/**
 * Called when task is about to finish Should clean up all state related information (stacks for
 * example)
 */
protected void finalizeTask() {
    if (!IvyContext.getContext().pop(ANT_PROJECT_CONTEXT_KEY, getProject())) {
        Message.error("ANT project popped from stack not equals current! Ignoring");
    }
    IvyContext.popContext();
}
 
Example 6
Source File: DefaultRepositoryCacheManagerTest.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
@After
public void tearDown() {
    IvyContext.popContext();
    Delete del = new Delete();
    del.setProject(new Project());
    del.setDir(cacheManager.getRepositoryCacheRoot());
    del.execute();
}
 
Example 7
Source File: LatestVersionMatcherTest.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
@After
public void tearDown() {
    IvyContext.popContext();
}
 
Example 8
Source File: WarnCircularDependencyStrategyTest.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
@After
public void tearDown() {
    resetMockLogger(loggerEngine);
    // pop the context we setup before
    IvyContext.popContext();
}
 
Example 9
Source File: Ivy.java    From ant-ivy with Apache License 2.0 2 votes vote down vote up
/**
 * Pops the current Ivy context.
 * <p>
 * You must call this method once and only once for each call to {@link #pushContext()}, when
 * you're done with the your Ivy related work.
 * </p>
 * <p>
 * Alternatively, you can use the {@link #execute(org.apache.ivy.Ivy.IvyCallback)} method which
 * takes care of everything for you.
 * </p>
 */
public void popContext() {
    IvyContext.popContext();
}