@Test
  public void wrapperSystemPropertiesOverride() throws Exception {
    Properties backup = new Properties();
    backup.putAll(System.getProperties());

    // test setup
    Map<String, String> testProps = Maps.newHashMap();
    testProps.put(JSWConfig.WRAPPER_JAVA_COMMAND, "/my/custom/java");
    testProps.put("nonwrapper.prop", "special");
    testProps.put("wrapper.prop", "something");
    System.getProperties().putAll(testProps);

    // load and then save capture system properties
    jswConfig.load();
    jswConfig.save();

    // check that overridden properties are written
    assertThat(config, contains("#  system overrides"));

    assertThat(config, contains("wrapper.java.command=/my/custom/java"));

    assertThat(config, contains("wrapper.prop=something"));

    assertThat(config, doesNotContain("nonwrapper.prop=special"));

    // reset system properties
    System.setProperties(backup);
  }
  @Test
  public void wrapperCommentsPerTypeOfOverride() throws Exception {

    // backup system properties
    Properties backup = new Properties();
    backup.putAll(System.getProperties());

    // setup sys props
    Map<String, String> testProps = Maps.newHashMap();
    testProps.put("wrapper.system.prop", "bar");
    System.getProperties().putAll(testProps);

    jswConfig.load(); // loads system properties

    // set an explicit property as well
    jswConfig.setProperty("wrapper.explicit.prop", "baz");

    // save again to write out config with system properties
    jswConfig.save();

    // check that overridden properties are written
    assertThat(config, contains("#  system overrides"));

    assertThat(config, contains("#  explicit overrides"));

    assertThat(config, contains("wrapper.explicit.prop=baz"));

    assertThat(config, contains("wrapper.system.prop=bar"));

    // reset system properties
    System.setProperties(backup);
  }
  /**
   * Creates a new Socket connected to the given IP address. The method uses connection settings
   * supplied in the constructor for connecting the socket.
   *
   * @param address the IP address to connect to
   * @return connected socket
   * @throws java.net.UnknownHostException if the hostname of the address or the proxy cannot be
   *     resolved
   * @throws java.io.IOException if an I/O error occured while connecting to the remote end or to
   *     the proxy
   */
  private Socket createSocket(InetSocketAddress address, int timeout) throws IOException {
    String socksProxyHost = System.getProperty("socksProxyHost");
    System.getProperties().remove("socksProxyHost");
    try {
      ConnectivitySettings cs = lastKnownSettings.get(address);
      if (cs != null) {
        try {
          return createSocket(cs, address, timeout);
        } catch (IOException e) {
          // not good anymore, try all proxies
          lastKnownSettings.remove(address);
        }
      }

      URI uri = addressToURI(address, "socket");
      try {
        return createSocket(uri, address, timeout);
      } catch (IOException e) {
        // we will also try https
      }

      uri = addressToURI(address, "https");
      return createSocket(uri, address, timeout);

    } finally {
      if (socksProxyHost != null) {
        System.setProperty("socksProxyHost", socksProxyHost);
      }
    }
  }
예제 #4
1
  private File() {
    Properties properties = System.getProperties();

    line = properties.getProperty("line.separator");
    encoding = properties.getProperty("file.encoding");
    separator = properties.getProperty("file.separator");
  }
예제 #5
0
    private void configureProperties(final MavenExecutionRequest request) {
      assert request != null;
      assert config != null;

      Properties sys = new Properties();
      sys.putAll(System.getProperties());

      Properties user = new Properties();
      user.putAll(config.getProperties());

      // Add the env vars to the property set, with the "env." prefix
      boolean caseSensitive = !Os.isFamily(Os.FAMILY_WINDOWS);
      for (Map.Entry<String, String> entry : System.getenv().entrySet()) {
        String key =
            "env." + (caseSensitive ? entry.getKey() : entry.getKey().toUpperCase(Locale.ENGLISH));
        sys.setProperty(key, entry.getValue());
      }

      request.setUserProperties(user);

      // HACK: Some bits of Maven still require using System.properties :-(
      sys.putAll(user);
      System.getProperties().putAll(user);

      request.setSystemProperties(sys);
    }
 @Test
 public void prototypeCreationIsFastEnough() {
   if (factoryLog.isTraceEnabled() || factoryLog.isDebugEnabled()) {
     // Skip this test: Trace logging blows the time limit.
     return;
   }
   GenericApplicationContext ac = new GenericApplicationContext();
   RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class);
   rbd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE);
   rbd.getConstructorArgumentValues().addGenericArgumentValue("#{systemProperties.name}");
   rbd.getPropertyValues().add("country", "#{systemProperties.country}");
   ac.registerBeanDefinition("test", rbd);
   ac.refresh();
   StopWatch sw = new StopWatch();
   sw.start("prototype");
   System.getProperties().put("name", "juergen");
   System.getProperties().put("country", "UK");
   try {
     for (int i = 0; i < 100000; i++) {
       TestBean tb = (TestBean) ac.getBean("test");
       assertEquals("juergen", tb.getName());
       assertEquals("UK", tb.getCountry());
     }
     sw.stop();
   } finally {
     System.getProperties().remove("country");
     System.getProperties().remove("name");
   }
   assertTrue(
       "Prototype creation took too long: " + sw.getTotalTimeMillis(),
       sw.getTotalTimeMillis() < 6000);
 }
