Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
AspectJ tools most notably contains the AspectJ compiler (AJC). AJC applies aspects to Java classes during
compilation, fully replacing Javac for plain Java classes and also compiling native AspectJ or annotation-based
@AspectJ syntax. Furthermore, AJC can weave aspects into existing class files in a post-compile binary weaving step.
This library is a superset of AspectJ weaver and hence also of AspectJ runtime.
/*******************************************************************************
* Copyright (c) 2004, 2021 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
* James Blackburn (Broadcom Corp.) - ongoing development
* Lars Vogel - Bug 473427
* Joerg Kubitz - caching
*******************************************************************************/
package org.eclipse.core.internal.localstore;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.ref.SoftReference;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.WeakHashMap;
import org.eclipse.core.internal.resources.ResourceException;
import org.eclipse.core.internal.resources.ResourceStatus;
import org.eclipse.core.internal.utils.Messages;
import org.eclipse.core.resources.IResourceStatus;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.osgi.util.NLS;
/**
* A bucket is a persistent dictionary having paths as keys. Values are determined
* by subclasses.
*
* @since 3.1
*/
public abstract class Bucket {
public static abstract class Entry {
/**
* This entry has not been modified in any way so far.
*
* @see #state
*/
private final static int STATE_CLEAR = 0;
/**
* This entry has been requested for deletion.
*
* @see #state
*/
private final static int STATE_DELETED = 0x02;
/**
* This entry has been modified.
*
* @see #state
*/
private final static int STATE_DIRTY = 0x01;
/**
* Logical path of the object we are storing history for. This does not
* correspond to a file system path.
*/
private IPath path;
/**
* State for this entry. Possible values are STATE_CLEAR, STATE_DIRTY and STATE_DELETED.
*
* @see #STATE_CLEAR
* @see #STATE_DELETED
* @see #STATE_DIRTY
*/
private byte state = STATE_CLEAR;
protected Entry(IPath path) {
this.path = path;
}
public void delete() {
state = STATE_DELETED;
}
public abstract int getOccurrences();
public IPath getPath() {
return path;
}
public abstract Object getValue();
public boolean isDeleted() {
return state == STATE_DELETED;
}
public boolean isDirty() {
return state == STATE_DIRTY;
}
public boolean isEmpty() {
return getOccurrences() == 0;
}
public void markDirty() {
Assert.isTrue(state != STATE_DELETED);
state = STATE_DIRTY;
}
/**
* Called on the entry right after the visitor has visited it.
*/
public void visited() {
// does not do anything by default
}
}
/**
* A visitor for bucket entries.
*/
public static abstract class Visitor {
// should continue the traversal
public final static int CONTINUE = 0;
// should stop looking at any states immediately
public final static int STOP = 1;
// should stop looking at states for files in this container (or any of its children)
public final static int RETURN = 2;
/**
* Called after the bucket has been visited and saved.
*
* @throws CoreException allows implementation to throw on error
*/
public void afterSaving(Bucket bucket) throws CoreException {
// empty implementation, subclasses to override
}
/**
* Called after the bucket has been visited but before saved.
*
* @throws CoreException allows implementation to throw on error. Throwing an
* exception prevents saving.
*/
public void beforeSaving(Bucket bucket) throws CoreException {
// empty implementation, subclasses to override
}
/**
* @return either STOP, CONTINUE or RETURN
*/
public abstract int visit(Entry entry);
}
/**
* The segment name for the root directory for index files.
*/
static final String INDEXES_DIR_NAME = ".indexes"; //$NON-NLS-1$
/**
* Map of the history entries in this bucket. Maps (String -> byte[][] or String[][]),
* where the key is the path of the object we are storing history for, and
* the value is the history entry data (UUID,timestamp) pairs.
*/
private final Map entries;
private SoftReference