• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ESuccess类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: _checkMPCOfPMode

import com.helger.commons.state.ESuccess; //导入依赖的package包/类
/**
 * Checks if the MPC that is contained in the PMode is valid.
 *
 * @param aPModeLeg
 *        the leg to get the MPCID
 * @param aMPCMgr
 *        the MPC-Manager to search for the MPCID in the persisted data
 * @param aLocale
 *        Locale to be used for the error messages
 * @param aErrorList
 *        to write errors to if they occur
 * @return Success if everything is all right, else Failure
 */
@Nonnull
private static ESuccess _checkMPCOfPMode (@Nonnull final PModeLeg aPModeLeg,
                                          @Nonnull final MPCManager aMPCMgr,
                                          @Nonnull final Locale aLocale,
                                          @Nonnull final ErrorList aErrorList)
{
  // Check if MPC is contained in PMode and if so, if it is valid
  if (aPModeLeg.getBusinessInfo () != null)
  {
    final String sPModeMPC = aPModeLeg.getBusinessInfo ().getMPCID ();
    if (sPModeMPC != null && !aMPCMgr.containsWithID (sPModeMPC))
    {
      s_aLogger.warn ("Error processing the usermessage, PMode-MPC ID '" + sPModeMPC + "' is invalid!");

      aErrorList.add (EEbmsError.EBMS_PROCESSING_MODE_MISMATCH.getAsError (aLocale));
      return ESuccess.FAILURE;
    }
  }
  return ESuccess.SUCCESS;
}
 
开发者ID:phax,项目名称:ph-as4,代码行数:34,代码来源:SOAPHeaderElementProcessorExtractEbms3Messaging.java


示例2: runAtomic

import com.helger.commons.state.ESuccess; //导入依赖的package包/类
/**
 * Run the provided action within a locked section.
 *
 * @param aRunnable
 *        Callback to be executed
 * @return {@link ESuccess#FAILURE} if the index is just closing
 * @throws IOException
 *         may be thrown by the callback
 */
@Nonnull
public ESuccess runAtomic (@Nonnull final IThrowingRunnable <IOException> aRunnable) throws IOException
{
  m_aLock.lock ();
  try
  {
    if (isClosing ())
      return ESuccess.FAILURE;
    aRunnable.run ();
  }
  finally
  {
    m_aLock.unlock ();
  }
  return ESuccess.SUCCESS;
}
 
开发者ID:phax,项目名称:peppol-directory,代码行数:26,代码来源:PDLucene.java


示例3: addServiceGroupToIndex

import com.helger.commons.state.ESuccess; //导入依赖的package包/类
@Nonnull
public ESuccess addServiceGroupToIndex (@Nonnull final IParticipantIdentifier aParticipantID)
{
  ValueEnforcer.notNull (aParticipantID, "ParticipantID");
  final String sParticipantID = aParticipantID.getURIEncoded ();

  final HttpPut aPut = new HttpPut (m_sPDIndexerURL);
  aPut.setEntity (new StringEntity (sParticipantID, StandardCharsets.UTF_8));

  try
  {
    if (executeRequest (aPut, new PDClientResponseHandler ()).isSuccess ())
    {
      s_aLogger.info ("Added service group '" +
                      sParticipantID +
                      "' to PEPPOL Directory index. May take some time until it shows up.");
      return ESuccess.SUCCESS;
    }
  }
  catch (final Throwable t)
  {
    m_aExceptionHdl.onException (aParticipantID, "addServiceGroupToIndex", t);
  }
  return ESuccess.FAILURE;
}
 
开发者ID:phax,项目名称:peppol-directory,代码行数:26,代码来源:PDClient.java


示例4: deleteServiceGroupFromIndex

