/*
(non-Javadoc)

@see org.restcomm.protocols.ss7.isup.ISUPMessageFactory#createUBL()
339063
@Override
    public UnblockingMessage createUBL() {
        UnblockingMessage msg = new UnblockingMessageImpl(_UBL_HOLDER.mandatoryCodes, _UBL_HOLDER.mandatoryVariableCodes,
                _UBL_HOLDER.optionalCodes, _UBL_HOLDER.mandatoryCodeToIndex, _UBL_HOLDER.mandatoryVariableCodeToIndex,
                _UBL_HOLDER.optionalCodeToIndex);
        return msg;
    }
1068932
@Override
    protected LicenseProvider createLicenseProvider(String licenseAgreementPrefix, String licenseInformationPrefix,
                                                    String subsystemLicenseType) {
        String featureLicenseAgreementPrefix = this.featureName + "/" + licenseAgreementPrefix;
        String featureLicenseInformationPrefix = licenseInformationPrefix == null ? null : this.featureName + "/" + licenseInformationPrefix;
        if (featureLicenseInformationPrefix == null) {
            LicenseProvider lp = ZipLicenseProvider.createInstance(zip, featureLicenseAgreementPrefix);
            if (lp != null)
                return lp;
        } else {
            wlp.lib.extract.ReturnCode licenseReturnCode = ZipLicenseProvider.buildInstance(zip, featureLicenseAgreementPrefix,
                                                                                            featureLicenseInformationPrefix);
            if (licenseReturnCode == wlp.lib.extract.ReturnCode.OK) {
                // Everything is set up ok so carry on
                return ZipLicenseProvider.getInstance();
            }
        }
        // An error indicates that the IBM licenses could not be found so we can use the subsystem header
        if (subsystemLicenseType != null && subsystemLicenseType.length() > 0) {
            return new ThirdPartyLicenseProvider(featureDefinition.getFeatureName(), subsystemLicenseType);
        }
        return null;
    }
1328035
void initFromSubMessageBuffer(ByteBuffer buf) throws IOException
    {
        // See Serialization Format comment above getSerializedSize().

        super.initFromBuffer(buf);

        // Header block
        short fragCount = buf.getShort();
        assert(fragCount > 0);
        short unplannedCount = buf.getShort();
        assert(unplannedCount >= 0 && unplannedCount <= fragCount);
        m_isFinal = buf.get() != 0;
        m_taskType = buf.get();
        m_emptyForRestart = buf.get() != 0;
        m_executedOnPreviousLeader = buf.get() == 1;
        boolean haveOutputDependencies = buf.get() != 0;
        boolean haveInputDependencies = buf.get() != 0;
        short procNameToLoadBytesLen = buf.getShort();
        if (procNameToLoadBytesLen >= 0) {
            m_procNameToLoad = new byte[procNameToLoadBytesLen];
            buf.get(m_procNameToLoad);
        }
        m_perFragmentStatsRecording = buf.get() != 0;
        m_coordinatorTask = buf.get() != 0;
        // N Partition Transaction PartitionCount
        m_nPartTxn = buf.get() != 0;
        // timestamp for restarted transaction
        m_restartTimestamp = buf.getLong();
        m_lastSpUniqueId = buf.getLong();

        m_items = new ArrayList<FragmentData>(fragCount);

        // Fragment ID block (creates the FragmentData objects)
        for (int i = 0; i < fragCount; i++) {
            FragmentData item = new FragmentData();
            item.m_planHash = new byte[20]; // sha1 is 20b
            buf.get(item.m_planHash);
            m_items.add(item);
        }

        // Statement names block
        for (FragmentData item : m_items) {
            short stmtNameLen = buf.getShort();
            if (stmtNameLen >= 0) {
                item.m_stmtName = new byte[stmtNameLen];
                buf.get(item.m_stmtName);
            }
            else {
                item.m_stmtName = null;
            }
        }

        // Parameter set block
        for (FragmentData item : m_items) {
            int paramsbytecount = buf.getInt();
            item.m_parameterSet = ByteBuffer.allocate(paramsbytecount);
            int cachedLimit = buf.limit();
            buf.limit(buf.position() + item.m_parameterSet.remaining());
            item.m_parameterSet.put(buf);
            item.m_parameterSet.flip();
            buf.limit(cachedLimit);
        }

        // Optional output dependency block
        if (haveOutputDependencies) {
            for (FragmentData item : m_items) {
                item.m_outputDepId = buf.getInt();
            }
        }

        // Optional input dependency block
        if (haveInputDependencies) {
            for (FragmentData item : m_items) {
                short count = buf.getShort();
                if (count > 0) {
                    assert count == 1;
                    item.m_inputDepId = buf.getInt();
                }
            }
        }

        // read procedure name if there
        short procNameLen = buf.getShort();
        if (procNameLen >= 0) {
            m_procedureName = new byte[procNameLen];
            buf.get(m_procedureName);
        }
        else {
            m_procedureName = null;
        }

        // ints for batch context
        m_currentBatchIndex = buf.getInt();

        BatchTimeoutOverrideType batchTimeoutType = BatchTimeoutOverrideType.typeFromByte(buf.get());
        if (batchTimeoutType == BatchTimeoutOverrideType.NO_OVERRIDE_FOR_BATCH_TIMEOUT) {
            m_batchTimeout = BatchTimeoutOverrideType.NO_TIMEOUT;
        } else {
            m_batchTimeout = buf.getInt();
        }

        // Involved partition
        short involvedPartitionCount = buf.getShort();
        ImmutableSet.Builder<Integer> involvedPartitionsBuilder = ImmutableSet.builder();
        for (int i = 0; i < involvedPartitionCount; i++) {
            involvedPartitionsBuilder.add(buf.getInt());
        }
        m_involvedPartitions = involvedPartitionsBuilder.build();

        int initiateTaskMessageLength = buf.getInt();
        if (initiateTaskMessageLength > 0) {
            int startPosition = buf.position();
            Iv2InitiateTaskMessage message = new Iv2InitiateTaskMessage();
            // EHGAWD: init task was serialized with flatten which added
            // the message type byte. deserialization expects the message
            // factory to have stripped that byte. but ... that's not the
            // way we do it here. So read the message type byte...
            byte messageType = buf.get();
            assert(messageType == VoltDbMessageFactory.IV2_INITIATE_TASK_ID);
            message.initFromBuffer(buf);
            m_initiateTask = message;
            if (m_initiateTask != null && m_initiateTaskBuffer == null) {
                m_initiateTaskBuffer = ByteBuffer.allocate(m_initiateTask.getSerializedSize());
                try {
                    m_initiateTask.flattenToBuffer(m_initiateTaskBuffer);
                    m_initiateTaskBuffer.flip();
                } catch (IOException e) {
                    //Executive decision, don't throw a checked exception. Let it burn.
                    throw new RuntimeException(e);
                }
            }

            /*
             * There is an assertion that all bytes of the message are consumed.
             * Initiate task lazily deserializes the parameter buffer and doesn't consume
             * all the bytes so do it here so the assertion doesn't trip
             */
            buf.position(startPosition + initiateTaskMessageLength);
        }

        // Unplanned block
        for (int iUnplanned = 0; iUnplanned < unplannedCount; iUnplanned++) {
            short index = buf.getShort();
            assert(index >= 0 && index < m_items.size());
            FragmentData item = m_items.get(index);
            int fragmentPlanLength = buf.getInt();
            if (fragmentPlanLength > 0) {
                item.m_fragmentPlan = new byte[fragmentPlanLength];
                buf.get(item.m_fragmentPlan);

                int stmtTextLength = buf.getInt();
                item.m_stmtText = new byte[stmtTextLength];
                buf.get(item.m_stmtText);
            }
        }
    }
