usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [31/33] incubator-usergrid git commit: Merge branch 'two-dot-o' into two-dot-o-dev
Date Wed, 10 Jun 2015 18:59:06 GMT
Merge branch 'two-dot-o' into two-dot-o-dev

Conflicts:
	stack/java-sdk-old/pom.xml
	stack/rest/src/test/resources/log4j.properties
	stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
	stack/services/src/main/java/org/apache/usergrid/services/assets/data/LocalFileBinaryStore.java


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/3d5bf6fc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/3d5bf6fc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/3d5bf6fc

Branch: refs/heads/two-dot-o-dev
Commit: 3d5bf6fcc5d31c5ab03ee0bc85adfdc76eaf4ee1
Parents: 05f8172 d8fdc3a
Author: Dave Johnson <dmjohnson@apigee.com>
Authored: Wed Jun 10 13:45:09 2015 -0400
Committer: Dave Johnson <dmjohnson@apigee.com>
Committed: Wed Jun 10 13:45:09 2015 -0400

----------------------------------------------------------------------
 .usergridversion                                |   1 -
 CHANGELOG                                       |  28 +-
 LICENSE                                         |  55 ++-
 NOTICE                                          |  13 +-
 stack/java-sdk-old/pom.xml                      | 102 +++++
 .../applications/assets/AssetResourceIT.java    |  13 +-
 stack/rest/src/test/resources/log4j.properties  |   6 +-
 .../usergrid/management/ManagementService.java  |   5 +-
 .../cassandra/ManagementServiceImpl.java        |  49 ++-
 .../assets/data/LocalFileBinaryStore.java       |  67 +--
 stack/tools/pom.xml                             |  18 +-
 .../org/apache/usergrid/tools/ExportAdmins.java | 154 ++++---
 .../org/apache/usergrid/tools/ImportAdmins.java | 412 +++++++++----------
 .../org/apache/usergrid/tools/ToolBase.java     |  10 +-
 stack/tools/src/main/resources/log4j.properties |  19 +
 .../usergrid/tools/ExportImportAdminsTest.java  | 234 +++++++++++
 ...adata.usergrid-management.1433331614293.json |  85 ++++
 ...users.usergrid-management.1433331614293.json |  23 ++
 18 files changed, 930 insertions(+), 364 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3d5bf6fc/.usergridversion
----------------------------------------------------------------------
diff --cc .usergridversion
index 7dea76e,7dea76e..e69de29
--- a/.usergridversion
+++ b/.usergridversion
@@@ -1,1 -1,1 +1,0 @@@
--1.0.1

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3d5bf6fc/stack/rest/src/test/java/org/apache/usergrid/rest/applications/assets/AssetResourceIT.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3d5bf6fc/stack/rest/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --cc stack/rest/src/test/resources/log4j.properties
index e0aa09d,4d3d764..ab700af
--- a/stack/rest/src/test/resources/log4j.properties
+++ b/stack/rest/src/test/resources/log4j.properties
@@@ -26,10 -26,15 +26,12 @@@ log4j.appender.stdout=org.apache.log4j.
  log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
  log4j.appender.stdout.layout.ConversionPattern=%d %p (%t) %c{1} - %m%n
  
- log4j.logger.org.apache.usergrid=ERROR
- log4j.logger.org.apache.usergrid.setup=DEBUG
 -<<<<<<< HEAD
+ log4j.logger.org.apache.usergrid=INFO
  #log4j.logger.org.apache.usergrid.cassandra=DEBUG
  #log4j.logger.org.apache.usergrid.persistence.cassandra=DEBUG
 -=======
+ log4j.category.org.apache=ERROR, stdout
+ log4j.category.org.apache.usergrid=WARN, stdout
+ log4j.category.org.apache.usergrid.rest=INFO, stdout
 ->>>>>>> master
  
  log4j.logger.org.apache.usergrid.persistence.cassandra.CounterUtils=ERROR, stdout
  log4j.logger.org.apache.usergrid.persistence.cassandra.DB=WARN, stdout

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3d5bf6fc/stack/services/src/main/java/org/apache/usergrid/management/ManagementService.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3d5bf6fc/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
----------------------------------------------------------------------
diff --cc stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
index 109895e,2f5f7d0..5c4262d
--- a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
+++ b/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
@@@ -537,10 -554,16 +537,16 @@@ public class ManagementServiceImpl impl
  
          Group organizationEntity = new Group();
          organizationEntity.setPath( organizationName );
-         organizationEntity = em.create( organizationEntity );
+ 
+         if ( orgUuid == null ) {
+             organizationEntity = em.create( organizationEntity );
+         } else {
+             em.create( orgUuid, Group.ENTITY_TYPE, organizationEntity.getProperties() );
+             organizationEntity = em.get( orgUuid, Group.class );
+         }
  
          em.addToCollection( organizationEntity, "users", new SimpleEntityRef( User.ENTITY_TYPE,
user.getUuid() ) );
 -
 +//        em.addToCollection( new SimpleEntityRef( User.ENTITY_TYPE, user.getUuid() ), Schema.COLLECTION_GROUPS,
