Author: dpfister
Date: Tue May  5 14:55:42 2009
New Revision: 771763

URL: http://svn.apache.org/viewvc?rev=771763&view=rev
Log:
Bad formatting

Modified:
    
incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrConnection.java
    
incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewDocument.java
    
incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrObjectEntry.java
    
incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrRepository.java

Modified: 
incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrConnection.java
URL: 
http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrConnection.java?rev=771763&r1=771762&r2=771763&view=diff
==============================================================================
--- 
incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrConnection.java
 (original)
+++ 
incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrConnection.java
 Tue May  5 14:55:42 2009
@@ -239,21 +239,22 @@
                                  VersioningState versioningState) {
 
        try {
-               JcrFolder folder = (JcrFolder) getObject(folderId, 
ReturnVersion.LATEST);
-               Document doc = folder.newDocument(null);
-               doc.setValues(properties);
-               if (contentStream != null) {
-                       doc.setName(contentStream.getFilename());
-                       doc.setValue("title", contentStream.getFilename());
-                       doc.setContentStream(contentStream);
-               }
-               doc.save();
-               return doc.getId();
-       } catch (IOException e) {
-               String msg = "Unable to create document.";
-               log.error(msg, e);
-       }
-       return null;
+            JcrFolder folder = (JcrFolder) getObject(folderId,
+                    ReturnVersion.LATEST);
+            Document doc = folder.newDocument(null);
+            doc.setValues(properties);
+            if (contentStream != null) {
+                doc.setName(contentStream.getFilename());
+                doc.setValue("title", contentStream.getFilename());
+                doc.setContentStream(contentStream);
+            }
+            doc.save();
+            return doc.getId();
+        } catch (IOException e) {
+            String msg = "Unable to create document.";
+            log.error(msg, e);
+        }
+        return null;
     }
 
     public String createFolder(String typeId,

Modified: 
incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewDocument.java
URL: 
http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewDocument.java?rev=771763&r1=771762&r2=771763&view=diff
==============================================================================
--- 
incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewDocument.java
 (original)
+++ 
incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewDocument.java
 Tue May  5 14:55:42 2009
@@ -89,8 +89,8 @@
             if (name == null) {
                Serializable val = getValue("title");
                if (val != null) {
-                       name = val.toString();
-               }
+                    name = val.toString();
+                }
             }
             if (name == null) {
                name = "unnamed";

Modified: 
incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrObjectEntry.java
URL: 
http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrObjectEntry.java?rev=771763&r1=771762&r2=771763&view=diff
==============================================================================
--- 
incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrObjectEntry.java
 (original)
+++ 
incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrObjectEntry.java
 Tue May  5 14:55:42 2009
@@ -275,16 +275,16 @@
         // TODO return other virtual properties and provide helper class
         properties.put(Property.TYPE_ID, new Property() {
 
-                       public PropertyDefinition getDefinition() {
-                               return PROP_TYPE_ID;
-                       }
-
-                       public Serializable getValue() {
-                               return getTypeId();
-                       }
+            public PropertyDefinition getDefinition() {
+                return PROP_TYPE_ID;
+            }
+
+            public Serializable getValue() {
+                return getTypeId();
+            }
 
-                       public void setValue(Serializable value) {
-                       }
+            public void setValue(Serializable value) {
+            }
         });
         return properties;
     }