578145
@NotNull
    public static EnhancedMimeType create(@NotNull final String primary, @NotNull final String sub,
            final Charset encoding, final String version, final Map<String, String> parameters) {
        try {
            return new EnhancedMimeType(primary, sub, encoding, version, parameters);
        } catch (final MimeTypeParseException ex) {
            throw new RuntimeException("Failed to create versioned mime type: " + primary + "/" + sub, ex);
        }
    }
192961
public Embed createEmbed(String url) {
		return getResourceFactory().getApiResource("/embed/")
				.entity(new EmbedCreate(url), MediaType.APPLICATION_JSON_TYPE)
				.post(Embed.class);
	}
1338298
protected SubscriptionMessage generateResetSubscriptionMessage()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "generateResetSubscriptionMessage");
    
    // Get the Message Handler for doing this operation.
    final SubscriptionMessageHandler messageHandler =
      iProxyHandler.getMessageHandler();

    // Reset the message.
    messageHandler.resetResetSubscriptionMessage();
     
    // Add the local subscriptions
    addToMessage(messageHandler, iLocalSubscriptions);
      
    // Add the remote Subscriptions
    addToMessage(messageHandler, iRemoteSubscriptions);
      
    SubscriptionMessage message = messageHandler.getSubscriptionMessage();
 
    // Add the message back into the pool
    iProxyHandler.addMessageHandler(messageHandler);

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "generateResetSubscriptionMessage", message);
   
    return message;
  }
