/*
(non-Javadoc)

@see org.restcomm.protocols.ss7.isup.ISUPMessageFactory#createACM()
359520
public AddressCompleteMessage createACM() {

        AddressCompleteMessageImpl acm = new AddressCompleteMessageImpl(_ACM_HOLDER.mandatoryCodes,
                _ACM_HOLDER.mandatoryVariableCodes, _ACM_HOLDER.optionalCodes, _ACM_HOLDER.mandatoryCodeToIndex,
                _ACM_HOLDER.mandatoryVariableCodeToIndex, _ACM_HOLDER.optionalCodeToIndex);

        return acm;
    }
359704
static JmsMessageImpl messageToJmsMessageImpl(Message message) throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "messageToJmsMessageImpl", message);

        JmsMessageImpl jmsMessage = null;

        if (message instanceof BytesMessage) {
            jmsMessage = new JmsBytesMessageImpl((BytesMessage) message);
        }
        else if (message instanceof MapMessage) {
            jmsMessage = new JmsMapMessageImpl((MapMessage) message);
        }
        else if (message instanceof ObjectMessage) {
            jmsMessage = new JmsObjectMessageImpl((ObjectMessage) message);
        }
        else if (message instanceof StreamMessage) {
            jmsMessage = new JmsStreamMessageImpl((StreamMessage) message);
        }
        else if (message instanceof TextMessage) {
            jmsMessage = new JmsTextMessageImpl((TextMessage) message);
        }
        else if (message instanceof Message) {
            jmsMessage = new JmsMessageImpl(message);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "messageToJmsMessageImpl", jmsMessage);
        return jmsMessage;
    }
1117134
@Override
    public CircuitGroupUnblockingAckMessage createCGUA(int cic) {
        CircuitGroupUnblockingAckMessage msg = createCGUA();
        CircuitIdentificationCode code = this.parameterFactory.createCircuitIdentificationCode();
        code.setCIC(cic);
        msg.setCircuitIdentificationCode(code);
        return msg;
    }
1260192
@Override
	public Permission createPerm(String p) {
		String[] params = Split.split('|', p);
		if(params.length==3) {
			return new AAFPermission(params[0],params[1],params[2]);
		} else {
			return new LocalPermission(p);
		}
	}
607376
protected UserMessage createTellMessage (BodyObject source, String message)
    {
        return UserMessage.create(source.getVisibleName(), message);
    }
1035529
@Override
    public CircuitGroupUnblockingMessage createCGU() {
        CircuitGroupUnblockingMessage msg = new CircuitGroupUnblockingMessageImpl(_CGU_HOLDER.mandatoryCodes,
                _CGU_HOLDER.mandatoryVariableCodes, _CGU_HOLDER.optionalCodes, _CGU_HOLDER.mandatoryCodeToIndex,
                _CGU_HOLDER.mandatoryVariableCodeToIndex, _CGU_HOLDER.optionalCodeToIndex);

        return msg;
    }
889813
@Override
	public SICoreConnection createConnection(ClientConnection cc,
			String credentialType, String userid, String password)
			throws SIResourceException, SINotAuthorizedException,
			SIAuthenticationException {
		// Basically this method will not be called
		// It is there in the interface just to be called by the Comms component to MessageProcessor
		if (TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, "createConnection", new Object[] {cc, credentialType, userid, password});
        }
		SibTr.error(TRACE, "This method should not have been called");
		if (TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, "createConnection", null);
        }
		return null;
	}
206619
public static Protos.PaymentACK createPaymentAck(Protos.Payment paymentMessage, @Nullable String memo) {
        final Protos.PaymentACK.Builder builder = Protos.PaymentACK.newBuilder();
        builder.setPayment(paymentMessage);
        if (memo != null)
            builder.setMemo(memo);
        return builder.build();
    }
1265884
def create_acs(self, **kwargs):
        
        acs = predix.admin.acs.AccessControl(**kwargs)
        acs.create()

        client_id = self.get_client_id()
        if client_id:
            acs.grant_client(client_id)

        acs.grant_client(client_id)
        acs.add_to_manifest(self)
        return acs
281347
@Override
	public String createMachine( TargetHandlerParameters parameters ) throws TargetException {

		this.logger.fine( "Creating a new machine on AWS." );

		// For IaaS, we only expect root instance names to be passed
		if( InstanceHelpers.countInstances( parameters.getScopedInstancePath()) > 1 )
			throw new TargetException( "Only root instances can be passed in arguments." );

		String rootInstanceName = InstanceHelpers.findRootInstancePath( parameters.getScopedInstancePath());

		// Deal with the creation
		String instanceId;
		try {
			AmazonEC2 ec2 = createEc2Client( parameters.getTargetProperties());
			String userData = UserDataHelpers.writeUserDataAsString(
					parameters.getMessagingProperties(),
					parameters.getDomain(),
					parameters.getApplicationName(),
					rootInstanceName );

			RunInstancesRequest runInstancesRequest = prepareEC2RequestNode( parameters.getTargetProperties(), userData );
			RunInstancesResult runInstanceResult = ec2.runInstances( runInstancesRequest );
			instanceId = runInstanceResult.getReservation().getInstances().get( 0 ).getInstanceId();

		} catch( Exception e ) {
			this.logger.severe( "An error occurred while creating a new machine on EC2. " + e.getMessage());
			throw new TargetException( e );
		}

		return instanceId;
	}
1294002
@Override
	public String createMachine( TargetHandlerParameters parameters ) throws TargetException {

		this.logger.fine( "Creating a new VM @ VMware." );

		// For IaaS, we only expect root instance names to be passed
		if( InstanceHelpers.countInstances( parameters.getScopedInstancePath()) > 1 )
			throw new TargetException( "Only root instances can be passed in arguments." );

		String rootInstanceName = InstanceHelpers.findRootInstancePath( parameters.getScopedInstancePath());

		// Deal with the creation
		try {
			System.setProperty("org.xml.sax.driver","org.apache.xerces.parsers.SAXParser");
			Map<String,String> targetProperties = parameters.getTargetProperties();
			final String machineImageId = targetProperties.get( TEMPLATE );
			final ServiceInstance vmwareServiceInstance = getServiceInstance( targetProperties );

			final ComputeResource vmwareComputeResource = (ComputeResource)(
					new InventoryNavigator( vmwareServiceInstance.getRootFolder())
					.searchManagedEntity("ComputeResource", targetProperties.get( CLUSTER )));

			// Generate the user data first, so that nothing has been done on the IaaS if it fails
			String userData = UserDataHelpers.writeUserDataAsString(
					parameters.getMessagingProperties(),
					parameters.getDomain(),
					parameters.getApplicationName(),
					rootInstanceName );

			VirtualMachine vm = getVirtualMachine( vmwareServiceInstance, machineImageId );
			String vmwareDataCenter = targetProperties.get( DATA_CENTER );
			Folder vmFolder =
					((Datacenter)(new InventoryNavigator( vmwareServiceInstance.getRootFolder())
					.searchManagedEntity("Datacenter", vmwareDataCenter)))
					.getVmFolder();

			this.logger.fine("machineImageId=" + machineImageId);
			if (vm == null || vmFolder == null)
				throw new TargetException("VirtualMachine (= " + vm + " ) or Datacenter path (= " + vmFolder + " ) is NOT correct. Please, double check.");

			VirtualMachineCloneSpec cloneSpec = new VirtualMachineCloneSpec();
			cloneSpec.setLocation(new VirtualMachineRelocateSpec());
			cloneSpec.setPowerOn(false);
			cloneSpec.setTemplate(true);

			VirtualMachineConfigSpec vmSpec = new VirtualMachineConfigSpec();
			vmSpec.setAnnotation( userData );
			cloneSpec.setConfig(vmSpec);

			Task task = vm.cloneVM_Task( vmFolder, rootInstanceName, cloneSpec );
			this.logger.fine("Cloning the template: "+ machineImageId +" ...");
			String status = task.waitForTask();
			if (!status.equals(Task.SUCCESS))
				throw new TargetException("Failure: Virtual Machine cannot be cloned." );

			VirtualMachine vm2 = getVirtualMachine( vmwareServiceInstance, rootInstanceName );
			this.logger.fine("Transforming the clone template to Virtual machine ...");
			vm2.markAsVirtualMachine( vmwareComputeResource.getResourcePool(), null);

			DynamicProperty dprop = new DynamicProperty();
			dprop.setName("guestinfo.userdata");
			dprop.setVal(userData);
			vm2.getGuest().setDynamicProperty(new DynamicProperty[]{dprop});

			task = vm2.powerOnVM_Task(null);
			this.logger.fine("Starting the virtual machine: "+ rootInstanceName +" ...");
			status = task.waitForTask();
			if( ! status.equals( Task.SUCCESS ))
				throw new TargetException("Failure: Virtual Machine cannot be started." );

			return vm2.getName();

		} catch( Exception e ) {
			throw new TargetException( e );
		}
	}
101278
@Override
	public String createMachine( TargetHandlerParameters parameters ) throws TargetException {

		this.logger.fine( "Creating a new machine." );

		// For IaaS, we only expect root instance names to be passed
		if( InstanceHelpers.countInstances( parameters.getScopedInstancePath()) > 1 )
			throw new TargetException( "Only root instances can be passed in arguments." );

		// Validate all the properties here
		String rootInstanceName = InstanceHelpers.findRootInstancePath( parameters.getScopedInstancePath());
		Map<String,String> targetProperties = parameters.getTargetProperties();
		validateAll( targetProperties, parameters.getApplicationName(), rootInstanceName );

		// Prepare the work
		NovaApi novaApi = OpenstackIaasHandler.novaApi( targetProperties );
		String zoneName = findZoneName( novaApi, targetProperties );
		String vmName = parameters.getApplicationName() + "." + rootInstanceName;

		// Find flavor and image IDs
		String flavorId = null;
		String flavorName = targetProperties.get( OpenstackIaasHandler.FLAVOR_NAME );
		for( Resource res : novaApi.getFlavorApiForZone( zoneName ).list().concat()) {
			if( res.getName().equalsIgnoreCase( flavorName )) {
				flavorId = res.getId();
				break;
			}
		}

		if( flavorId == null )
			throw new TargetException( "No flavor named '" + flavorName + "' was found." );

		String imageId = null;
		String imageName = targetProperties.get( OpenstackIaasHandler.IMAGE_NAME );
		for( Resource res : novaApi.getImageApiForZone( zoneName ).list().concat()) {
			if( res.getName().equalsIgnoreCase( imageName )) {
				imageId = res.getId();
				break;
			}
		}

		if( imageId == null )
			throw new TargetException( "No image named '" + imageName + "' was found." );

		// Prepare the server creation
		Map<String,String> metadata = new HashMap<>(3);
		metadata.put( "Application Name", parameters.getApplicationName());
		metadata.put( "Root Instance Name", rootInstanceName );
		metadata.put( "Created by", "Roboconf" );

		try {
			String userData = UserDataHelpers.writeUserDataAsString(
					parameters.getMessagingProperties(),
					parameters.getDomain(),
					parameters.getApplicationName(),
					rootInstanceName );

			CreateServerOptions options = CreateServerOptions.Builder
					.keyPairName( targetProperties.get( OpenstackIaasHandler.KEY_PAIR ))
					.securityGroupNames( targetProperties.get( OpenstackIaasHandler.SECURITY_GROUP ))
					.userData( userData.getBytes( StandardCharsets.UTF_8 ))
					.metadata( metadata );

			String networkId = targetProperties.get( OpenstackIaasHandler.NETWORK_ID );
			if( ! Utils.isEmptyOrWhitespaces( networkId ))
				options = options.networks( networkId );

			ServerCreated server = novaApi.getServerApiForZone( zoneName ).create( vmName, imageId, flavorId, options);
			String machineId = server.getId();
			novaApi.close();

			return machineId;

		} catch( Exception e ) {
			throw new TargetException( e );
		}
	}
731722
@Override
    public OverloadMessage createOLM() {
        OverloadMessage msg = new OverloadMessageImpl(_OLM_HOLDER.mandatoryCodes, _OLM_HOLDER.mandatoryVariableCodes,
                _OLM_HOLDER.optionalCodes, _OLM_HOLDER.mandatoryCodeToIndex, _OLM_HOLDER.mandatoryVariableCodeToIndex,
                _OLM_HOLDER.optionalCodeToIndex);
        return msg;
    }
334710
public ISUPMessage createCommand(int commandCode) {
        switch (commandCode) {
            case InitialAddressMessage.MESSAGE_CODE:
                InitialAddressMessage IAM = createIAM();
                return IAM;
            case AddressCompleteMessage.MESSAGE_CODE:
                AddressCompleteMessage ACM = createACM();
                return ACM;
            case ReleaseMessage.MESSAGE_CODE:
                ReleaseMessage REL = createREL(0);
                return REL;
            case ReleaseCompleteMessage.MESSAGE_CODE:
                ReleaseCompleteMessage RLC = createRLC();
                return RLC;

            case ApplicationTransportMessage.MESSAGE_CODE:
                ApplicationTransportMessage APT = createAPT();
                return APT;

            case AnswerMessage.MESSAGE_CODE:
                AnswerMessage ANM = createANM();
                return ANM;

            case CallProgressMessage.MESSAGE_CODE:
                CallProgressMessage CPG = createCPG();
                return CPG;

            case CircuitGroupResetAckMessage.MESSAGE_CODE:
                CircuitGroupResetAckMessage GRA = createGRA();
                return GRA;

            case ConfusionMessage.MESSAGE_CODE:
                ConfusionMessage CFN = createCNF();
                return CFN;

            case ConnectMessage.MESSAGE_CODE:
                ConnectMessage CON = createCON();
                return CON;

            case ContinuityMessage.MESSAGE_CODE:
                ContinuityMessage COT = createCOT();
                return COT;

            case FacilityRejectedMessage.MESSAGE_CODE:
                FacilityRejectedMessage FRJ = createFRJ();
                return FRJ;

            case InformationMessage.MESSAGE_CODE:
                InformationMessage INF = createINF();
                return INF;

            case InformationRequestMessage.MESSAGE_CODE:
                InformationRequestMessage INR = createINR();
                return INR;

            case SubsequentAddressMessage.MESSAGE_CODE:
                SubsequentAddressMessage SAM = createSAM();
                return SAM;

            case SubsequentDirectoryNumberMessage.MESSAGE_CODE:
                SubsequentDirectoryNumberMessage SDN = createSDN();
                return SDN;

            case ForwardTransferMessage.MESSAGE_CODE:
                ForwardTransferMessage FOT = createFOT();
                return FOT;

            case ResumeMessage.MESSAGE_CODE:
                ResumeMessage RES = createRES();
                return RES;
            case BlockingMessage.MESSAGE_CODE:
                BlockingMessage BLO = createBLO();
                return BLO;

            case BlockingAckMessage.MESSAGE_CODE:
                BlockingAckMessage BLA = createBLA();
                return BLA;

            case ContinuityCheckRequestMessage.MESSAGE_CODE:
                ContinuityCheckRequestMessage CCR = createCCR();
                return CCR;

            case LoopbackAckMessage.MESSAGE_CODE:
                LoopbackAckMessage LPA = createLPA();
                return LPA;

            case LoopPreventionMessage.MESSAGE_CODE:
                LoopPreventionMessage LPP = createLPP();
                return LPP;

            case OverloadMessage.MESSAGE_CODE:
                OverloadMessage OLM = createOLM();
                return OLM;

            case SuspendMessage.MESSAGE_CODE:
                SuspendMessage SUS = createSUS();
                return SUS;

            case ResetCircuitMessage.MESSAGE_CODE:
                ResetCircuitMessage RSC = createRSC();
                return RSC;

            case UnblockingMessage.MESSAGE_CODE:
                UnblockingMessage UBL = createUBL();
                return UBL;

            case UnblockingAckMessage.MESSAGE_CODE:
                UnblockingAckMessage UBA = createUBA();
                return UBA;

            case UnequippedCICMessage.MESSAGE_CODE:
                UnequippedCICMessage UCIC = createUCIC();
                return UCIC;

            case CircuitGroupBlockingMessage.MESSAGE_CODE:
                CircuitGroupBlockingMessage CGB = createCGB();
                return CGB;

            case CircuitGroupBlockingAckMessage.MESSAGE_CODE:
                CircuitGroupBlockingAckMessage CGBA = createCGBA();
                return CGBA;

            case CircuitGroupUnblockingMessage.MESSAGE_CODE:
                CircuitGroupUnblockingMessage CGU = createCGU();
                return CGU;

            case CircuitGroupUnblockingAckMessage.MESSAGE_CODE:
                CircuitGroupUnblockingAckMessage CGUA = createCGUA();
                return CGUA;

            case CircuitGroupResetMessage.MESSAGE_CODE:
                CircuitGroupResetMessage GRS = createGRS();
                return GRS;

            case CircuitGroupQueryResponseMessage.MESSAGE_CODE:
                CircuitGroupQueryResponseMessage CQR = createCQR();
                return CQR;

            case CircuitGroupQueryMessage.MESSAGE_CODE:
                CircuitGroupQueryMessage CQM = createCQM();
                return CQM;

            case FacilityAcceptedMessage.MESSAGE_CODE:
                FacilityAcceptedMessage FAA = createFAA();
                return FAA;

            case FacilityRequestMessage.MESSAGE_CODE:
                FacilityRequestMessage FAR = createFAR();
                return FAR;

            case PassAlongMessage.MESSAGE_CODE:
                PassAlongMessage PAM = createPAM();
                return PAM;

            case PreReleaseInformationMessage.MESSAGE_CODE:
                PreReleaseInformationMessage PRI = createPRI();
                return PRI;

            case FacilityMessage.MESSAGE_CODE:
                FacilityMessage FAC = createFAC();
                return FAC;

            case NetworkResourceManagementMessage.MESSAGE_CODE:
                NetworkResourceManagementMessage NRM = createNRM();
                return NRM;

            case IdentificationRequestMessage.MESSAGE_CODE:
                IdentificationRequestMessage IDR = createIDR();
                return IDR;

            case IdentificationResponseMessage.MESSAGE_CODE:
                IdentificationResponseMessage IRS = createIRS();
                return IRS;

            case SegmentationMessage.MESSAGE_CODE:
                SegmentationMessage SGM = createSGM();
                return SGM;

            case ChargeInformationMessage.MESSAGE_CODE:
                ChargeInformationMessage CIM = createCIM();
                return CIM;

            case UserPartAvailableMessage.MESSAGE_CODE:
                UserPartAvailableMessage UPA = createUPA();
                return UPA;

            case UserPartTestMessage.MESSAGE_CODE:
                UserPartTestMessage UPT = createUPT();
                return UPT;

            case UserToUserInformationMessage.MESSAGE_CODE:
                UserToUserInformationMessage USR = createUSR();
                return USR;
            default:
                throw new IllegalArgumentException("Not supported comamnd code: " + commandCode);
        }
    }
806485
@Override
    public TextMessage createTextMessage() throws JMSRuntimeException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createTextMessage");

        TextMessage textMessage = null;

        try {
            textMessage = jmsSession.createTextMessage();
        } catch (JMSException jmse) {
            throw (JMSRuntimeException) JmsErrorUtils.getJMS2Exception(jmse, JMSRuntimeException.class);
        } finally {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "createTextMessage", new Object[] { textMessage });
        }

        return textMessage;

    }
42091
@Override
    public StreamMessage createStreamMessage() throws JMSRuntimeException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createStreamMessage");

        StreamMessage streamMessage = null;

        try {
            streamMessage = jmsSession.createStreamMessage();
        } catch (JMSException jmse) {
            throw (JMSRuntimeException) JmsErrorUtils.getJMS2Exception(jmse, JMSRuntimeException.class);
        } finally {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "createStreamMessage", new Object[] { streamMessage });
        }

        return streamMessage;

    }
800807
protected Map<String, Object> createMessageModel(String attributeName, Object attributeValue) {
        Map<String, Object> model = new HashMap<>(1);
        model.put(attributeName, attributeValue);

        return model;
    }