Package the server

@return
183110
public ReturnCode doPackage() {
        boolean isClient = bootProps.getProcessType() == BootstrapConstants.LOC_PROCESS_TYPE_CLIENT;
        if (isClient) {
            System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.clientPackaging"), serverName));
        } else {
            System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverPackaging"), serverName));
        }

        // Use initialized bootstrap configuration to find the server lock file.
        ServerLock serverLock = ServerLock.createServerLock(bootProps);

        ReturnCode packageRc = ReturnCode.PACKAGE_ACTION;

        // create timestamp
        SimpleDateFormat sdf = new SimpleDateFormat("yy.MM.dd_HH.mm.ss");
        Date date = new Date();
        String packageTimestamp = sdf.format(date);

        File archive = null;
        if (serverLock.testServerRunning()) {
            packageRc = ReturnCode.SERVER_ACTIVE_STATUS;
        } else {
            archive = getArchive(serverName, new File(serverOutputDir));

            if (archive == null) {
                System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("error.package.extension"), serverName));
                return ReturnCode.ERROR_SERVER_PACKAGE;
            }

            //generate package txt
            File packageInfoFile = new File(serverOutputDir, BootstrapConstants.SERVER_PACKAGE_INFO_FILE_PREFIX + packageTimestamp + ".txt");
            generatePackageInfo(packageInfoFile, serverName, date);

            packageRc = packageServerRuntime(archive, false);

            //clean up package txt
            FileUtils.recursiveClean(packageInfoFile);
        }

        if (isClient) {
            if (packageRc == ReturnCode.OK) {
                System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.clientPackageComplete"), serverName, archive.getAbsolutePath()));
            } else if (packageRc == ReturnCode.SERVER_ACTIVE_STATUS) {
                System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.clientIsRunning"), serverName));
                System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.clientPackageUnreachable"), serverName));
            } else {
                System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.clientPackageException"), serverName));
            }
        } else {
            if (packageRc == ReturnCode.OK) {
                System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverPackageComplete"), serverName, archive.getAbsolutePath()));
            } else if (packageRc == ReturnCode.SERVER_ACTIVE_STATUS) {
                System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverIsRunning"), serverName));
                System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverPackageUnreachable"), serverName));
            } else {
                System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverPackageException"), serverName));
            }
        }

        return packageRc;
    }
1247426
protected function buildPackage()
	{
		list($vendor, $name) = $this->getPackageSegments();

		$config = $this->flyphp['config']['workbench'];

		return new Package($vendor, $name, $config['name'], $config['email']);
	}
887487
private Server __buildServer() {
        Server mServer = new Server();

        // Connectors...
        Connector[] connectors = getConnectors(mServer);
        if (connectors == null || connectors.length == 0)
            throw new RuntimeException("Missing connectors");

        for (Connector connector : connectors) {
            mServer.addConnector(connector);
        }

        ServletContextHandler handler = new ServletContextHandler(ServletContextHandler.SESSIONS);
        handler.setContextPath("/");
        handler.setResourceBase(System.getProperty("java.io.tmpdir"));

        // Filters...
        for (Map.Entry<String, List<Class<? extends Filter>>> filterEntry : filterMap.entrySet()) {
            for (Class<? extends Filter> filterClass : filterEntry.getValue()) {
                handler.addFilter(filterClass, filterEntry.getKey(), EnumSet.of(DispatcherType.REQUEST));
            }
        }

        // Servlets...
        for (Map.Entry<String, Class<? extends HttpServlet>> servletEntry : servletMap.entrySet()) {
            handler.addServlet(servletEntry.getValue(), servletEntry.getKey());
        }

        // Event listeners...
        for (Class<? extends EventListener> eventListenerClass : servletContextListenerSet) {
            try {
                EventListener eventListener = eventListenerClass.newInstance();
                handler.addEventListener(eventListener);
            } catch (IllegalAccessException | InstantiationException ex) {
                throw new RuntimeException(ex);
            }
        }

        // Error handler...
        if (errorHandler != null)
            handler.setErrorHandler(errorHandler);

        mServer.setHandler(handler);
        return mServer;
    }