예제 #7
0
  @Test
  public void testEnglishAutoLoad() throws Exception {
    String oldModelCache =
        System.setProperty(ResourceObjectProviderBase.PROP_REPO_CACHE, "target/test-output/models");
    String oldOfflineMode =
        System.setProperty(
            ResourceObjectProviderBase.PROP_REPO_OFFLINE,
            ResourceObjectProviderBase.FORCE_AUTO_LOAD);

    try {
      TestRunner.autoloadModelsOnNextTestRun();
      runTest(
          "en",
          null,
          "This is a test .",
          new String[] {"DT", "VBZ", "DT", "NN", "."},
          new String[] {"ART", "V", "ART", "NN", "PUNC"});
    } finally {
      if (oldModelCache != null) {
        System.setProperty(ResourceObjectProviderBase.PROP_REPO_CACHE, oldModelCache);
      } else {
        System.getProperties().remove(ResourceObjectProviderBase.PROP_REPO_CACHE);
      }
      if (oldOfflineMode != null) {
        System.setProperty(ResourceObjectProviderBase.PROP_REPO_OFFLINE, oldOfflineMode);
      } else {
        System.getProperties().remove(ResourceObjectProviderBase.PROP_REPO_OFFLINE);
      }
    }
  }
예제 #8
0
파일: LocalOozie.java 프로젝트: rvs/oozie
  /**
   * Start LocalOozie.
   *
   * @throws Exception if LocalOozie could not be started.
   */
  public static synchronized void start() throws Exception {
    if (localOozieActive) {
      throw new IllegalStateException("LocalOozie is already initialized");
    }

    String log4jFile = System.getProperty(XLogService.LOG4J_FILE_ENV, null);
    String oozieLocalLog = System.getProperty("oozielocal.log", null);
    if (log4jFile == null) {
      System.setProperty(XLogService.LOG4J_FILE_ENV, "localoozie-log4j.properties");
    }
    if (oozieLocalLog == null) {
      System.setProperty("oozielocal.log", "./oozielocal.log");
    }

    localOozieActive = true;
    new Services().init();

    if (log4jFile != null) {
      System.setProperty(XLogService.LOG4J_FILE_ENV, log4jFile);
    } else {
      System.getProperties().remove(XLogService.LOG4J_FILE_ENV);
    }
    if (oozieLocalLog != null) {
      System.setProperty("oozielocal.log", oozieLocalLog);
    } else {
      System.getProperties().remove("oozielocal.log");
    }

    container = new EmbeddedServletContainer("oozie");
    container.addServletEndpoint("/callback", CallbackServlet.class);
    container.start();
    String callbackUrl = container.getServletURL("/callback");
    Services.get().getConf().set(CallbackService.CONF_BASE_URL, callbackUrl);
    XLog.getLog(LocalOozie.class).info("LocalOozie started callback set to [{0}]", callbackUrl);
  }
  @Test
  public void testDynamicLimitDefault() throws Exception {
    final String limitProp = "det.dataservice.dynamic.limit";
    final int defaultLimit = 50000;
    boolean userDef = dataService.isUserDefined();
    try {
      System.getProperties().remove(limitProp);
      dataService.setUserDefined(false);
      DataServiceExecutor executor =
          new DataServiceExecutor.Builder(
                  new SQL("SELECT * FROM " + DATA_SERVICE_NAME), dataService, context)
              .serviceTrans(serviceTrans)
              .genTrans(genTrans)
              .build();
      assertEquals(defaultLimit, executor.getServiceRowLimit());

      System.setProperty(limitProp, "baah");
      executor =
          new DataServiceExecutor.Builder(
                  new SQL("SELECT * FROM " + DATA_SERVICE_NAME), dataService, context)
              .serviceTrans(serviceTrans)
              .genTrans(genTrans)
              .build();
      assertEquals(defaultLimit, executor.getServiceRowLimit());
      verify(logChannel).logError(anyString());
    } finally {
      dataService.setUserDefined(userDef);
      System.getProperties().remove(limitProp);
    }
  }
  public void setActive(boolean b) {
    // the function is called 3 times when leaving this perspective this odd
    // logic is here so it doesn't reload the data when leaving this perspective
    if (b) {
      if (!this.isActive) {
        System.out.println("create eclResults setActive");
        if (System.getProperties().getProperty("resultsFile") != null
            && !System.getProperties().getProperty("resultsFile").equals("")) {
          String xmlFile = System.getProperties().getProperty("resultsFile");
          ArrayList<String> resultFiles = parseData("resultsFile");
          for (int i = 0; i < resultFiles.size(); i++) {
            openResultsXML(resultFiles.get(i));
          }
          // openResultsXML(xmlFile);
          System.getProperties().setProperty("resultsFile", "");
        }
        int len = folder.getItemCount();
        folder.setSelection(len - 1);
        this.isActive = true;
      } else {
        this.isActive = false;
      }

    } else {
      System.out.println("create eclResults setActive -- deactivate");
    }
  }
