Example usage for org.apache.commons.lang ArrayUtils addAll

List of usage examples for org.apache.commons.lang ArrayUtils addAll

Introduction

In this page you can find the example usage for org.apache.commons.lang ArrayUtils addAll.

Prototype

public static double[] addAll(double[] array1, double[] array2) 

Source Link

Document

Adds all the elements of the given arrays into a new array.

Usage

From source file:com.blockwithme.longdb.leveldb.LevelDBTable.java

/** Removes the column ids. */
private void removeColIds(final long theKey, final long theColumnId) {
    final Bytes rowIdBytes = new Bytes(Util.toByta(theKey));
    if (dbInstance.get(toArray(rowIdBytes), readOpts) != null) {
        final byte[] allColIds = dbInstance.get(toArray(rowIdBytes), readOpts);
        final long position = Util.indexOf(allColIds, theColumnId);
        if (position == -1)
            return;
        final byte[] part1Bytes = Arrays.copyOfRange(allColIds, 0, (int) position);
        final byte[] part2Bytes = Arrays.copyOfRange(allColIds, (int) (position + LONG_BYTES),
                allColIds.length);//from w ww . ja v  a2 s .co  m
        // TODO try to use dbInstance.write() instead of delete()/put().
        // write() uses WriteBatch to 'batch' all the db updates
        // belonging to a single transaction.
        if (part1Bytes.length == 0 && part2Bytes.length == 0) {
            dbInstance.delete(toArray(rowIdBytes), writeOpts);
        } else {
            final byte[] newColIds = ArrayUtils.addAll(part1Bytes, part2Bytes);
            dbInstance.put(toArray(rowIdBytes), newColIds, writeOpts);
        }
    }
}

From source file:com.adobe.acs.commons.util.ResourceServiceManager.java

private void updateJobService(String id, Resource resource) {

    log.debug("Registering job: {}", id);
    try {/*from www  .  j av a2 s .c om*/

        String filter = "(&(" + SERVICE_OWNER_KEY + "=" + getClass().getCanonicalName() + ")" + "("
                + CONFIGURATION_ID_KEY + "=" + id + "))";
        ServiceReference[] serviceReferences = (ServiceReference[]) ArrayUtils.addAll(
                bctx.getServiceReferences(Runnable.class.getCanonicalName(), filter),
                bctx.getServiceReferences(EventHandler.class.getCanonicalName(), filter));

        if (serviceReferences != null && serviceReferences.length > 0) {
            ServiceReference sr = serviceReferences[0];
            if (isServiceUpdated(resource, sr)) {
                log.debug("Service for {} up to date, no changes necessary", id);
            } else {
                log.warn("Unbinding ServiceReference for {}", id);
                unregisterService(id);
                registerService(id, resource);
            }
        } else {
            registerService(id, resource);
        }

    } catch (Exception e) {
        log.error("Failed to register job " + id, e);
    }
}

From source file:com.dilipkumarg.qb.SelectQueryBuilder.java

@Override
public SqlQuery build() {
    SqlQuery whereQuery = buildWhere();/*from ww  w .  ja va 2 s.  co m*/
    SqlQuery joins = joinDelegator.build();
    StringBuilder sb = new StringBuilder();
    String select = isDistinct() ? SELECT_DISTINCT : SELECT;
    sb.append(String.format(SELECT_TEMPLATE, select, buildSelectedFieldsString(),
            getTable().getTableName(WITH_ALIAS)));

    if (!joins.getQuery().isEmpty()) {
        sb.append(" ");
        sb.append(joins.getQuery());
    }

    if (!whereQuery.getQuery().isEmpty()) {
        sb.append(" ");
        sb.append(whereQuery.getQuery());
    }
    sb.append(" ");// it is a last part, so No need to validate.
    sb.append(buildOrderByString());
    return new SqlQuery(sb.toString(), ArrayUtils.addAll(joins.getArgs(), whereQuery.getArgs()));
}

From source file:com.prowidesoftware.swift.model.SwiftCharsetUtils.java

/**
 * Gets SWIFT A charset; alphabetic, upper case or lower case A through Z, a through z.
 *//*from w  ww  .  j  a va2 s.  c  o  m*/
static public char[] get_A() {
    char[] result = get_a();
    return ArrayUtils.addAll(result, _get_az());
}

From source file:com.google.cloud.bigtable.hbase.TestBatch.java

/**
 * Requirement 8.1/*from ww  w . jav  a2 s  . com*/
 */
