List of usage examples for java.util EnumMap EnumMap
public EnumMap(Map<K, ? extends V> m)
From source file:org.apache.hadoop.hdfs.server.namenode.Ingest.java
/** * Continue to ingest transaction logs until the currentState is * no longer INGEST. If lastScan is set to true, then we process * till the end of the file and return./* w w w. j av a2 s. c om*/ */ int ingestFSEdits() throws IOException { FSDirectory fsDir = fsNamesys.dir; int numEdits = 0; long recentOpcodeOffsets[] = new long[2]; Arrays.fill(recentOpcodeOffsets, -1); EnumMap<FSEditLogOpCodes, Holder<Integer>> opCounts = new EnumMap<FSEditLogOpCodes, Holder<Integer>>( FSEditLogOpCodes.class); boolean error = false; boolean reopen = false; boolean quitAfterScan = false; long sharedLogTxId = FSEditLogLoader.TXID_IGNORE; long localLogTxId = FSEditLogLoader.TXID_IGNORE; FSEditLogOp op = null; FSEditLog localEditLog = fsDir.fsImage.getEditLog(); while (running && !quitAfterScan) { // if the application requested that we make a final pass over // the transaction log, then we remember it here. We close and // reopen the file to ensure that we can see all the data in the // file, one reason being that NFS has open-to-close cache // coherancy and the edit log could be stored in NFS. // if (reopen || lastScan) { inputEditStream.close(); inputEditStream = standby.setupIngestStreamWithRetries(startTxId); if (lastScan) { // QUIESCE requested by Standby thread LOG.info("Ingest: Starting last scan of transaction log: " + this.toString()); quitAfterScan = true; } // discard older buffers and start a fresh one. inputEditStream.refresh(currentPosition, localEditLog.getLastWrittenTxId()); setCatchingUp(); reopen = false; } // // Process all existing transactions till end of file // while (running) { if (lastScan && !quitAfterScan) { // Standby thread informed the ingest to quiesce // we should refresh the input stream as soon as possible // then quitAfterScan will be true break; } // record the current file offset. currentPosition = inputEditStream.getPosition(); InjectionHandler.processEvent(InjectionEvent.INGEST_BEFORE_LOAD_EDIT); fsNamesys.writeLock(); try { error = false; op = ingestFSEdit(inputEditStream); /* * In the case of segments recovered on primary namenode startup, we * have segments that are finalized (by name), but not containing the * ending transaction. Without this check, we will keep looping until * the next checkpoint to discover this situation. */ if (!inputEditStream.isInProgress() && standby.getLastCorrectTxId() == inputEditStream.getLastTxId()) { // this is a correct segment with no end segment transaction LOG.info( "Ingest: Reached finalized log segment end with no end marker. " + this.toString()); tearDown(localEditLog, false, true); break; } if (op == null) { FSNamesystem.LOG.debug("Ingest: Invalid opcode, reached end of log " + "Number of transactions found " + numEdits); break; // No more transactions. } sharedLogTxId = op.txid; // Verify transaction ids match. localLogTxId = localEditLog.getLastWrittenTxId() + 1; // Fatal error only when the log contains transactions from the future // we allow to process a transaction with smaller txid than local // we will simply skip it later after reading from the ingest edits if (localLogTxId < sharedLogTxId || InjectionHandler.falseCondition(InjectionEvent.INGEST_TXID_CHECK)) { String message = "The transaction id in the edit log : " + sharedLogTxId + " does not match the transaction id inferred" + " from FSIMAGE : " + localLogTxId; LOG.fatal(message); throw new RuntimeException(message); } // skip previously loaded transactions if (!canApplyTransaction(sharedLogTxId, localLogTxId, op)) continue; // for recovery, we do not want to re-load transactions, // but we want to populate local log with them if (shouldLoad(sharedLogTxId)) { FSEditLogLoader.loadEditRecord(logVersion, inputEditStream, recentOpcodeOffsets, opCounts, fsNamesys, fsDir, numEdits, op); } LOG.info("Ingest: " + this.toString() + ", size: " + inputEditStream.length() + ", processing transaction at offset: " + currentPosition + ", txid: " + op.txid + ", opcode: " + op.opCode); if (op.opCode == FSEditLogOpCodes.OP_START_LOG_SEGMENT) { LOG.info("Ingest: Opening log segment: " + this.toString()); localEditLog.open(); } else if (op.opCode == FSEditLogOpCodes.OP_END_LOG_SEGMENT) { InjectionHandler.processEventIO(InjectionEvent.INGEST_CLEAR_STANDBY_STATE); LOG.info("Ingest: Closing log segment: " + this.toString()); tearDown(localEditLog, true, true); numEdits++; LOG.info("Ingest: Reached log segment end. " + this.toString()); break; } else { localEditLog.logEdit(op); if (inputEditStream.getReadChecksum() != FSEditLog.getChecksumForWrite().getValue()) { throw new IOException("Ingest: mismatched r/w checksums for transaction #" + numEdits); } } numEdits++; standby.setLastCorrectTxId(op.txid); } catch (ChecksumException cex) { LOG.info("Checksum error reading the transaction #" + numEdits + " reopening the file"); reopen = true; break; } catch (IOException e) { LOG.info("Encountered error reading transaction", e); error = true; // if we haven't reached eof, then error. break; } finally { if (localEditLog.isOpen()) { localEditLog.logSyncIfNeeded(); } fsNamesys.writeUnlock(); } } // end inner while(running) -- all breaks come here // if we failed to read the entire transaction from disk, // then roll back to the offset where there was a last good // read, sleep for sometime for new transaction to // appear in the file and then continue; if (error || running) { // discard older buffers and start a fresh one. inputEditStream.refresh(currentPosition, localEditLog.getLastWrittenTxId()); setCatchingUp(); if (error) { LOG.info("Ingest: Incomplete transaction record at offset " + inputEditStream.getPosition() + " but the file is of size " + inputEditStream.length() + ". Continuing...."); } if (running && !lastScan) { try { Thread.sleep(100); // sleep for a second } catch (InterruptedException e) { // break out of waiting if we receive an interrupt. } } } } //end outer while(running) ///////////////////// FINAL ACTIONS ///////////////////// // This was the last scan of the file but we could not read a full // transaction from disk. If we proceed this will corrupt the image if (error) { String errorMessage = FSEditLogLoader.getErrorMessage(recentOpcodeOffsets, currentPosition); LOG.error(errorMessage); throw new IOException( "Failed to read the edits log. " + "Incomplete transaction at " + currentPosition); } // If the last Scan was completed, then stop the Ingest thread. if (lastScan && quitAfterScan) { LOG.info("Ingest: lastScan completed. " + this.toString()); running = false; if (localEditLog.isOpen()) { // quiesced non-finalized segment LOG.info("Ingest: Reached non-finalized log segment end. " + this.toString()); tearDown(localEditLog, false, localLogTxId != startTxId); } } FSEditLogLoader.dumpOpCounts(opCounts); return numEdits; // total transactions consumed }
From source file:org.codice.ddf.spatial.ogc.wfs.v2_0_0.catalog.source.WfsFilterDelegate.java
private final void updateAllowedOperations(FilterCapabilities filterCapabilities) { comparisonOps = Collections.newSetFromMap(new ConcurrentHashMap<COMPARISON_OPERATORS, Boolean>( new EnumMap<COMPARISON_OPERATORS, Boolean>(COMPARISON_OPERATORS.class))); geometryOperands = new ArrayList<QName>(); temporalOperands = new ArrayList<QName>(); if (filterCapabilities == null) { LOGGER.error("WFS 2.0 Service doesn't support any filters"); return;//www. ja va 2 s. c o m } // CONFORMANCE configureConformance(filterCapabilities.getConformance()); ScalarCapabilitiesType scalarCapabilities = filterCapabilities.getScalarCapabilities(); if (scalarCapabilities != null) { // LOGICAL OPERATORS if (scalarCapabilities.getLogicalOperators() != null) { logicalOps = true; } // COMPARISON OPERATORS ComparisonOperatorsType comparisonOperators = scalarCapabilities.getComparisonOperators(); if (comparisonOperators != null) { for (ComparisonOperatorType comp : comparisonOperators.getComparisonOperator()) { if (null != comp) { comparisonOps.add(COMPARISON_OPERATORS.valueOf(comp.getName())); } } } } // SPATIAL OPERATORS SpatialCapabilitiesType spatialCapabilities = filterCapabilities.getSpatialCapabilities(); if (spatialCapabilities != null) { if (spatialCapabilities.getSpatialOperators() != null) { setSpatialOps(spatialCapabilities.getSpatialOperators()); } // GEOMETRY OPERANDS GeometryOperandsType geometryOperandsType = spatialCapabilities.getGeometryOperands(); if (geometryOperandsType != null) { for (GeometryOperandsType.GeometryOperand geoOperand : geometryOperandsType.getGeometryOperand()) { if (geoOperand.getName() != null) { geometryOperands.add(geoOperand.getName()); } } LOGGER.debug("geometryOperands: {}", geometryOperands); } } // TEMPORAL OPERATORS TemporalCapabilitiesType temporalCapabilitiesType = filterCapabilities.getTemporalCapabilities(); if (temporalCapabilitiesType != null) { if (temporalCapabilitiesType.getTemporalOperators() != null) { setTemporalOps(temporalCapabilitiesType.getTemporalOperators()); } // TEMPORAL OPERANDS TemporalOperandsType temporalOperandsType = temporalCapabilitiesType.getTemporalOperands(); if (temporalOperandsType != null) { for (TemporalOperandsType.TemporalOperand temporalOperand : temporalOperandsType .getTemporalOperand()) { if (temporalOperand.getName() != null) { temporalOperands.add(temporalOperand.getName()); } } LOGGER.debug("temporalOperands: {}", temporalOperands); } } }
From source file:org.openecomp.sdc.asdctool.impl.DataMigration.java
/** * the method retrieves the fields from the given map and praprs them for * storage as an audit according to the table name * // ww w . j av a 2 s . c om * @param map * the map from which we will retrive the fields enum values * @param table * the table we are going to store the record in. * @return a enummap representing the audit record that is going to be * created. */ private EnumMap<AuditingFieldsKeysEnum, Object> createAuditMap(Map<String, String> map, Table table) { EnumMap<AuditingFieldsKeysEnum, Object> auditingFields = new EnumMap<>(AuditingFieldsKeysEnum.class); switch (table) { case USER_ADMIN_EVENT: auditingFields.put(AuditingFieldsKeysEnum.AUDIT_TIMESTAMP, map.get("TIMESTAMP")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_REQUEST_ID, map.get("REQUEST_ID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_SERVICE_INSTANCE_ID, map.get("SERVICE_INSTANCE_ID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_ACTION, map.get("ACTION")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DESC, map.get("DESC")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_STATUS, map.get("STATUS")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_USER_AFTER, map.get("USER_AFTER")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_USER_BEFORE, map.get("USER_BEFORE")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_MODIFIER_UID, map.get("MODIFIER")); break; case USER_ACCESS_EVENT: auditingFields.put(AuditingFieldsKeysEnum.AUDIT_TIMESTAMP, map.get("TIMESTAMP")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_REQUEST_ID, map.get("REQUEST_ID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_SERVICE_INSTANCE_ID, map.get("SERVICE_INSTANCE_ID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_ACTION, map.get("ACTION")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DESC, map.get("DESC")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_STATUS, map.get("STATUS")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_USER_UID, map.get("USER")); break; case RESOURCE_ADMIN_EVENT: auditingFields.put(AuditingFieldsKeysEnum.AUDIT_TIMESTAMP, map.get("TIMESTAMP")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_REQUEST_ID, map.get("REQUEST_ID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_SERVICE_INSTANCE_ID, map.get("SERVICE_INSTANCE_ID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_INVARIANT_UUID, map.get("INVARIANT_UUID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_ACTION, map.get("ACTION")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DESC, map.get("DESC")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_STATUS, map.get("STATUS")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_CURR_VERSION, map.get("CURR_VERSION")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_CURR_STATE, map.get("CURR_STATE")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_ID, map.get("DID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_MODIFIER_UID, map.get("MODIFIER")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_PREV_VERSION, map.get("PREV_VERSION")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_PREV_STATE, map.get("PREV_STATE")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, map.get("RESOURCE_NAME")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_TYPE, map.get("RESOURCE_TYPE")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_DPREV_STATUS, map.get("DPREV_STATUS")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_DCURR_STATUS, map.get("DCURR_STATUS")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_TOSCA_NODE_TYPE, map.get("TOSCA_NODE_TYPE")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_COMMENT, map.get("COMMENT")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_ARTIFACT_DATA, map.get("ARTIFACT_DATA")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_PREV_ARTIFACT_UUID, map.get("PREV_ARTIFACT_UUID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_CURR_ARTIFACT_UUID, map.get("CURR_ARTIFACT_UUID")); break; case DISTRIBUTION_DOWNLOAD_EVENT: auditingFields.put(AuditingFieldsKeysEnum.AUDIT_TIMESTAMP, map.get("TIMESTAMP")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_REQUEST_ID, map.get("REQUEST_ID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_SERVICE_INSTANCE_ID, map.get("SERVICE_INSTANCE_ID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_ACTION, map.get("ACTION")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DESC, map.get("DESC")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_STATUS, map.get("STATUS")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_RESOURCE_URL, map.get("RESOURCE_URL")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_CONSUMER_ID, map.get("CONSUMER_ID")); break; case DISTRIBUTION_ENGINE_EVENT: auditingFields.put(AuditingFieldsKeysEnum.AUDIT_TIMESTAMP, map.get("TIMESTAMP")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_REQUEST_ID, map.get("REQUEST_ID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_SERVICE_INSTANCE_ID, map.get("SERVICE_INSTANCE_ID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_ACTION, map.get("ACTION")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DESC, map.get("DESC")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_STATUS, map.get("STATUS")); if (map.get("TOPIC_NAME") != null) { if (map.get("TOPIC_NAME").contains("-STATUS-")) { auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_STATUS_TOPIC_NAME, map.get("TOPIC_NAME")); } else { auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_NOTIFICATION_TOPIC_NAME, map.get("TOPIC_NAME")); } } else { auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_STATUS_TOPIC_NAME, map.get("DSTATUS_TOPIC")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_NOTIFICATION_TOPIC_NAME, map.get("DNOTIF_TOPIC")); } auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_TOPIC_NAME, map.get("TOPIC_NAME")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_ROLE, map.get("ROLE")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_API_KEY, map.get("API_KEY")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_ENVRIONMENT_NAME, map.get("D_ENV")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_CONSUMER_ID, map.get("CONSUMER_ID")); break; case DISTRIBUTION_NOTIFICATION_EVENT: auditingFields.put(AuditingFieldsKeysEnum.AUDIT_TIMESTAMP, map.get("TIMESTAMP")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_REQUEST_ID, map.get("REQUEST_ID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_SERVICE_INSTANCE_ID, map.get("SERVICE_INSTANCE_ID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_ACTION, map.get("ACTION")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DESC, map.get("DESC")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_STATUS, map.get("STATUS")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_CURR_STATE, map.get("CURR_STATE")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_CURR_VERSION, map.get("CURR_VERSION")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_ID, map.get("DID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_MODIFIER_UID, map.get("MODIFIER")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, map.get("RESOURCE_NAME")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_TYPE, map.get("RESOURCE_TYPE")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_TOPIC_NAME, map.get("TOPIC_NAME")); break; case DISTRIBUTION_STATUS_EVENT: auditingFields.put(AuditingFieldsKeysEnum.AUDIT_TIMESTAMP, map.get("TIMESTAMP")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_REQUEST_ID, map.get("REQUEST_ID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_SERVICE_INSTANCE_ID, map.get("SERVICE_INSTANCE_ID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_ACTION, map.get("ACTION")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DESC, map.get("DESC")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_STATUS, map.get("STATUS")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_RESOURCE_URL, map.get("RESOURCE_URL")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_ID, map.get("DID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_TOPIC_NAME, map.get("TOPIC_NAME")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_CONSUMER_ID, map.get("CONSUMER_ID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_STATUS_TIME, map.get("STATUS_TIME")); break; case DISTRIBUTION_DEPLOY_EVENT: auditingFields.put(AuditingFieldsKeysEnum.AUDIT_TIMESTAMP, map.get("TIMESTAMP")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_REQUEST_ID, map.get("REQUEST_ID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_SERVICE_INSTANCE_ID, map.get("SERVICE_INSTANCE_ID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_ACTION, map.get("ACTION")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DESC, map.get("DESC")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_STATUS, map.get("STATUS")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_ID, map.get("DID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, map.get("RESOURCE_NAME")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_TYPE, map.get("RESOURCE_TYPE")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_MODIFIER_UID, map.get("MODIFIER")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_CURR_VERSION, map.get("CURR_VERSION")); break; case DISTRIBUTION_GET_UEB_CLUSTER_EVENT: auditingFields.put(AuditingFieldsKeysEnum.AUDIT_TIMESTAMP, map.get("TIMESTAMP")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_REQUEST_ID, map.get("REQUEST_ID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_SERVICE_INSTANCE_ID, map.get("SERVICE_INSTANCE_ID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_ACTION, map.get("ACTION")); if (map.get("STATUS_DESC") != null) { auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DESC, map.get("STATUS_DESC")); } else { auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DESC, map.get("DESC")); } auditingFields.put(AuditingFieldsKeysEnum.AUDIT_STATUS, map.get("STATUS")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_CONSUMER_ID, map.get("CONSUMER_ID")); break; case AUTH_EVENT: auditingFields.put(AuditingFieldsKeysEnum.AUDIT_TIMESTAMP, map.get("TIMESTAMP")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_ACTION, map.get("ACTION")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DESC, map.get("DESC")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_REQUEST_ID, map.get("REQUEST_ID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_STATUS, map.get("STATUS")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_AUTH_USER, map.get("USER")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_AUTH_URL, map.get("URL")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_AUTH_STATUS, map.get("AUTH_STATUS")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_AUTH_REALM, map.get("REALM")); break; case CONSUMER_EVENT: auditingFields.put(AuditingFieldsKeysEnum.AUDIT_TIMESTAMP, map.get("TIMESTAMP")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_ACTION, map.get("ACTION")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DESC, map.get("DESC")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_STATUS, map.get("STATUS")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_MODIFIER_UID, map.get("MODIFIER")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_REQUEST_ID, map.get("REQUEST_ID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_ECOMP_USER, map.get("ECOMP_USER")); break; case CATEGORY_EVENT: auditingFields.put(AuditingFieldsKeysEnum.AUDIT_TIMESTAMP, map.get("TIMESTAMP")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_ACTION, map.get("ACTION")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DESC, map.get("DESC")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_STATUS, map.get("STATUS")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_MODIFIER_UID, map.get("MODIFIER")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_REQUEST_ID, map.get("REQUEST_ID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_SERVICE_INSTANCE_ID, map.get("SERVICE_INSTANCE_ID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_CATEGORY_NAME, map.get("CATEGORY_NAME")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_SUB_CATEGORY_NAME, map.get("SUB_CATEGORY_NAME")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_GROUPING_NAME, map.get("GROUPING_NAME")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_TYPE, map.get("RESOURCE_TYPE")); break; case GET_USERS_LIST_EVENT: auditingFields.put(AuditingFieldsKeysEnum.AUDIT_TIMESTAMP, map.get("TIMESTAMP")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_ACTION, map.get("ACTION")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DESC, map.get("DESC")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_STATUS, map.get("STATUS")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_MODIFIER_UID, map.get("MODIFIER")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_REQUEST_ID, map.get("REQUEST_ID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DETAILS, map.get("DETAILS")); break; case GET_CATEGORY_HIERARCHY_EVENT: auditingFields.put(AuditingFieldsKeysEnum.AUDIT_TIMESTAMP, map.get("TIMESTAMP")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_ACTION, map.get("ACTION")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DESC, map.get("DESC")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_STATUS, map.get("STATUS")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_MODIFIER_UID, map.get("MODIFIER")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_REQUEST_ID, map.get("REQUEST_ID")); auditingFields.put(AuditingFieldsKeysEnum.AUDIT_DETAILS, map.get("DETAILS")); break; default: auditingFields = null; break; } return auditingFields; }
From source file:com.tesora.dve.sql.schema.PETable.java
@SuppressWarnings("unchecked") protected void loadRest(UserTable table, SchemaContext pc) { for (PEColumn c : getColumns(pc, true)) { if (c.isAutoIncrement()) hasAutoInc = Boolean.TRUE; }/*from w w w.j av a 2 s .c om*/ this.keys = new ArrayList<PEKey>(); for (Key k : table.getKeys()) { PEKey pek = PEKey.load(k, pc, this); if (pek.isPrimary()) pk = pek; keys.add(pek); pek.setTable(StructuralUtils.buildEdge(pc, this, true)); } referring = new ListSet<SchemaCacheKey<PEAbstractTable<?>>>(); for (Key k : table.getReferringKeys()) { referring.add(PEAbstractTable.getTableKey(k.getTable())); } forceStorage(pc); // load the triggers here this.triggers = new EnumMap<TriggerEvent, PETableTriggerEventInfo>(TriggerEvent.class); if (!table.getTriggers().isEmpty()) { for (UserTrigger ut : table.getTriggers()) { PETrigger trig = PETrigger.load(ut, pc, this); addTriggerInternal(trig, true); } } }
From source file:edu.cornell.mannlib.vitro.webapp.modelaccess.impl.ContextModelAccessImpl.java
private Map<ReasoningOption, WebappDaoFactory> populateWadfMap() { WebappDaoFactoryConfig config = new WebappDaoFactoryConfig(); config.setDefaultNamespace(getDefaultNamespace()); RDFService rdfService = getRDFService(CONTENT); Map<ReasoningOption, WebappDaoFactory> map = new EnumMap<>(ReasoningOption.class); map.put(ASSERTIONS_ONLY, new WebappDaoFactorySDB(rdfService, getOntModelSelector(ASSERTIONS_ONLY), config, SDBDatasetMode.ASSERTIONS_ONLY)); map.put(INFERENCES_ONLY, new WebappDaoFactorySDB(rdfService, getOntModelSelector(INFERENCES_ONLY), config, SDBDatasetMode.INFERENCES_ONLY)); map.put(ASSERTIONS_AND_INFERENCES, new WebappDaoFactorySDB(rdfService, getOntModelSelector(ASSERTIONS_AND_INFERENCES), config, SDBDatasetMode.ASSERTIONS_AND_INFERENCES)); log.debug("WebappdaoFactoryMap: " + map); return Collections.unmodifiableMap(map); }
From source file:eu.europa.ec.fisheries.uvms.rules.service.bean.RulesActivityServiceBean.java
private Map<ActivityTableType, List<IDType>> collectAllIdsFromMessage(FLUXFAReportMessage request) { Map<ActivityTableType, List<IDType>> idsmap = new EnumMap<>(ActivityTableType.class); idsmap.put(ActivityTableType.RELATED_FLUX_REPORT_DOCUMENT_ENTITY, new ArrayList<IDType>()); if (request == null) { return idsmap; }//w w w . ja v a2s.c o m // FLUXReportDocument IDs FLUXReportDocument fluxReportDocument = request.getFLUXReportDocument(); if (fluxReportDocument != null && CollectionUtils.isNotEmpty(fluxReportDocument.getIDS())) { idsmap.put(ActivityTableType.FLUX_REPORT_DOCUMENT_ENTITY, fluxReportDocument.getIDS()); } // FAReportDocument.RelatedFLUXReportDocument IDs and ReferencedID List<FAReportDocument> faReportDocuments = request.getFAReportDocuments(); if (CollectionUtils.isNotEmpty(faReportDocuments)) { for (FAReportDocument faRepDoc : faReportDocuments) { FLUXReportDocument relatedFLUXReportDocument = faRepDoc.getRelatedFLUXReportDocument(); if (relatedFLUXReportDocument != null) { List<IDType> idTypes = new ArrayList<>(); idTypes.addAll(relatedFLUXReportDocument.getIDS()); idTypes.add(relatedFLUXReportDocument.getReferencedID()); idTypes.removeAll(Collections.singletonList(null)); idsmap.get(ActivityTableType.RELATED_FLUX_REPORT_DOCUMENT_ENTITY).addAll(idTypes); } } } return idsmap; }
From source file:org.artifactory.common.property.ArtifactorySystemProperties.java
public void loadArtifactorySystemProperties(File systemPropertiesFile, File artifactoryPropertiesFile) { Properties combinedProperties = new Properties(); if (systemPropertiesFile != null && systemPropertiesFile.exists()) { FileInputStream fis = null; try {/* w ww.jav a 2 s. c o m*/ fis = new FileInputStream(systemPropertiesFile); combinedProperties.load(fis); } catch (Exception e) { throw new RuntimeException("Could not read default system properties from '" + systemPropertiesFile.getAbsolutePath() + "'.", e); } finally { IOUtils.closeQuietly(fis); } } // load artifactory.properties (version and revision properties) if (artifactoryPropertiesFile != null && artifactoryPropertiesFile.exists()) { FileInputStream fis = null; try { // Load from file than override from the system props fis = new FileInputStream(artifactoryPropertiesFile); combinedProperties.load(fis); } catch (Exception e) { throw new RuntimeException("Could not read artifactory.properties from '" + artifactoryPropertiesFile.getAbsolutePath() + "'.", e); } finally { IOUtils.closeQuietly(fis); } } // Override with System properties loadSystemProperties(combinedProperties); Set<String> setAsSystemProp = new HashSet<>(); //Cleanup all non-artifactory system properties and set them as system properties for (Object key : combinedProperties.keySet()) { String propName = (String) key; String propValue = combinedProperties.getProperty(propName); if (!propName.startsWith(ConstantValues.SYS_PROP_PREFIX)) { // TODO: mainly for derby db properties, find another way of doing it System.setProperty(propName, propValue); setAsSystemProp.add(propName); } } for (String key : setAsSystemProp) { combinedProperties.remove(key); } substituteRepoKeys = fillRepoKeySubstitute(combinedProperties); //Test for deprecated properties and warn handleDeprecatedProps(combinedProperties); validateConstants(combinedProperties); // Use the EnumMap as much as possible EnumMap<ConstantValues, String> newArtifactoryProperties = new EnumMap<>(ConstantValues.class); for (ConstantValues constVal : ConstantValues.values()) { Object val = combinedProperties.remove(constVal.getPropertyName()); if (val != null) { newArtifactoryProperties.put(constVal, (String) val); } } artifactoryProperties = newArtifactoryProperties; // TODO: Print a message when combined props is not empty as this should not happen. // It's probably a typo! But it's used for special security access values not declared in ConstantValues nonEnumArtifactoryProperties = combinedProperties; artifactoryBooleanProperties.clear(); artifactoryLongProperties.clear(); }
From source file:org.gradle.jvm.toolchain.internal.JavaInstallationProbe.java
private static EnumMap<SysProp, String> parseExecOutput(String probeResult) { String[] split = probeResult.split(System.getProperty("line.separator")); if (split.length != SysProp.values().length - 1) { // -1 because of Z_ERROR return error("Unexpected command output: \n" + probeResult); }/*from w w w . j a va 2 s.co m*/ EnumMap<SysProp, String> result = new EnumMap<SysProp, String>(SysProp.class); for (SysProp type : SysProp.values()) { if (type != SysProp.Z_ERROR) { result.put(type, split[type.ordinal()]); } } return result; }
From source file:com.adobe.acs.commons.mcp.impl.processes.AssetIngestor.java
@Override public void storeReport(ProcessInstance instance, ResourceResolver rr) throws RepositoryException, PersistenceException { EnumMap<ReportColumns, Object> values = new EnumMap<>(ReportColumns.class); List<EnumMap<ReportColumns, Object>> rows = new ArrayList<>(); rows.add(values);/* w ww . j ava2 s .co m*/ values.put(ReportColumns.folder_count, folderCount); values.put(ReportColumns.asset_count, assetCount); values.put(ReportColumns.files_skipped, filesSkipped); values.put(ReportColumns.data_imported, totalImportedData); report.setRows(rows, ReportColumns.class); report.persist(rr, instance.getPath() + "/jcr:content/report"); }
From source file:fr.free.movierenamer.scrapper.impl.movie.TMDbScrapper.java
@Override protected List<CastingInfo> fetchCastingInfo(Movie movie, Locale language) throws Exception { URL searchUrl = new URL("http", apiHost, "/" + version + "/movie/" + movie.getId() + "/casts?api_key=" + apikey); JSONObject json = URIRequest.getJsonDocument(searchUrl.toURI()); List<CastingInfo> casting = new ArrayList<CastingInfo>(); for (String section : new String[] { "cast", "crew" }) { List<JSONObject> jsonObjs = JSONUtils.selectList(section, json); for (JSONObject jsonObj : jsonObjs) { Map<PersonProperty, String> personFields = new EnumMap<PersonProperty, String>( PersonProperty.class); personFields.put(PersonProperty.name, JSONUtils.selectString("name", jsonObj)); personFields.put(PersonProperty.character, JSONUtils.selectString("character", jsonObj)); String image = JSONUtils.selectString("profile_path", jsonObj); if (image != null && image.length() > 0) { personFields.put(PersonProperty.picturePath, imageUrl + TmdbImageSize.cast.getMedium() + image); }// ww w . jav a 2s . com if (section.equals("crew")) { personFields.put(PersonProperty.job, JSONUtils.selectString("job", jsonObj)); } else { personFields.put(PersonProperty.job, CastingInfo.ACTOR); } casting.add(new CastingInfo(personFields)); } } return casting; }