code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
@Override
public void started(ServiceBroker broker) throws Exception {
super.started(broker);
// Set components
ServiceBrokerConfig cfg = broker.getConfig();
serviceInvoker = cfg.getServiceInvoker();
eventbus = cfg.getEventbus();
uid = cfg.getUidGenerator();
} | java |
@Override
public void started(ServiceBroker broker) throws Exception {
super.started(broker);
// Set nodeID
this.nodeID = broker.getNodeID();
// Set components
ServiceBrokerConfig cfg = broker.getConfig();
this.strategy = cfg.getStrategyFactory();
this.transporter = cfg.getTransporter();
this.executo... | java |
protected boolean append(byte[] packet) {
ByteBuffer buffer = ByteBuffer.wrap(packet);
ByteBuffer blocker;
while (true) {
blocker = blockerBuffer.get();
if (blocker == BUFFER_IS_CLOSED) {
return false;
}
if (blockerBuffer.compareAndSet(blocker, buffer)) {
queue.add(buffer);
retur... | java |
protected boolean tryToClose() {
ByteBuffer blocker = blockerBuffer.get();
if (blocker == BUFFER_IS_CLOSED) {
return true;
}
if (blocker != null) {
return false;
}
boolean closed = blockerBuffer.compareAndSet(null, BUFFER_IS_CLOSED);
if (closed) {
closeResources();
return true;
}... | java |
protected void write() throws Exception {
ByteBuffer buffer = queue.peek();
if (buffer == null) {
if (key != null) {
key.interestOps(0);
}
return;
}
if (channel != null) {
int count;
while (true) {
count = channel.write(buffer);
// Debug
if (debug) {
logger.in... | java |
@Override
public void started(ServiceBroker broker) throws Exception {
super.started(broker);
// Process config
ServiceBrokerConfig cfg = broker.getConfig();
namespace = cfg.getNamespace();
if (namespace != null && !namespace.isEmpty()) {
prefix = prefix + '-' + namespace;
}
nodeID = broker... | java |
@Override
public void started(ServiceBroker broker) throws Exception {
super.started(broker);
// Local nodeID
this.nodeID = broker.getNodeID();
// Set components
ServiceBrokerConfig cfg = broker.getConfig();
this.executor = cfg.getExecutor();
this.scheduler = cfg.getScheduler();
this.strategyFactory ... | java |
protected void reschedule(long minTimeoutAt) {
if (minTimeoutAt == Long.MAX_VALUE) {
for (PendingPromise pending : promises.values()) {
if (pending.timeoutAt > 0 && pending.timeoutAt < minTimeoutAt) {
minTimeoutAt = pending.timeoutAt;
}
}
long timeoutAt;
requestStreamReadLock.lock();
try {... | java |
public byte[] generateGossipHello() {
if (cachedHelloMessage != null) {
return cachedHelloMessage;
}
try {
FastBuildTree root = new FastBuildTree(4);
root.putUnsafe("ver", ServiceBroker.PROTOCOL_VERSION);
root.putUnsafe("sender", nodeID);
if (useHostname) {
root.putUnsafe("host", getHostName())... | java |
public ServiceBroker use(Collection<Middleware> middlewares) {
if (serviceRegistry == null) {
// Apply middlewares later
this.middlewares.addAll(middlewares);
} else {
// Apply middlewares now
serviceRegistry.use(middlewares);
}
return this;
} | java |
public Action getAction(String actionName, String nodeID) {
return serviceRegistry.getAction(actionName, nodeID);
} | java |
public final Promise get(String key) {
byte[] binaryKey = key.getBytes(StandardCharsets.UTF_8);
if (client != null) {
return new Promise(client.get(binaryKey));
}
if (clusteredClient != null) {
return new Promise(clusteredClient.get(binaryKey));
}
return Promise.resolve();
} | java |
public final Promise set(String key, byte[] value, SetArgs args) {
byte[] binaryKey = key.getBytes(StandardCharsets.UTF_8);
if (client != null) {
if (args == null) {
return new Promise(client.set(binaryKey, value));
}
return new Promise(client.set(binaryKey, value, args));
}
if (clusteredCl... | java |
public final Promise clean(String match) {
ScanArgs args = new ScanArgs();
args.limit(100);
boolean singleStar = match.indexOf('*') > -1;
boolean doubleStar = match.contains("**");
if (doubleStar) {
args.match(match.replace("**", "*"));
} else if (singleStar) {
if (match.length() > 1 && match.... | java |
public int getTotalCpuPercent() {
if (invalidMonitor.get()) {
return 0;
}
long now = System.currentTimeMillis();
int cpu;
synchronized (Monitor.class) {
if (now - cpuDetectedAt > cacheTimeout) {
try {
cachedCPU = detectTotalCpuPercent();
} catch (Throwable cause) {
logger.in... | java |
public long getPID() {
long currentPID = cachedPID.get();
if (currentPID != 0) {
return currentPID;
}
try {
currentPID = detectPID();
} catch (Throwable cause) {
logger.info("Unable to detect process ID!", cause);
}
if (currentPID == 0) {
currentPID = System.nanoTime();
if (!cac... | java |
public synchronized void reset() {
timeoutAt = 0;
prevSeq = -1;
pool.clear();
stream.closed.set(false);
stream.buffer.clear();
stream.cause = null;
stream.transferedBytes.set(0);
inited.set(false);
} | java |
@Override
public void started(ServiceBroker broker) throws Exception {
super.started(broker);
if (prefix == null) {
prefix = (broker.getNodeID() + ':').toCharArray();
}
} | java |
public boolean updateSchema(String text, ContentType contentType) {
Utils.require(text != null && text.length() > 0, "text");
Utils.require(contentType != null, "contentType");
try {
// Send a PUT request to "/_applications/{application}".
byte[] body = Uti... | java |
protected void throwIfErrorResponse(RESTResponse response) {
if (response.getCode().isError()) {
String errMsg = response.getBody();
if (Utils.isEmpty(errMsg)) {
errMsg = "Unknown error; response code: " + response.getCode();
}
throw new Runt... | java |
public String get(String key) {
if(requestedKeys == null) requestedKeys = new HashSet<String>();
String value = map.get(key);
requestedKeys.add(key);
return value;
} | java |
public String getString(String key) {
String value = get(key);
Utils.require(value != null, key + " parameter is not set");
return value;
} | java |
public int getInt(String key) {
String value = get(key);
Utils.require(value != null, key + " parameter is not set");
try {
return Integer.parseInt(value);
} catch (NumberFormatException e) {
throw new IllegalArgumentException(key + " parameter should be a number");
... | java |
public int getInt(String key, int defaultValue) {
String value = get(key);
if(value == null) return defaultValue;
try {
return Integer.parseInt(value);
} catch (NumberFormatException e) {
throw new IllegalArgumentException(key + " parameter should be a number");
}... | java |
public boolean getBoolean(String key, boolean defaultValue) {
String value = get(key);
if(value == null) return defaultValue;
return XType.getBoolean(value);
} | java |
public void checkInvalidParameters() {
for(String key: map.keySet()) {
boolean wasRequested = requestedKeys != null && requestedKeys.contains(key);
if(!wasRequested) throw new IllegalArgumentException("Unknown parameter " + key);
}
} | java |
static KeyRange keyRangeStartRow(byte[] startRowKey) {
KeyRange keyRange = new KeyRange();
keyRange.setStart_key(startRowKey);
keyRange.setEnd_key(EMPTY_BYTE_BUFFER);
keyRange.setCount(MAX_ROWS_BATCH_SIZE);
return keyRange;
} | java |
static KeyRange keyRangeSingleRow(byte[] rowKey) {
KeyRange keyRange = new KeyRange();
keyRange.setStart_key(rowKey);
keyRange.setEnd_key(rowKey);
keyRange.setCount(1);
return keyRange;
} | java |
static SlicePredicate slicePredicateColName(byte[] colName) {
SlicePredicate slicePred = new SlicePredicate();
slicePred.addToColumn_names(ByteBuffer.wrap(colName));
return slicePred;
} | java |
static SlicePredicate slicePredicateColNames(Collection<byte[]> colNames) {
SlicePredicate slicePred = new SlicePredicate();
for (byte[] colName : colNames) {
slicePred.addToColumn_names(ByteBuffer.wrap(colName));
}
return slicePred;
} | java |
public Calendar getTime(String propName) {
assert propName.endsWith("Time");
if (!m_properties.containsKey(propName)) {
return null;
}
Calendar calendar = new GregorianCalendar(Utils.UTC_TIMEZONE);
calendar.setTimeInMillis(Long.parseLong(m_properties.get(propName)));
... | java |
public UNode toDoc() {
UNode rootNode = UNode.createMapNode(m_taskID, "task");
for (String name : m_properties.keySet()) {
String value = m_properties.get(name);
if (name.endsWith("Time")) {
rootNode.addValueNode(name, formatTimestamp(value));
} else {... | java |
public final void waitForFullService() {
if (!m_state.isInitialized()) {
throw new RuntimeException("Service has not been initialized");
}
synchronized (m_stateChangeLock) {
// Loop until state >= RUNNING
while (!m_state.isRunning()) {
t... | java |
public String getParamString(String paramName) {
Object paramValue = getParam(paramName);
if (paramValue == null) {
return null;
}
return paramValue.toString();
} | java |
public int getParamInt(String paramName, int defaultValue) {
Object paramValue = getParam(paramName);
if (paramValue == null) {
return defaultValue;
}
try {
return Integer.parseInt(paramValue.toString());
} catch (Exception e) {
throw n... | java |
public boolean getParamBoolean(String paramName) {
Object paramValue = getParam(paramName);
if (paramValue == null) {
return false;
}
return Boolean.parseBoolean(paramValue.toString());
} | java |
@SuppressWarnings("unchecked")
public List<String> getParamList(String paramName) {
Object paramValue = getParam(paramName);
if (paramValue == null) {
return null;
}
if (!(paramValue instanceof List)) {
throw new IllegalArgumentException("Parameter '" +... | java |
@SuppressWarnings("unchecked")
public Map<String, Object> getParamMap(String paramName) {
Object paramValue = getParam(paramName);
if (paramValue == null) {
return null;
}
if (!(paramValue instanceof Map)) {
throw new IllegalArgumentException("Parameter... | java |
private void setState(State newState) {
m_logger.debug("Entering state: {}", newState.toString());
synchronized (m_stateChangeLock) {
m_state = newState;
m_stateChangeLock.notifyAll();
}
} | java |
@Override
public void startService() {
m_cmdRegistry.freezeCommandSet(true);
displayCommandSet();
if (m_webservice != null) {
try {
m_webservice.start();
} catch (Exception e) {
throw new RuntimeException("Failed to start WebSer... | java |
@Override
public void stopService() {
try {
if (m_webservice != null) {
m_webservice.stop();
}
} catch (Exception e) {
m_logger.warn("WebService stop failed", e);
}
} | java |
private WebServer loadWebServer() {
WebServer webServer = null;
if (!Utils.isEmpty(getParamString("webserver_class"))) {
try {
Class<?> serviceClass = Class.forName(getParamString("webserver_class"));
Method instanceMethod = serviceClass.getMethod("instan... | java |
private void displayCommandSet() {
if (m_logger.isDebugEnabled()) {
m_logger.debug("Registered REST Commands:");
Collection<String> commands = m_cmdRegistry.getCommands();
for (String command : commands) {
m_logger.debug(command);
}
... | java |
public static ObjectResult newErrorResult(String errMsg, String objID) {
ObjectResult result = new ObjectResult();
result.setStatus(Status.ERROR);
result.setErrorMessage(errMsg);
if (!Utils.isEmpty(objID)) {
result.setObjectID(objID);
}
return result;
... | java |
public Map<String, String> getErrorDetails() {
// Add stacktrace and/or comment fields.
Map<String, String> detailMap = new LinkedHashMap<String, String>();
if (m_resultFields.containsKey(COMMENT)) {
detailMap.put(COMMENT, m_resultFields.get(COMMENT));
}
if (m_r... | java |
public Status getStatus() {
String status = m_resultFields.get(STATUS);
if (status == null) {
return Status.OK;
} else {
return Status.valueOf(status.toUpperCase());
}
} | java |
public UNode toDoc() {
// Root node is called "doc".
UNode result = UNode.createMapNode("doc");
// Each child of "doc" is a simple VALUE node.
for (String fieldName : m_resultFields.keySet()) {
// In XML, we want the element name to be "field" when the node nam... | java |
private List<DBEntity> collectUninitializedEntities(DBEntity entity, final String category,
final TableDefinition tableDef, final List<String> fields, final String link, final Map<ObjectID, LinkList> cache, final Set<ObjectID> keys,
final DBEntitySequenceOptions options) {
DBEntityCollector collector = new... | java |
private <C, K, T> LRUCache<K, T> getCache(Map<C, LRUCache<K, T>> cacheMap, int capacity, C category) {
LRUCache<K, T> cache = cacheMap.get(category);
if (cache == null) {
cache = new LRUCache<K, T>(capacity);
cacheMap.put(category, cache);
}
return cache;
} | java |
private Map<ObjectID, Map<String, String>> fetchScalarFields(TableDefinition tableDef,
Collection<ObjectID> ids, List<String> fields, String category) {
timers.start(category, "Init Fields");
Map<ObjectID, Map<String, String>> map = SpiderHelper.getScalarValues(tableDef, ids, fields);
long time = timers.st... | java |
List<ObjectID> fetchLinks(TableDefinition tableDef, ObjectID id, String link, ObjectID continuationLink,
int count, String category) {
timers.start(category+" links", "Continuation");
FieldDefinition linkField = tableDef.getFieldDef(link);
List<ObjectID> list = SpiderHelper.getLinks(linkField, id, continua... | java |
private Map<ObjectID, List<ObjectID>> fetchLinks(TableDefinition tableDef, Collection<ObjectID> ids,
String link, int count) {
FieldDefinition linkField = tableDef.getFieldDef(link);
return SpiderHelper.getLinks(linkField, ids, null, true, count);
} | java |
public JSONEmitter addValue(String value) {
checkComma();
write('"');
write(encodeString(value));
write('"');
return this;
} | java |
private void write(String str) {
try {
m_writer.write(str);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
} | java |
public Map<String, Map<String, List<DColumn>>> getColumnUpdatesMap() {
Map<String, Map<String, List<DColumn>>> storeMap = new HashMap<>();
for(ColumnUpdate mutation: getColumnUpdates()) {
String storeName = mutation.getStoreName();
String rowKey = mutation.getRowKey();
... | java |
public Map<String, Map<String, List<String>>> getColumnDeletesMap() {
Map<String, Map<String, List<String>>> storeMap = new HashMap<>();
for(ColumnDelete mutation: getColumnDeletes()) {
String storeName = mutation.getStoreName();
String rowKey = mutation.getRowKey();
... | java |
public Map<String, List<String>> getRowDeletesMap() {
Map<String, List<String>> storeMap = new HashMap<>();
for(RowDelete mutation: getRowDeletes()) {
String storeName = mutation.getStoreName();
String rowKey = mutation.getRowKey();
List<String> rowList = storeMa... | java |
public void addColumn(String storeName, String rowKey, String columnName, byte[] columnValue) {
m_columnUpdates.add(new ColumnUpdate(storeName, rowKey, columnName, columnValue));
} | java |
public void addColumn(String storeName, String rowKey, String columnName, String columnValue) {
addColumn(storeName, rowKey, columnName, Utils.toBytes(columnValue));
} | java |
public void deleteRow(String storeName, String rowKey) {
m_rowDeletes.add(new RowDelete(storeName, rowKey));
} | java |
public void traceMutations(Logger logger) {
logger.debug("Transaction in " + getTenant().getName() + ": " + getMutationsCount() + " mutations");
for(ColumnUpdate mutation: getColumnUpdates()) {
logger.trace(mutation.toString());
}
//2. delete columns
for(ColumnD... | java |
public BatchResult addBatch(ApplicationDefinition appDef, String shardName, OlapBatch batch) {
Utils.require(shardName.equals(MONO_SHARD_NAME), "Shard name must be: " + MONO_SHARD_NAME);
return OLAPService.instance().addBatch(appDef, shardName, batch);
} | java |
public UNode toDoc() {
// Root "results" node.
UNode resultsNode = UNode.createMapNode("results");
// "aggregate" node.
UNode aggNode = resultsNode.addMapNode("aggregate");
aggNode.addValueNode("metric", m_metricParam, true);
if (m_queryParam != null){
... | java |
public static byte[] nextID() {
byte[] ID = new byte[15];
synchronized (LOCK) {
long timestamp = System.currentTimeMillis();
if (timestamp != LAST_TIMESTAMP) {
LAST_TIMESTAMP = timestamp;
LAST_SEQUENCE = 0;
TIMESTAMP_BUFFER[0... | java |
private static byte[] chooseMACAddress() {
byte[] result = new byte[6];
boolean bFound = false;
try {
Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces();
while (!bFound && ifaces.hasMoreElements()) {
// Look for a real NIC... | java |
public boolean Add(T value) {
if (m_Count < m_Capacity) {
m_Array[++m_Count] = value;
UpHeap();
}
else if (greaterThan(m_Array[1], value)) {
m_Array[1] = value;
DownHeap();
}
else return false;
return true;
} | java |
public static void checkShard(Olap olap, ApplicationDefinition appDef, String shard) {
VDirectory appDir = olap.getRoot(appDef);
VDirectory shardDir = appDir.getDirectory(shard);
checkShard(shardDir);
} | java |
public static void deleteSegment(Olap olap, ApplicationDefinition appDef, String shard, String segment) {
VDirectory appDir = olap.getRoot(appDef);
VDirectory shardDir = appDir.getDirectory(shard);
VDirectory segmentDir = shardDir.getDirectory(segment);
segmentDir.delete();
} | java |
public Collection<String> getCommands() {
List<String> commands = new ArrayList<String>();
for (String cmdOwner : m_cmdsByOwnerMap.keySet()) {
SortedMap<String, RESTCommand> ownerCmdMap = m_cmdsByOwnerMap.get(cmdOwner);
for (String name : ownerCmdMap.keySet()) {
... | java |
private void registerCommand(String cmdOwner, RegisteredCommand cmd) {
// Add to owner map in RESTCatalog.
Map<String, RESTCommand> nameMap = getCmdNameMap(cmdOwner);
String cmdName = cmd.getName();
RESTCommand oldCmd = nameMap.put(cmdName, cmd);
if (oldCmd != null) {
... | java |
private Map<String, RESTCommand> getCmdNameMap(String cmdOwner) {
SortedMap<String, RESTCommand> cmdNameMap = m_cmdsByOwnerMap.get(cmdOwner);
if (cmdNameMap == null) {
cmdNameMap = new TreeMap<>();
m_cmdsByOwnerMap.put(cmdOwner, cmdNameMap);
}
return cmdName... | java |
private Map<HttpMethod, SortedSet<RegisteredCommand>> getCmdEvalMap(String cmdOwner) {
Map<HttpMethod, SortedSet<RegisteredCommand>> evalMap = m_cmdEvalMap.get(cmdOwner);
if (evalMap == null) {
evalMap = new HashMap<>();
m_cmdEvalMap.put(cmdOwner, evalMap);
}
... | java |
private RegisteredCommand searchCommands(String cmdOwner, HttpMethod method, String uri,
String query, Map<String, String> variableMap) {
Map<HttpMethod, SortedSet<RegisteredCommand>> evalMap = getCmdEvalMap(cmdOwner);
if (evalMap == null) {
r... | java |
public boolean deleteApplication(String appName, String key) {
Utils.require(!m_restClient.isClosed(), "Client has been closed");
Utils.require(appName != null && appName.length() > 0, "appName");
try {
// Send a DELETE request to "/_applications/{application}/{key}".
... | java |
private static ApplicationSession openApplication(ApplicationDefinition appDef, RESTClient restClient) {
String storageService = appDef.getStorageService();
if (storageService == null ||
storageService.length() <= "Service".length() ||
!storageService.endsWith("Servic... | java |
public ServerMonitorMXBean createServerMonitorProxy() throws IOException {
String beanName = ServerMonitorMXBean.JMX_DOMAIN_NAME + ":type=" + ServerMonitorMXBean.JMX_TYPE_NAME;
return createMXBeanProxy(beanName, ServerMonitorMXBean.class);
} | java |
public StorageManagerMXBean createStorageManagerProxy() throws IOException {
String beanName = StorageManagerMXBean.JMX_DOMAIN_NAME + ":type=" + StorageManagerMXBean.JMX_TYPE_NAME;
return createMXBeanProxy(beanName, StorageManagerMXBean.class);
} | java |
@Override
public String getOperationMode() {
String mode = getNode().getOperationMode();
if(mode != null && NORMAL.equals(mode.toUpperCase())) {
mode = NORMAL;
}
return mode;
} | java |
private void collectGroupValues(Entity obj, PathEntry entry, GroupSetEntry groupSetEntry, Set<String>[] groupKeys) {
if(entry.query != null) {
timers.start("Where", entry.queryText);
boolean result = entry.checkCondition(obj);
timers.stop("Where", entry.queryText, result ? 1 : 0);
if (!result) return... | java |
private void updateMetric(String value, GroupSetEntry groupSetEntry, Set<String>[] groupKeys){
updateMetric(value, groupSetEntry.m_totalGroup, groupKeys, 0);
if (groupSetEntry.m_isComposite){
updateMetric(value, groupSetEntry.m_compositeGroup, groupKeys, groupKeys.length - 1);
}
} | java |
private synchronized void updateMetric(String value, Group group, Set<String>[] groupKeys, int index){
group.update(value);
if (index < groupKeys.length){
for (String key : groupKeys[index]){
Group subgroup = group.subgroup(key);
updateMetric(value, subgroup, groupKeys, index + 1);
}
}
} | java |
public GregorianCalendar getExpiredDate(GregorianCalendar relativeDate) {
// Get today's date and adjust by the specified age.
GregorianCalendar expiredDate = (GregorianCalendar)relativeDate.clone();
switch (m_units) {
case DAYS:
expiredDate.add(Calendar.DAY_OF_MONTH, -m... | java |
public PreparedStatement getPreparedQuery(String tableName, Query query) {
synchronized (m_prepQueryMap) {
Map<Query, PreparedStatement> statementMap = m_prepQueryMap.get(tableName);
if (statementMap == null) {
statementMap = new HashMap<>();
m_prepQueryMa... | java |
public PreparedStatement getPreparedUpdate(String tableName, Update update) {
synchronized (m_prepUpdateMap) {
Map<Update, PreparedStatement> statementMap = m_prepUpdateMap.get(tableName);
if (statementMap == null) {
statementMap = new HashMap<>();
m_prepU... | java |
public static Tenant getTenant(ApplicationDefinition appDef) {
String tenantName = appDef.getTenantName();
if (Utils.isEmpty(tenantName)) {
return TenantService.instance().getDefaultTenant();
}
TenantDefinition tenantDef = TenantService.instance().getTenantDefinition(tenantNa... | java |
public DBService getDefaultDB() {
String defaultTenantName = TenantService.instance().getDefaultTenantName();
synchronized (m_tenantDBMap) {
DBService dbservice = m_tenantDBMap.get(defaultTenantName);
assert dbservice != null : "Database for default tenant not found";
... | java |
public DBService getTenantDB(Tenant tenant) {
synchronized (m_tenantDBMap) {
DBService dbservice = m_tenantDBMap.get(tenant.getName());
if (dbservice == null) {
dbservice = createTenantDBService(tenant);
m_tenantDBMap.put(tenant.getName(), dbservice);
... | java |
public void updateTenantDef(TenantDefinition tenantDef) {
synchronized (m_tenantDBMap) {
DBService dbservice = m_tenantDBMap.get(tenantDef.getName());
if (dbservice != null) {
Tenant updatedTenant = new Tenant(tenantDef);
m_logger.info("Updating DBService ... | java |
public void deleteTenantDB(Tenant tenant) {
synchronized (m_tenantDBMap) {
DBService dbservice = m_tenantDBMap.remove(tenant.getName());
if (dbservice != null) {
m_logger.info("Stopping DBService for deleted tenant: {}", tenant.getName());
dbservice.stop()... | java |
public SortedMap<String, SortedMap<String, Object>> getActiveTenantInfo() {
SortedMap<String, SortedMap<String, Object>> activeTenantMap = new TreeMap<>();
synchronized (m_tenantDBMap) {
for (String tenantName : m_tenantDBMap.keySet()) {
DBService dbservice = m_tenantDBMap.ge... | java |
private DBService createDefaultDBService() {
m_logger.info("Creating DBService for default tenant");
String dbServiceName = ServerParams.instance().getModuleParamString("DBService", "dbservice");
if (Utils.isEmpty(dbServiceName)) {
throw new RuntimeException("'DBService.dbservice' pa... | java |
private DBService createTenantDBService(Tenant tenant) {
m_logger.info("Creating DBService for tenant: {}", tenant.getName());
Map<String, Object> dbServiceParams = tenant.getDefinition().getOptionMap("DBService");
String dbServiceName = null;
if (dbServiceParams == null || !dbServicePar... | java |
private static boolean sameTenantDefs(TenantDefinition tenantDef1, TenantDefinition tenantDef2) {
return isEqual(tenantDef1.getProperty(TenantService.CREATED_ON_PROP),
tenantDef2.getProperty(TenantService.CREATED_ON_PROP)) &&
isEqual(tenantDef1.getProperty(TenantService.CRE... | java |
private static boolean isEqual(String string1, String string2) {
return (string1 == null && string2 == null) || (string1 != null && string1.equals(string2));
} | java |
private void createApplication() {
String schema = getSchema();
ContentType contentType = null;
if (m_config.schema.toLowerCase().endsWith(".json")) {
contentType = ContentType.APPLICATION_JSON;
} else if (m_config.schema.toLowerCase().endsWith(".xml")) {
co... | java |
private void deleteApplication() {
ApplicationDefinition appDef = m_client.getAppDef(m_config.app);
if (appDef != null) {
m_logger.info("Deleting existing application: {}", appDef.getAppName());
m_client.deleteApplication(appDef.getAppName(), appDef.getKey());
}
... | java |
private TableDefinition determineTableFromFileName(String fileName) {
ApplicationDefinition appDef = m_session.getAppDef();
for (String tableName : m_tableNameList) {
if (fileName.regionMatches(true, 0, tableName, 0, tableName.length())) {
return appDef.getTableDef(tableN... | java |
private List<String> getFieldListFromHeader(BufferedReader reader) {
// Read the first line and watch out for BOM at the front of the header.
String header = null;
try {
header = reader.readLine();
} catch (IOException e) {
// Leave header null
}
... | java |
private String getSchema() {
if (Utils.isEmpty(m_config.schema)) {
m_config.schema = m_config.root + m_config.app + ".xml";
}
File schemaFile = new File(m_config.schema);
if (!schemaFile.exists()) {
logErrorThrow("Schema file not found: {}", m_config.schema)... | java |
private void loadTables() {
ApplicationDefinition appDef = m_session.getAppDef();
m_tableNameList = new ArrayList<String>(appDef.getTableDefinitions().keySet());
Collections.sort(m_tableNameList, new Comparator<String>() {
@Override
public int compare(String s1, Stri... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.