com.orientechnologies.common.log.OLogManager Java Examples
The following examples show how to use
com.orientechnologies.common.log.OLogManager.
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: OLuceneSpatialIndexManager.java From orientdb-lucene with Apache License 2.0 | 6 votes |
@Override public Object get(Object key) { try { if (key instanceof OSpatialCompositeKey) { final OSpatialCompositeKey newKey = (OSpatialCompositeKey) key; final SpatialOperation strategy = newKey.getOperation() != null ? newKey.getOperation() : SpatialOperation.Intersects; if (SpatialOperation.Intersects.equals(strategy)) return searchIntersect(newKey, newKey.getMaxDistance(), newKey.getContext()); else if (SpatialOperation.IsWithin.equals(strategy)) return searchWithin(newKey, newKey.getContext()); } else if (key instanceof OCompositeKey) return searchIntersect((OCompositeKey) key, 0, null); } catch (IOException e) { OLogManager.instance().error(this, "Error on getting entry against Lucene index", e); } return null; }
Example #2
Source File: Main.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
public static void main(final String[] args) throws Exception { // tweak levels to provide a smoother console experience LogManager.getLogManager().readConfiguration(Main.class.getResourceAsStream("/logging.properties")); OLogManager.instance().installCustomFormatter(); // support property-based configuration of PbeCompression Injector injector = Guice.createInjector(new WireModule(binder -> { binder.bind(PbeCipherFactory.class).to(PbeCipherFactoryImpl.class); binder.bind(CryptoHelper.class).to(CryptoHelperImpl.class); binder.bind(PbeCompression.class); })); // register support for PBE compression; needed to work with the security database OCompressionFactory.INSTANCE.register(injector.getInstance(PbeCompression.class)); // register 'ConflictHook' strategy but leave it disabled; needed to load databases that set it as a strategy Orient.instance().getRecordConflictStrategy().registerImplementation(ConflictHook.NAME, new ConflictHook(false)); OConsoleDatabaseApp.main(args); }
Example #3
Source File: OLuceneIndexManagerAbstract.java From orientdb-lucene with Apache License 2.0 | 6 votes |
protected void initIndex(String indexName, OIndexDefinition indexDefinition, String clusterIndexName, OStreamSerializer valueSerializer, boolean isAutomatic, ODocument metadata) { this.index = indexDefinition; this.indexName = indexName; this.serializer = valueSerializer; this.automatic = isAutomatic; this.clusterIndexName = clusterIndexName; this.metadata = metadata; try { this.index = indexDefinition; checkCollectionIndex(indexDefinition); reOpen(metadata); } catch (IOException e) { OLogManager.instance().error(this, "Error on initializing Lucene index", e); } }
Example #4
Source File: OLuceneIndexManagerAbstract.java From orientdb-lucene with Apache License 2.0 | 6 votes |
protected void closeIndex() throws IOException { OLogManager.instance().debug(this, "Closing Lucene index '" + this.indexName + "'..."); if (nrt != null) { nrt.interrupt(); nrt.close(); } if (searcherManager != null) searcherManager.close(); if (mgrWriter != null) { mgrWriter.getIndexWriter().commit(); mgrWriter.getIndexWriter().close(); } }
Example #5
Source File: LuceneResultSet.java From orientdb-lucene with Apache License 2.0 | 6 votes |
private void fetchFirstBatch() { try { switch (queryContext.cfg) { case NO_FILTER_NO_SORT: topDocs = queryContext.searcher.search(query, PAGE_SIZE); break; case FILTER_SORT: topDocs = queryContext.searcher.search(query, queryContext.filter, PAGE_SIZE, queryContext.sort); break; case FILTER: topDocs = queryContext.searcher.search(query, queryContext.filter, PAGE_SIZE); break; case SORT: topDocs = queryContext.searcher.search(query, PAGE_SIZE, queryContext.sort); break; } } catch (IOException e) { OLogManager.instance().error(this, "Error on fetching document by query '%s' to Lucene index", e, query); } }
Example #6
Source File: ImportCSVHandler.java From bjoern with GNU General Public License v3.0 | 6 votes |
@Override public boolean execute(OHttpRequest iRequest, OHttpResponse iResponse) throws Exception { logger.info("Importer called"); ImportJob importJob = getImportJobFromRequest(iRequest); (new ImportCSVRunnable(importJob)).run(); iResponse.send(OHttpUtils.STATUS_OK_CODE, "OK", null, OHttpUtils.CONTENT_TEXT_PLAIN, ""); OLogManager.instance().warn(this, "Response sent."); return false; }
Example #7
Source File: LuceneResultSet.java From orientdb-lucene with Apache License 2.0 | 5 votes |
private void fetchMoreResult() { TopDocs topDocs = null; try { switch (queryContext.cfg) { case NO_FILTER_NO_SORT: topDocs = queryContext.searcher.searchAfter(array[array.length - 1], query, PAGE_SIZE); break; case FILTER_SORT: topDocs = queryContext.searcher.searchAfter(array[array.length - 1], query, queryContext.filter, PAGE_SIZE, queryContext.sort); break; case FILTER: topDocs = queryContext.searcher.searchAfter(array[array.length - 1], query, queryContext.filter, PAGE_SIZE); break; case SORT: topDocs = queryContext.searcher.searchAfter(array[array.length - 1], query, PAGE_SIZE, queryContext.sort); break; } array = topDocs.scoreDocs; } catch (IOException e) { OLogManager.instance().error(this, "Error on fetching document by query '%s' to Lucene index", e, query); } }
Example #8
Source File: OPolygonShapeFactory.java From orientdb-lucene with Apache License 2.0 | 5 votes |
@Override public Shape makeShape(OCompositeKey key, SpatialContext ctx) { SpatialContext ctx1 = JtsSpatialContext.GEO; String value = key.getKeys().get(0).toString(); try { return ctx1.getWktShapeParser().parse(value); } catch (ParseException e) { OLogManager.instance().error(this, "Error on making shape", e); } return null; }
Example #9
Source File: OLuceneIndexFactory.java From orientdb-lucene with Apache License 2.0 | 5 votes |
@Override public void onDrop(final ODatabaseInternal iDatabase) { try { OLogManager.instance().debug(this, "Dropping Lucene indexes..."); for (OIndex idx : iDatabase.getMetadata().getIndexManager().getIndexes()) { if (idx.getInternal() instanceof OLuceneIndex) { OLogManager.instance().debug(this, "- index '%s'", idx.getName()); idx.delete(); } } } catch (Exception e) { OLogManager.instance().warn(this, "Error on dropping Lucene indexes", e); } }
Example #10
Source File: OLuceneMapEntryIterator.java From orientdb-lucene with Apache License 2.0 | 5 votes |
@Override public Map.Entry<K, V> next() { try { Document doc = reader.document(currentIdx); String val = ""; if (definition.getFields().size() > 0) { for (String field : definition.getFields()) { val += doc.get(field); } } else { val = doc.get(OLuceneIndexManagerAbstract.KEY); } final String finalVal = val; final ORecordId id = new ORecordId(doc.get(OLuceneIndexManagerAbstract.RID)); currentIdx++; return new Map.Entry<K, V>() { @Override public K getKey() { return (K) finalVal; } @Override public V getValue() { return (V) id; } @Override public V setValue(V value) { return null; } }; } catch (IOException e) { OLogManager.instance().error(this, "Error on iterating Lucene result", e); } return null; }
Example #11
Source File: OLuceneIndexManagerAbstract.java From orientdb-lucene with Apache License 2.0 | 5 votes |
public Iterator<Map.Entry<Object, V>> iterator() { try { IndexReader reader = getSearcher().getIndexReader(); return new OLuceneMapEntryIterator<Object, V>(reader, index); } catch (IOException e) { OLogManager.instance().error(this, "Error on creating iterator against Lucene index", e); } return new HashSet<Map.Entry<Object, V>>().iterator(); }
Example #12
Source File: ImportDataFromJson.java From orientdb-lucene with Apache License 2.0 | 5 votes |
protected void importGeometry(ODatabaseDocumentTx db, String file, final String clazz, String geomClazz) throws IOException { OClass points = db.getMetadata().getSchema().createClass(clazz); points.createProperty("geometry", OType.EMBEDDED, db.getMetadata().getSchema().getClass(geomClazz)); final ByteArrayOutputStream out = new ByteArrayOutputStream(); OIOUtils.copyStream(new FileInputStream(new File(file)), out, -1); ODocument doc = new ODocument().fromJSON(out.toString(), "noMap"); List<ODocument> collection = doc.field("collection"); // OShapeFactory builder = OShapeFactory.INSTANCE; final AtomicLong atomicLong = new AtomicLong(0); TimerTask task = new TimerTask() { @Override public void run() { OLogManager.instance().info(this, clazz + " per second [%d]", atomicLong.get()); atomicLong.set(0); } }; Orient.instance().scheduleTask(task, 1000, 1000); for (ODocument entries : collection) { ODocumentInternal.removeOwner(entries, doc); ODocumentInternal.removeOwner(entries, (ORecordElement) collection); entries.setClassName(clazz); String wkt = entries.field("GeometryWkt"); try { // ODocument location = builder.toDoc(wkt); // entries.field("geometry", location, OType.EMBEDDED); // db.save(entries); // // atomicLong.incrementAndGet(); } catch (Exception e) { } } task.cancel(); }
Example #13
Source File: OLuceneIndexManagerAbstract.java From orientdb-lucene with Apache License 2.0 | 5 votes |
public IndexSearcher getSearcher() throws IOException { try { nrt.waitForGeneration(reopenToken); } catch (InterruptedException e) { OLogManager.instance().error(this, "Error on get searcher from Lucene index", e); } return searcherManager.acquire(); }
Example #14
Source File: OLuceneIndexManagerAbstract.java From orientdb-lucene with Apache License 2.0 | 5 votes |
public void release(IndexSearcher searcher) { try { searcherManager.release(searcher); } catch (IOException e) { OLogManager.instance().error(this, "Error on releasing index searcher of Lucene index", e); } }
Example #15
Source File: OLuceneIndexManagerAbstract.java From orientdb-lucene with Apache License 2.0 | 5 votes |
public long size(final ValuesTransformer<V> transformer) { IndexReader reader = null; IndexSearcher searcher = null; try { reader = getSearcher().getIndexReader(); } catch (IOException e) { OLogManager.instance().error(this, "Error on getting size of Lucene index", e); } finally { if (searcher != null) { release(searcher); } } return reader.numDocs(); }
Example #16
Source File: OLuceneIndexManagerAbstract.java From orientdb-lucene with Apache License 2.0 | 5 votes |
public void rollback() { try { mgrWriter.getIndexWriter().rollback(); reOpen(metadata); } catch (IOException e) { OLogManager.instance().error(this, "Error on rolling back Lucene index", e); } }
Example #17
Source File: OLuceneIndexManagerAbstract.java From orientdb-lucene with Apache License 2.0 | 5 votes |
@Override public void close() { try { closeIndex(); } catch (Throwable e) { OLogManager.instance().error(this, "Error on closing Lucene index", e); } }
Example #18
Source File: ContentStore.java From jbake with MIT License | 5 votes |
private void startupIfEnginesAreMissing() { // Using a jdk which doesn't bundle a javascript engine // throws a NoClassDefFoundError while logging the warning // see https://github.com/orientechnologies/orientdb/issues/5855 OLogManager.instance().setWarnEnabled(false); // If an instance of Orient was previously shutdown all engines are removed. // We need to startup Orient again. if (Orient.instance().getEngines().isEmpty()) { Orient.instance().startup(); } OLogManager.instance().setWarnEnabled(true); }
Example #19
Source File: OLuceneIndexManagerAbstract.java From orientdb-lucene with Apache License 2.0 | 5 votes |
public void clear() { try { mgrWriter.getIndexWriter().deleteAll(); } catch (IOException e) { OLogManager.instance().error(this, "Error on clearing Lucene index", e); } }
Example #20
Source File: OLuceneIndexManagerAbstract.java From orientdb-lucene with Apache License 2.0 | 5 votes |
public void commit() { try { mgrWriter.getIndexWriter().commit(); } catch (IOException e) { OLogManager.instance().error(this, "Error on committing Lucene index", e); } }
Example #21
Source File: OLuceneIndexManagerAbstract.java From orientdb-lucene with Apache License 2.0 | 5 votes |
public void deleteDocument(Query query) { try { reopenToken = mgrWriter.deleteDocuments(query); if (!mgrWriter.getIndexWriter().hasDeletions()) { OLogManager.instance().error(this, "Error on deleting document by query '%s' to Lucene index", new OIndexException("Error deleting document"), query); } } catch (IOException e) { OLogManager.instance().error(this, "Error on deleting document by query '%s' to Lucene index", e, query); } }
Example #22
Source File: OLuceneIndexManagerAbstract.java From orientdb-lucene with Apache License 2.0 | 5 votes |
public void addDocument(Document doc) { try { reopenToken = mgrWriter.addDocument(doc); } catch (IOException e) { OLogManager.instance().error(this, "Error on adding new document '%s' to Lucene index", e, doc); } }
Example #23
Source File: OLuceneFullTextIndexManager.java From orientdb-lucene with Apache License 2.0 | 5 votes |
@Override public IndexWriter openIndexWriter(Directory directory, ODocument metadata) throws IOException { Analyzer analyzer = getAnalyzer(metadata); Version version = getLuceneVersion(metadata); IndexWriterConfig iwc = new IndexWriterConfig(version, analyzer); iwc.setOpenMode(IndexWriterConfig.OpenMode.APPEND); OLogManager.instance().debug(this, "Opening Lucene index in '%s'...", directory); return new IndexWriter(directory, iwc); }
Example #24
Source File: OLuceneFullTextIndexManager.java From orientdb-lucene with Apache License 2.0 | 5 votes |
@Override public IndexWriter createIndexWriter(Directory directory, ODocument metadata) throws IOException { Analyzer analyzer = getAnalyzer(metadata); Version version = getLuceneVersion(metadata); IndexWriterConfig iwc = new IndexWriterConfig(version, analyzer); iwc.setOpenMode(IndexWriterConfig.OpenMode.CREATE_OR_APPEND); facetManager = new OLuceneFacetManager(this, metadata); OLogManager.instance().debug(this, "Creating Lucene index in '%s'...", directory); return new IndexWriter(directory, iwc); }
Example #25
Source File: OLuceneIndexPlugin.java From orientdb-lucene with Apache License 2.0 | 5 votes |
@Override public void onDrop(final ODatabaseInternal iDatabase) { OLogManager.instance().info(this, "Dropping Lucene indexes..."); for (OIndex idx : iDatabase.getMetadata().getIndexManager().getIndexes()) { if (idx.getInternal() instanceof OLuceneIndex) { OLogManager.instance().info(this, "- index '%s'", idx.getName()); idx.delete(); } } }
Example #26
Source File: OLuceneIndexPlugin.java From orientdb-lucene with Apache License 2.0 | 5 votes |
@Override public void startup() { super.startup(); Orient.instance().addDbLifecycleListener(this); OIndexes.registerFactory(new OLuceneIndexFactory(true)); OSQLEngine.registerOperator(new OLuceneTextOperator()); OSQLEngine.registerOperator(new OLuceneWithinOperator()); OSQLEngine.registerOperator(new OLuceneNearOperator()); OLogManager.instance().info(this, "Lucene index plugin installed and active. Lucene version: %s", OLuceneIndexManagerAbstract.LUCENE_VERSION); }
Example #27
Source File: OETLComponentFactory.java From orientdb-etl with Apache License 2.0 | 5 votes |
public OETLComponentFactory registerLoader(final Class<? extends OLoader> iComponent) { try { loaders.put(iComponent.newInstance().getName(), iComponent); } catch (Exception e) { OLogManager.instance().error(this, "Error on registering loader: %s", iComponent.getName()); } return this; }
Example #28
Source File: OETLComponentFactory.java From orientdb-etl with Apache License 2.0 | 5 votes |
public OETLComponentFactory registerTransformer(final Class<? extends OTransformer> iComponent) { try { transformers.put(iComponent.newInstance().getName(), iComponent); } catch (Exception e) { OLogManager.instance().error(this, "Error on registering transformer: %s", iComponent.getName()); } return this; }
Example #29
Source File: OETLComponentFactory.java From orientdb-etl with Apache License 2.0 | 5 votes |
public OETLComponentFactory registerExtractor(final Class<? extends OExtractor> iComponent) { try { extractors.put(iComponent.newInstance().getName(), iComponent); } catch (Exception e) { OLogManager.instance().error(this, "Error on registering extractor: %s", iComponent.getName()); } return this; }
Example #30
Source File: OETLComponentFactory.java From orientdb-etl with Apache License 2.0 | 5 votes |
public OETLComponentFactory registerBlock(final Class<? extends OBlock> iComponent) { try { blocks.put(iComponent.newInstance().getName(), iComponent); } catch (Exception e) { OLogManager.instance().error(this, "Error on registering block: %s", iComponent.getName()); } return this; }