1222227
@Nonnull
  public static UnifiedResponse createSimple (@Nonnull final HttpServletRequest aHttpRequest)
  {
    return new UnifiedResponse (RequestHelper.getHttpVersion (aHttpRequest),
                                RequestHelper.getHttpMethod (aHttpRequest),
                                aHttpRequest);
  }
172198
public TrmMeBridgeBootstrapReply createNewTrmMeBridgeBootstrapReply() throws MessageCreateFailedException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createNewTrmMeBridgeBootstrapReply");
    TrmMeBridgeBootstrapReply msg = null;
    try {
      msg = new TrmMeBridgeBootstrapReplyImpl();
    }
    catch (MessageDecodeFailedException e) {
      /* No need to FFDC this as JsMsgObject will already have done so */
      // No FFDC code needed
      throw new MessageCreateFailedException(e);
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createNewTrmMeBridgeBootstrapReply");
    return msg;
  }
648616
@Override
	public CPMeasurementUnit create(long CPMeasurementUnitId) {
		CPMeasurementUnit cpMeasurementUnit = new CPMeasurementUnitImpl();

		cpMeasurementUnit.setNew(true);
		cpMeasurementUnit.setPrimaryKey(CPMeasurementUnitId);

		String uuid = PortalUUIDUtil.generate();

		cpMeasurementUnit.setUuid(uuid);

		cpMeasurementUnit.setCompanyId(companyProvider.getCompanyId());

		return cpMeasurementUnit;
	}
1167172
protected void createStartElem(String nsURI, String prefix, String localName, boolean isEmpty)
        throws XMLStreamException
    {
        DOMOutputElement elem;

        if (!mNsAware) {
            if(nsURI != null && nsURI.length() > 0) {
                throwOutputError("Can not specify non-empty uri/prefix in non-namespace mode");
            }
            elem =  mCurrElem.createAndAttachChild(mDocument.createElement(localName));
        } else {
            if (mNsRepairing) {
                String actPrefix = validateElemPrefix(prefix, nsURI, mCurrElem);
                if (actPrefix != null) { // fine, an existing binding we can use:
		    if (actPrefix.length() != 0) {
			elem = mCurrElem.createAndAttachChild(mDocument.createElementNS(nsURI, actPrefix+":"+localName));
		    } else {
			elem = mCurrElem.createAndAttachChild(mDocument.createElementNS(nsURI, localName));
		    }
                } else { // nah, need to create a new binding...
                    /* Need to ensure that we'll pass "" as prefix, not null,
                     * so it is understood as "I want to use the default NS",
                     * not as "whatever prefix, I don't care"
                     */
                    if (prefix == null) {
                        prefix = "";
                    }
                    actPrefix = generateElemPrefix(prefix, nsURI, mCurrElem);
                    boolean hasPrefix = (actPrefix.length() != 0);
                    if (hasPrefix) {
                        localName = actPrefix + ":" + localName;
                    }
                    elem = mCurrElem.createAndAttachChild(mDocument.createElementNS(nsURI, localName));
                    /* Hmmh. writeNamespace method requires open element
                     * to be defined. So we'll need to set it first
                     * (will be set again at a later point -- would be
                     * good to refactor this method into separate
                     * sub-classes or so)
                     */
                    mOpenElement = elem;
                    // Need to add new ns declaration as well
                    if (hasPrefix) {
                        writeNamespace(actPrefix, nsURI);
                        elem.addPrefix(actPrefix, nsURI);
                    } else {
                        writeDefaultNamespace(nsURI);
                        elem.setDefaultNsUri(nsURI);
                    }
                }
            } else {
                /* Non-repairing; if non-null prefix (including "" to
                 * indicate "no prefix") passed, use as is, otherwise
                 * try to locate the prefix if got namespace.
                 */
                if (prefix == null && nsURI != null && nsURI.length() > 0) {
                    prefix = (mSuggestedPrefixes == null) ? null : mSuggestedPrefixes.get(nsURI);
                    if (prefix == null) {
                        throwOutputError("Can not find prefix for namespace \""+nsURI+"\"");
                    }
		}
                if (prefix != null && prefix.length() != 0) {
                    localName = prefix + ":" +localName;
                }
                elem = mCurrElem.createAndAttachChild(mDocument.createElementNS(nsURI, localName));
            }
        }
        /* Got the element; need to make it the open element, and
         * if it's not an (explicit) empty element, current element as well
         */
        mOpenElement = elem;
        if (!isEmpty) {
            mCurrElem = elem;
        }
    }