import com.helger.commons.state.ESuccess; //导入依赖的package包/类
@Nonnull
public ESuccess deleteServiceGroupFromIndex (@Nonnull final IParticipantIdentifier aParticipantID)
{
  ValueEnforcer.notNull (aParticipantID, "ParticipantID");

  final HttpDelete aDelete = new HttpDelete (m_sPDIndexerURL + aParticipantID.getURIPercentEncoded ());
  try
  {
    if (executeRequest (aDelete, new PDClientResponseHandler ()).isSuccess ())
    {
      final String sParticipantID = aParticipantID.getURIEncoded ();
      s_aLogger.info ("Removed service group '" +
                      sParticipantID +
                      "' from PEPPOL Directory index. May take some time until it is removed.");
      return ESuccess.SUCCESS;
    }
  }
  catch (final Throwable t)
  {
    m_aExceptionHdl.onException (aParticipantID, "deleteServiceGroupFromIndex", t);
  }
  return ESuccess.FAILURE;
}
 
开发者ID:phax,项目名称:peppol-directory,代码行数:24,代码来源:PDClient.java


示例5: write

import com.helger.commons.state.ESuccess; //导入依赖的package包/类
@Nonnull
public final ESuccess write (@Nonnull final JAXBTYPE aObject,
                             @Nonnull final IJAXBMarshaller <JAXBTYPE> aMarshallerFunc)
{
  ValueEnforcer.notNull (aObject, "Object");
  ValueEnforcer.notNull (aMarshallerFunc, "MarshallerFunc");

  try
  {
    final Marshaller aMarshaller = _createMarshaller ();
    customizeMarshaller (aMarshaller);

    final JAXBElement <JAXBTYPE> aJAXBElement = m_aJAXBElementWrapper.apply (aObject);
    aMarshallerFunc.doMarshal (aMarshaller, aJAXBElement);
    return ESuccess.SUCCESS;
  }
  catch (final JAXBException ex)
  {
    handleWriteException (ex);
  }
  return ESuccess.FAILURE;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:23,代码来源:GenericJAXBMarshaller.java


示例6: write

import com.helger.commons.state.ESuccess; //导入依赖的package包/类
/**
 * Write the passed object to an {@link OutputStream}.
 *
 * @param aObject
 *        The object to be written. May not be <code>null</code>.
 * @param aOS
 *        The output stream to write to. Will always be closed. May not be
 *        <code>null</code>.
 * @return {@link ESuccess}
 */
@Nonnull
default ESuccess write (@Nonnull final JAXBTYPE aObject, @Nonnull @WillClose final OutputStream aOS)
{
  try
  {
    if (USE_JAXB_CHARSET_FIX)
    {
      return write (aObject, SafeXMLStreamWriter.create (aOS, getXMLWriterSettings ()));
    }
    return write (aObject, TransformResultFactory.create (aOS));
  }
  finally
  {
    // Needs to be manually closed
    StreamHelper.close (aOS);
  }
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:28,代码来源:IJAXBWriter.java


示例7: writeSettings

import com.helger.commons.state.ESuccess; //导入依赖的package包/类
@Nonnull
public ESuccess writeSettings (@Nonnull final ISettings aSettings, @Nonnull @WillClose final OutputStream aOS)
{
  ValueEnforcer.notNull (aSettings, "Settings");
  ValueEnforcer.notNull (aOS, "OutputStream");

  try
  {
    // Inside try so that OS is closed
    ValueEnforcer.notNull (aSettings, "Settings");

    // No event manager invocation on writing
    final SettingsMicroDocumentConverter <T> aConverter = new SettingsMicroDocumentConverter <> (m_aSettingsFactory);
    final IMicroDocument aDoc = new MicroDocument ();
    aDoc.appendChild (aConverter.convertToMicroElement (GenericReflection.uncheckedCast (aSettings),
                                                        getWriteNamespaceURI (),
                                                        getWriteElementName ()));

    // auto-closes the stream
    return MicroWriter.writeToStream (aDoc, aOS, m_aXWS);
  }
  finally
  {
    StreamHelper.close (aOS);
  }
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:27,代码来源:SettingsPersistenceXML.java


示例8: writeToFile

import com.helger.commons.state.ESuccess; //导入依赖的package包/类
/**
 * Write a Micro Node to a file.
 *
 * @param aNode
 *        The node to be serialized. May be any kind of node (incl.
 *        documents). May not be <code>null</code>.
 * @param aFile
 *        The file to write to. May not be <code>null</code>.
 * @param aSettings
 *        The settings to be used for the creation. May not be
 *        <code>null</code>.
 * @return {@link ESuccess}
 */
@Nonnull
public static ESuccess writeToFile (@Nonnull final IMicroNode aNode,
                                    @Nonnull final File aFile,
                                    @Nonnull final IXMLWriterSettings aSettings)
{
  ValueEnforcer.notNull (aFile, "File");

  final OutputStream aOS = FileHelper.getOutputStream (aFile);
  if (aOS == null)
    return ESuccess.FAILURE;

  // No need to wrap the OS in a BufferedOutputStream as inside, it is later
  // on wrapped in a BufferedWriter
  return writeToStream (aNode, aOS, aSettings);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:29,代码来源:MicroWriter.java


示例9: writeToStream

import com.helger.commons.state.ESuccess; //导入依赖的package包/类
/**
 * Write a Micro Node to an {@link OutputStream}.
 *
 * @param aNode
 *        The node to be serialized. May be any kind of node (incl.
 *        documents). May not be <code>null</code>.
 * @param aOS
 *        The output stream to write to. May not be <code>null</code>. The
 *        output stream is closed anyway directly after the operation finishes
 *        (on success and on error).
 * @param aSettings
 *        The settings to be used for the creation. May not be
 *        <code>null</code>.
 * @return {@link ESuccess}
 */
@Nonnull
public static ESuccess writeToStream (@Nonnull final IMicroNode aNode,
                                      @Nonnull @WillClose final OutputStream aOS,
                                      @Nonnull final IXMLWriterSettings aSettings)
{
  ValueEnforcer.notNull (aNode, "Node");
  ValueEnforcer.notNull (aOS, "OutputStream");
  ValueEnforcer.notNull (aSettings, "Settings");

  try
  {
    final MicroSerializer aSerializer = new MicroSerializer (aSettings);
    aSerializer.write (aNode, aOS);
    return ESuccess.SUCCESS;
  }
  finally
  {
    StreamHelper.close (aOS);
  }
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:36,代码来源:MicroWriter.java


示例10: writeToWriter

import com.helger.commons.state.ESuccess; //导入依赖的package包/类
/**
 * Write a Micro Node to a {@link Writer}.
 *
 * @param aNode
 *        The node to be serialized. May be any kind of node (incl.
 *        documents). May not be <code>null</code>.
 * @param aWriter
 *        The writer to write to. May not be <code>null</code>. The writer is
 *        closed anyway directly after the operation finishes (on success and
 *        on error).
 * @param aSettings
 *        The settings to be used for the creation. May not be
 *        <code>null</code>.
 * @return {@link ESuccess}
 */
@Nonnull
public static ESuccess writeToWriter (@Nonnull final IMicroNode aNode,
                                      @Nonnull @WillClose final Writer aWriter,
                                      @Nonnull final IXMLWriterSettings aSettings)
{
  ValueEnforcer.notNull (aNode, "Node");
  ValueEnforcer.notNull (aWriter, "Writer");
  ValueEnforcer.notNull (aSettings, "Settings");

  try
  {
    final MicroSerializer aSerializer = new MicroSerializer (aSettings);
    aSerializer.write (aNode, aWriter);
    return ESuccess.SUCCESS;
  }
  finally
  {
    StreamHelper.close (aWriter);
  }
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:36,代码来源:MicroWriter.java


示例11: writeMap

import com.helger.commons.state.ESuccess; //导入依赖的package包/类
/**
 * Write the passed map to the passed output stream using the predefined XML
 * layout.
 *
 * @param aMap
 *        The map to be written. May not be <code>null</code>.
 * @param aOS
 *        The output stream to write to. The stream is closed independent of
 *        success or failure. May not be <code>null</code>.
 * @return {@link ESuccess#SUCCESS} when everything went well,
 *         {@link ESuccess#FAILURE} otherwise.
 */
@Nonnull
public static ESuccess writeMap (@Nonnull final Map <String, String> aMap, @Nonnull @WillClose final OutputStream aOS)
{
  ValueEnforcer.notNull (aMap, "Map");
  ValueEnforcer.notNull (aOS, "OutputStream");

  try
  {
    final IMicroDocument aDoc = createMapDocument (aMap);
    return MicroWriter.writeToStream (aDoc, aOS, XMLWriterSettings.DEFAULT_XML_SETTINGS);
  }
  finally
  {
    StreamHelper.close (aOS);
  }
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:29,代码来源:XMLMapHandler.java


示例12: writeList

import com.helger.commons.state.ESuccess; //导入依赖的package包/类
/**
 * Write the passed collection to the passed output stream using the
 * predefined XML layout.
 *
 * @param aCollection
 *        The map to be written. May not be <code>null</code>.
 * @param aOS
 *        The output stream to write to. The stream is closed independent of
 *        success or failure. May not be <code>null</code>.
 * @return {@link ESuccess#SUCCESS} when everything went well,
 *         {@link ESuccess#FAILURE} otherwise.
 */
@Nonnull
public static ESuccess writeList (@Nonnull final Collection <String> aCollection,
                                  @Nonnull @WillClose final OutputStream aOS)
{
  ValueEnforcer.notNull (aCollection, "Collection");
  ValueEnforcer.notNull (aOS, "OutputStream");

  try
  {
    final IMicroDocument aDoc = createListDocument (aCollection);
    return MicroWriter.writeToStream (aDoc, aOS, XMLWriterSettings.DEFAULT_XML_SETTINGS);
  }
  finally
  {
    StreamHelper.close (aOS);
  }
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:30,代码来源:XMLListHandler.java


示例13: changeParent

import com.helger.commons.state.ESuccess; //导入依赖的package包/类
@Nonnull
public final ESuccess changeParent (@Nonnull final ITEMTYPE aNewParent)
{
  ValueEnforcer.notNull (aNewParent, "NewParent");

  // no change so far
  if (getParent () == aNewParent)
    return ESuccess.SUCCESS;

  // cannot make a child of this, this' new parent.
  final ITEMTYPE aThis = thisAsT ();
  if (aNewParent.isSameOrChildOf (aThis))
    return ESuccess.FAILURE;

  // add this to the new parent
  if (getParent ().removeChild (aThis).isUnchanged ())
    throw new IllegalStateException ("Failed to remove this from parent!");

  // Remember new parent!
  m_aParent = aNewParent;
  return ESuccess.valueOfChange (aNewParent.internalAddChild (aThis));
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:23,代码来源:BasicTreeItem.java


示例14: changeParent

import com.helger.commons.state.ESuccess; //导入依赖的package包/类
@Nonnull
public final ESuccess changeParent (@Nonnull final ITEMTYPE aNewParent)
{
  ValueEnforcer.notNull (aNewParent, "NewParent");

  // no change so far
  if (getParent () == aNewParent)
    return ESuccess.SUCCESS;

  // cannot make a child of this, this' new parent.
  final ITEMTYPE aThis = _asT (this);
  if (aNewParent.isSameOrChildOf (aThis))
    return ESuccess.FAILURE;

  // add this to the new parent
  if (m_aParent.removeChild (getID ()).isUnchanged ())
    throw new IllegalStateException ("Failed to remove this from parent!");

  // Remember new parent!
  m_aParent = aNewParent;
  return ESuccess.valueOfChange (aNewParent.internalAddChild (getID (), aThis, false));
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:23,代码来源:BasicTreeItemWithID.java


示例15: exposeMBean

import com.helger.commons.state.ESuccess; //导入依赖的package包/类
@Nonnull
public static ESuccess exposeMBean (@Nonnull final Object aObject, @Nonnull final ObjectName aObjectName)
{
  ValueEnforcer.notNull (aObject, "Object");
  ValueEnforcer.notNull (aObjectName, "ObjectName");

  try
  {
    ManagementFactory.getPlatformMBeanServer ().registerMBean (aObject, aObjectName);
    return ESuccess.SUCCESS;
  }
  catch (final JMException ex)
  {
    s_aLogger.error ("Error registering MBean with name " + aObjectName, ex);
    return ESuccess.FAILURE;
  }
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:18,代码来源:JMXHelper.java


示例16: returnObject

import com.helger.commons.state.ESuccess; //导入依赖的package包/类
@Nonnull
public ESuccess returnObject (@Nonnull final DATATYPE aItem)
{
  return m_aLock.locked ( () -> {
    for (int i = 0; i < m_aItems.length; ++i)
      if (m_aUsed[i] && aItem == m_aItems[i])
      {
        m_aUsed[i] = false;

        // Okay, we have one more unused item
        m_aAvailable.release ();
        return ESuccess.SUCCESS;
      }
    s_aLogger.warn ("Object " + aItem + " is not pooled!");
    return ESuccess.FAILURE;
  });
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:18,代码来源:ObjectPool.java


示例17: sleep

import com.helger.commons.state.ESuccess; //导入依赖的package包/类
/**
 * Sleep the current thread for a certain amount of time
 *
 * @param nMilliseconds
 *        The milliseconds to sleep. Must be &ge; 0.
 * @return {@link ESuccess#SUCCESS} if sleeping was not interrupted,
 *         {@link ESuccess#FAILURE} if sleeping was interrupted
 */
@Nonnull
public static ESuccess sleep (@Nonnegative final long nMilliseconds)
{
  ValueEnforcer.isGE0 (nMilliseconds, "MilliSeconds");

  try
  {
    Thread.sleep (nMilliseconds);
    return ESuccess.SUCCESS;
  }
  catch (final InterruptedException ex)
  {
    return ESuccess.FAILURE;
  }
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:24,代码来源:ThreadHelper.java


示例18: queueObject

import com.helger.commons.state.ESuccess; //导入依赖的package包/类
@Nonnull
public final ESuccess queueObject (@Nonnull final DATATYPE aObject)
{
  ValueEnforcer.notNull (aObject, "Object");
  if (isStopped ())
    throw new IllegalStateException ("The queue is already stopped and does not take any more elements");

  return m_aRWLock.writeLocked ( () -> {
    try
    {
      m_aQueue.put (aObject);
      return ESuccess.SUCCESS;
    }
    catch (final InterruptedException ex)
    {
      s_aLogger.error ("Failed to submit object to queue", ex);
      return ESuccess.FAILURE;
    }
  });
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:21,代码来源:AbstractConcurrentCollector.java


示例19: stopQueuingNewObjects

import com.helger.commons.state.ESuccess; //导入依赖的package包/类
@Nonnull
public final ESuccess stopQueuingNewObjects ()
{
  return m_aRWLock.writeLocked ( () -> {
    try
    {
      // put specific stop queue object
      m_aQueue.put (STOP_QUEUE_OBJECT);
      m_bStopTakingNewObjects = true;
      return ESuccess.SUCCESS;
    }
    catch (final InterruptedException ex)
    {
      s_aLogger.error ("Error stopping queue", ex);
      return ESuccess.FAILURE;
    }
  });
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:19,代码来源:AbstractConcurrentCollector.java


示例20: setDefaultDateTimeZoneID

import com.helger.commons.state.ESuccess; //导入依赖的package包/类
/**
 * Set the default date time zone to use. This effects all objects created via
 * {@link PDTFactory} as well as the default JDK TimeZone.
 *
 * @param sDateTimeZoneID
 *        Must be a valid, non-<code>null</code> time zone.
 * @return {@link ESuccess}
 */
@Nonnull
public static ESuccess setDefaultDateTimeZoneID (@Nonnull @Nonempty final String sDateTimeZoneID)
{
  ValueEnforcer.notEmpty (sDateTimeZoneID, "DateTimeZoneID");

  try
  {
    // Try to resolve ID -> throws exception if unknown
    final ZoneId aDefaultZoneId = ZoneId.of (sDateTimeZoneID);

    // getTimeZone falls back to GMT if unknown
    final TimeZone aDefaultTimeZone = TimeZone.getTimeZone (aDefaultZoneId);

    s_aDefaultZoneId = aDefaultZoneId;
    TimeZone.setDefault (aDefaultTimeZone);
    return ESuccess.SUCCESS;
  }
  catch (final DateTimeException ex)
  {
    // time zone ID is unknown
    s_aLogger.warn ("Unsupported ZoneId '" + sDateTimeZoneID + "'", ex);
    return ESuccess.FAILURE;
  }
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:33,代码来源:PDTConfig.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JDBCUtils类代码示例发布时间:2022-05-22
下一篇:
Java GMSSRandom类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap