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

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

Introduction

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

Prototype

public static Boolean[] toObject(boolean[] array) 

Source Link

Document

Converts an array of primitive booleans to objects.

Usage

From source file:com.flexive.core.storage.genericSQL.GenericSQLFulltextIndexer.java

/**
 * {@inheritDoc}/*from   w  w  w . ja va  2  s  .  c om*/
 */
@Override
public void index(FxDelta.FxDeltaChange change) {
    initStatements();
    if (pk == null || psi == null || psu == null || psd == null || psd_all == null) {
        LOG.warn("Tried to index FxDeltaChange with no pk provided!");
        return;
    }
    if (change.isGroup())
        return; //only index properties
    try {
        FxProperty prop = change.getNewData() != null
                ? ((FxPropertyAssignment) change.getNewData().getAssignment()).getProperty()
                : ((FxPropertyAssignment) change.getOriginalData().getAssignment()).getProperty();
        if (!prop.getDataType().isTextType())
            return; //make sure only text types are fulltext indexed
        if (!prop.isFulltextIndexed()) {
            return; // respect fulltext flag for updates
        }
    } catch (Exception e) {
        //could not get the property, return
        LOG.error("Could not retrieve the used FxProperty for change " + change + "!");
        return;
    }
    if (change.getNewData() == null) {
        //data removed
        try {
            psd_all.setLong(3, change.getOriginalData().getAssignmentId());
            psd_all.executeUpdate();
        } catch (SQLException e) {
            LOG.error(e);
        }
        return;
    }

    if (change.getOriginalData() == null) {
        //add
        index((FxPropertyData) change.getNewData());
        return;
    }

    //update, try to update and if not found insert
    try {
        final String xmult = StringUtils.join(ArrayUtils.toObject(change.getNewData().getIndices()), ',');
        psu.setLong(5, change.getNewData().getAssignmentId());
        psu.setString(6, xmult);
        psi.setLong(4, change.getNewData().getAssignmentId());
        psi.setString(5, xmult);
        FxValue value = ((FxPropertyData) change.getNewData()).getValue();
        String data;
        long[] newLang = value.getTranslatedLanguages();
        for (long lang : newLang) {
            try {
                if (value instanceof FxBinary)
                    data = prepare(FxXMLUtils
                            .getElementData(((FxBinary) value).getTranslation(lang).getMetadata(), "text"));
                else
                    data = prepare(String.valueOf(value.getTranslation(lang)));
            } catch (Exception e) {
                LOG.error("Failed to fetch indexing data for " + change);
                continue;
            }
            if (data.length() == 0)
                continue;
            psu.setString(1, data);
            psu.setLong(4, lang);
            if (psu.executeUpdate() == 0) {
                psi.setLong(3, lang);
                psi.setString(6, data);
                psi.executeUpdate();
            }
        }
        for (long lang : ((FxPropertyData) change.getOriginalData()).getValue().getTranslatedLanguages()) {
            if (!ArrayUtils.contains(newLang, lang)) {
                //delete lang entry
                psd.setLong(3, change.getOriginalData().getAssignmentId());
                psd.setLong(4, lang);
                psd.executeUpdate();
            }
        }
    } catch (SQLException e) {
        LOG.error(e);
    }
}

From source file:ch.epfl.data.squall.operators.ApproximateAvgSamplingOperator.java

@Override
public ApproximateAvgSamplingOperator setGroupByColumns(int... hashIndexes) {
    return setGroupByColumns(Arrays.asList(ArrayUtils.toObject(hashIndexes)));
}

From source file:ch.epfl.data.squall.operators.ApproximateSumSamplingOperator.java

@Override
public ApproximateSumSamplingOperator setGroupByColumns(int... hashIndexes) {
    return setGroupByColumns(Arrays.asList(ArrayUtils.toObject(hashIndexes)));
}

From source file:de.hub.cs.dbis.aeolus.queries.utils.TimestampMergerTest.java

