ContentLoaderBackend.java :  » Web-Framework » rife-1.6.1 » com » uwyn » rife » cmf » loader » Java Open Source

Java Open Source » Web Framework » rife 1.6.1 
rife 1.6.1 » com » uwyn » rife » cmf » loader » ContentLoaderBackend.java
/*
 * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
 * Distributed under the terms of either:
 * - the common development and distribution license (CDDL), v1.0; or
 * - the GNU Lesser General Public License, v2.1 or later
 * $Id: ContentLoaderBackend.java 3634 2007-01-08 21:42:24Z gbevin $
 */
package com.uwyn.rife.cmf.loader;

import java.util.Set;

/**
 * This is an interface that should be implemented by all content loader
 * back-ends.
 * <p>All content loader back-ends that are fronted by the same {@link
 * ContentLoader} should handle the same <code>InternalType</code>, which is
 * returned by the {@link #load(Object, boolean, Set) load} method.
 * 
 * @author Geert Bevin (gbevin[remove] at uwyn dot com)
 * @version $Revision: 3634 $
 * @since 1.0
 */
public interface ContentLoaderBackend<InternalType>
{
  /**
   * Indicates whether the back-end is present.
   * <p>This can be important for optional libraries that should only
   * actually try to load the data when the required classes are available
   * in the classpath.
   * 
   * @return <code>true</code> if the back-end is present; or
   * <p><code>false</code> if this is not the case
   * @since 1.0
   */
  public boolean isBackendPresent();

  /**
   * Loads any kind of raw data and tries to accommodate as much as possible
   * to return an instance of <code>InternalType</code> after successful
   * loading and handling.
   * <p>Should any errors occur, then they will be added as text messages to
   * the <code>errors</code> collection.
   * 
   * @param data the raw data that has to be loaded
   * @param fragment <code>true</code> if the raw data is a fragment; or
   * <p><code>false</code> if the raw data is a complete document or file
   * @param errors a set to which possible error messages will be added
   * @return an instance of the <code>InternalType</code>; or
   * <p><code>null</code> if the raw data couldn't be loaded
   * @since 1.0
   */
  public InternalType load(Object data, boolean fragment, Set<String> errors);
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.