JRE1.5 Port


@todo REFACTOR
@param array $ac
@param array $ai
@internal
507096
private static function removeDots(&$ac, &$ai)
    {
        $i = count($ai);
        $j = count($ac) - 1;
        for ($k = 0; $k < $i; $k++) {
            $byte0 = 0;
            do {
                $l = $ai[$k];
                if ($ac[$l] === '.') {

                    if (($l == $j) || ($ac[$l + 1] === '')) {
                        $byte0 = 1;
                        break;
                    } else if ($ac[$l + 1] === '.' && $l + 1 == $j || $ac[$l + 2] === '') {
                        $byte0 = 2;
                        break;
                    }
                }
            } while (++$k < $i);

            if ($k > $i || $byte0 === 0) {
                break;
            } elseif ($byte0 === 1) {
                $ai[$k] = -1;
            } else {
                //$i1;
                for ($i1 = $k - 1; $i1 >= 0; $i1--) {
                    if ($ai[$i1] !== -1) break;
                }
                if ($i1 >= 0) {
                    $j1 = $ai[$i1];
                    if ($ac[$j1] !== '.' || $ac[$j1 + 1] !== '.' || $ac[$j1 + 2] !== '') {
                        $ai[$k] = -1;
                        $ai[$i1] = -1;
                    }
                }
            }
        }

    }
647227
function DevAdapter (controller) {
    this.id        = controller.svc;
    this.uid       = "//" + controller.svcopts.adapter + "/" + controller.svc + ":" +  controller.svcopts.port;;
    this.info      = 'ocpvlm';
    this.control   = 'tcpsock';                // this wait for AIS clients to connect via TCP  
    this.gateway   =  controller.gateway;
    this.debug     =  controller.svcopts.debug;// inherit debug from controller
    this.controller=  controller;              // keep a link to device controller and TCP socket
    this.count     =  0;                       // index for incomming client
    this.nbclient  =  0;
    this.distance  =  controller.svcopts.distance*1852 || 30*1852;
    this.maxclient =  controller.svcopts.maxclient || 30;
    this.Debug (1,"uid=%s distance=%dNM", this.uid, this.distance/1852);
    
    HookBackendEvent(this, controller.gateway.backend);
}
698853
public function cp(array &$array, string $from, string $to): void
    {
        // If $from is not readable
        if (false === $this->pa->isReadable($array, $from)) {
            throw new AccessException(sprintf('The $from path "%s" isn\'t readable.', $from));
        }

        // Get the value to move
        $value = $this->getValue($array, $from);

        // Check if $to is the root and if it is
        if ($this->isRoot($to)) {
            // Merge the value in the passed $array
            $array = array_merge($array, $this->forceArray($value));

            return;
        }

        // Do the copy
        $this->pa->setValue($array, $to, $value);
    }
972719
public function build(
        $action,
        array $data,
        CliInput $input,
        Mapping $mapping
    ) {
        $context = new ZMQContext();
        $socket = new ZMQSocket($context, ZMQ::SOCKET_REQ);
        $socket->setSockOpt(ZMQ::SOCKOPT_LINGER, 0);

        if ($input->getMapping() === 'compact') {
            $transportMapper = new CompactTransportMapper();
            $runtimeCallMapper = new CompactRuntimeCallMapper($transportMapper);
        } else {
            $transportMapper = new ExtendedTransportMapper();
            $runtimeCallMapper = new ExtendedRuntimeCallMapper($transportMapper);
        }

        $caller = new ZeroMQRuntimeCaller(
            new MessagePackSerializer(),
            new CompactTransportMapper(),
            $socket,
            $runtimeCallMapper,
            new Timer()
        );

        $transport = $this->mapper->getTransport($data);
        return new ActionApi(
            $this->logger->getRequestLogger($transport->getMeta()->getId()),
            $this->component,
            $mapping,
            dirname(realpath($_SERVER['SCRIPT_FILENAME'])),
            $input->getName(),
            $input->getVersion(),
            $input->getFrameworkVersion(),
            $input->getVariables(),
            $input->isDebug(),
            $action,
            $caller,
            $transport,
            new TypeCatalog(),
            $this->mapper->getParams($data)
        );
    }
41019
public function setPort($port)
    {
        $port = (int)$port;

        if ($port < 1 || $port > 65535) {
            throw new Exception\InvalidArgumentException('$port must be between 1 and 65535');
        }

        $this->port = $port;
        $this->onConfigChanged();
    }
467042
public void bind(ExposedPort exposedPort, Binding binding) {
        if (ports.containsKey(exposedPort)) {
            Binding[] bindings = ports.get(exposedPort);
            ports.put(exposedPort, (Binding[]) ArrayUtils.add(bindings, binding));
        } else {
            if (binding == null) {
                ports.put(exposedPort, null);
            } else {
                ports.put(exposedPort, new Binding[] {binding});
            }
        }
    }
