本文整理汇总了Java中org.ini4j.Profile.Section.add方法的典型用法代码示例。如果您正苦于以下问题:Java Section.add方法的具体用法?Java Section.add怎么用?Java Section.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ini4j.Profile.Section
的用法示例。
在下文中一共展示了Section.add方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createHandleManagerDeployCfg
import org.ini4j.Profile.Section; //导入方法依赖的package包/类
private File createHandleManagerDeployCfg(
final AuthToken shockAdminToken,
final String allowedUser,
final URL authServiceURL)
throws IOException {
final File iniFile = tempDir.resolve("handleManager.cfg").toFile();
if (iniFile.exists()) {
iniFile.delete();
}
final Ini ini = new Ini();
final Section hm = ini.add("HandleMngr");
hm.add("handle-service-url", "http://localhost:" + handleServicePort);
hm.add("service-host", "localhost");
hm.add("service-port", "" + handleManagerPort);
hm.add("auth-service-url", authServiceURL.toString());
hm.add("admin-token", shockAdminToken.getToken());
hm.add("allowed-users", allowedUser);
ini.store(iniFile);
return iniFile;
}
示例2: createHandleServiceDeployCfg
import org.ini4j.Profile.Section; //导入方法依赖的package包/类
private File createHandleServiceDeployCfg(
final MySQLController mysql,
final String shockHost,
final URL authServiceURL) throws IOException {
final File iniFile = tempDir.resolve("handleService.cfg").toFile();
if (iniFile.exists()) {
iniFile.delete();
}
final Ini ini = new Ini();
final Section hs = ini.add(HANDLE_SERVICE_NAME);
hs.add("self-url", "http://localhost:" + handleServicePort);
hs.add("service-port", "" + handleServicePort);
hs.add("service-host", "localhost");
hs.add("auth-service-url", authServiceURL.toString());
hs.add("default-shock-server", shockHost);
hs.add("mysql-host", "127.0.0.1");
hs.add("mysql-port", "" + mysql.getServerPort());
hs.add("mysql-user", USER);
hs.add("mysql-pass", PWD);
hs.add("data-source", "dbi:mysql:" + DB);
ini.store(iniFile);
return iniFile;
}
示例3: createServer
import org.ini4j.Profile.Section; //导入方法依赖的package包/类
private static DocServer createServer(String serverName, String serverDocs)
throws IOException, NoSuchFieldException, IllegalAccessException,
InterruptedException {
File iniFile = File.createTempFile("test", ".cfg",
new File(TestCommon.getTempDir()));
Ini ini = new Ini();
Section ws = ini.add("Workspace");
if (serverName != null) {
ws.add("doc-server-name", serverName);
}
if (serverDocs != null) {
ws.add("doc-server-docs-location", serverDocs);
}
ini.store(iniFile);
iniFile.deleteOnExit();
System.out.println("Created temporary config file: " +
iniFile.getAbsolutePath());
//set up env
Map<String, String> env = TestCommon.getenv();
env.put("KB_DEPLOYMENT_CONFIG", iniFile.getAbsolutePath());
env.put("KB_SERVICE_NAME", "Workspace");
DocServer serv = new DocServer();
new ServerThread(serv).start();
while (serv.getServerPort() == null) {
Thread.sleep(1000);
}
return serv;
}
示例4: startupWorkspaceServer
import org.ini4j.Profile.Section; //导入方法依赖的package包/类
private static WorkspaceServer startupWorkspaceServer(
final String mongohost,
final DB db,
final String typedb)
throws InvalidHostException, UnknownHostException, IOException,
NoSuchFieldException, IllegalAccessException, Exception,
InterruptedException {
WorkspaceTestCommon.initializeGridFSWorkspaceDB(db, typedb);
//write the server config file:
File iniFile = File.createTempFile("test", ".cfg",
new File(TestCommon.getTempDir()));
if (iniFile.exists()) {
iniFile.delete();
}
System.out.println("Created temporary config file: " + iniFile.getAbsolutePath());
Ini ini = new Ini();
Section ws = ini.add("Workspace");
ws.add("mongodb-host", mongohost);
ws.add("mongodb-database", db.getName());
ws.add("auth-service-url", TestCommon.getAuthUrl());
ws.add("auth-service-url-allow-insecure", "true");
ws.add("globus-url", TestCommon.getGlobusUrl());
ws.add("backend-secret", "foo");
ws.add("ws-admin", USER2);
ws.add("temp-dir", Paths.get(TestCommon.getTempDir())
.resolve("tempForJSONRPCLayerTester"));
ws.add("ignore-handle-service", "true");
ini.store(iniFile);
iniFile.deleteOnExit();
//set up env
Map<String, String> env = TestCommon.getenv();
env.put("KB_DEPLOYMENT_CONFIG", iniFile.getAbsolutePath());
env.put("KB_SERVICE_NAME", "Workspace");
WorkspaceServer.clearConfigForTests();
InitWorkspaceServer.setMaximumUniqueIdCountForTests(
MAX_UNIQUE_IDS_PER_CALL);
WorkspaceServer server = new WorkspaceServer();
//as of 3/10/14 out of 64 objects this would force 15 to be written as temp files
server.setResourceUsageConfiguration(
new ResourceUsageConfigurationBuilder(
server.getWorkspaceResourceUsageConfig())
.withMaxIncomingDataMemoryUsage(24)
.withMaxReturnedDataMemoryUsage(24).build());
TFMS.add(server.getTempFilesManager());
new ServerThread(server).start();
System.out.println("Main thread waiting for server to start up");
while (server.getServerPort() == null) {
Thread.sleep(1000);
}
return server;
}
示例5: startupWorkspaceServer
import org.ini4j.Profile.Section; //导入方法依赖的package包/类
private static WorkspaceServer startupWorkspaceServer(
String mongohost,
DB db,
String typedb,
AuthToken handleToken)
throws InvalidHostException, UnknownHostException, IOException,
NoSuchFieldException, IllegalAccessException, Exception,
InterruptedException {
WorkspaceTestCommon.initializeGridFSWorkspaceDB(db, typedb);
//write the server config file:
File iniFile = File.createTempFile("test", ".cfg",
new File(TestCommon.getTempDir()));
if (iniFile.exists()) {
iniFile.delete();
}
System.out.println("Created temporary config file: " +
iniFile.getAbsolutePath());
Ini ini = new Ini();
Section ws = ini.add("Workspace");
ws.add("mongodb-host", mongohost);
ws.add("mongodb-database", db.getName());
ws.add("backend-secret", "foo");
ws.add("auth-service-url", TestCommon.getAuthUrl());
ws.add("globus-url", TestCommon.getGlobusUrl());
ws.add("handle-service-url", "http://localhost:" +
HANDLE.getHandleServerPort());
ws.add("handle-manager-url", "http://localhost:" +
HANDLE.getHandleManagerPort());
ws.add("ws-admin", USER2);
ws.add("handle-manager-token", handleToken.getToken());
ws.add("temp-dir", Paths.get(TestCommon.getTempDir())
.resolve("tempForJSONRPCLayerTester"));
ini.store(iniFile);
iniFile.deleteOnExit();
//set up env
Map<String, String> env = TestCommon.getenv();
env.put("KB_DEPLOYMENT_CONFIG", iniFile.getAbsolutePath());
env.put("KB_SERVICE_NAME", "Workspace");
WorkspaceServer.clearConfigForTests();
WorkspaceServer server = new WorkspaceServer();
new JSONRPCLayerTester.ServerThread(server).start();
System.out.println("Main thread waiting for server to start up");
while (server.getServerPort() == null) {
Thread.sleep(1000);
}
return server;
}
示例6: startupWorkspaceServer
import org.ini4j.Profile.Section; //导入方法依赖的package包/类
private static WorkspaceServer startupWorkspaceServer(
final String mongohost,
final DB db,
final String typedb)
throws Exception {
WorkspaceTestCommon.initializeGridFSWorkspaceDB(db, typedb);
//write the server config file:
File iniFile = File.createTempFile("test", ".cfg",
new File(TestCommon.getTempDir()));
if (iniFile.exists()) {
iniFile.delete();
}
System.out.println("Created temporary config file: " +
iniFile.getAbsolutePath());
Ini ini = new Ini();
Section ws = ini.add("Workspace");
ws.add("mongodb-host", mongohost);
ws.add("mongodb-database", db.getName());
ws.add("auth-service-url", TestCommon.getAuthUrl());
ws.add("globus-url", TestCommon.getGlobusUrl());
ws.add("backend-secret", "foo");
ws.add("ws-admin", USER2);
ws.add("temp-dir", Paths.get(TestCommon.getTempDir())
.resolve("tempForLoggingTest"));
ws.add("ignore-handle-service", "true");
ini.store(iniFile);
iniFile.deleteOnExit();
//set up env
Map<String, String> env = TestCommon.getenv();
env.put("KB_DEPLOYMENT_CONFIG", iniFile.getAbsolutePath());
env.put("KB_SERVICE_NAME", "Workspace");
WorkspaceServer.clearConfigForTests();
WorkspaceServer server = new WorkspaceServer();
new ServerThread(server).start();
System.out.println("Main thread waiting for server to start up");
while (server.getServerPort() == null) {
Thread.sleep(1000);
}
return server;
}
示例7: saveConfig
import org.ini4j.Profile.Section; //导入方法依赖的package包/类
/**
* @param iniFile
* INI file where save configuration
*/
public void saveConfig(final File iniFile)
{
final Wini ini = new Wini();
ini.getConfig().setFileEncoding(Charset.forName("CP1252"));
try
{
final Section generalSection = ini.add("GENERAL");
generalSection.add("output", output.get());
final List<String> inputs = new ArrayList<>();
for (final InputRequirementSource requirementSource : requirementSources)
{
final String name = requirementSource.getName();
inputs.add(name);
final Section sourceSection = ini.add(name);
sourceSection.put("plugin", requirementSource.getProvider().getClass().getName());
requirementSource.getProvider().saveSourceConfiguration(requirementSource.getConfiguration(),
sourceSection);
sourceSection.put("covers", requirementSource.getCovers()
.stream()
.map(InputRequirementSource::getName)
.collect(Collectors.joining(",")));
}
generalSection.put("inputs", inputs.stream().collect(Collectors.joining(",")));
ini.store(iniFile);
config = iniFile;
}
catch (final IOException e)
{
LOGGER.log(Level.SEVERE, "Invalid config file " + iniFile, e);
// TODO show error as dialog or dimmer panel
}
}