@SuppressWarnings("unchecked")
private void testExecuteMerge(int numberOfProducers, int numberOfTasks, double duplicatesFraction,
        boolean tsIndexOrName, int minNumberOfAttributes, int maxNumberOfAttributes) {
    int createdTasks = this.mockInputs(numberOfProducers, numberOfTasks, tsIndexOrName, minNumberOfAttributes,
            maxNumberOfAttributes);/*from   www .  jav  a  2s .com*/

    final int numberOfTuples = createdTasks * 10 + this.r.nextInt(createdTasks * (1 + this.r.nextInt(10)));
    TimestampOrderChecker checkerBolt;
    TimestampMerger merger;
    if (tsIndexOrName) {
        checkerBolt = new TimestampOrderChecker(forwarder, 0, duplicatesFraction != 0);
        merger = new TimestampMerger(checkerBolt, 0);
    } else {
        checkerBolt = new TimestampOrderChecker(forwarder, "ts", duplicatesFraction != 0);
        merger = new TimestampMerger(checkerBolt, "ts");
    }
    TestOutputCollector collector = new TestOutputCollector();

    merger.prepare(null, this.topologyContextMock, new OutputCollector(collector));

    this.input = new LinkedList[createdTasks];
    for (int i = 0; i < createdTasks; ++i) {
        this.input[i] = new LinkedList<Tuple>();
    }
    this.result.clear();

    int numberDistinctValues = 1;
    int counter = 0;
    while (true) {
        int taskId = this.r.nextInt(createdTasks);

        Fields schema = this.contextMock.getComponentOutputFields(this.contextMock.getComponentId(taskId),
                null);
        int numberOfAttributes = schema.size();
        List<Object> value = new ArrayList<Object>(numberOfAttributes);
        for (int i = 0; i < numberOfAttributes; ++i) {
            value.add(new Character((char) (32 + this.r.nextInt(95))));
        }
        Long ts = new Long(numberDistinctValues - 1);
        value.set(schema.fieldIndex("ts"), ts);

        this.result.add(value);
        this.input[taskId].add(new TupleImpl(this.contextMock, value, taskId, null));

        if (++counter == numberOfTuples) {
            break;
        }

        if (1 - this.r.nextDouble() > duplicatesFraction) {
            ++numberDistinctValues;
        }
    }

    int[] max = new int[createdTasks];
    int[][] bucketSums = new int[createdTasks][numberDistinctValues];
    for (int i = 0; i < numberOfTuples; ++i) {
        int taskId = this.r.nextInt(createdTasks);

        while (this.input[taskId].size() == 0) {
            taskId = (taskId + 1) % createdTasks;
        }

        Tuple t = this.input[taskId].removeFirst();
        max[taskId] = t.getLongByField("ts").intValue();
        ++bucketSums[taskId][max[taskId]];
        merger.execute(t);
    }

    int stillBuffered = numberOfTuples;
    int smallestMax = Collections.min(Arrays.asList(ArrayUtils.toObject(max))).intValue();
    for (int i = 0; i < createdTasks; ++i) {
        for (int j = 0; j <= smallestMax; ++j) {
            stillBuffered -= bucketSums[i][j];
        }
    }

    Assert.assertEquals(this.result.subList(0, this.result.size() - stillBuffered),
            collector.output.get(Utils.DEFAULT_STREAM_ID));
    Assert.assertTrue(collector.acked.size() == numberOfTuples - stillBuffered);
    Assert.assertTrue(collector.failed.size() == 0);

}

From source file:de.alpharogroup.file.read.ReadFileExtensions.java

/**
 * To byte array./*from  www.ja va2  s .  co  m*/
 *
 * @param byteArray
 *            the byte array
 * @return the byte[]
 */
private static Byte[] toObject(final byte[] byteArray) {
    return ArrayUtils.toObject(byteArray);
}

From source file:de.hub.cs.dbis.aeolus.utils.TimestampMergerTest.java