1078097
protected function _loadAclAdapter($adapter) {
		if (!class_exists($adapter)) {
			throw new Exception(sprintf('The Acl Adapter class "%s" was not found.', $adapter));
		}

		$adapterInstance = new $adapter();
		if (!($adapterInstance instanceof AclAdapterInterface)) {
			throw new InvalidArgumentException(sprintf(
				'TinyAuth Acl adapters have to implement %s.', AclAdapterInterface::class
			));
		}

		return $adapterInstance;
	}
616747
public void onJdbcTaskExecutionThrowableEvent(
			JdbcTaskExecutionThrowableEvent event, ActivityContextInterface aci) {
		if (tracer.isWarningEnabled()) {
			tracer.warning(
					"Received a JdbcTaskExecutionThrowableEvent, as result of executed task "
							+ event.getTask(), event.getThrowable());
		}
		// end jdbc activity
		final JdbcActivity activity = (JdbcActivity) aci.getActivity();
		activity.endActivity();
		// call back parent
		final DataSourceParentSbbLocalInterface parent = (DataSourceParentSbbLocalInterface) sbbContextExt
				.getSbbLocalObject().getParent();
		final DataSourceJdbcTask jdbcTask = (DataSourceJdbcTask) event
				.getTask();
		jdbcTask.callBackParentOnException(parent);
	}
1020900
@Override
    public void doExecute() throws MojoExecutionException {
        getLog().info(" ");
        getLog().info(LINE_SEPARATOR);
        getLog().info(" S T A R T I N G    J M E T E R    S E R V E R ");
        getLog().info(LINE_SEPARATOR);
        getLog().info(String.format(" Host: %s", exportedRmiHostname));
        getLog().info(String.format(" Port: %s", serverPort));
        startJMeterServer(initializeJMeterArgumentsArray());
    }
974943
public function forward(ConnectionInterface $connection, $forwardAddress, $forwardPort, $protocolVersion = 2)
    {
        if ($connection instanceof PortConnection) {
            $sourceAddress = $connection->getSourceAddress();
            $sourcePort = $connection->getSourcePort();
            $targetAddress = $connection->getTargetAddress();
            $targetPort = $connection->getTargetPort();
        } elseif ($connection instanceof Connection) {
            list($sourceAddress, $sourcePort) = explode(':', stream_socket_get_name($connection->stream, true));
            list($targetAddress, $targetPort) = explode(':', stream_socket_get_name($connection->stream, false));
        } else {
            throw new \InvalidArgumentException("This connection type is not supported.");
        }

        $connection->pause();

        $header = Header::createForward4($sourceAddress, $sourcePort, $targetAddress, $targetPort, $protocolVersion);
        /** @var Promise $promise */
        $promise = $this->connector->create($forwardAddress, $forwardPort);
        return $promise
            ->then(function(Stream $forwardedConnection) use (
                $connection, $header,
                $sourceAddress, $sourcePort,
                $targetAddress, $targetPort
            ) {
                $forwardedConnection->pause();
                $forwardedConnection->getBuffer()->once('full-drain', function() use ($connection, $forwardedConnection) {
                    $this->emit('forward', [$connection, $forwardedConnection]);
                    $connection->pipe($forwardedConnection);
                    $forwardedConnection->pipe($connection);
                    $connection->resume();
                    $forwardedConnection->resume();
                });
                $forwardedConnection->write($header);

        });
    }
394722
public function actionIf($condition, $action, string $text, array $parameters = [], bool $absolute = true)
    {
        return $this->addIf($condition, Link::toAction($action, $text, $parameters, $absolute));
    }
