org.eclipse.text,
org.eclipse.core.resources,
org.eclipse.core.filesystem,
- org.opendaylight.yangide.yangparser;bundle-version="1.1.1"
+ org.opendaylight.yangide.yangparser;bundle-version="1.1.1",
+ org.slf4j.api;bundle-version="1.7.2"
Bundle-ClassPath: .,
libs/mapdb-1.0.4.jar
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IStatus;
import org.opendaylight.yangide.core.IOpenable;
-import org.opendaylight.yangide.core.YangCorePlugin;
import org.opendaylight.yangide.core.model.YangElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* @author Konstantin Zaitsev
*/
public class BufferManager {
+ private static final Logger log = LoggerFactory.getLogger(BufferManager.class);
+
protected static BufferManager DEFAULT_BUFFER_MANAGER;
- protected static boolean VERBOSE = false;
/**
* LRU cache of buffers. The key and value for an entry in the table is the identical buffer.
* Adds a buffer to the table of open buffers.
*/
public void addBuffer(IBuffer buffer) {
- if (VERBOSE) {
- String owner = ((YangElement) buffer.getOwner()).toStringWithAncestors();
- YangCorePlugin.log(IStatus.INFO, "Adding buffer for " + owner);
- }
+ String owner = ((YangElement) buffer.getOwner()).toStringWithAncestors();
+ log.debug("Adding buffer for {}", owner);
synchronized (this.openBuffers) {
this.openBuffers.put(buffer.getOwner(), buffer);
}
// close buffers that were removed from the cache if space was needed
this.openBuffers.closeBuffers();
- if (VERBOSE) {
- YangCorePlugin.log(IStatus.INFO, "-> Buffer cache filling ratio = " + NumberFormat.getInstance().format(this.openBuffers.fillingRatio()) + "%"); //$NON-NLS-1$//$NON-NLS-2$
- }
+ log.debug("-> Buffer cache filling ratio = {}%",
+ NumberFormat.getInstance().format(this.openBuffers.fillingRatio()));
}
public static IBuffer createBuffer(IOpenable owner) {
/**
* Returns an enumeration of all open buffers.
- * <p>
+ *
* The <code>Enumeration</code> answered is thread safe.
*
* @see OverflowingLRUCache
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.core.JavaProject;
-
import org.opendaylight.yangide.core.CoreUtil;
import org.opendaylight.yangide.core.YangCorePlugin;
import org.opendaylight.yangide.core.YangModelException;
import org.opendaylight.yangide.core.model.YangProjectInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
+ * Indexer.
+ *
* @author Konstantin Zaitsev
- * date: Jul 1, 2014
+ * @since Jul 1, 2014
*/
@SuppressWarnings("restriction")
public class IndexAllProject extends IndexRequest {
+ private static final Logger log = LoggerFactory.getLogger(IndexAllProject.class);
+
private IProject project;
public IndexAllProject(IProject project, IndexManager manager) {
@Override
public boolean execute(IProgressMonitor progressMonitor) {
- YangCorePlugin.log(IStatus.INFO, "[I] Project: " + project.getName());
+ log.info("[I] Project: {}", project.getName());
if (this.isCancelled || progressMonitor != null && progressMonitor.isCanceled()) {
return true;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.mapdb.DB;
import org.mapdb.DBMaker;
import org.opendaylight.yangide.core.dom.TypeReference;
import org.opendaylight.yangide.core.dom.UsesNode;
import org.opendaylight.yangide.core.model.YangProjectInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Provides functionality to index AST nodes and search item in index.
*
* @author Konstantin Zaitsev
- * date: Jun 25, 2014
+ * @since Jun 25, 2014
*/
public class IndexManager extends JobManager {
+ private static final Logger log = LoggerFactory.getLogger(IndexManager.class);
+
/**
* Stores index version, it is required increment version on each major changes of indexing
* algorithm or indexed data.
Iterable<Long> it = Fun.filter(idxResources, file.getProject().getName(), file.getFullPath().toString());
for (Long modStamp : it) {
if (modStamp == file.getModificationStamp()) {
- YangCorePlugin.log(IStatus.INFO, "[x] " + file);
+ log.debug("[x] {}", file);
return;
}
}
Iterable<Long> it = Fun.filter(idxResources, project.getName(), file.toString());
for (Long modStamp : it) {
if (modStamp == file.toFile().lastModified()) {
- YangCorePlugin.log(IStatus.INFO, "[x] " + file);
+ log.debug("[x] {}", file);
return;
}
}
}
public synchronized void addElementIndexInfo(ElementIndexInfo info) {
- YangCorePlugin.log(IStatus.INFO,
- "[I] " + info.getModule() + "@" + info.getRevision() + " - " + info.getName() + " - " + info.getType());
+ log.debug("[I] {}@{} - {} - {}", info.getModule(), info.getRevision(), info.getName(), info.getType());
idxKeywords.add(Fun.t6(info.getModule(), info.getRevision(), info.getName(), info.getType(), info.getPath(), info));
}
public synchronized void addElementIndexReferenceInfo(ElementIndexReferenceInfo info) {
- YangCorePlugin.log(IStatus.INFO,
- "[IR] " + info.getReference() + " : " + info.getType() + " - " + info.getProject() + "@" + info.getPath());
+ log.debug("[IR] {} : {} - {}@{}", info.getReference(), info.getType(), info.getProject(), info.getPath());
idxReferences.add(Fun.t4(info.getReference(), info.getType(), info.getPath(), info));
}