예제 #11
0
  public static ApplicationConfiguration readConfiguration(final String... resources) {
    if (resources == null) return new ApplicationConfiguration(ImmutableMap.of());

    final HashMap<String, String> result = new HashMap<>();

    for (String resource : resources) {

      if (StringTools.isNullOrEmpty(resource)) continue;

      // Read anything from an external config file or resource
      if (FileTools.fileExistsAndCanRead(resource)) {
        mergeConfigMaps(readConfigFileLines(resource), result);
      } else {
        mergeConfigMaps(ResourceTools.readResourceTextFileAsMap(resource), result);
      }
    }

    // Check for system properties/envs for overrides
    // for the known configuration options and apply them
    // as overrides

    final Map<String, String> environmentMatches =
        MapTools.intersectKeysCaseInsensitive(result, System.getenv());

    for (Map.Entry<String, String> matchEntry : environmentMatches.entrySet()) {
      final String envOverride = System.getenv().get(matchEntry.getValue());

      if (!StringTools.isNullOrEmpty(envOverride)) {
        result.put(matchEntry.getKey(), envOverride);
      }
    }

    // Ultimately - command-line properties override everything

    final Map<String, Object> propertiesMatches =
        MapTools.intersectKeys(
            result,
            System.getProperties(),
            String::toLowerCase,
            key -> {
              if (key instanceof String) {
                return ((String) key).toLowerCase();
              } else {
                // Do not support non-string matching
                return UUID.randomUUID().toString();
              }
            });

    for (Map.Entry<String, Object> matchEntry : propertiesMatches.entrySet()) {
      final Object propertiesOverride = System.getProperties().get(matchEntry.getValue());

      if (propertiesOverride instanceof String
          && !StringTools.isNullOrEmpty((String) propertiesOverride)) {
        result.put(matchEntry.getKey(), (String) propertiesOverride);
      }
    }

    return new ApplicationConfiguration(ImmutableMap.copyOf(result));
  }
예제 #12
0
 public Object watch(Map<String, Object> params) {
   String key = (String) params.get(Constants.KEY);
   if (key == null) {
     return toMap(System.getProperties());
   } else {
     return System.getProperties().get(key);
   }
 }
  @Test
  public void testOnClassLoadAndUnload() throws Exception {
    ScriptManager sm = new ScriptManager();
    sm.setGlobalClassListener(new OnClassLoadUnloadListener());
    sm.loadDirectory(new File(FILE_TEST_DATA_DIR));
    assertEquals(System.getProperties().containsKey(SYSTEM_PROPERTY_KEY_CLASS_LOADED), true);

    sm.shutdown();
    assertEquals(System.getProperties().containsKey(SYSTEM_PROPERTY_KEY_CLASS_UNLOADED), true);
  }