@Test
public void testBatchAppend() throws IOException, InterruptedException {
    // Initialize data
    Table table = getConnection().getTable(TABLE_NAME);
    byte[] rowKey1 = dataHelper.randomData("testrow-");
    byte[] qual1 = dataHelper.randomData("qual-");
    byte[] value1_1 = dataHelper.randomData("value-");
    byte[] value1_2 = dataHelper.randomData("value-");
    byte[] rowKey2 = dataHelper.randomData("testrow-");
    byte[] qual2 = dataHelper.randomData("qual-");
    byte[] value2_1 = dataHelper.randomData("value-");
    byte[] value2_2 = dataHelper.randomData("value-");

    // Put
    Put put1 = new Put(rowKey1).addColumn(COLUMN_FAMILY, qual1, value1_1);
    Put put2 = new Put(rowKey2).addColumn(COLUMN_FAMILY, qual2, value2_1);
    List<Row> batch = new ArrayList<Row>(2);
    batch.add(put1);
    batch.add(put2);
    table.batch(batch, null);

    // Increment
    Append append1 = new Append(rowKey1).add(COLUMN_FAMILY, qual1, value1_2);
    Append append2 = new Append(rowKey2).add(COLUMN_FAMILY, qual2, value2_2);
    batch.clear();
    batch.add(append1);
    batch.add(append2);
    Object[] results = new Object[2];
    table.batch(batch, results);
    Assert.assertArrayEquals("Should be value1_1 + value1_2", ArrayUtils.addAll(value1_1, value1_2),
            CellUtil.cloneValue(((Result) results[0]).getColumnLatestCell(COLUMN_FAMILY, qual1)));
    Assert.assertArrayEquals("Should be value1_1 + value1_2", ArrayUtils.addAll(value2_1, value2_2),
            CellUtil.cloneValue(((Result) results[1]).getColumnLatestCell(COLUMN_FAMILY, qual2)));

    table.close();
}

From source file:com.linkedin.cubert.analyzer.physical.AggregateRewriter.java

public void injectRewrite(ObjectNode programNode, ObjectNode jobNode, JsonNode phaseNode,
        ObjectNode cubeOperatorNode, String mvName, String mvPath)
        throws AggregateRewriteException, IOException {
    this.programNode = programNode;
    this.cubeJobNode = jobNode;
    this.cubePhaseNode = phaseNode;
    this.cubeOperatorNode = cubeOperatorNode;
    this.mvName = mvName;
    this.mvPath = mvPath;

    try {//from w w w  . j av  a 2 s .  c o m
        this.lineage.buildLineage(programNode);
    } catch (LineageException e) {
        throw new AggregateRewriteException(e.toString());
    }

    readSummaryMetaData();

    String[] measures = getMeasureColumns(cubeOperatorNode);
    String[] dimensions = getDimensionColumns(cubeOperatorNode);

    System.out.println(
            "Measure columns = " + Arrays.toString(measures) + " Dimensions=" + Arrays.toString(dimensions));
    traceFactLoads(measures);
    traceFactBlockgens();
    calculateIncrementalFactLoadDates();
    rewriteFactBlockgenPaths();
    // Perform any pre-blockgen xforms needed on the fact.
    transformFactPreBlockgen(programNode, bgInfo);
    createMVBlockgen(dimensions, measures);
    insertPreCubeCombine((String[]) (ArrayUtils.addAll(dimensions, measures)));
    incrementalizeFactLoads();
    insertMVRefreshDateJobHook();
    rewritePreCubeMeasureJoins();
    programNode.put("summaryRewrite", "true");
}

From source file:com.prowidesoftware.swift.model.SwiftCharsetUtils.java

/**
 * Gets SWIFT x charset; any character of the X permitted set (General FIN application set)  upper case and lower case allowed.
 *//*from  w w  w  .  ja  v  a 2 s  .  co m*/
static public char[] get_x() {
    char[] result = { '/', '-', '?', ':', '(', ')', '.', ',', '\'', '+', ' ', '\n', '\r' };
    result = ArrayUtils.addAll(result, get_A());
    result = ArrayUtils.addAll(result, get_n());
    return result;
}

From source file:com.stratio.explorer.interpreter.InterpreterFactory.java

private URL[] recursiveBuildLibList(File path) throws MalformedURLException {
    URL[] urls = new URL[0];
    if (path == null || path.exists() == false) {
        return urls;
    } else if (path.getName().startsWith(".")) {
        return urls;
    } else if (path.isDirectory()) {
        File[] files = path.listFiles();
        if (files != null) {
            for (File f : files) {
                urls = (URL[]) ArrayUtils.addAll(urls, recursiveBuildLibList(f));
            }/*from  w w w . jav  a 2  s.  c  om*/
        }
        return urls;
    } else {
        return new URL[] { path.toURI().toURL() };
    }
}

From source file:hydrograph.ui.common.property.util.Utils.java

/**
 * /*  w  w  w .java2s  .c o m*/
 * loading the properties files without open jon file
 * @param jobFile job file path
 */
public void loadProperties(IFile jobFile) {
    List<File> paramNameList = null;
    IProject activeProject = jobFile.getProject();
    final File globalparamFilesPath = new File(activeProject.getLocation().toString() + "/" + "globalparam");
    final File localParamFilePath = new File(
            activeProject.getLocation().toString() + "/" + Constants.PARAM_FOLDER);
    File[] files = (File[]) ArrayUtils.addAll(listFilesForFolder(globalparamFilesPath),
            getJobsPropertyFile(localParamFilePath, jobFile));
    if (files != null) {
        paramNameList = Arrays.asList(files);
        getParamMap(paramNameList, jobFile);
    }
}

From source file:io.joynr.runtime.MessagingServletConfig.java

private String[] mergeAppPackages(Properties properties) {
    String systemAppPackagesSetting = System.getProperties().getProperty(IO_JOYNR_APPS_PACKAGES);
    String appPackagesSetting = properties.getProperty(IO_JOYNR_APPS_PACKAGES);
    String[] appPackages = appPackagesSetting != null ? appPackagesSetting.split(";") : null;
    String[] systemAppPackages = systemAppPackagesSetting != null ? systemAppPackagesSetting.split(";") : null;
    appPackages = (String[]) ArrayUtils.addAll(appPackages, systemAppPackages);
    return appPackages;
}