当前位置: 首页>>代码示例>>Java>>正文


Java SystemProperties类代码示例

本文整理汇总了Java中com.helger.commons.system.SystemProperties的典型用法代码示例。如果您正苦于以下问题:Java SystemProperties类的具体用法?Java SystemProperties怎么用?Java SystemProperties使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SystemProperties类属于com.helger.commons.system包,在下文中一共展示了SystemProperties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setJavaCommonComponentsDebugMode

import com.helger.commons.system.SystemProperties; //导入依赖的package包/类
/**
 * Set the debug mode for the common Java components:
 * <ul>
 * <li>JAXP</li>
 * <li>Javax Activation</li>
 * <li>Javax Mail</li>
 * </ul>
 *
 * @param bDebugMode
 *        <code>true</code> to enable debug mode, <code>false</code> to
 *        disable it
 */
public static void setJavaCommonComponentsDebugMode (final boolean bDebugMode)
{
  // Set JAXP debugging!
  // Note: this property is read-only on Ubuntu, defined by the following
  // policy file: /etc/tomcat6/policy.d/04webapps.policy
  SystemProperties.setPropertyValue (SYSTEM_PROPERTY_JAXP_DEBUG, bDebugMode);

  // Set javax.activation debugging
  SystemProperties.setPropertyValue (SYSTEM_PROPERTY_JAVAX_ACTIVATION_DEBUG, bDebugMode);

  // Set javax.mail debugging
  SystemProperties.setPropertyValue (SYSTEM_PROPERTY_MAIL_DEBUG, bDebugMode);

  // Set serialization debugging
  SystemProperties.setPropertyValue (SYSTEM_PROPERTY_SERIALIZATION_DEBUG, bDebugMode);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:29,代码来源:GlobalDebug.java

示例2: enableSoapLogging

import com.helger.commons.system.SystemProperties; //导入依赖的package包/类
/**
 * Enable the JAX-WS SOAP debugging. This shows the exchanged SOAP messages in
 * the log file. By default this logging is disabled.
 *
 * @param bServerDebug
 *        <code>true</code> to enable server debugging, <code>false</code> to
 *        disable it.
 * @param bClientDebug
 *        <code>true</code> to enable client debugging, <code>false</code> to
 *        disable it.
 */
public static void enableSoapLogging (final boolean bServerDebug, final boolean bClientDebug)
{
  // Server debug mode
  String sDebug = Boolean.toString (bServerDebug);
  SystemProperties.setPropertyValue ("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", sDebug);
  SystemProperties.setPropertyValue ("com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump", sDebug);

  // Client debug mode
  sDebug = Boolean.toString (bClientDebug);
  SystemProperties.setPropertyValue ("com.sun.xml.ws.transport.http.HttpTransportPipe.dump", sDebug);
  SystemProperties.setPropertyValue ("com.sun.xml.internal.ws.transport.http.HttpTransportPipe.dump", sDebug);

  // Enlarge dump size
  if (bServerDebug || bClientDebug)
  {
    final String sValue = Integer.toString (2 * CGlobal.BYTES_PER_MEGABYTE);
    SystemProperties.setPropertyValue ("com.sun.xml.ws.transport.http.HttpAdapter.dumpTreshold", sValue);
    SystemProperties.setPropertyValue ("com.sun.xml.internal.ws.transport.http.HttpAdapter.dumpTreshold", sValue);
  }
  else
  {
    SystemProperties.removePropertyValue ("com.sun.xml.ws.transport.http.HttpAdapter.dumpTreshold");
    SystemProperties.removePropertyValue ("com.sun.xml.internal.ws.transport.http.HttpAdapter.dumpTreshold");
  }
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:37,代码来源:WSHelper.java

示例3: setMetroDebugSystemProperties

import com.helger.commons.system.SystemProperties; //导入依赖的package包/类
/**
 * Enable advanced JAX-WS debugging on more or less all relevant layers. This
 * method internally calls {@link #enableSoapLogging(boolean)} so it does not
 * need to be called explicitly. By default all this logging is disabled.
 *
 * @param bDebug
 *        <code>true</code> to enabled debugging, <code>false</code> to
 *        disable it.
 */
public static void setMetroDebugSystemProperties (final boolean bDebug)
{
  // Depending on the used JAX-WS version, the property names are
  // different....
  enableSoapLogging (bDebug);

  SystemProperties.setPropertyValue ("com.sun.xml.ws.transport.http.HttpAdapter.dump", Boolean.toString (bDebug));
  SystemProperties.setPropertyValue ("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump",
                                     Boolean.toString (bDebug));

  SystemProperties.setPropertyValue ("com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace",
                                     bDebug ? null : "false");

  SystemProperties.setPropertyValue ("com.sun.metro.soap.dump", Boolean.toString (bDebug));
  SystemProperties.setPropertyValue ("com.sun.xml.wss.provider.wsit.SecurityTubeFactory.dump",
                                     Boolean.toString (bDebug));
  SystemProperties.setPropertyValue ("com.sun.xml.wss.jaxws.impl.SecurityServerTube.dump", Boolean.toString (bDebug));
  SystemProperties.setPropertyValue ("com.sun.xml.wss.jaxws.impl.SecurityClientTube.dump", Boolean.toString (bDebug));
  SystemProperties.setPropertyValue ("com.sun.xml.ws.rx.rm.runtime.ClientTube.dump", Boolean.toString (bDebug));
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:30,代码来源:WSHelper.java

示例4: startNinetyServer

import com.helger.commons.system.SystemProperties; //导入依赖的package包/类
public static void startNinetyServer () throws Exception
{
  SystemProperties.setPropertyValue ("as4.server.configfile",
                                     new ClassPathResource ("test-as4-9090.properties").getAsFile ()
                                                                                       .getAbsolutePath ());
  final JettyRunner aJetty = new JettyRunner ();
  aJetty.setPort (PORT).setStopPort (STOP_PORT).setAllowAnnotationBasedConfig (false);
  aJetty.startServer ();
}
 
开发者ID:phax,项目名称:ph-as4,代码行数:10,代码来源:RunInJettyAS4TEST9090.java

示例5: applyAsSystemProperties

import com.helger.commons.system.SystemProperties; //导入依赖的package包/类
/**
 * This is a utility method, that takes the provided property names, checks if
 * they are defined in the configuration and if so, applies applies them as
 * System properties. It does it only when the configuration file was read
 * correctly.
 *
 * @param aPropertyNames
 *        The property names to consider.
 * @since 8.5.3
 */
public void applyAsSystemProperties (@Nullable final String... aPropertyNames)
{
  if (isRead () && aPropertyNames != null)
    for (final String sProperty : aPropertyNames)
    {
      final String sConfigFileValue = getAsString (sProperty);
      if (sConfigFileValue != null)
      {
        SystemProperties.setPropertyValue (sProperty, sConfigFileValue);
        s_aLogger.info ("Set Java system property from configuration: " + sProperty + "=" + sConfigFileValue);
      }
    }
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:24,代码来源:ConfigFile.java

示例6: getXMLEntityExpansionLimit

import com.helger.commons.system.SystemProperties; //导入依赖的package包/类
public static int getXMLEntityExpansionLimit ()
{
  // Default value depends.
  // JDK 1.6: 100.000
  // JDK 1.7+: 64.0000
  // Source: https://docs.oracle.com/javase/tutorial/jaxp/limits/limits.html
  String sPropertyValue = SystemProperties.getPropertyValueOrNull (SYSTEM_PROPERTY_JDX_XML_ENTITY_EXPANSION_LIMIT);
  if (sPropertyValue == null)
    sPropertyValue = SystemProperties.getPropertyValueOrNull (SYSTEM_PROPERTY_ENTITY_EXPANSION_LIMIT);
  if (sPropertyValue == null)
    return 64000;
  return Integer.parseInt (sPropertyValue);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:14,代码来源:XMLSystemProperties.java

示例7: getXMLElementAttributeLimit

import com.helger.commons.system.SystemProperties; //导入依赖的package包/类
public static int getXMLElementAttributeLimit ()
{
  // Default value depends.
  // JDK 1.7+: 10.0000
  String sPropertyValue = SystemProperties.getPropertyValueOrNull (SYSTEM_PROPERTY_JDX_XML_ELEMENT_ATTRIBUTE_LIMIT);
  if (sPropertyValue == null)
    sPropertyValue = SystemProperties.getPropertyValueOrNull (SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT);
  if (sPropertyValue == null)
    return 10000;
  return Integer.parseInt (sPropertyValue);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:12,代码来源:XMLSystemProperties.java

示例8: getXMLMaxOccur

import com.helger.commons.system.SystemProperties; //导入依赖的package包/类
public static int getXMLMaxOccur ()
{
  // Default value depends.
  // JDK 1.7+: 5.0000
  String sPropertyValue = SystemProperties.getPropertyValueOrNull (SYSTEM_PROPERTY_JDX_XML_MAX_OCCUR);
  if (sPropertyValue == null)
    sPropertyValue = SystemProperties.getPropertyValueOrNull (SYSTEM_PROPERTY_MAX_OCCUR);
  if (sPropertyValue == null)
    return 5000;
  return Integer.parseInt (sPropertyValue);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:12,代码来源:XMLSystemProperties.java

示例9: getXMLTotalEntitySizeLimit

import com.helger.commons.system.SystemProperties; //导入依赖的package包/类
public static int getXMLTotalEntitySizeLimit ()
{
  // Default value:
  // JDK 1.7.0_45: 5x10^7
  final String sPropertyValue = SystemProperties.getPropertyValueOrNull (SYSTEM_PROPERTY_JDX_XML_TOTAL_ENTITY_SIZE_LIMIT);
  if (sPropertyValue == null)
    return 5 * (int) 10e7;
  return Integer.parseInt (sPropertyValue);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:10,代码来源:XMLSystemProperties.java

示例10: getXMLMaxGeneralEntitySizeLimit

import com.helger.commons.system.SystemProperties; //导入依赖的package包/类
public static int getXMLMaxGeneralEntitySizeLimit ()
{
  // Default value:
  // JDK 1.7.0_45: 0
  final String sPropertyValue = SystemProperties.getPropertyValueOrNull (SYSTEM_PROPERTY_JDX_XML_MAX_GENERAL_ENTITY_SIZE_LIMIT);
  if (sPropertyValue == null)
    return 0;
  return Integer.parseInt (sPropertyValue);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:10,代码来源:XMLSystemProperties.java

示例11: getXMLMaxParameterEntitySizeLimit

import com.helger.commons.system.SystemProperties; //导入依赖的package包/类
public static int getXMLMaxParameterEntitySizeLimit ()
{
  // Default value:
  // JDK 1.7.0_45: 0
  final String sPropertyValue = SystemProperties.getPropertyValueOrNull (SYSTEM_PROPERTY_JDX_XML_MAX_PARAMETER_ENTITY_SIZE_LIMIT);
  if (sPropertyValue == null)
    return 0;
  return Integer.parseInt (sPropertyValue);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:10,代码来源:XMLSystemProperties.java

示例12: testReadingXML11

import com.helger.commons.system.SystemProperties; //导入依赖的package包/类
@Test
public void testReadingXML11 () throws Exception
{
  final String sFilename1 = "target/xml11test.xml";
  _generateXmlFile (sFilename1, 2500);

  // Read again
  final IMicroDocument aDoc = MicroReader.readMicroXML (new File (sFilename1));
  assertNotNull (aDoc);

  // Write again
  final String sFilename2 = "target/xml11test2.xml";
  assertTrue (MicroWriter.writeToFile (aDoc, new File (sFilename2), XWS_11).isSuccess ());

  // Read again
  final IMicroDocument aDoc2 = MicroReader.readMicroXML (new File (sFilename2));
  assertNotNull (aDoc2);

  // When using JAXP with Java 1.6.0_22, 1.6.0_29 or 1.6.0_45 (tested only
  // with this
  // version) the following test fails. That's why xerces must be included!
  // The bogus XMLReader is
  // com.sun.org.apache.xerces.internal.parsers.SAXParser
  assertTrue ("Documents are different when written to XML 1.1!\nUsed SAX XML reader: " +
              SAXReaderFactory.createXMLReader ().getClass ().getName () +
              "\nJava version: " +
              SystemProperties.getJavaVersion () +
              "\n" +
              MicroWriter.getNodeAsString (aDoc) +
              "\n\n" +
              MicroWriter.getNodeAsString (aDoc2),
              aDoc.isEqualContent (aDoc2));
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:34,代码来源:ReadWriteXML11FuncTest.java

示例13: cleanup

import com.helger.commons.system.SystemProperties; //导入依赖的package包/类
/**
 * Cleanup all custom caches contained in this library. Loaded SPI
 * implementations are not affected by this method!
 */
public static void cleanup ()
{
  // Reinitialize singletons to the default values
  if (LocaleCache.isInstantiated ())
    LocaleCache.getInstance ().reinitialize ();
  if (CountryCache.isInstantiated ())
    CountryCache.getInstance ().reinitialize ();
  if (SerializationConverterRegistry.isInstantiated ())
    SerializationConverterRegistry.getInstance ().reinitialize ();
  if (MimeTypeDeterminator.isInstantiated ())
    MimeTypeDeterminator.getInstance ().reinitialize ();
  if (ThirdPartyModuleRegistry.isInstantiated ())
    ThirdPartyModuleRegistry.getInstance ().reinitialize ();
  if (TypeConverterRegistry.isInstantiated ())
    TypeConverterRegistry.getInstance ().reinitialize ();
  if (URLProtocolRegistry.isInstantiated ())
    URLProtocolRegistry.getInstance ().reinitialize ();
  if (EqualsImplementationRegistry.isInstantiated ())
    EqualsImplementationRegistry.getInstance ().reinitialize ();
  if (HashCodeImplementationRegistry.isInstantiated ())
    HashCodeImplementationRegistry.getInstance ().reinitialize ();

  // Clear caches
  if (DefaultTextResolver.isInstantiated ())
    DefaultTextResolver.getInstance ().clearCache ();
  EnumHelper.clearCache ();
  ResourceBundleHelper.clearCache ();
  if (RegExCache.isInstantiated ())
    RegExCache.getInstance ().clearCache ();
  CollatorHelper.clearCache ();
  LocaleHelper.clearCache ();
  StatisticsManager.clearCache ();
  SystemProperties.clearWarnedPropertyNames ();
  if (ImageDataManager.isInstantiated ())
    ImageDataManager.getInstance ().clearCache ();

  // Clean this one last as it is used in equals and hashCode implementations!
  ClassHierarchyCache.clearCache ();
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:44,代码来源:CommonsCleanup.java

示例14: NonBlockingBufferedWriter

import com.helger.commons.system.SystemProperties; //导入依赖的package包/类
/**
 * Creates a new buffered character-output stream that uses an output buffer
 * of the given size.
 *
 * @param aWriter
 *        A Writer
 * @param nBufSize
 *        Output-buffer size, a positive integer
 * @exception IllegalArgumentException
 *            If size is &le; 0
 */
public NonBlockingBufferedWriter (@Nonnull final Writer aWriter, @Nonnegative final int nBufSize)
{
  super (aWriter);
  ValueEnforcer.isGT0 (nBufSize, "BufSize");
  m_aWriter = aWriter;
  m_aBuf = new char [nBufSize];
  m_nChars = nBufSize;
  m_nNextChar = 0;

  m_sLineSeparator = SystemProperties.getLineSeparator ();
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:23,代码来源:NonBlockingBufferedWriter.java

示例15: internalCheckParentDirectoryExistanceAndAccess

import com.helger.commons.system.SystemProperties; //导入依赖的package包/类
@Nonnull
static EValidity internalCheckParentDirectoryExistanceAndAccess (@Nonnull final File aFile)
{
  try
  {
    ensureParentDirectoryIsPresent (aFile);
  }
  catch (final IllegalStateException ex)
  {
    // Happens e.g. when the parent directory is " "
    s_aLogger.warn ("Failed to create parent directory of '" + aFile + "'", ex);
    return EValidity.INVALID;
  }

  // Check if parent directory is writable, to avoid catching the
  // FileNotFoundException with "permission denied" afterwards
  final File aParentDir = aFile.getParentFile ();
  if (aParentDir != null && !aParentDir.canWrite ())
  {
    s_aLogger.warn ("Parent directory '" +
                    aParentDir +
                    "' of '" +
                    aFile +
                    "' is not writable for current user '" +
                    SystemProperties.getUserName () +
                    "'");
    return EValidity.INVALID;
  }

  return EValidity.VALID;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:32,代码来源:FileHelper.java


注:本文中的com.helger.commons.system.SystemProperties类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。