예제 #14
0
  /**
   * Sets the Logfile
   *
   * @param aLogFile The logFile to set. *
   * @return The logfile to write into
   */
  public static synchronized PrintWriter setLogFile(PrintWriter aLogFile) {
    System.getProperties().put(IZPACK_LOGFILE, aLogFile);

    PrintWriter logfile = (PrintWriter) System.getProperties().get(IZPACK_LOGFILE);

    if (logfile == null) {
      System.err.println("Set::logfile == null");
    }

    return logfile;
  }
예제 #15
0
  @Test
  public void testDefault() {
    final SystemProperties props = SystemProperties.getDefault();

    final String propKey = System.getProperties().keySet().iterator().next().toString();
    final String propValue = System.getProperties().getProperty(propKey);
    assertEquals(propValue, props.get(propKey));

    final String envKey = System.getenv().keySet().iterator().next();
    final String envValue = System.getenv(envKey);
    assertEquals(envValue, props.getEnv(envKey));
  }
예제 #16
0
 /**
  * Returns a new Session object that is appropriate for the given context.
  *
  * @param contextString the message context
  * @return a new <code>javax.mail.Session</code> value
  */
 protected javax.mail.Session newSessionForContext(String contextString) {
   javax.mail.Session session;
   if (contextString == null || contextString.length() == 0) {
     session = newSessionForContext(System.getProperties(), contextString);
   } else {
     Properties sessionProperties = new Properties();
     sessionProperties.putAll(System.getProperties());
     setupSmtpProperties(sessionProperties, contextString);
     session = newSessionForContext(sessionProperties, contextString);
   }
   return session;
 }
예제 #17
0
 private WrappedDataSource createLocal() {
   localDataSource = (DataSource) System.getProperties().get(LOCAL_DB_NAME);
   if (localDataSource == null) {
     localDataSource = new EmbeddedDataSource();
     ((EmbeddedDataSource) localDataSource).setDatabaseName(LOCAL_DB_NAME);
     ((EmbeddedDataSource) localDataSource).setCreateDatabase(LOCAL_DB_ACTION);
     System.getProperties().put(LOCAL_DB_NAME, localDataSource);
   }
   logger.warn(EMBEDDED_DATA_SOURCE_IS_USED);
   WrappedDataSource wrappedDataSource = new WrappedDataSource(localDataSource);
   return wrappedDataSource;
 }
  private void prepareProperties(PersistenceParser parser) {
    final Enumeration<?> e = System.getProperties().propertyNames();

    while (e.hasMoreElements()) {
      final Object key = e.nextElement();
      if (key instanceof String) {
        this.properties.put((String) key, System.getProperties().get(key));
      }
    }

    this.properties.putAll(parser.getProperties());
  }
예제 #19
0
 static {
   // Read host and port from environment variable
   // Maven's surefire plugin set it to the string 'null'
   String mongoHostName = System.getenv("MONGODB_HOSTNAME");
   if (isNotNull(mongoHostName)) {
     System.getProperties().setProperty(OgmProperties.HOST, mongoHostName);
   }
   String mongoPort = System.getenv("MONGODB_PORT");
   if (isNotNull(mongoPort)) {
     System.getProperties().setProperty(OgmProperties.PORT, mongoPort);
   }
 }
 public String toString() {
   String outputString = "";
   return super.toString()
       + "["
       + "id"
       + ":"
       + getId()
       + ","
       + "description"
       + ":"
       + getDescription()
       + ","
       + "other_details"
       + ":"
       + getOther_details()
       + "]"
       + System.getProperties().getProperty("line.separator")
       + "  "
       + "date"
       + "="
       + (getDate() != null
           ? !getDate().equals(this) ? getDate().toString().replaceAll("  ", "    ") : "this"
           : "null")
       + System.getProperties().getProperty("line.separator")
       + "  "
       + "time"
       + "="
       + (getTime() != null
           ? !getTime().equals(this) ? getTime().toString().replaceAll("  ", "    ") : "this"
           : "null")
       + System.getProperties().getProperty("line.separator")
       + "  "
       + "employee = "
       + (getEmployee() != null
           ? Integer.toHexString(System.identityHashCode(getEmployee()))
           : "null")
       + System.getProperties().getProperty("line.separator")
       + "  "
       + "accidentType = "
       + (getAccidentType() != null
           ? Integer.toHexString(System.identityHashCode(getAccidentType()))
           : "null")
       + System.getProperties().getProperty("line.separator")
       + "  "
       + "seriousnessLevel = "
       + (getSeriousnessLevel() != null
           ? Integer.toHexString(System.identityHashCode(getSeriousnessLevel()))
           : "null")
       + outputString;
 }
예제 #21
0
 /**
  * Checks whether the agent is available
  *
  * @return true if available
  */
 static boolean agentIsAvailable() {
   try {
     if (instrumentation == null) {
       instrumentation =
           (Instrumentation)
               System.getProperties().get(INSTRUMENTATION_INSTANCE_SYSTEM_PROPERTY_NAME);
     }
     if (instrumentation == null) {
       Class sizeOfAgentClass =
           ClassLoader.getSystemClassLoader().loadClass(SIZEOF_AGENT_CLASSNAME);
       Method getInstrumentationMethod = sizeOfAgentClass.getMethod("getInstrumentation");
       instrumentation = (Instrumentation) getInstrumentationMethod.invoke(sizeOfAgentClass);
     }
     return instrumentation != null;
   } catch (SecurityException e) {
     LOGGER.warn(
         "Couldn't access the system classloader because of the security policies applied by "
             + "the security manager. You either want to loosen these, so ClassLoader.getSystemClassLoader() and "
             + "reflection API calls are permitted or the sizing will be done using some other mechanism.\n"
             + "Alternatively, set the system property net.sf.ehcache.sizeof.agent.instrumentationSystemProperty to true "
             + "to have the agent put the required instances in the System Properties for the loader to access.");
     return false;
   } catch (Throwable e) {
     return false;
   }
 }
  @Override
  public final void runBare() throws Throwable {
    // Patch a bug with maven that does not pass properly the system property
    // with an empty value
    if ("org.hsqldb.jdbcDriver".equals(System.getProperty("gatein.test.datasource.driver"))) {
      System.setProperty("gatein.test.datasource.password", "");
    }

    //
    log.info("Running unit test:" + getName());
    for (Map.Entry<?, ?> entry : System.getProperties().entrySet()) {
      if (entry.getKey() instanceof String) {
        String key = (String) entry.getKey();
        log.debug(key + "=" + entry.getValue());
      }
    }

    //
    beforeRunBare();

    //
    try {
      super.runBare();
      log.info("Unit test " + getName() + " completed");
    } catch (Throwable throwable) {
      log.error("Unit test " + getName() + " did not complete", throwable);

      //
      throw throwable;
    } finally {
      afterRunBare();
    }
  }
예제 #23
0
 public static Instrumentation getInstrumentation() {
   try {
     return (Instrumentation) System.getProperties().get(INSTRUMENTATION_KEY);
   } catch (Exception e) {
     throw new IllegalStateException("The agent is not properly initialized", e);
   }
 }
예제 #24
0
  public static boolean sendEmail(String from, String to, String subject, String message) {
    // create a new authenticator for the SMTP server
    EmailUtilsAuthenticator authenticator = new EmailUtilsAuthenticator();

    // Get system properties
    Properties properties = System.getProperties();

    // Setup mail server
    properties.setProperty(MAIL_SMTP_HOST, Configuration.getSmtpHost());
    // setup the authentication
    properties.setProperty(MAIL_SMTP_AUTH, "true");

    // Get the Session object with the authenticator.
    Session session = Session.getInstance(properties, authenticator);

    try {
      MimeMessage mime = new MimeMessage(session);
      mime.setFrom(new InternetAddress(from));
      mime.addRecipient(Message.RecipientType.TO, new InternetAddress(to));

      mime.setSubject(subject);
      mime.setText(message);

      // Send it
      Transport.send(mime);

      return true;

    } catch (MessagingException mex) {
      logger.error("sendEmail(String, String, String, String) - exception ", mex);
      return false;
    }
  }
예제 #25
0
  public static void main(String[] args) {
    java.util.Properties props = new Properties();
    props.putAll(System.getProperties());
    props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
    props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton");

    int status = 0;
    ORB orb = null;

    try {
      orb = ORB.init(args, props);
      status = run(orb, false, args);
    } catch (Exception ex) {
      ex.printStackTrace();
      status = 1;
    }

    if (orb != null) {
      try {
        orb.destroy();
      } catch (Exception ex) {
        ex.printStackTrace();
        status = 1;
      }
    }

    System.exit(status);
  }
  /** Tests select(URI) HTTS */
  @Test
  public void testSelect_HTTPS() throws UnknownHostException {
    System.getProperties().put(HTTPS_PROXY_HOST, "127.0.0.1");
    System.getProperties().put(HTTPS_PROXY_PORT, "8888");

    JaxWsProxySelector ps = new JaxWsProxySelector(ProxySelector.getDefault());
    ProxySelector.setDefault(ps);

    List<Proxy> list = ps.select(testHttpsUri);
    assertEquals(
        list.get(0),
        new Proxy(Type.HTTP, new InetSocketAddress(InetAddress.getByName("127.0.0.1"), 8888)));

    System.getProperties().remove(HTTPS_PROXY_HOST);
    System.getProperties().remove(HTTPS_PROXY_PORT);
  }
예제 #27
0
 // ---------------------------------------------------- Overall Test Methods
 // Set up instance variables required by this test case.
 @Override
 public void setUp() throws Exception {
   super.setUp();
   for (int i = 0, len = FactoryFinderTestCase2.FACTORIES.length; i < len; i++) {
     System.getProperties().remove(FactoryFinderTestCase2.FACTORIES[i][0]);
   }
 }
예제 #28
0
  /**
   * 返回服务系统信息
   *
   * @throws Exception
   */
  public static ServerStatus getServerStatus() throws Exception {
    ServerStatus status = new ServerStatus();
    status.setServerTime(DateFormatUtils.format(Calendar.getInstance(), "yyyy-MM-dd HH:mm:ss"));
    status.setServerName(System.getenv().get("COMPUTERNAME"));

    Runtime rt = Runtime.getRuntime();
    // status.setIp(InetAddress.getLocalHost().getHostAddress());
    status.setJvmTotalMem(rt.totalMemory() / (1024 * 1024));
    status.setJvmFreeMem(rt.freeMemory() / (1024 * 1024));
    status.setJvmMaxMem(rt.maxMemory() / (1024 * 1024));
    Properties props = System.getProperties();
    status.setServerOs(
        props.getProperty("os.name")
            + " "
            + props.getProperty("os.arch")
            + " "
            + props.getProperty("os.version"));
    status.setJavaHome(props.getProperty("java.home"));
    status.setJavaVersion(props.getProperty("java.version"));
    status.setJavaTmpPath(props.getProperty("java.io.tmpdir"));

    Sigar sigar = new Sigar();
    getServerCpuInfo(sigar, status);
    getServerDiskInfo(sigar, status);
    getServerMemoryInfo(sigar, status);

    return status;
  }
예제 #29
0
  /** @param args */
  public static void main(String[] args) {
    Properties props = new Properties(System.getProperties());
    props.setProperty("java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory");
    props.setProperty("java.naming.security.authentication", "simple");
    //		props.setProperty( "java.naming.provider.url", "ldap://bowmore.dev.ksi.co.jp:50389/" );
    //		props.setProperty( "java.naming.security.principal", "cn=Directory Manager" );
    //		props.setProperty( "java.naming.security.credentials", "amAdmin25" );
    props.setProperty("java.naming.provider.url", "ldap://fscs1.ap.ksi.co.jp/");
    //		props.setProperty( "java.naming.security.principal", "cn=Directory Manager" );
    //		props.setProperty( "java.naming.security.credentials", "amAdmin25" );
    String base = "OU=User,OU=Account,DC=oa,DC=ksi,DC=co,DC=jp";

    String searchText = "(objectClass=*)";
    int scope = LdapManager.ONELEVEL_SCOPE;
    LdapManager ldap = new LdapManager();
    try {
      ldap = new LdapManager(props);
      System.out.println("baseDN=" + ldap.getBaseDN());
      ldap.searchEntry(base, searchText, scope);
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      ldap.close();
    }
  }
예제 #30
0
파일: PropUtil.java 프로젝트: swxx/Pioneer
 public static String getString(String key) {
   if (prop == null) {
     prop = System.getProperties();
     load();
   }
   return prop.getProperty(key);
 }