code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public void startup() {
underlying.startup();
OProfiler.getInstance().registerHookValue(profilerPrefix + "enabled", new OProfilerHookValue() {
public Object getValue() {
return isEnabled();
}
});
OProfiler.getInstance().registerHookValue(profilerPrefix + "current", new OPr... | java |
public Cipher getCipher() throws GeneralSecurityException {
Cipher cipher = Cipher.getInstance("Blowfish/ECB/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(key, "Blowfish"));
return cipher;
} | java |
public Cipher getEncryptionCipher() throws GeneralSecurityException {
Cipher cipher = Cipher.getInstance("Blowfish/ECB/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key, "Blowfish"));
return cipher;
} | java |
public Object execute(final Map<Object, Object> iArgs) {
if (className == null)
throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet");
final ODatabaseRecord database = getDatabase();
final OClass oClass = database.getMetadata().getSchema().getClass... | java |
public int compareTo(final OCompositeKey otherKey) {
final Iterator<Object> inIter = keys.iterator();
final Iterator<Object> outIter = otherKey.keys.iterator();
while (inIter.hasNext() && outIter.hasNext()) {
final Object inKey = inIter.next();
final Object outKey = outIter.next();
... | java |
public Map<String, Object> getVariables() {
final HashMap<String, Object> map = new HashMap<String, Object>();
if (inherited != null)
map.putAll(inherited.getVariables());
if (variables != null)
map.putAll(variables);
return map;
} | java |
@SuppressWarnings("unchecked")
public <T> T getPropertyValue(ElementDescriptor<T> property)
{
if (mProperties == null)
{
return null;
}
return (T) mProperties.get(property);
} | java |
public <T> void clear(ElementDescriptor<T> property)
{
if (mSet != null)
{
mSet.remove(property);
}
} | java |
public long countClass(final String iClassName) {
final OClass cls = getMetadata().getSchema().getClass(iClassName);
if (cls == null)
throw new IllegalArgumentException("Class '" + iClassName + "' not found in database");
return cls.count();
} | java |
public OBinarySerializer<?> getObjectSerializer(final byte identifier) {
OBinarySerializer<?> impl = serializerIdMap.get(identifier);
if (impl == null) {
final Class<? extends OBinarySerializer<?>> cls = serializerClassesIdMap.get(identifier);
if (cls != null)
try {
impl = cl... | java |
public long addRecord(final ORecordId iRid, final byte[] iContent) throws IOException {
if (iContent.length == 0)
// AVOID UNUSEFUL CREATION OF EMPTY RECORD: IT WILL BE CREATED AT FIRST UPDATE
return -1;
final int recordSize = iContent.length + RECORD_FIX_SIZE;
acquireExclusiveLock();... | java |
public byte[] getRecord(final long iPosition) throws IOException {
if (iPosition == -1)
return null;
acquireSharedLock();
try {
final long[] pos = getRelativePosition(iPosition);
final OFile file = files[(int) pos[0]];
final int recordSize = file.readInt(pos[1]);
... | java |
public int getRecordSize(final long iPosition) throws IOException {
acquireSharedLock();
try {
final long[] pos = getRelativePosition(iPosition);
final OFile file = files[(int) pos[0]];
return file.readInt(pos[1]);
} finally {
releaseSharedLock();
}
} | java |
public long setRecord(final long iPosition, final ORecordId iRid, final byte[] iContent) throws IOException {
acquireExclusiveLock();
try {
long[] pos = getRelativePosition(iPosition);
final OFile file = files[(int) pos[0]];
final int recordSize = file.readInt(pos[1]);
final in... | java |
public List<ODataHoleInfo> getHolesList() {
acquireSharedLock();
try {
final List<ODataHoleInfo> holes = new ArrayList<ODataHoleInfo>();
final int tot = holeSegment.getHoles();
for (int i = 0; i < tot; ++i) {
final ODataHoleInfo h = holeSegment.getHole(i);
if (h != n... | java |
private static boolean betweenLongitudes(double topLeftLon, double bottomRightLon, double lon) {
if (topLeftLon <= bottomRightLon)
return lon >= topLeftLon && lon <= bottomRightLon;
else
return lon >= topLeftLon || lon <= bottomRightLon;
} | java |
public int getPropertyStatus(ElementDescriptor<?> descriptor)
{
PropStat propStat = mPropStatByProperty.get(descriptor);
if (propStat == null)
{
return STATUS_NONE;
}
return propStat.getStatusCode();
} | java |
public <T> T getPropertyValue(ElementDescriptor<T> descriptor)
{
PropStat propStat = mPropStatByProperty.get(descriptor);
if (propStat == null)
{
return null;
}
return propStat.getPropertyValue(descriptor);
} | java |
private static synchronized Set<OIndexFactory> getFactories() {
if (FACTORIES == null) {
final Iterator<OIndexFactory> ite = lookupProviderWithOrientClassLoader(OIndexFactory.class,orientClassLoader);
final Set<OIndexFactory> factories = new HashSet<OIndexFactory>();
while (ite.hasNext()) {
factories.a... | java |
public void addListener(final ORecordListener iListener) {
if (_listeners == null)
_listeners = Collections.newSetFromMap(new WeakHashMap<ORecordListener, Boolean>());
_listeners.add(iListener);
} | java |
public static String getComponentProjectName(int componentType, String groupId, String artifactId) {
IModel m = ModelFactory.newModel(groupId, artifactId, null, null, MuleVersionEnum.MAIN_MULE_VERSION, null, null);
String projectFolderName = null;
ComponentEnum compEnum = ComponentEnum.get(componentType);
switc... | java |
protected boolean checkConsistency(Object o1, Object o2) {
return checkConsistency(o1, o2, null, null);
} | java |
public boolean checkConsistency(final Object legacyEntity, final Object lightblueEntity, final String methodName, MethodCallStringifier callToLogInCaseOfInconsistency) {
if (legacyEntity == null && lightblueEntity == null) {
return true;
}
if (callToLogInCaseOfInconsistency == null... | java |
public Object execute(final Map<Object, Object> iArgs) {
if (newRecords == null)
throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet");
final OCommandParameters commandParameters = new OCommandParameters(iArgs);
if (indexName != null) {
fina... | java |
@SuppressWarnings("unchecked")
public OGraphEdge link(final OGraphVertex iTargetVertex, final String iClassName) {
if (iTargetVertex == null)
throw new IllegalArgumentException("Missed the target vertex");
// CREATE THE EDGE BETWEEN ME AND THE TARGET
final OGraphEdge edge = new OGraphEdge(database, iCl... | java |
public OGraphVertex unlink(final OGraphVertex iTargetVertex) {
if (iTargetVertex == null)
throw new IllegalArgumentException("Missed the target vertex");
unlink(database, document, iTargetVertex.getDocument());
return this;
} | java |
public boolean hasInEdges() {
final Set<ODocument> docs = document.field(OGraphDatabase.VERTEX_FIELD_IN);
return docs != null && !docs.isEmpty();
} | java |
public boolean hasOutEdges() {
final Set<ODocument> docs = document.field(OGraphDatabase.VERTEX_FIELD_OUT);
return docs != null && !docs.isEmpty();
} | java |
public Set<OGraphEdge> getInEdges(final String iEdgeLabel) {
Set<OGraphEdge> temp = in != null ? in.get() : null;
if (temp == null) {
if (iEdgeLabel == null)
temp = new HashSet<OGraphEdge>();
in = new SoftReference<Set<OGraphEdge>>(temp);
final Set<Object> docs = document.field(OGraphDatabase... | java |
@SuppressWarnings("unchecked")
public Set<OGraphVertex> browseOutEdgesVertexes() {
final Set<OGraphVertex> resultset = new HashSet<OGraphVertex>();
Set<OGraphEdge> temp = out != null ? out.get() : null;
if (temp == null) {
final Set<OIdentifiable> docEdges = (Set<OIdentifiable>) document.field(OGraph... | java |
@SuppressWarnings("unchecked")
public Set<OGraphVertex> browseInEdgesVertexes() {
final Set<OGraphVertex> resultset = new HashSet<OGraphVertex>();
Set<OGraphEdge> temp = in != null ? in.get() : null;
if (temp == null) {
final Set<ODocument> docEdges = (Set<ODocument>) document.field(OGraphDatabase.VE... | java |
public static void unlink(final ODatabaseGraphTx iDatabase, final ODocument iSourceVertex, final ODocument iTargetVertex) {
if (iTargetVertex == null)
throw new IllegalArgumentException("Missed the target vertex");
if (iDatabase.existsUserObjectByRID(iSourceVertex.getIdentity())) {
// WORK ALSO WITH IN ... | java |
public SyncCollection limitNumberOfResults(int limit)
{
if (limit > 0)
{
addLimit(WebDavSearch.NRESULTS, limit);
}
else
{
removeLimit(WebDavSearch.NRESULTS);
}
return this;
} | java |
public int getNumberOfResultsLimit()
{
if (mLimit == null)
{
return 0;
}
Integer limit = (Integer) mLimit.get(WebDavSearch.NRESULTS);
return limit == null ? 0 : limit;
} | java |
private <T> void addLimit(ElementDescriptor<T> descriptor, T limit)
{
if (mLimit == null)
{
mLimit = new HashMap<ElementDescriptor<?>, Object>(6);
}
mLimit.put(descriptor, limit);
} | java |
public void put(K k, V v) {
cache.put(k, v);
acquireLock(k).countDown();
} | java |
public V get(K k) throws InterruptedException {
await(k);
return cache.get(k);
} | java |
public V get(K k, long timeout, TimeUnit unit) throws InterruptedException, TimeoutException {
await(k, timeout, unit);
return cache.get(k);
} | java |
public void await(K k, long timeout, TimeUnit unit) throws InterruptedException, TimeoutException {
if (!acquireLock(k).await(timeout, unit)) {
throw new TimeoutException("Wait time for retrieving value for key " + k + " exceeded " + timeout + " " + unit);
}
} | java |
public static void initEndpointDirectories(MuleContext muleContext, String[] serviceNames, String[] endpointNames) throws Exception {
// Stop all named services (either Flows or services
List<Lifecycle> services = new ArrayList<Lifecycle>();
for (String serviceName : serviceNames) {
try {
Lifecycle servic... | java |
static protected SftpClient getSftpClient(MuleContext muleContext,
String endpointName) throws IOException {
ImmutableEndpoint endpoint = getImmutableEndpoint(muleContext,
endpointName);
try {
SftpClient sftpClient = SftpConnectionFactory.createClient(endpoint);
return sftpClient;
} catch (Excepti... | java |
static protected void recursiveDelete(MuleContext muleContext, SftpClient sftpClient, String endpointName, String relativePath) throws IOException {
EndpointURI endpointURI = getImmutableEndpoint(muleContext, endpointName).getEndpointURI();
String path = endpointURI.getPath() + relativePath;
try {
// Ensure t... | java |
public OMVRBTreeEntryPersistent<K, V> save() throws OSerializationException {
if (!dataProvider.isEntryDirty())
return this;
final boolean isNew = dataProvider.getIdentity().isNew();
// FOR EACH NEW LINK, SAVE BEFORE
if (left != null && left.dataProvider.getIdentity().isNew()) {
if... | java |
public OMVRBTreeEntryPersistent<K, V> delete() throws IOException {
if (dataProvider != null) {
pTree.removeNodeFromMemory(this);
pTree.removeEntry(dataProvider.getIdentity());
// EARLY LOAD LEFT AND DELETE IT RECURSIVELY
if (getLeft() != null)
((OMVRBTreeEntryPersistent<K, V... | java |
protected int disconnect(final boolean iForceDirty, final int iLevel) {
if (dataProvider == null)
// DIRTY NODE, JUST REMOVE IT
return 1;
int totalDisconnected = 0;
final ORID rid = dataProvider.getIdentity();
boolean disconnectedFromParent = false;
if (parent != null) {
... | java |
public V setValue(final V iValue) {
V oldValue = getValue();
int index = tree.getPageIndex();
if (dataProvider.setValueAt(index, iValue))
markDirty();
return oldValue;
} | java |
public static OIdentifiable readIdentifiable(final OChannelBinaryClient network) throws IOException {
final int classId = network.readShort();
if (classId == RECORD_NULL)
return null;
if (classId == RECORD_RID) {
return network.readRID();
} else {
final ORecordInternal<?> reco... | java |
public static Map<Identity, JsonNode> getDocumentIdMap(List<JsonNode> list, List<String> identityFields) {
Map<Identity, JsonNode> map = new HashMap<>();
if (list != null) {
LOGGER.debug("Getting doc IDs for {} docs, fields={}", list.size(), identityFields);
for (JsonNode node : ... | java |
public static boolean fastCompareDocs(JsonNode sourceDocument, JsonNode destinationDocument, List<String> exclusionPaths, boolean ignoreTimestampMSDiffs) {
try {
JsonDiff diff = new JsonDiff();
diff.setOption(JsonDiff.Option.ARRAY_ORDER_INSIGNIFICANT);
diff.setOption(JsonDiff... | java |
public synchronized void createHole(final long iRecordOffset, final int iRecordSize) throws IOException {
final long timer = OProfiler.getInstance().startChrono();
// IN MEMORY
final int recycledPosition;
final ODataHoleInfo hole;
if (!freeHoles.isEmpty()) {
// RECYCLE THE FIRST FREE H... | java |
public synchronized ODataHoleInfo getHole(final int iPosition) {
final ODataHoleInfo hole = availableHolesList.get(iPosition);
if (hole.dataOffset == -1)
return null;
return hole;
} | java |
public synchronized void updateHole(final ODataHoleInfo iHole, final long iNewDataOffset, final int iNewRecordSize)
throws IOException {
final long timer = OProfiler.getInstance().startChrono();
final boolean offsetChanged = iNewDataOffset != iHole.dataOffset;
final boolean sizeChanged = iNewRec... | java |
public synchronized void deleteHole(int iHolePosition) throws IOException {
// IN MEMORY
final ODataHoleInfo hole = availableHolesList.get(iHolePosition);
availableHolesBySize.remove(hole);
availableHolesByPosition.remove(hole);
hole.dataOffset = -1;
freeHoles.add(iHolePosition);
... | java |
protected T getObject() {
final T object;
if (reusedObject != null) {
// REUSE THE SAME RECORD AFTER HAVING RESETTED IT
object = reusedObject;
object.reset();
} else
// CREATE A NEW ONE
object = (T) database.newInstance(className);
return object;
} | java |
@SneakyThrows(IOException.class)
public static String sha1(String input) throws NoSuchAlgorithmException {
MessageDigest mDigest = MessageDigest.getInstance("SHA1");
byte[] result = mDigest.digest(input.getBytes("UTF-8"));
String resultString = String.format("%040x", new BigInteger(1, result));
return resultSt... | java |
public void saveRecord(final ORecordInternal<?> iRecord, final String iClusterName, final OPERATION_MODE iMode,
final ORecordCallback<? extends Number> iCallback) {
try {
database.executeSaveRecord(iRecord, iClusterName, iRecord.getVersion(), iRecord.getRecordType(), true, iMode, iCallback);
} c... | java |
public void deleteRecord(final ORecordInternal<?> iRecord, final OPERATION_MODE iMode) {
if (!iRecord.getIdentity().isPersistent())
return;
try {
database.executeDeleteRecord(iRecord, iRecord.getVersion(), true, true, iMode);
} catch (Exception e) {
// REMOVE IT FROM THE CACHE TO A... | java |
@SuppressWarnings("unchecked")
public <RET> RET execute(final Object... iArgs) {
setParameters(iArgs);
return (RET) ODatabaseRecordThreadLocal.INSTANCE.get().getStorage().command(this);
} | java |
public Collection<ODocument> getEntriesBetween(final Object iRangeFrom, final Object iRangeTo) {
return getEntriesBetween(iRangeFrom, iRangeTo, true);
} | java |
public long rebuild(final OProgressListener iProgressListener) {
long documentIndexed = 0;
final boolean intentInstalled = getDatabase().declareIntent(new OIntentMassiveInsert());
acquireExclusiveLock();
try {
try {
map.clear();
} catch (Exception e) {
// IGNORE E... | java |
public boolean isConnected() {
if (socket != null && socket.isConnected() && !socket.isInputShutdown() && !socket.isOutputShutdown())
return true;
return false;
} | java |
public void detach(Object self) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
for (String fieldName : doc.fieldNames()) {
Object value = getValue(self, fieldName, false, null);
if (value instanceof OLazyObjectMultivalueElement)
((OLazyObjectMultivalueElement) value).detac... | java |
public void attach(Object self) throws IllegalArgumentException, IllegalAccessException, NoSuchMethodException,
InvocationTargetException {
for (Class<?> currentClass = self.getClass(); currentClass != Object.class;) {
if (Proxy.class.isAssignableFrom(currentClass)) {
currentClass = currentClass.getSupercla... | java |
private void ensureRespondJsScriptElement() {
if (this.respondJsScript == null) {
this.respondJsScript = Document.get().createScriptElement();
this.respondJsScript.setSrc(GWT.getModuleBaseForStaticFiles() + DefaultIE8ThemeController.RESPOND_JS_LOCATION);
this.respondJsScript.setType("text/javascript");
}
... | java |
public static MessageDispatcherServlet createMessageDispatcherServlet(Class... contextConfigLocation) {
StringBuilder items = new StringBuilder();
for (Class aClass : contextConfigLocation) {
items.append( aClass.getName());
items.append(",");
}
MessageDispatcherS... | java |
@VisibleForTesting
static Integer getReceivedStations(AisExtractor extractor, int slotTimeout,
int startIndex) {
if (slotTimeout == 3 || slotTimeout == 5 || slotTimeout == 7)
return extractor.getValue(startIndex + 5, startIndex + 19);
else
return null;
} | java |
private static Integer getHourUtc(AisExtractor extractor, int slotTimeout,
int startIndex) {
if (slotTimeout == 1) {
// skip the msb bit
int hours = extractor.getValue(startIndex + 5, startIndex + 10);
return hours;
} else
return null;
} | java |
private static Integer getMinuteUtc(AisExtractor extractor,
int slotTimeout, int startIndex) {
if (slotTimeout == 1) {
// skip the msb bit
int minutes = extractor.getValue(startIndex + 10, startIndex + 17);
return minutes;
} else
return null;
} | java |
private static Integer getSlotOffset(AisExtractor extractor,
int slotTimeout, int startIndex) {
if (slotTimeout == 0)
return extractor.getValue(startIndex + 5, startIndex + 19);
else
return null;
} | java |
public synchronized int getValue(int from, int to) {
try {
// is synchronized so that values of bitSet and calculated can be
// lazily
// calculated and safely published (thread safe).
SixBit.convertSixBitToBits(message, padBits, bitSet, calculated, from, to);
... | java |
public synchronized int getSignedValue(int from, int to) {
try {
// is synchronized so that values of bitSet and calculated can be
// lazily
// calculated and safely published (thread safe).
SixBit.convertSixBitToBits(message, padBits, bitSet, calculated, from, to... | java |
public static Object getField(Object obj, String name) {
try {
Class<? extends Object> klass = obj.getClass();
do {
try {
Field field = klass.getDeclaredField(name);
field.setAccessible(true);
return field.get(obj);
} catch (NoSuchFieldException e) {
... | java |
public final double getDistanceToKm(Position position) {
double lat1 = toRadians(lat);
double lat2 = toRadians(position.lat);
double lon1 = toRadians(lon);
double lon2 = toRadians(position.lon);
double deltaLon = lon2 - lon1;
double cosLat2 = cos(lat2);
double cosLat1 = cos(lat1);
double sinLat1 = sin(l... | java |
public final double getDistanceKmToPath(Position p1, Position p2) {
double d = radiusEarthKm
* asin(sin(getDistanceToKm(p1) / radiusEarthKm)
* sin(toRadians(getBearingDegrees(p1)
- p1.getBearingDegrees(p2))));
return abs(d);
} | java |
@SuppressWarnings("unchecked")
public static void setModelClass(Class<?> modelClass) throws IllegalArgumentException {
if (!DefaultModelImpl.class.isAssignableFrom(modelClass)) {
throw new IllegalArgumentException("Modelclass, " + modelClass.getName() + ", is not a subtype of " + DefaultModelImpl.class.getN... | java |
public static void resetModelClass() {
ModelFactory.modelClass = DefaultModelImpl.class;
System.err.println("[INFO] Reset model-class: " + ModelFactory.modelClass.getName());
} | java |
public static IModel newModel(String groupId, String artifactId, String version, String service, MuleVersionEnum muleVersion, TransportEnum inboundTransport, TransportEnum outboundTransport, TransformerEnum transformerType) {
return doCreateNewModel(groupId, artifactId, version, service, muleVersion, null, null, inbo... | java |
public static void lockMemory(boolean useSystemJNADisabled) {
if (useSystemJNADisabled)
disableUsingSystemJNA();
try {
int errorCode = MemoryLockerLinux.INSTANCE.mlockall(MemoryLockerLinux.LOCK_CURRENT_MEMORY);
if (errorCode != 0) {
final String errorMessage;
int lastE... | java |
public OMVRBTreeEntry<K, V> getFirstInMemory() {
OMVRBTreeEntry<K, V> node = this;
OMVRBTreeEntry<K, V> prev = this;
while (node != null) {
prev = node;
node = node.getPreviousInMemory();
}
return prev;
} | java |
public OMVRBTreeEntry<K, V> getPreviousInMemory() {
OMVRBTreeEntry<K, V> t = this;
OMVRBTreeEntry<K, V> p = null;
if (t.getLeftInMemory() != null) {
p = t.getLeftInMemory();
while (p.getRightInMemory() != null)
p = p.getRightInMemory();
} else {
p = t.getParentInMemor... | java |
private V linearSearch(final K iKey) {
V value = null;
int i = 0;
tree.pageItemComparator = -1;
for (int s = getSize(); i < s; ++i) {
if (tree.comparator != null)
tree.pageItemComparator = tree.comparator.compare(getKeyAt(i), iKey);
else
tree.pageItemComparator = ((Co... | java |
private V binarySearch(final K iKey) {
int low = 0;
int high = getSize() - 1;
int mid = 0;
while (low <= high) {
mid = (low + high) >>> 1;
Object midVal = getKeyAt(mid);
if (tree.comparator != null)
tree.pageItemComparator = tree.comparator.compare((K) midVal, iKey)... | java |
public int compareTo(final OMVRBTreeEntry<K, V> o) {
if (o == null)
return 1;
if (o == this)
return 0;
if (getSize() == 0)
return -1;
if (o.getSize() == 0)
return 1;
if (tree.comparator != null)
return tree.comparator.compare(getFirstKey(), o.getFirstKey());
... | java |
public static long parsePeriod(String periodStr) {
PeriodFormatter fmt = PeriodFormat.getDefault();
Period p = fmt.parsePeriod(periodStr);
return p.toStandardDuration().getMillis();
} | java |
public Date getEndDate(Date startDate, long period) {
long now = getNow().getTime();
long endDate = startDate.getTime() + period;
if (now - period > endDate) {
return new Date(endDate);
} else {
return null;
}
} | java |
protected List<MigrationJob> createJobs(Date startDate, Date endDate, ActiveExecution ae) throws Exception {
List<MigrationJob> ret = new ArrayList<MigrationJob>();
LOGGER.debug("Creating the migrator to setup new jobs");
// We setup a new migration job
MigrationJob mj = new MigrationJob... | java |
private OMMapBufferEntry[] searchAmongExisting(OFileMMap file, final OMMapBufferEntry[] fileEntries, final long beginOffset,
final int size) {
if (fileEntries.length == 0) {
return EMPTY_BUFFER_ENTRIES;
}
final OMMapBufferEntry lastEntry = fileEntries[fileEntries.length - 1];
if (las... | java |
private OMMapBufferEntry mapNew(final OFileMMap file, final long beginOffset) throws IOException {
return new OMMapBufferEntry(file, file.map(beginOffset, file.getFileSize() - (int) beginOffset), beginOffset,
file.getFileSize() - (int) beginOffset);
} | java |
private void acquireLocksOnEntries(final OMMapBufferEntry[] entries, OPERATION_TYPE operationType) {
if (operationType == OPERATION_TYPE.WRITE)
for (OMMapBufferEntry entry : entries) {
entry.acquireWriteLock();
entry.setDirty();
}
else
for (OMMapBufferEntry entry : entri... | java |
private void removeFileEntries(OMMapBufferEntry[] fileEntries) {
if (fileEntries != null) {
for (OMMapBufferEntry entry : fileEntries) {
removeEntry(entry);
}
}
} | java |
public static String getRelativePath(File file, File srcDir) {
String base = srcDir.getPath();
String filePath = file.getPath();
String relativePath = new File(base).toURI()
.relativize(new File(filePath).toURI()).getPath();
return relativePath;
} | java |
public static void copyFile(File srcFile, File destFile) {
OutputStream out = null;
InputStream in = null;
try {
if (!destFile.getParentFile().exists())
destFile.getParentFile().mkdirs();
in = new FileInputStream(srcFile);
out = new FileOutputStream(destFile);
// Transfer bytes from in to out
... | java |
public static ContextLoaderListener createSpringContextLoader(final WebApplicationContext webApplicationContext) {
return new ContextLoaderListener() {
@SuppressWarnings("unchecked")
@Override
protected WebApplicationContext createWebApplicationContext(ServletContext sc) {
... | java |
public static JsonNode getFieldValue(JsonNode doc, String field) {
StringTokenizer tkz = new StringTokenizer(field, ". ");
JsonNode trc = doc;
while (tkz.hasMoreTokens() && trc != null) {
String tok = tkz.nextToken();
trc = trc.get(tok);
}
return trc;
... | java |
public OPhysicalPosition getPhysicalPosition(final OPhysicalPosition iPPosition) throws IOException {
final long filePosition = iPPosition.clusterPosition * RECORD_SIZE;
acquireSharedLock();
try {
final long[] pos = fileSegment.getRelativePosition(filePosition);
final OFile f = fileSe... | java |
public void removePhysicalPosition(final long iPosition) throws IOException {
final long position = iPosition * RECORD_SIZE;
acquireExclusiveLock();
try {
final long[] pos = fileSegment.getRelativePosition(position);
final OFile file = fileSegment.files[(int) pos[0]];
final long ... | java |
public void addPhysicalPosition(final OPhysicalPosition iPPosition) throws IOException {
final long[] pos;
final boolean recycled;
long offset;
acquireExclusiveLock();
try {
offset = holeSegment.popLastEntryPosition();
if (offset > -1) {
// REUSE THE HOLE
pos... | java |
private void setDataSegmentInternal(final String iName) {
final int dataId = storage.getDataSegmentIdByName(iName);
config.setDataSegmentId(dataId);
storage.getConfiguration().update();
} | java |
protected Object getCustomEventLoggerFromRegistry(MuleContext muleContext) {
Object obj = muleContext.getRegistry().lookupObject(
CUSTOM_EVENT_LOGGER_BEAN_NAME);
return obj;
} | java |
public void addIndex(final OIndexDefinition indexDefinition) {
indexDefinitions.add(indexDefinition);
if (indexDefinition instanceof OIndexDefinitionMultiValue) {
if (multiValueDefinitionIndex == -1)
multiValueDefinitionIndex = indexDefinitions.size() - 1;
else
throw new OIndex... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.