/*
(non-Javadoc)

@see org.mobicents.protocols.api.Management#addServerAssociation(java.lang .String, int, java.lang.String,
java.lang.String, org.mobicents.protocols.api.IpChannelType)
195711
@Override
    public Association addServerAssociation(String peerAddress, int peerPort, String serverName, String assocName,
            IpChannelType ipChannelType) throws Exception {
        if (!this.started) {
            throw new Exception(String.format("Management=%s not started", this.name));
        }

        if (peerAddress == null) {
            throw new Exception("Peer address cannot be null");
        }

        if (peerPort < 0) {
            throw new Exception("Peer port cannot be less than 0");
        }

        if (serverName == null) {
            throw new Exception("Server name cannot be null");
        }

        if (assocName == null) {
            throw new Exception("Association name cannot be null");
        }

        synchronized (this) {
            if (this.associations.get(assocName) != null) {
                throw new Exception(String.format("Already has association=%s", assocName));
            }

            Server server = null;

            for (FastList.Node<Server> n = this.servers.head(), end = this.servers.tail(); (n = n.getNext()) != end;) {
                Server serverTemp = n.getValue();
                if (serverTemp.getName().equals(serverName)) {
                    server = serverTemp;
                }
            }

            if (server == null) {
                throw new Exception(String.format("No Server found for name=%s", serverName));
            }

            for (FastMap.Entry<String, Association> n = this.associations.head(), end = this.associations.tail(); (n = n
                    .getNext()) != end;) {
                Association associationTemp = n.getValue();
                
                if (associationTemp.getServerName().equals(server.getName()) && peerAddress.equals(associationTemp.getPeerAddress()) && associationTemp.getPeerPort() == peerPort) {
                    throw new Exception(String.format("Already has association=%s with same peer address=%s and port=%d",
                            associationTemp.getName(), peerAddress, peerPort));
                }
            }

            if (server.getIpChannelType() != ipChannelType)
                throw new Exception(String.format("Server and Accociation has different IP channel type"));

            NettyAssociationImpl association = new NettyAssociationImpl(peerAddress, peerPort, serverName, assocName,
                    ipChannelType);
            association.setManagement(this);

            NettyAssociationMap<String, Association> newAssociations = new NettyAssociationMap<String, Association>();
            newAssociations.putAll(this.associations);
            newAssociations.put(assocName, association);
            this.associations = newAssociations;
            // this.associations.put(assocName, association);

            FastList<String> newAssociations2 = new FastList<String>();
            newAssociations2.addAll(((NettyServerImpl) server).associations);
            newAssociations2.add(assocName);
            ((NettyServerImpl) server).associations = newAssociations2;
            // ((ServerImpl) server).associations.add(assocName);

            this.store();

            for (ManagementEventListener lstr : managementEventListeners) {
                try {
                    lstr.onAssociationAdded(association);
                } catch (Throwable ee) {
                    logger.error("Exception while invoking onAssociationAdded", ee);
                }
            }

            if (logger.isInfoEnabled()) {
                logger.info(String.format("Added Associoation=%s of type=%s", association.getName(),
                        association.getAssociationType()));
            }

            return association;
        }
    }
838804
protected void addSubscription(SIBUuid12 topicSpace, String topic, MESubscription subscription)
  {
    // Generate a key for the topicSpace/topic
    final String key = BusGroup.subscriptionKey(topicSpace, topic);

    iProxies.put(key, subscription);
  }
218930
void changeChannelType(final ChannelType newChannelType) throws GraphConversionException {

		if (!this.channelType.equals(newChannelType) && this.userDefinedChannelType) {
			throw new GraphConversionException("Cannot overwrite user defined channel type");
		}

		this.channelType = newChannelType;
	}
175019
protected void addIssue(final JvmDeclaredType type, final String fileName) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("The type ");
    String _simpleName = type.getSimpleName();
    _builder.append(_simpleName);
    _builder.append(" is already defined");
    {
      if ((fileName != null)) {
        _builder.append(" in ");
        _builder.append(fileName);
      }
    }
    _builder.append(".");
    final String message = _builder.toString();
    final EObject sourceElement = this.associations.getPrimarySourceElement(type);
    if ((sourceElement == null)) {
      this.addIssue(message, type, IssueCodes.DUPLICATE_TYPE);
    } else {
      final EStructuralFeature feature = sourceElement.eClass().getEStructuralFeature("name");
      this.addIssue(message, sourceElement, feature, IssueCodes.DUPLICATE_TYPE);
    }
  }
1128009
public void registerServiceInstance(ProvidedServiceInstance instance, final RegistrationCallback cb, Object context){

        ProtocolHeader header = new ProtocolHeader();
        header.setType(ProtocolType.RegisterServiceInstance);

        RegisterServiceInstanceProtocol p = new RegisterServiceInstanceProtocol(instance);

        ProtocolCallback pcb = new ProtocolCallback(){

            @Override
            public void call(boolean result, Response response,
                    ErrorCode error, Object ctx) {
                cb.call(result, error, ctx);
            }

        };

        connection.submitCallbackRequest(header, p, pcb, context);

    }
139379
public void addBcc(final Address internetAddress) throws MessagingException
	{
		super.addRecipient(javax.mail.Message.RecipientType.BCC, internetAddress);
	}
7443
public static ns_ns_ip add(nitro_service client, ns_ns_ip resource) throws Exception
	{
		resource.validate("add");
		return ((ns_ns_ip[]) resource.perform_operation(client, "add"))[0];
	}
487274
def vserver_add(v_name, v_ip, v_port, v_type, **connection_args):
    '''
    
    '''
    ret = True
    if vserver_exists(v_name, **connection_args):
        return False
    nitro = _connect(**connection_args)
    if nitro is None:
        return False
    vserver = NSLBVServer()
    vserver.set_name(v_name)
    vserver.set_ipv46(v_ip)
    vserver.set_port(v_port)
    vserver.set_servicetype(v_type.upper())
    try:
        NSLBVServer.add(nitro, vserver)
    except NSNitroError as error:
        log.debug('netscaler module error - NSLBVServer.add() failed: %s', error)
        ret = False
    _disconnect(nitro)
    return ret
317212
public void addInterfaceOperationType(String strVersion, TPortType interfaceType, MessageProcessInfo recMessageProcessInfo)
    {
        TOperation interfaceOperationType = wsdlFactory.createTOperation();
        interfaceType.getOperation().add(interfaceOperationType);
        String name = this.fixName(recMessageProcessInfo.getField(MessageProcessInfo.DESCRIPTION).toString());
        interfaceOperationType.setName(name);
        String pattern = this.getURIProperty(MESSAGE_PATTERN_URI);
        //xinterfaceOperationType.setPattern(pattern);
        boolean safe = SAFE_DEFAULT;
        String safeValue = ((PropertiesField)recMessageProcessInfo.getField(MessageProcessInfo.PROPERTIES)).getProperty(MessageProcessInfo.SAFE);
        if (safeValue != null)
            safe = Boolean.parseBoolean(safeValue);
        //xinterfaceOperationType.setSafe(safe);
        String style = ((PropertiesField)recMessageProcessInfo.getField(MessageProcessInfo.PROPERTIES)).getProperty(MESSAGE_STYLE_URI);
        if (style == null)
            style = this.getURIProperty(MESSAGE_STYLE_URI);
        //xinterfaceOperationType.setStyle(style);
        MessageInfo recMessageInfo = this.getMessageIn(recMessageProcessInfo);
        if (recMessageInfo != null)
        {
            TParam messageRefType = wsdlFactory.createTParam();
            interfaceOperationType.getAny().add(wsdlFactory.createTOperationInput(messageRefType));
            name = this.fixName(recMessageInfo.getField(MessageInfo.DESCRIPTION).toString());
            String interfacens = this.getNamespace();
            QName qname = new QName(interfacens, name);
            String code = recMessageInfo.getField(MessageInfo.CODE).toString();
            if (code == null)
                code = name;
            String element = ((PropertiesField)recMessageInfo.getField(MessageInfo.MESSAGE_PROPERTIES)).getProperty(MessageInfo.ELEMENT);
            if (element == null)
                if (code != null)
                    element = code;
            String messageLabel = "In";
            messageRefType.setMessage(qname);
        }
        recMessageInfo = this.getMessageOut(recMessageProcessInfo);
        if (recMessageInfo != null)
        {
            TParam messageRefType = wsdlFactory.createTParam();
            interfaceOperationType.getAny().add(wsdlFactory.createTOperationOutput(messageRefType));
            name = this.fixName(recMessageInfo.getField(MessageInfo.DESCRIPTION).toString());
            String interfacens = this.getNamespace();
            QName qname = new QName(interfacens, name);
            String code = recMessageInfo.getField(MessageInfo.CODE).toString();
            if (code == null)
                code = name;
            String element = ((PropertiesField)recMessageInfo.getField(MessageInfo.MESSAGE_PROPERTIES)).getProperty(MessageInfo.ELEMENT);
            if (element == null)
                if (code != null)
                    element = code;
            String messageLabel = "Out";
            messageRefType.setMessage(qname);
        }
    }
213037
@Override
    public void accept(IBinaryType binaryType, PackageBinding packageBinding, AccessRestriction accessRestriction) {
        if (this.options.verbose) {
            this.out.println(
                Messages.bind(Messages.compilation_loadBinary, new String(binaryType.getName())));
//			new Exception("TRACE BINARY").printStackTrace(System.out);
//		    System.out.println();
        }
        LookupEnvironment env = packageBinding.environment;
        env.createBinaryTypeFrom(binaryType, packageBinding, accessRestriction);
    }
14439
void registerTypeImplementingInterface(
      FunctionType type, ObjectType interfaceInstance) {
    interfaceToImplementors.put(interfaceInstance.getReferenceName(), type);
  }
1342970
static ServerSocketChannelUDT newAcceptorChannelUDT(
            final TypeUDT type) {
        try {
            return SelectorProviderUDT.from(type).openServerSocketChannel();
        } catch (final IOException e) {
            throw new ChannelException("failed to open a server socket channel", e);
        }
    }
164315
public void addInterfaceType(DescriptionType descriptionType)
    {
        // Create the interfaces
        InterfaceType interfaceType = wsdlFactory.createInterfaceType();
        descriptionType.getImportOrIncludeOrTypes().add(wsdlFactory.createInterface(interfaceType));
        String interfaceName = this.getControlProperty(MessageControl.INTERFACE_NAME);
        interfaceType.setName(interfaceName);
        
        this.addInterfaceOperationTypes(interfaceType);
    }
1244555
public static base_response add(nitro_service client, nsip resource) throws Exception {
		nsip addresource = new nsip();
		addresource.ipaddress = resource.ipaddress;
		addresource.netmask = resource.netmask;
		addresource.type = resource.type;
		addresource.arp = resource.arp;
		addresource.icmp = resource.icmp;
		addresource.vserver = resource.vserver;
		addresource.telnet = resource.telnet;
		addresource.ftp = resource.ftp;
		addresource.gui = resource.gui;
		addresource.ssh = resource.ssh;
		addresource.snmp = resource.snmp;
		addresource.mgmtaccess = resource.mgmtaccess;
		addresource.restrictaccess = resource.restrictaccess;
		addresource.dynamicrouting = resource.dynamicrouting;
		addresource.ospf = resource.ospf;
		addresource.bgp = resource.bgp;
		addresource.rip = resource.rip;
		addresource.hostroute = resource.hostroute;
		addresource.hostrtgw = resource.hostrtgw;
		addresource.metric = resource.metric;
		addresource.vserverrhilevel = resource.vserverrhilevel;
		addresource.ospflsatype = resource.ospflsatype;
		addresource.ospfarea = resource.ospfarea;
		addresource.state = resource.state;
		addresource.vrid = resource.vrid;
		addresource.icmpresponse = resource.icmpresponse;
		addresource.ownernode = resource.ownernode;
		addresource.arpresponse = resource.arpresponse;
		addresource.td = resource.td;
		return addresource.add_resource(client);
	}
132409
public void addBindingOperationType(String strVersion, TBinding binding, MessageProcessInfo recMessageProcessInfo)
    {
        String interfacename;
        
        TBindingOperation bindingOperationType = wsdlFactory.createTBindingOperation();
        binding.getOperation().add(bindingOperationType);
        interfacename = this.fixName(recMessageProcessInfo.getField(MessageProcessInfo.DESCRIPTION).toString());
        bindingOperationType.setName(interfacename);
        interfacename = this.fixName(recMessageProcessInfo.getField(MessageProcessInfo.CODE).toString());
        if (interfacename == null)
            interfacename = this.getURIValue(this.getRecord(MessageControl.MESSAGE_CONTROL_FILE).getField(MessageControl.WEB_SERVICES_SERVER).toString());  // Important - This is the web services URL
        
        org.xmlsoap.schemas.wsdl.soap.TOperation tBinding = soapFactory.createTOperation();
        bindingOperationType.getAny().add(soapFactory.createOperation(tBinding));
        tBinding.setSoapAction(interfacename);
        tBinding.setStyle(org.xmlsoap.schemas.wsdl.soap.TStyleChoice.DOCUMENT);
        
        TBindingOperationMessage message = wsdlFactory.createTBindingOperationMessage();
        bindingOperationType.setInput(message);
        org.xmlsoap.schemas.wsdl.soap.TBody body = soapFactory.createTBody();
        message.getAny().add(soapFactory.createBody(body));
        body.setUse(org.xmlsoap.schemas.wsdl.soap.UseChoice.LITERAL);
        
        message = wsdlFactory.createTBindingOperationMessage();
        bindingOperationType.setOutput(message);
        body = soapFactory.createTBody();
        message.getAny().add(soapFactory.createBody(body));
        body.setUse(org.xmlsoap.schemas.wsdl.soap.UseChoice.LITERAL);
    }
1168251
public void registerServiceInstance(ProvidedServiceInstance instance){

        ProtocolHeader header = new ProtocolHeader();
        header.setType(ProtocolType.RegisterServiceInstance);

        RegisterServiceInstanceProtocol p = new RegisterServiceInstanceProtocol(instance);

        connection.submitRequest(header, p, null);

    }
666736
public static base_response add(nitro_service client, onlinkipv6prefix resource) throws Exception {
		onlinkipv6prefix addresource = new onlinkipv6prefix();
		addresource.ipv6prefix = resource.ipv6prefix;
		addresource.onlinkprefix = resource.onlinkprefix;
		addresource.autonomusprefix = resource.autonomusprefix;
		addresource.depricateprefix = resource.depricateprefix;
		addresource.decrementprefixlifetimes = resource.decrementprefixlifetimes;
		addresource.prefixvalidelifetime = resource.prefixvalidelifetime;
		addresource.prefixpreferredlifetime = resource.prefixpreferredlifetime;
		return addresource.add_resource(client);
	}