1063256
private void createService(@NonNull OkHttpClient client, String baseUrl) {

        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(baseUrl)
                .addConverterFactory(GsonConverterFactory.create(createGson()))
                .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
                .client(client)
                .build();

        service = retrofit.create(RestApi.class);
    }
584730
@Override
  public NlsMessage create(NlsTemplate template, String key1, Object argument1, String key2, Object argument2, String key3, Object argument3, String key4,
      Object argument4) {

    // CHECKSTYLE:ON

    Map<String, Object> arguments = new HashMap<>();
    arguments.put(key1, argument1);
    arguments.put(key2, argument2);
    arguments.put(key3, argument3);
    arguments.put(key4, argument4);
    return create(template, arguments);
  }
125365
private static Pubsub.Builder newPubsubClient(PubsubOptions options) {
    return new Pubsub.Builder(Transport.getTransport(), Transport.getJsonFactory(),
        chainHttpRequestInitializer(
            options.getGcpCredential(),
            // Do not log 404. It clutters the output and is possibly even required by the caller.
            new RetryHttpRequestInitializer(ImmutableList.of(404))))
        .setRootUrl(options.getPubsubRootUrl())
        .setApplicationName(options.getAppName())
        .setGoogleClientRequestInitializer(options.getGoogleApiTrace());
  }
523325
@Override
	public CPSpecificationOption create(long CPSpecificationOptionId) {
		CPSpecificationOption cpSpecificationOption = new CPSpecificationOptionImpl();

		cpSpecificationOption.setNew(true);
		cpSpecificationOption.setPrimaryKey(CPSpecificationOptionId);

		String uuid = PortalUUIDUtil.generate();

		cpSpecificationOption.setUuid(uuid);

		cpSpecificationOption.setCompanyId(companyProvider.getCompanyId());

		return cpSpecificationOption;
	}
1196914
@Override
    public FacilityRejectedMessage createFRJ() {
        FacilityRejectedMessage msg = new FacilityRejectedMessageImpl(_FRJ_HOLDER.mandatoryCodes,
                _FRJ_HOLDER.mandatoryVariableCodes, _FRJ_HOLDER.optionalCodes, _FRJ_HOLDER.mandatoryCodeToIndex,
                _FRJ_HOLDER.mandatoryVariableCodeToIndex, _FRJ_HOLDER.optionalCodeToIndex);

        return msg;
    }
891089
public SubscriptionEnvelope createSubscription(SubscriptionInfo subscriptionInfo) throws ApiException {
        ApiResponse<SubscriptionEnvelope> resp = createSubscriptionWithHttpInfo(subscriptionInfo);
        return resp.getData();
    }
1064258
@Override public SVDModel createImpl() {
    SVDModel.SVDParameters parms = parameters.createImpl();
    return new SVDModel( model_id.key(), parms, null );
  }