910062
@Override
	public void actionPerformed(ActionEvent arg0) {

        try {
		final OWLWorkspace workspace = editorKit.getWorkspace();
            if (obdaModel.getSources().isEmpty())
            {
                JOptionPane.showMessageDialog(workspace, "The data source is missing. Create one in ontop Mappings. ");
            }
            else {
                // Get the path of the file of the active OWL model
                OWLOntology activeOntology = modelManager.getActiveOntology();
                IRI documentIRI = modelManager.getOWLOntologyManager().getOntologyDocumentIRI(activeOntology);

                File ontologyDir = new File(documentIRI.toURI().getPath());

                final JFileChooser fc = new JFileChooser(ontologyDir);
                final String shortForm = documentIRI.getShortForm();
                int i = shortForm.lastIndexOf(".");
                String ontologyName = (i < 1)?
                        shortForm:
                        shortForm.substring(0, i);
                fc.setSelectedFile(new File(ontologyName + "-mapping.ttl"));
                //fc.setSelectedFile(new File(sourceID + "-mapping.ttl"));

                int approve = fc.showSaveDialog(workspace);

                if(approve == JFileChooser.APPROVE_OPTION) {


                    final File file = fc.getSelectedFile();

                    Thread th = new Thread("R2RML Export Action Thread"){
                        @Override
                        public void run() {
                            try {
                                OBDAProgressMonitor monitor = new OBDAProgressMonitor(
                                        "Exporting the mapping to R2RML...", workspace);
                                R2RMLExportThread t = new R2RMLExportThread();
                                monitor.addProgressListener(t);
                                monitor.start();
                                t.run(file);
                                monitor.stop();
                                JOptionPane.showMessageDialog(workspace,
                                        "R2RML Export completed.", "Done",
                                        JOptionPane.INFORMATION_MESSAGE);
                            } catch (Exception e) {
                                JOptionPane.showMessageDialog(workspace, "An error occurred. For more info, see the logs.");
                                log.error("Error during R2RML export. \n", e.getMessage());
                                e.printStackTrace();
                            }
                        }
                    };
                    th.start();


                }
            }
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(getWorkspace(), "An error occurred. For more info, see the logs.");
            log.error("Error during R2RML export. \n");
            ex.printStackTrace();
        }

	}
85472
public static function port($service, $privatePort, array $args = [])
    {
        $args[] = $service;
        $args[] = $privatePort;
        return self::runCommand('port', $args);
    }
307439
public function connect($config='',$linkNum=0,$autoConnection=false) {
        if ( !isset($this->linkID[$linkNum]) ) {
            if(empty($config))  $config =   $this->config;
            try{
                if(empty($config['dsn'])) {
                    $config['dsn']  =   $this->parseDsn($config);
                }
                if(version_compare(PHP_VERSION,'5.3.6','<=')){ 
                    // 禁用模拟预处理语句
                    $this->options[PDO::ATTR_EMULATE_PREPARES]  =   false;
                }
                $this->linkID[$linkNum] = new PDO( $config['dsn'], $config['username'], $config['password'],$this->options);
            }catch (\PDOException $e) {
                if($autoConnection){
                    trace($e->getMessage(),'','ERR');
                    return $this->connect($autoConnection,$linkNum);
                }elseif($config['debug']){
                    E($e->getMessage());
                }
            }
        }
        return $this->linkID[$linkNum];
    }
1065124
public function grant() {
        $aro_id = isset($this->request->params['named']['aro_id']) ? $this->request->params['named']['aro_id'] : null;
        $aco_id = isset($this->request->params['named']['aco_id']) ? $this->request->params['named']['aco_id'] : null;

        if (!$aro_id || !$aco_id) {
            throw new BadRequestException(__d('admin', 'Invalid ARO/ACO IDs'));
        }

        $aro = $this->Aro->getById($aro_id);
        $aco = $this->Aco->getById($aco_id);

        if (!$aro || !$aco) {
            throw new NotFoundException(__d('admin', 'Invalid ARO/ACO Records'));
        }

        $aroAlias = $aro['RequestObject']['alias'];
        $acoAlias = $aco['ControlObject']['alias'];

        if (!empty($aro['Parent']['alias'])) {
            $aroAlias = $aro['Parent']['alias'] . '/' . $aroAlias;
        }

        if ($this->Acl->allow($aroAlias, $acoAlias)) {
            $this->AdminToolbar->logAction(ActionLog::CREATE, $this->Permission, $this->Acl->adapter()->Permission->id, sprintf('Granted %s access to %s', $aroAlias, $acoAlias));
            $this->AdminToolbar->setFlashMessage(__d('admin', 'Successfully granted %s permission to %s', array($aroAlias, $acoAlias)));
        } else {
            $this->AdminToolbar->setFlashMessage(__d('admin', 'Failed to grant %s permission to %s', array($aroAlias, $acoAlias)), 'is-error');
        }

        $this->redirect(array('action' => 'index'));
    }
1312785
public function setConnectionParam($host, $username, $password, $database = null, $port = null,  $settingList = [])
    {
        parent::setConnectionParam($host, $username, $password, $database, $port,  $settingList);

        // if there is no port set the default port
        if (!$this->getPort() && !$port) {
            $this->setPort(self::MYSQL_DEFAULT_PORT);
        }
    }
238089
public function listen(int $port = 119, string $address = self::DEFAULT_ADDRESS, array $options = [])
    {
        // Create a server for the requested address and port.
        $server = $this->factory->create($address, $port, $options);
        $this->servers[] = $server;

        $coroutine = new Coroutine($this->accept($server));
        $coroutine->done();
    }