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


Java ESuccess类代码示例

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


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


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