@@ -368,12 +368,12 @@
 
     public Serializable getValue(String name) {
         try {
-               if (node.hasProperty(name)) {
-                   Value value = node.getProperty(name).getValue();
-                   if (value instanceof Serializable) {
-                       return (Serializable) value;
-                   }
-               }
+            if (node.hasProperty(name)) {
+                Value value = node.getProperty(name).getValue();
+                if (value instanceof Serializable) {
+                    return (Serializable) value;
+                }
+            }
         } catch (PathNotFoundException e) {
             /* property does not exist */
         } catch (RepositoryException e) {

Modified: 
incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrRepository.java
URL: 
http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrRepository.java?rev=771763&r1=771762&r2=771763&view=diff
==============================================================================
--- 
incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrRepository.java
 (original)
+++ 
incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrRepository.java
 Tue May  5 14:55:42 2009
@@ -41,6 +41,7 @@
 import org.apache.chemistry.type.Type;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.JcrConstants;
 import org.w3c.dom.Document;
 
 public class JcrRepository implements Repository, RepositoryInfo,
@@ -81,24 +82,25 @@
 
     public Type getType(String typeId) {
        try {
-               // TODO pass credentials as parameters
-               SimpleCredentials creds = new SimpleCredentials("admin", 
"admin".toCharArray());
-
-               Session session = repository.login(creds, workspace);
-
-               // TODO fetch the types only once, include other types
-               NodeTypeManager ntmgr = 
session.getWorkspace().getNodeTypeManager();
-               NodeType nt = ntmgr.getNodeType(typeId);
-
-               BaseType baseType = BaseType.FOLDER;
-               if (nt.getName().equals("nt:file")) {
-                       baseType = BaseType.DOCUMENT;
-               }
-               return new JcrType(nt, baseType);
-       } catch (RepositoryException e) {
-               String msg = "Unable get type: " + typeId;
-               log.error(msg, e);
-       }
+            // TODO pass credentials as parameters
+            SimpleCredentials creds = new SimpleCredentials("admin", "admin"
+                    .toCharArray());
+
+            Session session = repository.login(creds, workspace);
+
+            // TODO fetch the types only once, include other types
+            NodeTypeManager ntmgr = 
session.getWorkspace().getNodeTypeManager();
+            NodeType nt = ntmgr.getNodeType(typeId);
+
+            BaseType baseType = BaseType.FOLDER;
+            if (nt.getName().equals(JcrConstants.NT_FILE)) {
+                baseType = BaseType.DOCUMENT;
+            }
+            return new JcrType(nt, baseType);
+        } catch (RepositoryException e) {
+            String msg = "Unable get type: " + typeId;
+            log.error(msg, e);
+        }
        return null;
     }
 
@@ -112,23 +114,29 @@
                                boolean returnPropertyDefinitions, int maxItems,
                                int skipCount, boolean[] hasMoreItems) {
 
-       try {
-               // TODO pass credentials as parameters
-               SimpleCredentials creds = new SimpleCredentials("admin", 
"admin".toCharArray());
-
-               ArrayList<Type> result = new ArrayList<Type>();
+        // TODO dynamically discover and return types.
 
-               Session session = repository.login(creds, workspace);
-
-               // TODO fetch the types only once, include other types
-               NodeTypeManager ntmgr = 
session.getWorkspace().getNodeTypeManager();
-               result.add(new JcrType(ntmgr.getNodeType("rep:root"), 
BaseType.FOLDER));
-               result.add(new JcrType(ntmgr.getNodeType("nt:folder"), 
BaseType.FOLDER));
-               result.add(new JcrType(ntmgr.getNodeType("nt:file"), 
BaseType.DOCUMENT));
-               return result;
+       try {
+            // TODO pass credentials as parameters
+            SimpleCredentials creds = new SimpleCredentials("admin", "admin"
+                    .toCharArray());
+
+            ArrayList<Type> result = new ArrayList<Type>();
+
+            Session session = repository.login(creds, workspace);
+
+            // TODO fetch the types only once, include other types
+            NodeTypeManager ntmgr = 
session.getWorkspace().getNodeTypeManager();
+            result.add(new JcrType(ntmgr.getNodeType("rep:root"),
+                    BaseType.FOLDER));
+            result.add(new JcrType(ntmgr.getNodeType(JcrConstants.NT_FOLDER),
+                    BaseType.FOLDER));
+            result.add(new JcrType(ntmgr.getNodeType(JcrConstants.NT_FILE),
+                    BaseType.DOCUMENT));
+            return result;
        } catch (RepositoryException e) {
                String msg = "Unable to retrieve node types.";
-               log.error(msg, e);
+            log.error(msg, e);
        }
         return null;
     }


Reply via email to