chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r934896 [1/12] - in /incubator/chemistry/opencmis/trunk/chemistry-opencmis-server: chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/ chemistry-opencmis-server-bindings/src/main/java/org/apache/chemi...
Date Fri, 16 Apr 2010 14:14:02 GMT
Author: jens
Date: Fri Apr 16 14:14:00 2010
New Revision: 934896

URL: http://svn.apache.org/viewvc?rev=934896&view=rev
Log:
Apply code formatting to server side modules

Modified:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/CallContextImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/CmisRepositoryContextListener.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/ObjectInfoHolderImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AclDocument.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AclService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AllowableActionsDocument.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomDocumentBase.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntry.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntryParser.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomFeed.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomPubUtils.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/BasicAuthCallContextHandler.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CallContextHandler.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/DiscoveryService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/Dispatcher.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/MultiFilingService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/NavigationService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ObjectService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/PolicyService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RelationshipService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RepositoryService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ServiceDocument.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/XMLDocumentBase.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/dummy/DummyRepositoryService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/dummy/DummyServicesFactory.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AclService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AuthHandler.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/DiscoveryService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/MultiFilingService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/NavigationService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/ObjectService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/PolicyService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/RelationshipService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/RepositoryService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/VersioningService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/test/java/org/apache/chemistry/opencmis/server/impl/AtomEntryParserTest.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/AclService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/DocumentInfo.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareRepository.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FolderInfo.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/MIMETypes.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/NavigationService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/ObjectService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/RepositoryMap.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/RepositoryService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/ServicesFactory.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/TypeManager.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/VersioningService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/AbstractServicesFactory.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CallContext.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisAclService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisDiscoveryService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisMultiFilingService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisNavigationService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisObjectService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisPolicyService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisRelationshipService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisRepositoryService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisVersioningService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/ObjectInfo.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/ObjectInfoHolder.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/ObjectInfoImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/RenditionInfo.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/RenditionInfosImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/AbstractServiceWrapper.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/AclServiceWrapper.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/DiscoveryServiceWrapper.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/MultiFilingServiceWrapper.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/NavigationServiceWrapper.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/ObjectInfoHelper.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/ObjectServiceWrapper.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/PolicyServiceWrapper.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/RelationshipServiceWrapper.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/RepositoryServiceWrapper.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/VersioningServiceWrapper.java

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/CallContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/CallContextImpl.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/CallContextImpl.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/CallContextImpl.java Fri Apr 16 14:14:00 2010
@@ -31,69 +31,69 @@ import org.apache.chemistry.opencmis.ser
  */
 public class CallContextImpl implements CallContext {
 
-  private String fBinding;
-  private Map<String, String> fParameter = new HashMap<String, String>();
+	private String fBinding;
+	private Map<String, String> fParameter = new HashMap<String, String>();
 
-  public CallContextImpl(String binding) {
-    fBinding = binding;
-  }
-
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.opencmis.server.spi.CallContext#getBinding()
-   */
-  public String getBinding() {
-    return fBinding;
-  }
-
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.opencmis.server.spi.CallContext#get(java.lang.String)
-   */
-  public String get(String key) {
-    return fParameter.get(key);
-  }
-
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.opencmis.server.spi.CallContext#getUsername()
-   */
-  public String getUsername() {
-    return get(USERNAME);
-  }
-
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.opencmis.server.spi.CallContext#getPassword()
-   */
-  public String getPassword() {
-    return get(PASSWORD);
-  }
-
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.opencmis.server.spi.CallContext#getLocale()
-   */
-  public String getLocale() {
-    return get(LOCALE);
-  }
-
-  /**
-   * Adds a parameter.
-   */
-  public void put(String key, String value) {
-    fParameter.put(key, value);
-  }
-
-  /**
-   * Removes a parameter.
-   */
-  public String remove(String key) {
-    return fParameter.remove(key);
-  }
+	public CallContextImpl(String binding) {
+		fBinding = binding;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.opencmis.server.spi.CallContext#getBinding()
+	 */
+	public String getBinding() {
+		return fBinding;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.opencmis.server.spi.CallContext#get(java.lang.String)
+	 */
+	public String get(String key) {
+		return fParameter.get(key);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.opencmis.server.spi.CallContext#getUsername()
+	 */
+	public String getUsername() {
+		return get(USERNAME);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.opencmis.server.spi.CallContext#getPassword()
+	 */
+	public String getPassword() {
+		return get(PASSWORD);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.opencmis.server.spi.CallContext#getLocale()
+	 */
+	public String getLocale() {
+		return get(LOCALE);
+	}
+
+	/**
+	 * Adds a parameter.
+	 */
+	public void put(String key, String value) {
+		fParameter.put(key, value);
+	}
+
+	/**
+	 * Removes a parameter.
+	 */
+	public String remove(String key) {
+		return fParameter.remove(key);
+	}
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/CmisRepositoryContextListener.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/CmisRepositoryContextListener.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/CmisRepositoryContextListener.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/CmisRepositoryContextListener.java Fri Apr 16 14:14:00 2010
@@ -40,97 +40,98 @@ import org.apache.commons.logging.LogFac
  */
 public class CmisRepositoryContextListener implements ServletContextListener {
 
-  public static final String SERVICES_FACTORY = "org.apache.chemistry.opencmis.servicesfactory";
+	public static final String SERVICES_FACTORY = "org.apache.chemistry.opencmis.servicesfactory";
 
-  private static final Log log = LogFactory.getLog(CmisRepositoryContextListener.class.getName());
+	private static final Log log = LogFactory.getLog(CmisRepositoryContextListener.class.getName());
 
-  private static final String CONFIG_FILENAME = "/repository.properties";
-  private static final String PROPERTY_CLASS = "class";
+	private static final String CONFIG_FILENAME = "/repository.properties";
+	private static final String PROPERTY_CLASS = "class";
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)
-   */
-  public void contextInitialized(ServletContextEvent sce) {
-    // create services factory
-    AbstractServicesFactory factory = createServicesFactory(CONFIG_FILENAME);
-
-    // set the services factory into the servlet context
-    sce.getServletContext().setAttribute(SERVICES_FACTORY, factory);
-  }
-
-  /*
-   * (non-Javadoc)
-   * 
-   * @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent)
-   */
-  public void contextDestroyed(ServletContextEvent sce) {
-    // destroy services factory
-    AbstractServicesFactory factory = (AbstractServicesFactory) sce.getServletContext()
-        .getAttribute(SERVICES_FACTORY);
-    if (factory != null) {
-      factory.destroy();
-    }
-  }
-
-  /**
-   * Creates a services factory.
-   */
-  private AbstractServicesFactory createServicesFactory(String filename) {
-    // load properties
-    InputStream stream = this.getClass().getResourceAsStream(filename);
-
-    if (stream == null) {
-      log.warn("Cannot find configuration!");
-      return null;
-    }
-
-    Properties props = new Properties();
-    try {
-      props.load(stream);
-    }
-    catch (IOException e) {
-      log.warn("Cannot load configuration: " + e, e);
-      return null;
-    }
-
-    // get 'class' property
-    String className = props.getProperty(PROPERTY_CLASS);
-    if (className == null) {
-      log.warn("Configuration doesn't contain the property 'class'!");
-      return null;
-    }
-
-    // create a factory instance
-    Object object = null;
-    try {
-      object = Class.forName(className).newInstance();
-    }
-    catch (Exception e) {
-      log.warn("Could not create a services factory instance: " + e, e);
-      return null;
-    }
-
-    if (!(object instanceof AbstractServicesFactory)) {
-      log.warn("The provided class is not a sub class of AbstractServicesFactory!");
-    }
-
-    AbstractServicesFactory factory = (AbstractServicesFactory) object;
-
-    // initialize factory instance
-    Map<String, String> parameters = new HashMap<String, String>();
-
-    for (Enumeration<?> e = props.propertyNames(); e.hasMoreElements();) {
-      String key = (String) e.nextElement();
-      String value = props.getProperty(key);
-      parameters.put(key, value);
-    }
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * javax.servlet.ServletContextListener#contextInitialized(javax.servlet
+	 * .ServletContextEvent)
+	 */
+	public void contextInitialized(ServletContextEvent sce) {
+		// create services factory
+		AbstractServicesFactory factory = createServicesFactory(CONFIG_FILENAME);
+
+		// set the services factory into the servlet context
+		sce.getServletContext().setAttribute(SERVICES_FACTORY, factory);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seejavax.servlet.ServletContextListener#contextDestroyed(javax.servlet.
+	 * ServletContextEvent)
+	 */
+	public void contextDestroyed(ServletContextEvent sce) {
+		// destroy services factory
+		AbstractServicesFactory factory = (AbstractServicesFactory) sce.getServletContext().getAttribute(
+				SERVICES_FACTORY);
+		if (factory != null) {
+			factory.destroy();
+		}
+	}
+
+	/**
+	 * Creates a services factory.
+	 */
+	private AbstractServicesFactory createServicesFactory(String filename) {
+		// load properties
+		InputStream stream = this.getClass().getResourceAsStream(filename);
+
+		if (stream == null) {
+			log.warn("Cannot find configuration!");
+			return null;
+		}
+
+		Properties props = new Properties();
+		try {
+			props.load(stream);
+		} catch (IOException e) {
+			log.warn("Cannot load configuration: " + e, e);
+			return null;
+		}
+
+		// get 'class' property
+		String className = props.getProperty(PROPERTY_CLASS);
+		if (className == null) {
+			log.warn("Configuration doesn't contain the property 'class'!");
+			return null;
+		}
+
+		// create a factory instance
+		Object object = null;
+		try {
+			object = Class.forName(className).newInstance();
+		} catch (Exception e) {
+			log.warn("Could not create a services factory instance: " + e, e);
+			return null;
+		}
+
+		if (!(object instanceof AbstractServicesFactory)) {
+			log.warn("The provided class is not a sub class of AbstractServicesFactory!");
+		}
+
+		AbstractServicesFactory factory = (AbstractServicesFactory) object;
+
+		// initialize factory instance
+		Map<String, String> parameters = new HashMap<String, String>();
+
+		for (Enumeration<?> e = props.propertyNames(); e.hasMoreElements();) {
+			String key = (String) e.nextElement();
+			String value = props.getProperty(key);
+			parameters.put(key, value);
+		}
 
-    factory.init(parameters);
+		factory.init(parameters);
 
-    log.info("Initialized Services Factory: " + parameters);
+		log.info("Initialized Services Factory: " + parameters);
 
-    return factory;
-  }
+		return factory;
+	}
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/ObjectInfoHolderImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/ObjectInfoHolderImpl.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/ObjectInfoHolderImpl.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/ObjectInfoHolderImpl.java Fri Apr 16 14:14:00 2010
@@ -32,37 +32,41 @@ import org.apache.chemistry.opencmis.ser
  */
 public class ObjectInfoHolderImpl implements ObjectInfoHolder {
 
-  private Map<String, ObjectInfo> fObjectInfoMap;
+	private Map<String, ObjectInfo> fObjectInfoMap;
 
-  /**
-   * Constructor.
-   */
-  public ObjectInfoHolderImpl() {
-    fObjectInfoMap = new HashMap<String, ObjectInfo>();
-  }
+	/**
+	 * Constructor.
+	 */
+	public ObjectInfoHolderImpl() {
+		fObjectInfoMap = new HashMap<String, ObjectInfo>();
+	}
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.opencmis.server.spi.ObjectInfoHolder#addObjectInfo(org.apache.opencmis.server.spi.ObjectInfo)
-   */
-  public void addObjectInfo(ObjectInfo info) {
-    if (info == null) {
-      throw new IllegalArgumentException("Object Info must not be null!");
-    }
-    if (info.getId() == null) {
-      throw new IllegalArgumentException("Object Info Id must not be null!");
-    }
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.apache.opencmis.server.spi.ObjectInfoHolder#addObjectInfo(org.apache
+	 * .opencmis.server.spi.ObjectInfo)
+	 */
+	public void addObjectInfo(ObjectInfo info) {
+		if (info == null) {
+			throw new IllegalArgumentException("Object Info must not be null!");
+		}
+		if (info.getId() == null) {
+			throw new IllegalArgumentException("Object Info Id must not be null!");
+		}
 
-    fObjectInfoMap.put(info.getId(), info);
-  }
+		fObjectInfoMap.put(info.getId(), info);
+	}
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.opencmis.server.spi.ObjectInfoHolder#getObjectInfo(java.lang.String)
-   */
-  public ObjectInfo getObjectInfo(String id) {
-    return fObjectInfoMap.get(id);
-  }
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.apache.opencmis.server.spi.ObjectInfoHolder#getObjectInfo(java.lang
+	 * .String)
+	 */
+	public ObjectInfo getObjectInfo(String id) {
+		return fObjectInfoMap.get(id);
+	}
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AclDocument.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AclDocument.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AclDocument.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AclDocument.java Fri Apr 16 14:14:00 2010
@@ -37,22 +37,21 @@ import org.apache.chemistry.opencmis.com
  */
 public class AclDocument {
 
-  /**
-   * Creates an ACL document.
-   */
-  public AclDocument() {
-  }
+	/**
+	 * Creates an ACL document.
+	 */
+	public AclDocument() {
+	}
 
-  /**
-   * Writes an object.
-   */
-  public void writeAcl(Acl acl, OutputStream out) throws XMLStreamException,
-      JAXBException {
-    CmisAccessControlListType aclJaxb = convert(acl);
-    if (aclJaxb == null) {
-      return;
-    }
+	/**
+	 * Writes an object.
+	 */
+	public void writeAcl(Acl acl, OutputStream out) throws XMLStreamException, JAXBException {
+		CmisAccessControlListType aclJaxb = convert(acl);
+		if (aclJaxb == null) {
+			return;
+		}
 
-    JaxBHelper.marshal(JaxBHelper.CMIS_OBJECT_FACTORY.createAcl(aclJaxb), out, false);
-  }
+		JaxBHelper.marshal(JaxBHelper.CMIS_OBJECT_FACTORY.createAcl(aclJaxb), out, false);
+	}
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AclService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AclService.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AclService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AclService.java Fri Apr 16 14:14:00 2010
@@ -47,78 +47,71 @@ import org.apache.chemistry.opencmis.ser
  */
 public class AclService {
 
-  /**
-   * Get ACL.
-   */
-  public static void getAcl(CallContext context, AbstractServicesFactory factory,
-      String repositoryId, HttpServletRequest request, HttpServletResponse response)
-      throws Exception {
-    CmisAclService service = factory.getAclService();
-
-    // get parameters
-    String objectId = getStringParameter(request, Constants.PARAM_ID);
-    Boolean onlyBasicPermissions = getBooleanParameter(request,
-        Constants.PARAM_ONLY_BASIC_PERMISSIONS);
-
-    // execute
-    Acl acl = service.getAcl(context, repositoryId, objectId, onlyBasicPermissions,
-        null);
-
-    if (acl == null) {
-      throw new CmisRuntimeException("ACL is null!");
-    }
-
-    // set headers
-    response.setStatus(HttpServletResponse.SC_OK);
-    response.setContentType(Constants.MEDIATYPE_ACL);
-
-    // write XML
-    AclDocument aclDocument = new AclDocument();
-    aclDocument.writeAcl(acl, response.getOutputStream());
-  }
-
-  /**
-   * Apply ACL.
-   */
-  public static void applyAcl(CallContext context, AbstractServicesFactory factory,
-      String repositoryId, HttpServletRequest request, HttpServletResponse response)
-      throws Exception {
-    CmisAclService service = factory.getAclService();
-
-    // get parameters
-    String objectId = getStringParameter(request, Constants.PARAM_ID);
-    AclPropagation aclPropagation = getEnumParameter(request, Constants.PARAM_ACL_PROPAGATION,
-        AclPropagation.class);
-
-    Object aclRequest = null;
-    try {
-      Unmarshaller u = JaxBHelper.createUnmarshaller();
-      aclRequest = u.unmarshal(request.getInputStream());
-    }
-    catch (Exception e) {
-      throw new CmisInvalidArgumentException("Invalid ACL request: " + e, e);
-    }
-
-    if (!(aclRequest instanceof JAXBElement<?>)) {
-      throw new CmisInvalidArgumentException("Not an ACL document!");
-    }
-
-    if (!(((JAXBElement<?>) aclRequest).getValue() instanceof CmisAccessControlListType)) {
-      throw new CmisInvalidArgumentException("Not an ACL document!");
-    }
-
-    Acl aces = convert((CmisAccessControlListType) ((JAXBElement<?>) aclRequest)
-        .getValue(), null);
-
-    // execute
-    Acl acl = service.applyAcl(context, repositoryId, objectId, aces, aclPropagation);
-
-    // set headers
-    response.setStatus(HttpServletResponse.SC_CREATED);
-    response.setContentType(Constants.MEDIATYPE_ACL);
-
-    // write XML
-    AclDocument aclDocument = new AclDocument();
-    aclDocument.writeAcl(acl, response.getOutputStream());
-  }
+	/**
+	 * Get ACL.
+	 */
+	public static void getAcl(CallContext context, AbstractServicesFactory factory, String repositoryId,
+			HttpServletRequest request, HttpServletResponse response) throws Exception {
+		CmisAclService service = factory.getAclService();
+
+		// get parameters
+		String objectId = getStringParameter(request, Constants.PARAM_ID);
+		Boolean onlyBasicPermissions = getBooleanParameter(request, Constants.PARAM_ONLY_BASIC_PERMISSIONS);
+
+		// execute
+		Acl acl = service.getAcl(context, repositoryId, objectId, onlyBasicPermissions, null);
+
+		if (acl == null) {
+			throw new CmisRuntimeException("ACL is null!");
+		}
+
+		// set headers
+		response.setStatus(HttpServletResponse.SC_OK);
+		response.setContentType(Constants.MEDIATYPE_ACL);
+
+		// write XML
+		AclDocument aclDocument = new AclDocument();
+		aclDocument.writeAcl(acl, response.getOutputStream());
+	}
+
+	/**
+	 * Apply ACL.
+	 */
+	public static void applyAcl(CallContext context, AbstractServicesFactory factory, String repositoryId,
+			HttpServletRequest request, HttpServletResponse response) throws Exception {
+		CmisAclService service = factory.getAclService();
+
+		// get parameters
+		String objectId = getStringParameter(request, Constants.PARAM_ID);
+		AclPropagation aclPropagation = getEnumParameter(request, Constants.PARAM_ACL_PROPAGATION, AclPropagation.class);
+
+		Object aclRequest = null;
+		try {
+			Unmarshaller u = JaxBHelper.createUnmarshaller();
+			aclRequest = u.unmarshal(request.getInputStream());
+		} catch (Exception e) {
+			throw new CmisInvalidArgumentException("Invalid ACL request: " + e, e);
+		}
+
+		if (!(aclRequest instanceof JAXBElement<?>)) {
+			throw new CmisInvalidArgumentException("Not an ACL document!");
+		}
+
+		if (!(((JAXBElement<?>) aclRequest).getValue() instanceof CmisAccessControlListType)) {
+			throw new CmisInvalidArgumentException("Not an ACL document!");
+		}
+
+		Acl aces = convert((CmisAccessControlListType) ((JAXBElement<?>) aclRequest).getValue(), null);
+
+		// execute
+		Acl acl = service.applyAcl(context, repositoryId, objectId, aces, aclPropagation);
+
+		// set headers
+		response.setStatus(HttpServletResponse.SC_CREATED);
+		response.setContentType(Constants.MEDIATYPE_ACL);
+
+		// write XML
+		AclDocument aclDocument = new AclDocument();
+		aclDocument.writeAcl(acl, response.getOutputStream());
+	}
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AllowableActionsDocument.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AllowableActionsDocument.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AllowableActionsDocument.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AllowableActionsDocument.java Fri Apr 16 14:14:00 2010
@@ -37,23 +37,22 @@ import org.apache.chemistry.opencmis.com
  */
 public class AllowableActionsDocument {
 
-  /**
-   * Creates an Allowable Actions document.
-   */
-  public AllowableActionsDocument() {
-  }
+	/**
+	 * Creates an Allowable Actions document.
+	 */
+	public AllowableActionsDocument() {
+	}
 
-  /**
-   * Writes an object.
-   */
-  public void writeAllowableActions(AllowableActions allowableActions, OutputStream out)
-      throws XMLStreamException, JAXBException {
-    CmisAllowableActionsType allowableActionsJaxb = convert(allowableActions);
-    if (allowableActionsJaxb == null) {
-      return;
-    }
+	/**
+	 * Writes an object.
+	 */
+	public void writeAllowableActions(AllowableActions allowableActions, OutputStream out) throws XMLStreamException,
+			JAXBException {
+		CmisAllowableActionsType allowableActionsJaxb = convert(allowableActions);
+		if (allowableActionsJaxb == null) {
+			return;
+		}
 
-    JaxBHelper.marshal(JaxBHelper.CMIS_OBJECT_FACTORY.createAllowableActions(allowableActionsJaxb),
-        out, false);
-  }
+		JaxBHelper.marshal(JaxBHelper.CMIS_OBJECT_FACTORY.createAllowableActions(allowableActionsJaxb), out, false);
+	}
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomDocumentBase.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomDocumentBase.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomDocumentBase.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomDocumentBase.java Fri Apr 16 14:14:00 2010
@@ -40,318 +40,315 @@ import org.apache.commons.codec.binary.B
  */
 public abstract class AtomDocumentBase extends XMLDocumentBase {
 
-  private static final String ID_PREFIX = "http://opencmis.org/";
-  private static final String ID_DUMMY = "http://opencmis.org/no-id";
+	private static final String ID_PREFIX = "http://opencmis.org/";
+	private static final String ID_DUMMY = "http://opencmis.org/no-id";
 
-  private SimpleDateFormat fDateFormater;
+	private SimpleDateFormat fDateFormater;
 
-  /**
-   * Formats a DateTime.
-   */
-  public String formatDate(long millis) {
-    if (fDateFormater == null) {
-      fDateFormater = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US);
-      fDateFormater.setTimeZone(TimeZone.getTimeZone("UTC"));
-    }
-
-    return fDateFormater.format(millis);
-  }
-
-  /**
-   * Generates a valid Atom id.
-   */
-  public String generateAtomId(String input) {
-    if (input == null) {
-      return ID_DUMMY;
-    }
-
-    try {
-      return ID_PREFIX + (new String(Base64.encodeBase64(input.getBytes("UTF-8"))));
-    }
-    catch (UnsupportedEncodingException e) {
-      return ID_DUMMY;
-    }
-  }
-
-  /**
-   * Writes a simple tag.
-   */
-  public void writeSimpleTag(String namespace, String name, String value) throws XMLStreamException {
-    if (value == null) {
-      return;
-    }
-
-    XMLStreamWriter xsw = getWriter();
-
-    xsw.writeStartElement(namespace, name);
-    xsw.writeCharacters(value);
-    xsw.writeEndElement();
-  }
-
-  /**
-   * Writes a simple date tag.
-   */
-  public void writeSimpleDate(String namespace, String name, GregorianCalendar value)
-      throws XMLStreamException {
-    if (value == null) {
-      return;
-    }
-
-    writeSimpleTag(namespace, name, formatDate(value.getTimeInMillis()));
-  }
-
-  /**
-   * Writes a simple date tag.
-   */
-  public void writeSimpleDate(String namespace, String name, long millis) throws XMLStreamException {
-    writeSimpleTag(namespace, name, formatDate(millis));
-  }
-
-  /**
-   * Writes an Atom id tag.
-   */
-  public void writeId(String id) throws XMLStreamException {
-    writeSimpleTag(Constants.NAMESPACE_ATOM, "id", id);
-  }
-
-  /**
-   * Writes an Atom title tag.
-   */
-  public void writeTitle(String title) throws XMLStreamException {
-    writeSimpleTag(Constants.NAMESPACE_ATOM, "title", title);
-  }
-
-  /**
-   * Writes an Atom author tag.
-   */
-  public void writeAuthor(String author) throws XMLStreamException {
-    XMLStreamWriter xsw = getWriter();
-
-    xsw.writeStartElement(Constants.NAMESPACE_ATOM, "author");
-    writeSimpleTag(Constants.NAMESPACE_ATOM, "name", author);
-    xsw.writeEndElement();
-  }
-
-  /**
-   * Writes an Atom updated tag.
-   */
-  public void writeUpdated(GregorianCalendar updated) throws XMLStreamException {
-    writeSimpleDate(Constants.NAMESPACE_APP, "edited", updated);
-    writeSimpleDate(Constants.NAMESPACE_ATOM, "updated", updated);
-  }
-
-  /**
-   * Writes an Atom updated tag.
-   */
-  public void writeUpdated(long updated) throws XMLStreamException {
-    writeSimpleDate(Constants.NAMESPACE_APP, "edited", updated);
-    writeSimpleDate(Constants.NAMESPACE_ATOM, "updated", updated);
-  }
-
-  /**
-   * Writes an Atom published tag.
-   */
-  public void writePublished(GregorianCalendar published) throws XMLStreamException {
-    writeSimpleDate(Constants.NAMESPACE_ATOM, "published", published);
-  }
-
-  /**
-   * Writes an Atom published tag.
-   */
-  public void writePublished(long published) throws XMLStreamException {
-    writeSimpleDate(Constants.NAMESPACE_ATOM, "published", published);
-  }
-
-  /**
-   * Writes a CMIS pathSegment tag.
-   */
-  public void writePathSegment(String pathSegment) throws XMLStreamException {
-    writeSimpleTag(Constants.NAMESPACE_RESTATOM, "pathSegment", pathSegment);
-  }
-
-  /**
-   * Writes a CMIS relativePathSegment tag.
-   */
-  public void writeRelativePathSegment(String relativePathSegment) throws XMLStreamException {
-    writeSimpleTag(Constants.NAMESPACE_RESTATOM, "relativePathSegment", relativePathSegment);
-  }
-
-  /**
-   * Writes an Atom collection.
-   */
-  public void writeCollection(String href, String collectionType, String text, String... accept)
-      throws XMLStreamException {
-    XMLStreamWriter xsw = getWriter();
-
-    xsw.writeStartElement(Constants.NAMESPACE_APP, "collection");
-    xsw.writeAttribute("href", href);
-
-    if (collectionType != null) {
-      xsw.writeStartElement(Constants.NAMESPACE_RESTATOM, "collectionType");
-      xsw.writeCharacters(collectionType);
-      xsw.writeEndElement();
-    }
-
-    xsw.writeStartElement(Constants.NAMESPACE_ATOM, "title");
-    xsw.writeAttribute("type", "text");
-    xsw.writeCharacters(text);
-    xsw.writeEndElement();
-
-    for (String ct : accept) {
-      xsw.writeStartElement(Constants.NAMESPACE_APP, "accept");
-      xsw.writeCharacters(ct);
-      xsw.writeEndElement();
-    }
-
-    xsw.writeEndElement();
-  }
-
-  /**
-   * Writes a link.
-   */
-  public void writeLink(String rel, String href, String type, String id) throws XMLStreamException {
-    XMLStreamWriter xsw = getWriter();
-
-    xsw.writeStartElement(Constants.NAMESPACE_ATOM, "link");
-
-    xsw.writeAttribute("rel", rel);
-    xsw.writeAttribute("href", href);
-    if (type != null) {
-      xsw.writeAttribute("type", type);
-    }
-    if (id != null) {
-      xsw.writeAttribute(Constants.NAMESPACE_RESTATOM, "id", id);
-    }
-
-    xsw.writeEndElement();
-  }
-
-  public void writeServiceLink(String href, String repositoryId) throws XMLStreamException {
-    try {
-      writeLink(Constants.REL_SERVICE, href + "?repositoryId="
-          + URLEncoder.encode(repositoryId, "UTF-8"), Constants.MEDIATYPE_SERVICE, null);
-    }
-    catch (UnsupportedEncodingException e) {
-    }
-  }
-
-  public void writeSelfLink(String href, String id) throws XMLStreamException {
-    writeLink(Constants.REL_SELF, href, Constants.MEDIATYPE_ENTRY, id);
-  }
-
-  public void writeEnclosureLink(String href) throws XMLStreamException {
-    writeLink(Constants.REL_ENCLOSURE, href, Constants.MEDIATYPE_ENTRY, null);
-  }
-
-  public void writeEditLink(String href) throws XMLStreamException {
-    writeLink(Constants.REL_EDIT, href, Constants.MEDIATYPE_ENTRY, null);
-  }
-
-  public void writeAlternateLink(String href, String type, String kind, String title,
-      BigInteger length) throws XMLStreamException {
-    XMLStreamWriter xsw = getWriter();
-
-    xsw.writeStartElement(Constants.NAMESPACE_ATOM, "link");
-
-    xsw.writeAttribute("rel", Constants.REL_ALTERNATE);
-    xsw.writeAttribute("href", href);
-    if (type != null) {
-      xsw.writeAttribute("type", type);
-    }
-    if (kind != null) {
-      xsw.writeAttribute(Constants.NAMESPACE_RESTATOM, "renditionKind", kind);
-    }
-    if (title != null) {
-      xsw.writeAttribute("title", title);
-    }
-    if (length != null) {
-      xsw.writeAttribute("length", length.toString());
-    }
-
-    xsw.writeEndElement();
-  }
-
-  public void writeWorkingCopyLink(String href) throws XMLStreamException {
-    writeLink(Constants.REL_WORKINGCOPY, href, Constants.MEDIATYPE_ENTRY, null);
-  }
-
-  public void writeUpLink(String href, String type) throws XMLStreamException {
-    writeLink(Constants.REL_UP, href, type, null);
-  }
-
-  public void writeDownLink(String href, String type) throws XMLStreamException {
-    writeLink(Constants.REL_DOWN, href, type, null);
-  }
-
-  public void writeVersionHistoryLink(String href) throws XMLStreamException {
-    writeLink(Constants.REL_VERSIONHISTORY, href, Constants.MEDIATYPE_FEED, null);
-  }
-
-  public void writeCurrentVerionsLink(String href) throws XMLStreamException {
-    writeLink(Constants.REL_CURRENTVERSION, href, Constants.MEDIATYPE_ENTRY, null);
-  }
-
-  public void writeEditMediaLink(String href, String type) throws XMLStreamException {
-    writeLink(Constants.REL_EDITMEDIA, href, type, null);
-  }
-
-  public void writeDescribedByLink(String href) throws XMLStreamException {
-    writeLink(Constants.REL_DESCRIBEDBY, href, Constants.MEDIATYPE_ENTRY, null);
-  }
-
-  public void writeAllowableActionsLink(String href) throws XMLStreamException {
-    writeLink(Constants.REL_ALLOWABLEACTIONS, href, Constants.MEDIATYPE_ALLOWABLEACTION, null);
-  }
-
-  public void writeAclLink(String href) throws XMLStreamException {
-    writeLink(Constants.REL_ACL, href, Constants.MEDIATYPE_ACL, null);
-  }
-
-  public void writePoliciesLink(String href) throws XMLStreamException {
-    writeLink(Constants.REL_POLICIES, href, Constants.MEDIATYPE_FEED, null);
-  }
-
-  public void writeRelationshipsLink(String href) throws XMLStreamException {
-    writeLink(Constants.REL_RELATIONSHIPS, href, Constants.MEDIATYPE_FEED, null);
-  }
-
-  public void writeRelationshipSourceLink(String href) throws XMLStreamException {
-    writeLink(Constants.REL_SOURCE, href, Constants.MEDIATYPE_ENTRY, null);
-  }
-
-  public void writeRelationshipTargetLink(String href) throws XMLStreamException {
-    writeLink(Constants.REL_TARGET, href, Constants.MEDIATYPE_ENTRY, null);
-  }
-
-  public void writeFolderTreeLink(String href) throws XMLStreamException {
-    writeLink(Constants.REL_FOLDERTREE, href, Constants.MEDIATYPE_DESCENDANTS, null);
-  }
-
-  public void writeTypeUpLink(String href, String type) throws XMLStreamException {
-    writeLink(Constants.REL_UP, href, type, null);
-  }
-
-  public void writeTypeDownLink(String href, String type) throws XMLStreamException {
-    writeLink(Constants.REL_DOWN, href, type, null);
-  }
-
-  public void writeViaLink(String href) throws XMLStreamException {
-    writeLink(Constants.REL_VIA, href, Constants.MEDIATYPE_ENTRY, null);
-  }
-
-  public void writeFirstLink(String href) throws XMLStreamException {
-    writeLink(Constants.REL_FIRST, href, Constants.MEDIATYPE_FEED, null);
-  }
-
-  public void writeLastLink(String href) throws XMLStreamException {
-    writeLink(Constants.REL_LAST, href, Constants.MEDIATYPE_FEED, null);
-  }
-
-  public void writePreviousLink(String href) throws XMLStreamException {
-    writeLink(Constants.REL_PREV, href, Constants.MEDIATYPE_FEED, null);
-  }
-
-  public void writeNextLink(String href) throws XMLStreamException {
-    writeLink(Constants.REL_NEXT, href, Constants.MEDIATYPE_FEED, null);
-  }
+	/**
+	 * Formats a DateTime.
+	 */
+	public String formatDate(long millis) {
+		if (fDateFormater == null) {
+			fDateFormater = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US);
+			fDateFormater.setTimeZone(TimeZone.getTimeZone("UTC"));
+		}
+
+		return fDateFormater.format(millis);
+	}
+
+	/**
+	 * Generates a valid Atom id.
+	 */
+	public String generateAtomId(String input) {
+		if (input == null) {
+			return ID_DUMMY;
+		}
+
+		try {
+			return ID_PREFIX + (new String(Base64.encodeBase64(input.getBytes("UTF-8"))));
+		} catch (UnsupportedEncodingException e) {
+			return ID_DUMMY;
+		}
+	}
+
+	/**
+	 * Writes a simple tag.
+	 */
+	public void writeSimpleTag(String namespace, String name, String value) throws XMLStreamException {
+		if (value == null) {
+			return;
+		}
+
+		XMLStreamWriter xsw = getWriter();
+
+		xsw.writeStartElement(namespace, name);
+		xsw.writeCharacters(value);
+		xsw.writeEndElement();
+	}
+
+	/**
+	 * Writes a simple date tag.
+	 */
+	public void writeSimpleDate(String namespace, String name, GregorianCalendar value) throws XMLStreamException {
+		if (value == null) {
+			return;
+		}
+
+		writeSimpleTag(namespace, name, formatDate(value.getTimeInMillis()));
+	}
+
+	/**
+	 * Writes a simple date tag.
+	 */
+	public void writeSimpleDate(String namespace, String name, long millis) throws XMLStreamException {
+		writeSimpleTag(namespace, name, formatDate(millis));
+	}
+
+	/**
+	 * Writes an Atom id tag.
+	 */
+	public void writeId(String id) throws XMLStreamException {
+		writeSimpleTag(Constants.NAMESPACE_ATOM, "id", id);
+	}
+
+	/**
+	 * Writes an Atom title tag.
+	 */
+	public void writeTitle(String title) throws XMLStreamException {
+		writeSimpleTag(Constants.NAMESPACE_ATOM, "title", title);
+	}
+
+	/**
+	 * Writes an Atom author tag.
+	 */
+	public void writeAuthor(String author) throws XMLStreamException {
+		XMLStreamWriter xsw = getWriter();
+
+		xsw.writeStartElement(Constants.NAMESPACE_ATOM, "author");
+		writeSimpleTag(Constants.NAMESPACE_ATOM, "name", author);
+		xsw.writeEndElement();
+	}
+
+	/**
+	 * Writes an Atom updated tag.
+	 */
+	public void writeUpdated(GregorianCalendar updated) throws XMLStreamException {
+		writeSimpleDate(Constants.NAMESPACE_APP, "edited", updated);
+		writeSimpleDate(Constants.NAMESPACE_ATOM, "updated", updated);
+	}
+
+	/**
+	 * Writes an Atom updated tag.
+	 */
+	public void writeUpdated(long updated) throws XMLStreamException {
+		writeSimpleDate(Constants.NAMESPACE_APP, "edited", updated);
+		writeSimpleDate(Constants.NAMESPACE_ATOM, "updated", updated);
+	}
+
+	/**
+	 * Writes an Atom published tag.
+	 */
+	public void writePublished(GregorianCalendar published) throws XMLStreamException {
+		writeSimpleDate(Constants.NAMESPACE_ATOM, "published", published);
+	}
+
+	/**
+	 * Writes an Atom published tag.
+	 */
+	public void writePublished(long published) throws XMLStreamException {
+		writeSimpleDate(Constants.NAMESPACE_ATOM, "published", published);
+	}
+
+	/**
+	 * Writes a CMIS pathSegment tag.
+	 */
+	public void writePathSegment(String pathSegment) throws XMLStreamException {
+		writeSimpleTag(Constants.NAMESPACE_RESTATOM, "pathSegment", pathSegment);
+	}
+
+	/**
+	 * Writes a CMIS relativePathSegment tag.
+	 */
+	public void writeRelativePathSegment(String relativePathSegment) throws XMLStreamException {
+		writeSimpleTag(Constants.NAMESPACE_RESTATOM, "relativePathSegment", relativePathSegment);
+	}
+
+	/**
+	 * Writes an Atom collection.
+	 */
+	public void writeCollection(String href, String collectionType, String text, String... accept)
+			throws XMLStreamException {
+		XMLStreamWriter xsw = getWriter();
+
+		xsw.writeStartElement(Constants.NAMESPACE_APP, "collection");
+		xsw.writeAttribute("href", href);
+
+		if (collectionType != null) {
+			xsw.writeStartElement(Constants.NAMESPACE_RESTATOM, "collectionType");
+			xsw.writeCharacters(collectionType);
+			xsw.writeEndElement();
+		}
+
+		xsw.writeStartElement(Constants.NAMESPACE_ATOM, "title");
+		xsw.writeAttribute("type", "text");
+		xsw.writeCharacters(text);
+		xsw.writeEndElement();
+
+		for (String ct : accept) {
+			xsw.writeStartElement(Constants.NAMESPACE_APP, "accept");
+			xsw.writeCharacters(ct);
+			xsw.writeEndElement();
+		}
+
+		xsw.writeEndElement();
+	}
+
+	/**
+	 * Writes a link.
+	 */
+	public void writeLink(String rel, String href, String type, String id) throws XMLStreamException {
+		XMLStreamWriter xsw = getWriter();
+
+		xsw.writeStartElement(Constants.NAMESPACE_ATOM, "link");
+
+		xsw.writeAttribute("rel", rel);
+		xsw.writeAttribute("href", href);
+		if (type != null) {
+			xsw.writeAttribute("type", type);
+		}
+		if (id != null) {
+			xsw.writeAttribute(Constants.NAMESPACE_RESTATOM, "id", id);
+		}
+
+		xsw.writeEndElement();
+	}
+
+	public void writeServiceLink(String href, String repositoryId) throws XMLStreamException {
+		try {
+			writeLink(Constants.REL_SERVICE, href + "?repositoryId=" + URLEncoder.encode(repositoryId, "UTF-8"),
+					Constants.MEDIATYPE_SERVICE, null);
+		} catch (UnsupportedEncodingException e) {
+		}
+	}
+
+	public void writeSelfLink(String href, String id) throws XMLStreamException {
+		writeLink(Constants.REL_SELF, href, Constants.MEDIATYPE_ENTRY, id);
+	}
+
+	public void writeEnclosureLink(String href) throws XMLStreamException {
+		writeLink(Constants.REL_ENCLOSURE, href, Constants.MEDIATYPE_ENTRY, null);
+	}
+
+	public void writeEditLink(String href) throws XMLStreamException {
+		writeLink(Constants.REL_EDIT, href, Constants.MEDIATYPE_ENTRY, null);
+	}
+
+	public void writeAlternateLink(String href, String type, String kind, String title, BigInteger length)
+			throws XMLStreamException {
+		XMLStreamWriter xsw = getWriter();
+
+		xsw.writeStartElement(Constants.NAMESPACE_ATOM, "link");
+
+		xsw.writeAttribute("rel", Constants.REL_ALTERNATE);
+		xsw.writeAttribute("href", href);
+		if (type != null) {
+			xsw.writeAttribute("type", type);
+		}
+		if (kind != null) {
+			xsw.writeAttribute(Constants.NAMESPACE_RESTATOM, "renditionKind", kind);
+		}
+		if (title != null) {
+			xsw.writeAttribute("title", title);
+		}
+		if (length != null) {
+			xsw.writeAttribute("length", length.toString());
+		}
+
+		xsw.writeEndElement();
+	}
+
+	public void writeWorkingCopyLink(String href) throws XMLStreamException {
+		writeLink(Constants.REL_WORKINGCOPY, href, Constants.MEDIATYPE_ENTRY, null);
+	}
+
+	public void writeUpLink(String href, String type) throws XMLStreamException {
+		writeLink(Constants.REL_UP, href, type, null);
+	}
+
+	public void writeDownLink(String href, String type) throws XMLStreamException {
+		writeLink(Constants.REL_DOWN, href, type, null);
+	}
+
+	public void writeVersionHistoryLink(String href) throws XMLStreamException {
+		writeLink(Constants.REL_VERSIONHISTORY, href, Constants.MEDIATYPE_FEED, null);
+	}
+
+	public void writeCurrentVerionsLink(String href) throws XMLStreamException {
+		writeLink(Constants.REL_CURRENTVERSION, href, Constants.MEDIATYPE_ENTRY, null);
+	}
+
+	public void writeEditMediaLink(String href, String type) throws XMLStreamException {
+		writeLink(Constants.REL_EDITMEDIA, href, type, null);
+	}
+
+	public void writeDescribedByLink(String href) throws XMLStreamException {
+		writeLink(Constants.REL_DESCRIBEDBY, href, Constants.MEDIATYPE_ENTRY, null);
+	}
+
+	public void writeAllowableActionsLink(String href) throws XMLStreamException {
+		writeLink(Constants.REL_ALLOWABLEACTIONS, href, Constants.MEDIATYPE_ALLOWABLEACTION, null);
+	}
+
+	public void writeAclLink(String href) throws XMLStreamException {
+		writeLink(Constants.REL_ACL, href, Constants.MEDIATYPE_ACL, null);
+	}
+
+	public void writePoliciesLink(String href) throws XMLStreamException {
+		writeLink(Constants.REL_POLICIES, href, Constants.MEDIATYPE_FEED, null);
+	}
+
+	public void writeRelationshipsLink(String href) throws XMLStreamException {
+		writeLink(Constants.REL_RELATIONSHIPS, href, Constants.MEDIATYPE_FEED, null);
+	}
+
+	public void writeRelationshipSourceLink(String href) throws XMLStreamException {
+		writeLink(Constants.REL_SOURCE, href, Constants.MEDIATYPE_ENTRY, null);
+	}
+
+	public void writeRelationshipTargetLink(String href) throws XMLStreamException {
+		writeLink(Constants.REL_TARGET, href, Constants.MEDIATYPE_ENTRY, null);
+	}
+
+	public void writeFolderTreeLink(String href) throws XMLStreamException {
+		writeLink(Constants.REL_FOLDERTREE, href, Constants.MEDIATYPE_DESCENDANTS, null);
+	}
+
+	public void writeTypeUpLink(String href, String type) throws XMLStreamException {
+		writeLink(Constants.REL_UP, href, type, null);
+	}
+
+	public void writeTypeDownLink(String href, String type) throws XMLStreamException {
+		writeLink(Constants.REL_DOWN, href, type, null);
+	}
+
+	public void writeViaLink(String href) throws XMLStreamException {
+		writeLink(Constants.REL_VIA, href, Constants.MEDIATYPE_ENTRY, null);
+	}
+
+	public void writeFirstLink(String href) throws XMLStreamException {
+		writeLink(Constants.REL_FIRST, href, Constants.MEDIATYPE_FEED, null);
+	}
+
+	public void writeLastLink(String href) throws XMLStreamException {
+		writeLink(Constants.REL_LAST, href, Constants.MEDIATYPE_FEED, null);
+	}
+
+	public void writePreviousLink(String href) throws XMLStreamException {
+		writeLink(Constants.REL_PREV, href, Constants.MEDIATYPE_FEED, null);
+	}
+
+	public void writeNextLink(String href) throws XMLStreamException {
+		writeLink(Constants.REL_NEXT, href, Constants.MEDIATYPE_FEED, null);
+	}
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntry.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntry.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntry.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntry.java Fri Apr 16 14:14:00 2010
@@ -40,106 +40,103 @@ import org.apache.chemistry.opencmis.ser
  */
 public class AtomEntry extends AtomDocumentBase {
 
-  private final static String DEFAULT_AUTHOR = "unknown";
+	private final static String DEFAULT_AUTHOR = "unknown";
 
-  /**
-   * Creates an Atom entry document.
-   */
-  public AtomEntry() {
-  }
-
-  /**
-   * Creates an Atom entry that is embedded somewhere.
-   */
-  public AtomEntry(XMLStreamWriter writer) {
-    setWriter(writer);
-  }
-
-  /**
-   * Opens the entry tag.
-   */
-  public void startEntry(boolean isRoot) throws XMLStreamException {
-    getWriter().writeStartElement(Constants.NAMESPACE_ATOM, "entry");
-
-    if (isRoot) {
-      writeNamespace(Constants.NAMESPACE_ATOM);
-      writeNamespace(Constants.NAMESPACE_CMIS);
-      writeNamespace(Constants.NAMESPACE_RESTATOM);
-      writeNamespace(Constants.NAMESPACE_APP);
-    }
-  }
-
-  /**
-   * Closes the entry tag.
-   */
-  public void endEntry() throws XMLStreamException {
-    getWriter().writeEndElement();
-  }
-
-  /**
-   * Writes an object.
-   */
-  public void writeObject(ObjectData object, ObjectInfo info, String contentSrc,
-      String contentType, String pathSegment, String relativePathSegment)
-      throws XMLStreamException, JAXBException {
-    CmisObjectType objectJaxb = convert(object);
-    if (objectJaxb == null) {
-      return;
-    }
-
-    writeAuthor(info.getCreatedBy());
-    writeId(generateAtomId(info.getId()));
-    writePublished(info.getCreationDate());
-    writeTitle(info.getName());
-    writeUpdated(info.getLastModificationDate());
-
-    writeContent(contentSrc, contentType);
-
-    JaxBHelper.marshal(JaxBHelper.CMIS_EXTRA_OBJECT_FACTORY.createObject(objectJaxb), getWriter(),
-        true);
-
-    writePathSegment(pathSegment);
-    writeRelativePathSegment(relativePathSegment);
-  }
-
-  /**
-   * Writes a type.
-   * 
-   * @throws JAXBException
-   */
-  public void writeType(TypeDefinition type) throws XMLStreamException, JAXBException {
-    CmisTypeDefinitionType typeJaxb = convert(type);
-    if (typeJaxb == null) {
-      return;
-    }
-
-    long now = System.currentTimeMillis();
-
-    writeAuthor(DEFAULT_AUTHOR);
-    writeId(generateAtomId(type.getId()));
-    writeTitle(type.getDisplayName());
-    writeUpdated(now);
-
-    JaxBHelper.marshal(JaxBHelper.CMIS_EXTRA_OBJECT_FACTORY.createTypeDefinition(typeJaxb),
-        getWriter(), true);
-  }
-
-  /**
-   * Writes a content tag.
-   */
-  public void writeContent(String src, String type) throws XMLStreamException {
-    if (src == null) {
-      return;
-    }
-
-    XMLStreamWriter xsw = getWriter();
-    xsw.writeStartElement(Constants.NAMESPACE_ATOM, "content");
-
-    xsw.writeAttribute("src", src);
-    if (type != null) {
-      xsw.writeAttribute("type", type);
-    }
+	/**
+	 * Creates an Atom entry document.
+	 */
+	public AtomEntry() {
+	}
+
+	/**
+	 * Creates an Atom entry that is embedded somewhere.
+	 */
+	public AtomEntry(XMLStreamWriter writer) {
+		setWriter(writer);
+	}
+
+	/**
+	 * Opens the entry tag.
+	 */
+	public void startEntry(boolean isRoot) throws XMLStreamException {
+		getWriter().writeStartElement(Constants.NAMESPACE_ATOM, "entry");
+
+		if (isRoot) {
+			writeNamespace(Constants.NAMESPACE_ATOM);
+			writeNamespace(Constants.NAMESPACE_CMIS);
+			writeNamespace(Constants.NAMESPACE_RESTATOM);
+			writeNamespace(Constants.NAMESPACE_APP);
+		}
+	}
+
+	/**
+	 * Closes the entry tag.
+	 */
+	public void endEntry() throws XMLStreamException {
+		getWriter().writeEndElement();
+	}
+
+	/**
+	 * Writes an object.
+	 */
+	public void writeObject(ObjectData object, ObjectInfo info, String contentSrc, String contentType,
+			String pathSegment, String relativePathSegment) throws XMLStreamException, JAXBException {
+		CmisObjectType objectJaxb = convert(object);
+		if (objectJaxb == null) {
+			return;
+		}
+
+		writeAuthor(info.getCreatedBy());
+		writeId(generateAtomId(info.getId()));
+		writePublished(info.getCreationDate());
+		writeTitle(info.getName());
+		writeUpdated(info.getLastModificationDate());
+
+		writeContent(contentSrc, contentType);
+
+		JaxBHelper.marshal(JaxBHelper.CMIS_EXTRA_OBJECT_FACTORY.createObject(objectJaxb), getWriter(), true);
+
+		writePathSegment(pathSegment);
+		writeRelativePathSegment(relativePathSegment);
+	}
+
+	/**
+	 * Writes a type.
+	 * 
+	 * @throws JAXBException
+	 */
+	public void writeType(TypeDefinition type) throws XMLStreamException, JAXBException {
+		CmisTypeDefinitionType typeJaxb = convert(type);
+		if (typeJaxb == null) {
+			return;
+		}
+
+		long now = System.currentTimeMillis();
+
+		writeAuthor(DEFAULT_AUTHOR);
+		writeId(generateAtomId(type.getId()));
+		writeTitle(type.getDisplayName());
+		writeUpdated(now);
+
+		JaxBHelper.marshal(JaxBHelper.CMIS_EXTRA_OBJECT_FACTORY.createTypeDefinition(typeJaxb), getWriter(), true);
+	}
+
+	/**
+	 * Writes a content tag.
+	 */
+	public void writeContent(String src, String type) throws XMLStreamException {
+		if (src == null) {
+			return;
+		}
+
+		XMLStreamWriter xsw = getWriter();
+		xsw.writeStartElement(Constants.NAMESPACE_ATOM, "content");
+
+		xsw.writeAttribute("src", src);
+		if (type != null) {
+			xsw.writeAttribute("type", type);
+		}
 
-    xsw.writeEndElement();
-  }
+		xsw.writeEndElement();
+	}
 }



Mime
View raw message