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


Java ESuccess.SUCCESS属性代码示例

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


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

示例1: _checkMPCOfPMode

/**
 * 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,代码行数:33,代码来源:SOAPHeaderElementProcessorExtractEbms3Messaging.java

示例2: runAtomic

/**
 * 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,代码行数:25,代码来源:PDLucene.java

示例3: addServiceGroupToIndex

@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,代码行数:25,代码来源:PDClient.java

示例4: deleteServiceGroupFromIndex

@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,代码行数:23,代码来源:PDClient.java

示例5: write

@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,代码行数:22,代码来源:GenericJAXBMarshaller.java

示例6: writeTo

/**
 * Write the current workbook to an output stream.
 *
 * @param aOS
 *        The output stream to write to. May not be <code>null</code>. Is
 *        automatically closed independent of the success state.
 * @return {@link ESuccess}
 */
@Nonnull
public ESuccess writeTo (@Nonnull @WillClose final OutputStream aOS)
{
  try
  {
    ValueEnforcer.notNull (aOS, "OutputStream");

    if (m_nCreatedCellStyles > 0 && s_aLogger.isDebugEnabled ())
      s_aLogger.debug ("Writing Excel workbook with " + m_nCreatedCellStyles + " different cell styles");

    m_aWB.write (aOS);
    return ESuccess.SUCCESS;
  }
  catch (final IOException ex)
  {
    if (!StreamHelper.isKnownEOFException (ex))
      s_aLogger.error ("Failed to write Excel workbook to output stream " + aOS, ex);
    return ESuccess.FAILURE;
  }
  finally
  {
    StreamHelper.close (aOS);
  }
}
 
开发者ID:phax,项目名称:ph-poi,代码行数:32,代码来源:WorkbookCreationHelper.java

示例7: writeStream

/**
 * Write bytes to an {@link OutputStream}.
 *
 * @param aOS
 *        The output stream to write to. May not be <code>null</code>. Is
 *        closed independent of error or success.
 * @param aBuf
 *        The byte array from which is to be written. May not be
 *        <code>null</code>.
 * @param nOfs
 *        The 0-based index to the first byte in the array to be written. May
 *        not be &lt; 0.
 * @param nLen
 *        The non-negative amount of bytes to be written. May not be &lt; 0.
 * @return {@link ESuccess}
 */
@Nonnull
public static ESuccess writeStream (@WillClose @Nonnull final OutputStream aOS,
                                    @Nonnull final byte [] aBuf,
                                    @Nonnegative final int nOfs,
                                    @Nonnegative final int nLen)
{
  try
  {
    ValueEnforcer.notNull (aOS, "OutputStream");
    ValueEnforcer.isArrayOfsLen (aBuf, nOfs, nLen);

    aOS.write (aBuf, nOfs, nLen);
    aOS.flush ();
    return ESuccess.SUCCESS;
  }
  catch (final IOException ex)
  {
    s_aLogger.error ("Failed to write to output stream", ex instanceof IMockException ? null : ex);
    return ESuccess.FAILURE;
  }
  finally
  {
    close (aOS);
  }
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:41,代码来源:StreamHelper.java

示例8: writeToWriter

/**
 * 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,代码行数:35,代码来源:MicroWriter.java

示例9: changeParent

@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,代码行数:22,代码来源:BasicTreeItem.java

示例10: changeParent

@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,代码行数:22,代码来源:BasicTreeItemWithID.java

示例11: exposeMBean

@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,代码行数:17,代码来源:JMXHelper.java

示例12: sleep

/**
 * 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,代码行数:23,代码来源:ThreadHelper.java

示例13: setDefaultDateTimeZoneID

/**
 * 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,代码行数:32,代码来源:PDTConfig.java

示例14: closeWithoutFlush

/**
 * Close the passed object, without trying to call flush on it.
 *
 * @param aCloseable
 *        The object to be closed. May be <code>null</code>.
 * @return {@link ESuccess#SUCCESS} if the object was successfully closed.
 */
@Nonnull
public static ESuccess closeWithoutFlush (@Nullable @WillClose final AutoCloseable aCloseable)
{
  if (aCloseable != null)
  {
    try
    {
      // close stream
      aCloseable.close ();
      return ESuccess.SUCCESS;
    }
    catch (final Exception ex)
    {
      if (!isKnownEOFException (ex))
        s_aLogger.error ("Failed to close object " + aCloseable.getClass ().getName (),
                         ex instanceof IMockException ? null : ex);
    }
  }
  return ESuccess.FAILURE;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:27,代码来源:StreamHelper.java

示例15: release

@Nonnull
public static ESuccess release (@Nullable final FileLock aFileLock)
{
  if (aFileLock != null)
  {
    try
    {
      aFileLock.release ();
      return ESuccess.SUCCESS;
    }
    catch (final IOException ex)
    {
      s_aLogger.error ("Failed to release object " + aFileLock, ex instanceof IMockException ? null : ex);
    }
  }

  return ESuccess.FAILURE;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:18,代码来源:ChannelHelper.java


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