@SuppressWarnings("unchecked")
private void testExecuteMerge(int numberOfProducers, int numberOfTasks, double duplicatesFraction,
        boolean tsIndexOrName, int minNumberOfAttributes, int maxNumberOfAttributes) {
    int createdTasks = this.mockInputs(numberOfProducers, numberOfTasks, tsIndexOrName, minNumberOfAttributes,
            maxNumberOfAttributes);/*from w w  w .  j a va  2  s . c  o m*/

    final int numberOfTuples = createdTasks * 10 + this.r.nextInt(createdTasks * (1 + this.r.nextInt(10)));
    TimestampOrderChecker checkerBolt;
    TimestampMerger merger;
    if (tsIndexOrName) {
        checkerBolt = new TimestampOrderChecker(forwarder, 0, duplicatesFraction != 0);
        merger = new TimestampMerger(checkerBolt, 0);
    } else {
        checkerBolt = new TimestampOrderChecker(forwarder, "ts", duplicatesFraction != 0);
        merger = new TimestampMerger(checkerBolt, "ts");
    }
    TestOutputCollector collector = new TestOutputCollector();

    merger.prepare(null, this.topologyContextMock, new OutputCollector(collector));

    this.input = new LinkedList[createdTasks];
    for (int i = 0; i < createdTasks; ++i) {
        this.input[i] = new LinkedList<Tuple>();
    }
    this.result.clear();

    int numberDistinctValues = 1;
    int counter = 0;
    while (true) {
        int taskId = this.r.nextInt(createdTasks);

        Fields schema = this.contextMock.getComponentOutputFields(this.contextMock.getComponentId(taskId),
                null);
        int numberOfAttributes = schema.size();
        List<Object> value = new ArrayList<Object>(numberOfAttributes);
        for (int i = 0; i < numberOfAttributes; ++i) {
            value.add(new Character((char) (32 + this.r.nextInt(95))));
        }
        Long ts = new Long(numberDistinctValues - 1);
        value.set(schema.fieldIndex("ts"), ts);

        this.result.add(value);
        this.input[taskId].add(new TupleImpl(this.contextMock, value, taskId, null));

        if (++counter == numberOfTuples) {
            break;
        }

        if (1 - this.r.nextDouble() > duplicatesFraction) {
            ++numberDistinctValues;
        }
    }

    int[] max = new int[createdTasks];
    for (int i = 0; i < max.length; ++i) {
        max[i] = -1;
    }
    int[][] bucketSums = new int[createdTasks][numberDistinctValues];
    for (int i = 0; i < numberOfTuples; ++i) {
        int taskId = this.r.nextInt(createdTasks);

        while (this.input[taskId].size() == 0) {
            taskId = (taskId + 1) % createdTasks;
        }

        Tuple t = this.input[taskId].removeFirst();
        max[taskId] = t.getLongByField("ts").intValue();
        ++bucketSums[taskId][max[taskId]];
        merger.execute(t);
    }

    int stillBuffered = numberOfTuples;
    int smallestMax = Collections.min(Arrays.asList(ArrayUtils.toObject(max))).intValue();
    for (int i = 0; i < createdTasks; ++i) {
        for (int j = 0; j <= smallestMax; ++j) {
            stillBuffered -= bucketSums[i][j];
        }
    }
    List<List<Object>> expectedResult = this.result.subList(0, this.result.size() - stillBuffered);

    if (expectedResult.size() > 0) {
        Assert.assertEquals(expectedResult, collector.output.get(Utils.DEFAULT_STREAM_ID));
    } else {
        Assert.assertNull(collector.output.get(Utils.DEFAULT_STREAM_ID));
    }
    Assert.assertTrue(collector.acked.size() == numberOfTuples - stillBuffered);
    Assert.assertTrue(collector.failed.size() == 0);

}

From source file:ch.epfl.data.squall.components.theta.AdaptiveThetaJoinComponent.java

@Override
public AdaptiveThetaJoinComponent setOutputPartKey(int... hashIndexes) {
    return setOutputPartKey(Arrays.asList(ArrayUtils.toObject(hashIndexes)));
}

From source file:com.opengamma.financial.analytics.model.credit.isdanew.ISDACompliantCreditCurveFunction.java

@Override
public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs,
        final ComputationTarget target, final Set<ValueRequirement> desiredValues)
        throws AsynchronousExecution {
    ValueRequirement requirement = desiredValues.iterator().next();
    final Clock snapshotClock = executionContext.getValuationClock();
    final ZonedDateTime now = ZonedDateTime.now(snapshotClock);
    final LegacyVanillaCDSSecurity security = (LegacyVanillaCDSSecurity) target.getSecurity();

    final CdsRecoveryRateIdentifier recoveryRateIdentifier = security
            .accept(new CreditSecurityToRecoveryRateVisitor(executionContext.getSecuritySource()));
    Object recoveryRateObject = inputs.getValue(new ValueRequirement("PX_LAST", ComputationTargetType.PRIMITIVE,
            recoveryRateIdentifier.getExternalId()));
    if (recoveryRateObject == null) {
        throw new OpenGammaRuntimeException("Could not get recovery rate");
        //s_logger.warn("Could not get recovery rate, defaulting to 0.4: " + recoveryRateIdentifier);
        //recoveryRateObject = 0.4;
    }//ww w.ja  v a  2s  . c o  m
    final double recoveryRate = (Double) recoveryRateObject;

    CreditDefaultSwapSecurityConverterDeprecated converter = new CreditDefaultSwapSecurityConverterDeprecated(
            _holidaySource, _regionSource, recoveryRate);
    LegacyVanillaCreditDefaultSwapDefinition cds = converter.visitLegacyVanillaCDSSecurity(security);
    final StandardCDSQuotingConvention quoteConvention = StandardCDSQuotingConvention
            .parse(requirement.getConstraint(ISDAFunctionConstants.CDS_QUOTE_CONVENTION));
    final NodalTenorDoubleCurve spreadCurve = (NodalTenorDoubleCurve) inputs
            .getValue(ValueRequirementNames.BUCKETED_SPREADS);
    if (spreadCurve == null) {
        throw new OpenGammaRuntimeException(
                "Bucketed spreads not available for " + getSpreadCurveIdentifier(security));
    }

    // get the isda curve
    final ISDACompliantYieldCurve yieldCurve = (ISDACompliantYieldCurve) inputs
            .getValue(ValueRequirementNames.YIELD_CURVE);
    if (yieldCurve == null) {
        throw new OpenGammaRuntimeException("Couldn't get isda curve");
    }

    final Double cdsQuoteDouble = (Double) inputs.getValue(MarketDataRequirementNames.MARKET_VALUE);
    if (cdsQuoteDouble == null) {
        throw new OpenGammaRuntimeException("Couldn't get spread for " + security);
    }
    final CDSAnalyticVisitor pricingVisitor = new CDSAnalyticVisitor(now.toLocalDate(), _holidaySource,
            _regionSource, recoveryRate);
    final CDSAnalytic pricingCDS = security.accept(pricingVisitor);
    final CDSQuoteConvention quote = SpreadCurveFunctions.getQuotes(security.getMaturityDate(),
            new double[] { cdsQuoteDouble }, security.getParSpread(), quoteConvention, true)[0];
    final QuotedSpread quotedSpread = getQuotedSpread(quote,
            security.isBuy() ? BuySellProtection.BUY : BuySellProtection.SELL, yieldCurve, pricingCDS,
            security.getParSpread());

    ISDACompliantCreditCurve creditCurve;
    NodalTenorDoubleCurve modifiedSpreadCurve;
    NodalTenorDoubleCurve modifiedPillarCurve;

    if (IMMDateGenerator.isIMMDate(security.getMaturityDate())) {
        final String pillarString = requirement.getConstraint(ISDAFunctionConstants.ISDA_BUCKET_TENORS);
        final ZonedDateTime[] bucketDates = SpreadCurveFunctions.getPillarDates(now, pillarString);
        final ZonedDateTime[] pillarDates = bucketDates;
        double[] spreads = SpreadCurveFunctions.getSpreadCurveNew(spreadCurve, bucketDates,
                security.getStartDate(), quoteConvention);
        Tenor[] tenors = SpreadCurveFunctions.getBuckets(pillarString);
        modifiedSpreadCurve = new NodalTenorDoubleCurve(tenors, ArrayUtils.toObject(spreads), true);
        modifiedPillarCurve = modifiedSpreadCurve; // for IMM buckets and spreads are the same
        //final CDSQuoteConvention[] quotes = SpreadCurveFunctions.getQuotes(security.getMaturityDate(), spreads, security.getParSpread(), quoteConvention, false);

        // CDS analytics for credit curve
        final CDSAnalytic[] creditAnalytics = new CDSAnalytic[pillarDates.length];
        for (int i = 0; i < creditAnalytics.length; i++) {
            final CDSAnalyticVisitor curveVisitor = new CDSAnalyticVisitor(now.toLocalDate(), _holidaySource,
                    _regionSource, security.getStartDate().toLocalDate(), pillarDates[i].toLocalDate(),
                    recoveryRate);
            creditAnalytics[i] = security.accept(curveVisitor);
        }
        creditCurve = CREDIT_CURVE_BUILDER.calibrateCreditCurve(pricingCDS, quotedSpread, yieldCurve);

    } else {
        // non IMM date - pillars set to fixed set
        final String pillarString = NON_IMM_PILLAR_TENORS;
        final String bucketString = requirement.getConstraint(ISDAFunctionConstants.ISDA_BUCKET_TENORS);
        final ZonedDateTime[] bucketDates = SpreadCurveFunctions.getPillarDates(now, bucketString);
        final ZonedDateTime[] pillarDates = SpreadCurveFunctions.getPillarDates(now, pillarString);
        double[] bucketSpreads = SpreadCurveFunctions.getSpreadCurveNew(spreadCurve, bucketDates,
                security.getStartDate(), quoteConvention);
        double[] pillarSpreads = SpreadCurveFunctions.getSpreadCurveNew(spreadCurve, pillarDates,
                security.getStartDate(), quoteConvention);
        Tenor[] bucketTenors = SpreadCurveFunctions.getBuckets(bucketString);
        Tenor[] pillarTenors = SpreadCurveFunctions.getBuckets(pillarString);
        modifiedSpreadCurve = new NodalTenorDoubleCurve(bucketTenors, ArrayUtils.toObject(bucketSpreads), true);
        modifiedPillarCurve = new NodalTenorDoubleCurve(pillarTenors, ArrayUtils.toObject(pillarSpreads), true);
        final CDSQuoteConvention[] quotes = SpreadCurveFunctions.getQuotes(security.getMaturityDate(),
                pillarSpreads, security.getParSpread(), quoteConvention, false);

        // CDS analytics for credit curve
        final CDSAnalytic[] creditAnalytics = new CDSAnalytic[pillarDates.length];
        for (int i = 0; i < creditAnalytics.length; i++) {
            final CDSAnalyticVisitor curveVisitor = new CDSAnalyticVisitor(now.toLocalDate(), _holidaySource,
                    _regionSource, security.getStartDate().toLocalDate(), pillarDates[i].toLocalDate(),
                    recoveryRate);
            creditAnalytics[i] = security.accept(curveVisitor);
        }
        creditCurve = CREDIT_CURVE_BUILDER.calibrateCreditCurve(creditAnalytics, quotes, yieldCurve);
    }

    //if (IMMDateGenerator.isIMMDate(security.getMaturityDate())) {
    //  creditCurve = CREDIT_CURVE_BUILDER.calibrateCreditCurve(pricingCDS, quotedSpread, yieldCurve);
    //} else {
    //  creditCurve = CREDIT_CURVE_BUILDER.calibrateCreditCurve(creditAnalytics, quotes, yieldCurve);
    //}
    //if (IMMDateGenerator.isIMMDate(security.getMaturityDate())) {
    //  // form from single point instead of all
    //  final int index = Arrays.binarySearch(spreadCurve, security.getMaturityDate());
    //  ArgumentChecker.isTrue(index > 0, "cds maturity " + security + " not in pillar dates");
    //  creditCurve = creditCurveBuilder.calibrateCreditCurve(new CDSAnalytic[] { creditAnalytics[index] },
    //                                                        new CDSQuoteConvention[] { quotes[index] }, yieldCurve);
    //} else {
    //  creditCurve = creditCurveBuilder.calibrateCreditCurve(creditAnalytics, quotes, yieldCurve);
    //}
    final ValueSpecification spec = new ValueSpecification(ValueRequirementNames.HAZARD_RATE_CURVE,
            target.toSpecification(), requirement.getConstraints());

    // spreads
    final ValueSpecification spreadSpec = new ValueSpecification(ValueRequirementNames.BUCKETED_SPREADS,
            target.toSpecification(), requirement.getConstraints());
    final ValueSpecification pillarSpec = new ValueSpecification(ValueRequirementNames.PILLAR_SPREADS,
            target.toSpecification(), requirement.getConstraints());

    return Sets.newHashSet(new ComputedValue(spec, creditCurve),
            new ComputedValue(spreadSpec, modifiedSpreadCurve),
            new ComputedValue(pillarSpec, modifiedPillarCurve));
}

From source file:com.twineworks.kettle.ruby.step.execmodels.SimpleExecutionModel.java

public RubyHash createRubyInputRow(RowMetaInterface rowMeta, Object[] r) throws KettleException {

    // create a hash for the row, they are not reused on purpose, so the scripting user can safely use them to store entire rows between invocations
    RubyHash rubyRow = new RubyHash(data.runtime);

    String[] fieldNames = rowMeta.getFieldNames();
    for (int i = 0; i < fieldNames.length; i++) {

        String field = fieldNames[i];
        // null values don't need no special treatment, they'll become nil
        if (r[i] == null) {
            rubyRow.put(field, null);//from www. jav a 2s  .  com
        } else {

            ValueMetaInterface vm = rowMeta.getValueMeta(i);

            switch (vm.getType()) {
            case ValueMetaInterface.TYPE_BOOLEAN:
                rubyRow.put(field, vm.getBoolean(r[i]));
                break;
            case ValueMetaInterface.TYPE_INTEGER:
                rubyRow.put(field, vm.getInteger(r[i]));
                break;
            case ValueMetaInterface.TYPE_STRING:
                rubyRow.put(field, vm.getString(r[i]));
                break;
            case ValueMetaInterface.TYPE_NUMBER:
                rubyRow.put(field, vm.getNumber(r[i]));
                break;
            case ValueMetaInterface.TYPE_NONE:
                rubyRow.put(field, r[i]);
                break;
            case ValueMetaInterface.TYPE_SERIALIZABLE:
                if (r[i] instanceof RubyStepMarshalledObject) {
                    Object restoredObject = getMarshal().callMethod(data.runtime.getCurrentContext(), "restore",
                            data.runtime.newString(r[i].toString()));
                    rubyRow.put(field, restoredObject);
                } else {
                    // try to put the object in there as it is.. should create a nice adapter for the java object
                    rubyRow.put(field, r[i]);
                }
                break;
            case ValueMetaInterface.TYPE_BINARY:
                // put a ruby array with bytes in there, that is expensive and should probably be avoided
                rubyRow.put(fieldNames[i],
                        data.runtime.newArrayNoCopy(JavaUtil.convertJavaArrayToRuby(data.runtime,
                                ArrayUtils.toObject((byte[]) vm.getBinary(r[i])))));

                break;

            case ValueMetaInterface.TYPE_BIGNUMBER:
                IRubyObject bigDecimalObject = getBigDecimal().callMethod(data.runtime.getCurrentContext(),
                        "new", data.runtime.newString((vm.getBigNumber(r[i])).toString()));
                rubyRow.put(field, bigDecimalObject);
                break;

            case ValueMetaInterface.TYPE_DATE:
                rubyRow.put(field, data.runtime.newTime((vm.getDate(r[i])).getTime()));
                break;

            case ValueMetaInterface.TYPE_TIMESTAMP:
                ValueMetaTimestamp vmTimestamp = (ValueMetaTimestamp) vm;
                Timestamp ts = vmTimestamp.getTimestamp(r[i]);
                RubyTime rubyTime = data.runtime.newTime(ts.getTime() / 1000 * 1000);
                rubyTime.setNSec(ts.getNanos());
                rubyRow.put(field, rubyTime);
                break;

            case ValueMetaInterface.TYPE_INET:
                ValueMetaInternetAddress vmInet = (ValueMetaInternetAddress) vm;
                InetAddress ip = vmInet.getInternetAddress(r[i]);
                IRubyObject ipObject = getIPAddr().callMethod(data.runtime.getCurrentContext(), "new",
                        data.runtime.newString(ip.getHostAddress()));
                rubyRow.put(field, ipObject);
                break;
            }

        }

    }

    return rubyRow;

}

From source file:LicenseGenerator.java

private void cmdLicense_click(ActionEvent e) {
    // ?license//from   w w  w . j av  a2  s.c o m
    StringBuffer buffer = new StringBuffer();

    int[] adapterFlag = new int[128];
    String[] adapterDate = new String[128];
    Arrays.fill(adapterDate, "00000000");

    if (chkAdapter.isSelected()) {
        checkAdapter(chkHTTP_C, txtHTTP_C, adapterFlag, adapterDate);
        checkAdapter(chkHTTP_S, txtHTTP_S, adapterFlag, adapterDate);
        checkAdapter(chkSOAP_C, txtSOAP_C, adapterFlag, adapterDate);
        checkAdapter(chkSOAP_S, txtSOAP_S, adapterFlag, adapterDate);
        checkAdapter(chkTCP_C, txtTCP_C, adapterFlag, adapterDate);
        checkAdapter(chkTCP_S, txtTCP_S, adapterFlag, adapterDate);
        checkAdapter(chkUDP_C, txtUDP_C, adapterFlag, adapterDate);
        checkAdapter(chkUDP_S, txtUDP_S, adapterFlag, adapterDate);
        checkAdapter(chkTUXEDO_C, txtTUXEDO_C, adapterFlag, adapterDate);
        checkAdapter(chkTUXEDO_S, txtTUXEDO_S, adapterFlag, adapterDate);
        checkAdapter(chkMQ_C, txtMQ_C, adapterFlag, adapterDate);
        checkAdapter(chkMQ_S, txtMQ_S, adapterFlag, adapterDate);
    } else {
        Arrays.fill(adapterFlag, 1);
    }

    buffer.append(StringUtils.join(ArrayUtils.toObject(adapterFlag))).append("\r");
    buffer.append("|" + StringUtils.join(adapterDate, "|")).append("\r");
    buffer.append(chkDate.isSelected() ? txtDate.getText() : "00000000").append("\r");
    buffer.append(chkAdapterNum.isSelected() ? txtAdapterNum.getText() : "0");

    System.out.print(buffer);

    // license
    try {
        byte[] data = buffer.toString().getBytes(RuntimeUtils.utf8);
        byte[] key = "nuclearg".getBytes();

        // des
        byte[] enData = encrypt(data, key);
        enData = ArrayUtils.addAll(enData, key);

        // ?license
        String license = new BASE64Encoder().encode(enData);

        // license?

        // base64decode
        byte[] _enData = new BASE64Decoder().decodeBuffer(license);
        System.out.println("_enData == enData " + Arrays.equals(_enData, enData));

        // 
        byte[] _buffer = new byte[_enData.length - 8];
        System.arraycopy(_enData, 0, _buffer, 0, _enData.length - 8);
        byte[] _data = decrypt(_buffer, "nuclearg".getBytes());
        System.out.println("_data == data " + Arrays.equals(_data, data));

        System.out.println(new String(_data, RuntimeUtils.utf8));

        txtLicense.setText(license);
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}