716825
public SslContext createHttpTLSContextForServer() throws SSLException {
        SslProvider provider = SslProvider.JDK;
        SslContext certsSslContext = serverContextBuilderWithCerts(provider).build();
        int sessionTimeout = sslConfig.getSessionTimeOut();
        if (sessionTimeout > 0) {
            certsSslContext.sessionContext().setSessionTimeout(sessionTimeout);
        }
        return certsSslContext;
    }
834240
public java.util.List<String> getPackages() {
        if (packages == null) {
            packages = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return packages;
    }
788031
public GrpcServer build() {
    addService(new GrpcService(new ServiceVersionClientServiceHandler(mServices))
        .disableAuthentication());
    return new GrpcServer(mNettyServerBuilder.build(),
        mConfiguration.getMs(PropertyKey.MASTER_GRPC_SERVER_SHUTDOWN_TIMEOUT));
  }
626955
public FtpServerBuilder server(org.apache.ftpserver.FtpServer server) {
        endpoint.setFtpServer(server);
        return this;
    }
1320
public Properties asProperties() {
        final Properties props = new Properties();
        other.forEach(props::setProperty);
        props.setProperty("bootstrap.servers", bootstrapServers);
        return props;
    }
1246596
public function server()
    {
        if($this->server === null) {
            $data = $this->serverRequest->getServerParams();
            $this->server = $this->builder->serverData($data);
        }
        
        return $this->server;
    }
296910
public ServerConfiguration copy() throws IOException {
        ReadableByteArrayOutputStream out = new ReadableByteArrayOutputStream();
        serialize(out);
        return new ServerConfigurationParser(out.toInputStream()).parse();
    }
1344189
@Override
    public Server addServer(String serverName, String hostAddress, int port) throws Exception {
        return addServer(serverName, hostAddress, port, IpChannelType.SCTP, false, 0, null);
    }
986210
public List<CreateServerConfig> getServerConfigs() {
        List<CreateServerConfig> serverConfigs = new ArrayList<>();
        collectConfigs(this, serverConfigs);
        return serverConfigs;
    }
958215
public ConfigurationMetadataRepository build() {
        val result = new SimpleConfigurationMetadataRepository();
        for (val repository : this.repositories) {
            result.include(repository);
        }
        return result;
    }
753162
def package(self):
        
        cmake = self.configure_cmake()
        cmake.install()
        self.copy(pattern="LICENSE.txt", dst="licenses")
        self.copy(pattern="FindFlatBuffers.cmake", dst=os.path.join("lib", "cmake", "flatbuffers"), src="CMake")
        self.copy(pattern="flathash*", dst="bin", src="bin")
        self.copy(pattern="flatc*", dst="bin", src="bin")
        if self.settings.os == "Windows" and self.options.shared:
            if self.settings.compiler == "Visual Studio":
                shutil.move(os.path.join(self.package_folder, "lib", "%s.dll" % self.name),
                            os.path.join(self.package_folder, "bin", "%s.dll" % self.name))
            elif self.settings.compiler == "gcc":
                shutil.move(os.path.join(self.package_folder, "lib", "lib%s.dll" % self.name),
                            os.path.join(self.package_folder, "bin", "lib%s.dll" % self.name))
180869
protected Server createServer(IJettyConfiguration iJettyConfiguration) {
        LOG.trace("Create Jetty Server...");

        Server server = new Server(new QueuedThreadPool(iJettyConfiguration.getMaxThreads()));
        server.setStopAtShutdown(false); // Reimplemented. See
                                         // @IJettyConfiguration.stopAtShutdown
        server.setStopTimeout(iJettyConfiguration.getStopTimeout());

        return server;
    }
171511
protected Package[] getPackages() {
        Map<String, Package> map;
        synchronized (packages) {
            map = new HashMap<>(packages);
        }
        return map.values().toArray(new Package[map.size()]);
    }
168752
@Override
	public Launcher build() {
		LauncherImpl launcher = new LauncherImpl();
		launcher.setNativeFastCheck(nativeFastCheck);
		launcher.setPrintDebugCommandline(printDebugCommandline);
		launcher.setUseDaemonThreads(useDaemonThreads);
		return launcher;
	}