organizationEntity );
  
          writeUserToken( smf.getManagementAppId(), organizationEntity, encryptionService
                  .plainTextCredentials( generateOAuthSecretKey( AuthPrincipalType.ORGANIZATION
), user.getUuid(),
@@@ -1485,11 -1532,16 +1501,16 @@@
                      path = path.toLowerCase();
                  }
  
-                 organizations.put( entity.getUuid(), path );
+                 try {
+                     organizations.put( entity.getUuid(), path );
+                 } catch (IllegalArgumentException e) {
+                     logger.warn("Error adding " + entity.getUuid() + ":" + path + " to BiMap:
" + e.getMessage() );
+                 }
              }
  
 -            results = results.getNextPageResults();
 +            results = results.hasMoreResults() ? results.getNextPageResults() : null ;
-         }while(results != null);
+ 
 -        } while(results != null);
++        } while (results != null);
  
          return organizations;
      }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3d5bf6fc/stack/services/src/main/java/org/apache/usergrid/services/assets/data/LocalFileBinaryStore.java
----------------------------------------------------------------------
diff --cc stack/services/src/main/java/org/apache/usergrid/services/assets/data/LocalFileBinaryStore.java
index 0da74ad,486c500..f4cc735
--- a/stack/services/src/main/java/org/apache/usergrid/services/assets/data/LocalFileBinaryStore.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/assets/data/LocalFileBinaryStore.java
@@@ -17,22 -17,25 +17,24 @@@
  package org.apache.usergrid.services.assets.data;
  
  
 -import java.io.BufferedInputStream;
 -import java.io.File;
 -import java.io.IOException;
 -import java.io.InputStream;
 -import java.util.Map;
 -import java.util.Properties;
 -import java.util.UUID;
 -
++import org.apache.commons.io.FileUtils;
+ import org.apache.commons.lang.RandomStringUtils;
+ import org.apache.usergrid.persistence.Entity;
 -
 -import org.apache.commons.io.FileUtils;
+ import org.apache.usergrid.persistence.EntityManager;
+ import org.apache.usergrid.persistence.EntityManagerFactory;
+ import org.apache.usergrid.utils.StringUtils;
+ import org.slf4j.Logger;
+ import org.slf4j.LoggerFactory;
+ import org.springframework.beans.factory.annotation.Autowired;
+ 
 +import java.io.BufferedInputStream;
 +import java.io.File;
 +import java.io.IOException;
 +import java.io.InputStream;
 +import java.util.Map;
 +import java.util.Properties;
 +import java.util.UUID;
 +
- import org.springframework.beans.factory.annotation.Autowired;
- 
- import org.apache.usergrid.persistence.Entity;
- import org.apache.usergrid.persistence.EntityManager;
- import org.apache.usergrid.utils.StringUtils;
- 
- import org.apache.commons.io.FileUtils;
- 
  
  /** A binary store implementation using the local file system */
  public class LocalFileBinaryStore implements BinaryStore {
@@@ -42,6 -49,10 +48,9 @@@
      @Autowired
      private Properties properties;
  
+     @Autowired
+     private EntityManagerFactory emf;
+ 
 -
      /** Control where to store the file repository. In the system's temp dir by default.
*/
      public void setReposLocation( String reposLocation ) {
          this.reposLocation = reposLocation;
@@@ -80,27 -89,40 +87,35 @@@
              maxSizeBytes = Long.parseLong( maxSizeMbString ) * FileUtils.ONE_MB;
          }
  
+         // always allow files up to 5mb
+         if (maxSizeBytes < 5 * FileUtils.ONE_MB ) {
+             maxSizeBytes = 5 * FileUtils.ONE_MB;
+         }
+ 
+         EntityManager em = emf.getEntityManager( appId );
+         Map<String, Object> fileMetadata = AssetUtils.getFileMetadata( entity );
+ 
          if ( size > maxSizeBytes ) {
              try {
-                 fileMetadata.put( "error", "Asset size " + file.length()
-                     + " is larger than max size of " + maxSizeBytes );
-                 //em.update( entity );
-                 //tempFile.delete();
+                 fileMetadata.put( "error", "Asset size " + size
+                         + " is larger than max size of " + maxSizeBytes );
+                 em.update( entity );
  
              } catch ( Exception e ) {
-                 //LOG.error( "Error updating entity with error message", e);
+                 LOG.error( "Error updating entity with error message", e);
              }
- 
+             return;
          }
-         else {
-             fileMetadata.put( AssetUtils.CONTENT_LENGTH, size );
-             fileMetadata.put( AssetUtils.LAST_MODIFIED, System.currentTimeMillis() );
  
-             // if we were successful, write the mime type
-             if ( file.exists() ) {
-                 AssetMimeHandler.get().getMimeType( entity, file );
-             }
+         fileMetadata.put( AssetUtils.CONTENT_LENGTH, size );
+         fileMetadata.put( AssetUtils.LAST_MODIFIED, System.currentTimeMillis() );
+         fileMetadata.put( AssetUtils.E_TAG, RandomStringUtils.randomAlphanumeric( 10 ) );
+ 
+         try {
+             em.update( entity );
+         } catch (Exception e) {
+             throw new IOException("Unable to update entity filedata", e);
          }
 -
 -        // if we were successful, write the mime type
 -        if ( file.exists() ) {
 -            AssetMimeHandler.get().getMimeType( entity, file );
 -        }
      }
  
  


Mime
View raw message