diff --git a/account-management-db-model/pom.xml b/account-management-db-model/pom.xml
index 080915c..8b48688 100644
--- a/account-management-db-model/pom.xml
+++ b/account-management-db-model/pom.xml
@@ -1,32 +1,33 @@
-
+
-
- org.duracloud.db
- db
- 4.2.0-SNAPSHOT
- ../pom.xml
-
-
- 4.0.0
+
org.duracloud.db
- account-management-db-model
+ db
4.2.0-SNAPSHOT
- Account DB Model
+ ../pom.xml
+
+
+ 4.0.0
+ org.duracloud.db
+ account-management-db-model
+ 4.2.0-SNAPSHOT
+ Account DB Model
-
-
- org.hibernate.javax.persistence
- hibernate-jpa-2.1-api
-
+
+
+ org.hibernate.javax.persistence
+ hibernate-jpa-2.1-api
+
-
- org.springframework.security
- spring-security-core
-
+
+ org.springframework.security
+ spring-security-core
+
-
- org.apache.commons
- commons-lang3
-
-
+
+ org.apache.commons
+ commons-lang3
+
+
diff --git a/account-management-db-model/src/main/java/org/duracloud/account/db/model/AccountInfo.java b/account-management-db-model/src/main/java/org/duracloud/account/db/model/AccountInfo.java
index c207298..43922a6 100644
--- a/account-management-db-model/src/main/java/org/duracloud/account/db/model/AccountInfo.java
+++ b/account-management-db-model/src/main/java/org/duracloud/account/db/model/AccountInfo.java
@@ -8,7 +8,6 @@
package org.duracloud.account.db.model;
import java.util.Set;
-
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.EnumType;
@@ -53,7 +52,6 @@ public enum AccountStatus {
@Enumerated(EnumType.STRING)
private AccountStatus status;
-
/**
* The StorageProviderAccount which is used for primary storage
*/
@@ -64,7 +62,7 @@ public enum AccountStatus {
/**
* The StorageProviderAccounts which are used for secondary storage
*/
- @OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.ALL })
+ @OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.ALL})
@JoinColumn(name = "account_info_id", nullable = true, columnDefinition = "bigint(20)")
private Set secondaryStorageProviderAccounts;
@@ -113,7 +111,7 @@ public StorageProviderAccount getPrimaryStorageProviderAccount() {
}
public void setPrimaryStorageProviderAccount(
- StorageProviderAccount primaryStorageProviderAccount) {
+ StorageProviderAccount primaryStorageProviderAccount) {
this.primaryStorageProviderAccount = primaryStorageProviderAccount;
}
@@ -122,11 +120,10 @@ public Set getSecondaryStorageProviderAccounts() {
}
public void setSecondaryStorageProviderAccounts(
- Set secondaryStorageProviderAccounts) {
+ Set secondaryStorageProviderAccounts) {
this.secondaryStorageProviderAccounts = secondaryStorageProviderAccounts;
}
-
@Override
public int compareTo(AccountInfo o) {
return this.acctName.compareTo(o.acctName);
diff --git a/account-management-db-model/src/main/java/org/duracloud/account/db/model/AccountRights.java b/account-management-db-model/src/main/java/org/duracloud/account/db/model/AccountRights.java
index bd4470e..ae3ac58 100644
--- a/account-management-db-model/src/main/java/org/duracloud/account/db/model/AccountRights.java
+++ b/account-management-db-model/src/main/java/org/duracloud/account/db/model/AccountRights.java
@@ -8,7 +8,6 @@
package org.duracloud.account.db.model;
import java.util.Set;
-
import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
@@ -21,24 +20,24 @@
/**
* @author Erik Paulsson
- * Date: 7/10/13
+ * Date: 7/10/13
*/
@Entity
public class AccountRights extends BaseEntity {
- @ManyToOne(fetch=FetchType.EAGER, optional=false)
- @JoinColumn(name="account_id", nullable=false, columnDefinition = "bigint(20)")
+ @ManyToOne(fetch = FetchType.EAGER, optional = false)
+ @JoinColumn(name = "account_id", nullable = false, columnDefinition = "bigint(20)")
private AccountInfo account;
- @ManyToOne(fetch= FetchType.EAGER, optional=true)
- @JoinColumn(name="user_id", nullable=true, columnDefinition = "bigint(20)")
+ @ManyToOne(fetch = FetchType.EAGER, optional = true)
+ @JoinColumn(name = "user_id", nullable = true, columnDefinition = "bigint(20)")
private DuracloudUser user;
- @ElementCollection(targetClass=Role.class, fetch = FetchType.EAGER)
+ @ElementCollection(targetClass = Role.class, fetch = FetchType.EAGER)
@Enumerated(EnumType.STRING)
- @CollectionTable(name="account_rights_role",
- joinColumns=@JoinColumn(name="account_rights_id", columnDefinition = "bigint(20)"))
- @Column(name="role")
+ @CollectionTable(name = "account_rights_role",
+ joinColumns = @JoinColumn(name = "account_rights_id", columnDefinition = "bigint(20)"))
+ @Column(name = "role")
private Set roles;
public AccountInfo getAccount() {
diff --git a/account-management-db-model/src/main/java/org/duracloud/account/db/model/BaseEntity.java b/account-management-db-model/src/main/java/org/duracloud/account/db/model/BaseEntity.java
index 3c8999a..047b407 100644
--- a/account-management-db-model/src/main/java/org/duracloud/account/db/model/BaseEntity.java
+++ b/account-management-db-model/src/main/java/org/duracloud/account/db/model/BaseEntity.java
@@ -8,7 +8,6 @@
package org.duracloud.account.db.model;
import java.util.Date;
-
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
@@ -18,17 +17,16 @@
/**
* @author Erik Paulsson
- * Date: 7/10/13
+ * Date: 7/10/13
*/
@MappedSuperclass
public abstract class BaseEntity {
@Id
- @GeneratedValue(strategy=GenerationType.AUTO)
- @Column(columnDefinition="bigint(20) AUTO_INCREMENT")
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(columnDefinition = "bigint(20) AUTO_INCREMENT")
protected Long id;
-
@Version
private Date modified;
@@ -50,12 +48,18 @@ public void setModified(Date modified) {
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
BaseEntity that = (BaseEntity) o;
- if (id != null ? !id.equals(that.id) : that.id != null) return false;
+ if (id != null ? !id.equals(that.id) : that.id != null) {
+ return false;
+ }
return true;
}
diff --git a/account-management-db-model/src/main/java/org/duracloud/account/db/model/DuracloudGroup.java b/account-management-db-model/src/main/java/org/duracloud/account/db/model/DuracloudGroup.java
index bc0072a..cdc97fe 100644
--- a/account-management-db-model/src/main/java/org/duracloud/account/db/model/DuracloudGroup.java
+++ b/account-management-db-model/src/main/java/org/duracloud/account/db/model/DuracloudGroup.java
@@ -8,7 +8,6 @@
package org.duracloud.account.db.model;
import java.util.Set;
-
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
@@ -18,7 +17,7 @@
/**
* @author Erik Paulsson
- * Date: 7/10/13
+ * Date: 7/10/13
*/
@Entity
public class DuracloudGroup extends BaseEntity {
@@ -28,14 +27,16 @@ public class DuracloudGroup extends BaseEntity {
private String name;
- @ManyToMany(fetch=FetchType.EAGER)
- @JoinTable(name="group_user",
- joinColumns=@JoinColumn(name="group_id", referencedColumnName="id", columnDefinition = "bigint(20)"),
- inverseJoinColumns=@JoinColumn(name="user_id", referencedColumnName="id", columnDefinition = "bigint(20)"))
+ @ManyToMany(fetch = FetchType.EAGER)
+ @JoinTable(name = "group_user",
+ joinColumns = @JoinColumn(name = "group_id", referencedColumnName = "id",
+ columnDefinition = "bigint(20)"),
+ inverseJoinColumns = @JoinColumn(name = "user_id", referencedColumnName = "id",
+ columnDefinition = "bigint(20)"))
private Set users;
- @ManyToOne(fetch=FetchType.LAZY, optional=false)
- @JoinColumn(name="account_id", nullable=false, columnDefinition = "bigint(20)")
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
+ @JoinColumn(name = "account_id", nullable = false, columnDefinition = "bigint(20)")
private AccountInfo account;
public String getName() {
@@ -45,9 +46,9 @@ public String getName() {
public void setName(String name) {
this.name = name;
}
-
- public String getPrettyName(){
- return this.name.substring(this.name.indexOf(PREFIX)+PREFIX.length());
+
+ public String getPrettyName() {
+ return this.name.substring(this.name.indexOf(PREFIX) + PREFIX.length());
}
public Set getUsers() {
diff --git a/account-management-db-model/src/main/java/org/duracloud/account/db/model/DuracloudMill.java b/account-management-db-model/src/main/java/org/duracloud/account/db/model/DuracloudMill.java
index d3f4bc6..4ec1f34 100644
--- a/account-management-db-model/src/main/java/org/duracloud/account/db/model/DuracloudMill.java
+++ b/account-management-db-model/src/main/java/org/duracloud/account/db/model/DuracloudMill.java
@@ -12,68 +12,81 @@
/**
* Contains basic configuration information for interacting with the Duracloud Mill.
+ *
* @author Daniel Bernstein
- * Date: 05/06/2015
+ * Date: 05/06/2015
*/
@Entity
public class DuracloudMill extends BaseEntity {
- @Column(nullable=false)
+ @Column(nullable = false)
private String dbName;
- @Column(nullable=false)
+ @Column(nullable = false)
private String dbHost;
- @Column(nullable=false)
+ @Column(nullable = false)
private Integer dbPort;
- @Column(nullable=false)
+ @Column(nullable = false)
private String dbUsername;
- @Column(nullable=false)
+ @Column(nullable = false)
private String dbPassword;
- @Column(nullable=false)
+ @Column(nullable = false)
private String auditQueue;
- @Column(nullable=false)
+ @Column(nullable = false)
private String auditLogSpaceId;
-
+
public String getDbName() {
return dbName;
}
+
public void setDbName(String dbName) {
this.dbName = dbName;
}
+
public String getDbHost() {
return dbHost;
}
+
public void setDbHost(String dbHost) {
this.dbHost = dbHost;
}
+
public Integer getDbPort() {
return dbPort;
}
+
public void setDbPort(Integer dbPort) {
this.dbPort = dbPort;
}
+
public String getDbUsername() {
return dbUsername;
}
+
public void setDbUsername(String dbUsername) {
this.dbUsername = dbUsername;
}
+
public String getDbPassword() {
return dbPassword;
}
+
public void setDbPassword(String dbPassword) {
this.dbPassword = dbPassword;
}
+
public String getAuditQueue() {
return auditQueue;
}
+
public void setAuditQueue(String auditQueue) {
this.auditQueue = auditQueue;
}
+
public String getAuditLogSpaceId() {
return auditLogSpaceId;
}
+
public void setAuditLogSpaceId(String auditLogSpaceId) {
this.auditLogSpaceId = auditLogSpaceId;
}
-
-
+
}
diff --git a/account-management-db-model/src/main/java/org/duracloud/account/db/model/DuracloudUser.java b/account-management-db-model/src/main/java/org/duracloud/account/db/model/DuracloudUser.java
index 3dd6f44..2fb414b 100644
--- a/account-management-db-model/src/main/java/org/duracloud/account/db/model/DuracloudUser.java
+++ b/account-management-db-model/src/main/java/org/duracloud/account/db/model/DuracloudUser.java
@@ -10,7 +10,6 @@
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
-
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
@@ -22,7 +21,7 @@
/**
* @author Erik Paulsson
- * Date: 7/10/13
+ * Date: 7/10/13
*/
@Entity
public class DuracloudUser extends BaseEntity implements UserDetails {
@@ -39,13 +38,13 @@ public class DuracloudUser extends BaseEntity implements UserDetails {
private boolean accountNonExpired = true;
private boolean credentialsNonExpired = true;
private boolean accountNonLocked = true;
-
+
/**
* A CIDR formatted IP Range.
*/
- private String allowableIPAddressRange;
+ private String allowableIPAddressRange;
- @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER, mappedBy="user")
+ @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "user")
private Set accountRights;
private boolean root = false;
@@ -168,8 +167,8 @@ public Collection getAuthorities() {
}
}
}
-
- if(isRoot()){
+
+ if (isRoot()) {
authorities.add(new SimpleGrantedAuthority(Role.ROLE_ROOT.name()));
}
return authorities;
@@ -184,15 +183,15 @@ public Set getRolesByAcct(Long accountId) {
}
}
}
-
- if(isRoot()){
+
+ if (isRoot()) {
roles.addAll(Role.ROLE_ROOT.getRoleHierarchy());
}
return roles;
}
public Role getRoleByAcct(Long accountId) {
- if(isRoot()){
+ if (isRoot()) {
return Role.ROLE_ROOT;
}
Set roles = getRolesByAcct(accountId);
@@ -219,7 +218,7 @@ public boolean hasRoleForAcct(Long accountId, Role role) {
public boolean isRootUser() {
return root;
}
-
+
public boolean isRoot() {
return root;
}
diff --git a/account-management-db-model/src/main/java/org/duracloud/account/db/model/GlobalProperties.java b/account-management-db-model/src/main/java/org/duracloud/account/db/model/GlobalProperties.java
index 3b0a12b..336c154 100644
--- a/account-management-db-model/src/main/java/org/duracloud/account/db/model/GlobalProperties.java
+++ b/account-management-db-model/src/main/java/org/duracloud/account/db/model/GlobalProperties.java
@@ -12,32 +12,32 @@
/**
* A grab bag of global properties.
+ *
* @author Daniel Bernstein
- * Date: 01/05/2016
+ * Date: 01/05/2016
*/
@Entity
public class GlobalProperties extends BaseEntity {
/*
* an SNS topic arn for sending noticiations to the instances
*/
- @Column(nullable=false)
+ @Column(nullable = false)
private String instanceNotificationTopicArn;
- @Column(nullable=false)
+ @Column(nullable = false)
private String cloudFrontAccountId;
- @Column(nullable=false)
+ @Column(nullable = false)
private String cloudFrontKeyId;
- @Column(nullable=false)
+ @Column(nullable = false)
private String cloudFrontKeyPath;
public String getInstanceNotificationTopicArn() {
return instanceNotificationTopicArn;
}
- public void setInstanceNotificationTopicArn(
- String instanceNotificationTopicArn) {
+ public void setInstanceNotificationTopicArn(String instanceNotificationTopicArn) {
this.instanceNotificationTopicArn = instanceNotificationTopicArn;
}
@@ -63,6 +63,6 @@ public String getCloudFrontKeyPath() {
public void setCloudFrontKeyPath(String cloudFrontKeyPath) {
this.cloudFrontKeyPath = cloudFrontKeyPath;
- }
-
+ }
+
}
diff --git a/account-management-db-model/src/main/java/org/duracloud/account/db/model/Identifiable.java b/account-management-db-model/src/main/java/org/duracloud/account/db/model/Identifiable.java
index 93bda88..1d1fe14 100644
--- a/account-management-db-model/src/main/java/org/duracloud/account/db/model/Identifiable.java
+++ b/account-management-db-model/src/main/java/org/duracloud/account/db/model/Identifiable.java
@@ -9,9 +9,10 @@
/**
* @author Erik Paulsson
- * Date: 7/10/13
+ * Date: 7/10/13
*/
public interface Identifiable {
public Long getId();
+
public void setId(Long id);
}
diff --git a/account-management-db-model/src/main/java/org/duracloud/account/db/model/InstanceType.java b/account-management-db-model/src/main/java/org/duracloud/account/db/model/InstanceType.java
index 9ed276c..0f8c9fc 100644
--- a/account-management-db-model/src/main/java/org/duracloud/account/db/model/InstanceType.java
+++ b/account-management-db-model/src/main/java/org/duracloud/account/db/model/InstanceType.java
@@ -11,7 +11,6 @@
* Represents different instance sizes available on which to deploy duracloud.
*
* @author Daniel Bernstein
- *
*/
public enum InstanceType {
SMALL,
diff --git a/account-management-db-model/src/main/java/org/duracloud/account/db/model/Role.java b/account-management-db-model/src/main/java/org/duracloud/account/db/model/Role.java
index fb3a039..2a76adb 100644
--- a/account-management-db-model/src/main/java/org/duracloud/account/db/model/Role.java
+++ b/account-management-db-model/src/main/java/org/duracloud/account/db/model/Role.java
@@ -15,7 +15,7 @@
/**
* @author Erik Paulsson
- * Date: 7/10/13
+ * Date: 7/10/13
*/
public enum Role {
ROLE_INIT("Init"),
@@ -46,18 +46,25 @@ public Set getRoleHierarchy() {
switch (this) {
case ROLE_ROOT:
hierarchy.add(ROLE_ROOT);
+ // fall through
case ROLE_OWNER:
hierarchy.add(ROLE_OWNER);
+ // fall through
case ROLE_ADMIN:
hierarchy.add(ROLE_ADMIN);
+ // fall through
case ROLE_USER:
hierarchy.add(ROLE_USER);
+ // fall through
case ROLE_ANONYMOUS:
hierarchy.add(ROLE_ANONYMOUS);
break;
case ROLE_INIT:
// not in hierarchy
hierarchy.add(ROLE_INIT);
+ break;
+ default:
+ break;
}
return hierarchy;
diff --git a/account-management-db-model/src/main/java/org/duracloud/account/db/model/StorageProviderAccount.java b/account-management-db-model/src/main/java/org/duracloud/account/db/model/StorageProviderAccount.java
index e6f5837..c4cb7f2 100644
--- a/account-management-db-model/src/main/java/org/duracloud/account/db/model/StorageProviderAccount.java
+++ b/account-management-db-model/src/main/java/org/duracloud/account/db/model/StorageProviderAccount.java
@@ -8,7 +8,6 @@
package org.duracloud.account.db.model;
import java.util.Map;
-
import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
@@ -23,7 +22,7 @@
/**
* @author Erik Paulsson
- * Date: 7/10/13
+ * Date: 7/10/13
*/
@Entity
public class StorageProviderAccount extends ProviderAccount {
@@ -35,18 +34,18 @@ public class StorageProviderAccount extends ProviderAccount {
@Enumerated(EnumType.STRING)
private StorageProviderType providerType;
- @ElementCollection(fetch=FetchType.EAGER)
- @MapKeyColumn (name="map_key")
- @CollectionTable(name ="storage_provider_account_properties",
- joinColumns=@JoinColumn(name="storage_provider_account_id"))
- @Column(name="map_value")
- private Map properties;
-
+ @ElementCollection(fetch = FetchType.EAGER)
+ @MapKeyColumn(name = "map_key")
+ @CollectionTable(name = "storage_provider_account_properties",
+ joinColumns = @JoinColumn(name = "storage_provider_account_id"))
+ @Column(name = "map_value")
+ private Map properties;
+
/**
* The max GBs of storage allowable for the account.
*/
private int storageLimit = 1;
-
+
public StorageProviderType getProviderType() {
return providerType;
}
@@ -55,11 +54,11 @@ public void setProviderType(StorageProviderType providerType) {
this.providerType = providerType;
}
- public Map getProperties() {
+ public Map getProperties() {
return properties;
}
- public void setProperties(Map properties) {
+ public void setProperties(Map properties) {
this.properties = properties;
}
diff --git a/account-management-db-model/src/main/java/org/duracloud/account/db/model/UserInvitation.java b/account-management-db-model/src/main/java/org/duracloud/account/db/model/UserInvitation.java
index 0f0bbeb..068978c 100644
--- a/account-management-db-model/src/main/java/org/duracloud/account/db/model/UserInvitation.java
+++ b/account-management-db-model/src/main/java/org/duracloud/account/db/model/UserInvitation.java
@@ -8,7 +8,6 @@
package org.duracloud.account.db.model;
import java.util.Date;
-
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
@@ -16,13 +15,13 @@
/**
* @author Erik Paulsson
- * Date: 7/11/13
+ * Date: 7/11/13
*/
@Entity
public class UserInvitation extends BaseEntity {
- @ManyToOne(fetch= FetchType.EAGER, optional=true)
- @JoinColumn(name="account_id", nullable=true, columnDefinition = "bigint(20)")
+ @ManyToOne(fetch = FetchType.EAGER, optional = true)
+ @JoinColumn(name = "account_id", nullable = true, columnDefinition = "bigint(20)")
private AccountInfo account;
private String accountName;
@@ -35,12 +34,12 @@ public class UserInvitation extends BaseEntity {
private Date expirationDate;
private String redemptionCode;
- public UserInvitation() {}
+ public UserInvitation() {
+ }
- public UserInvitation(
- Long id, AccountInfo account, String accountName, String accountOrg, String accountDep,
- String accountSubdomain, String adminUsername, String userEmail,
- int expirationDays, String redemptionCode) {
+ public UserInvitation(Long id, AccountInfo account, String accountName, String accountOrg, String accountDep,
+ String accountSubdomain, String adminUsername, String userEmail, int expirationDays,
+ String redemptionCode) {
this.id = id;
this.account = account;
this.accountName = accountName;
@@ -139,19 +138,15 @@ public void setRedemptionCode(String redemptionCode) {
this.redemptionCode = redemptionCode;
}
-
-
-
-
@Override
public String toString() {
return "UserInvitation[id="
- + id + ", accountId=" + account.getId() + ", accountName=" + accountName
- + ", accountOrg=" + accountOrg + ", accountDep=" + accountDep
- + ", accountSubdomain=" + accountSubdomain + ", adminUsername=" + adminUsername
- + ", userEmail=" + userEmail
- + ", creationDate=" + creationDate + ", expirationDate="
- + expirationDate + ", redemptionCode=" + redemptionCode + "]";
+ + id + ", accountId=" + account.getId() + ", accountName=" + accountName
+ + ", accountOrg=" + accountOrg + ", accountDep=" + accountDep
+ + ", accountSubdomain=" + accountSubdomain + ", adminUsername=" + adminUsername
+ + ", userEmail=" + userEmail
+ + ", creationDate=" + creationDate + ", expirationDate="
+ + expirationDate + ", redemptionCode=" + redemptionCode + "]";
}
}
diff --git a/account-management-db-model/src/main/java/org/duracloud/account/db/model/util/DuracloudAccount.java b/account-management-db-model/src/main/java/org/duracloud/account/db/model/util/DuracloudAccount.java
index 1b9fbc6..c66247c 100644
--- a/account-management-db-model/src/main/java/org/duracloud/account/db/model/util/DuracloudAccount.java
+++ b/account-management-db-model/src/main/java/org/duracloud/account/db/model/util/DuracloudAccount.java
@@ -7,22 +7,21 @@
*/
package org.duracloud.account.db.model.util;
+import java.util.Set;
+
import org.duracloud.account.db.model.AccountInfo;
import org.duracloud.account.db.model.InstanceType;
import org.duracloud.account.db.model.Role;
-import java.util.Set;
-
public class DuracloudAccount implements Comparable {
private AccountInfo accountInfo;
-
private String instanceStatus;
private String instanceVersion;
private InstanceType instanceType;
-
+
private Set versions;
private Role userRole;
@@ -43,7 +42,6 @@ public void setAccountInfo(AccountInfo accountInfo) {
this.accountInfo = accountInfo;
}
-
public String getInstanceStatus() {
return instanceStatus;
}
diff --git a/account-management-db-model/src/main/java/org/duracloud/reportdata/bitintegrity/BitIntegrityReportResult.java b/account-management-db-model/src/main/java/org/duracloud/reportdata/bitintegrity/BitIntegrityReportResult.java
index f50f067..8695424 100644
--- a/account-management-db-model/src/main/java/org/duracloud/reportdata/bitintegrity/BitIntegrityReportResult.java
+++ b/account-management-db-model/src/main/java/org/duracloud/reportdata/bitintegrity/BitIntegrityReportResult.java
@@ -6,10 +6,9 @@
* http://duracloud.org/license/
*/
package org.duracloud.reportdata.bitintegrity;
+
/**
- *
* @author Daniel Bernstein
- *
*/
public enum BitIntegrityReportResult {
SUCCESS,
diff --git a/account-management-db-model/src/main/java/org/duracloud/security/domain/SecurityUserBean.java b/account-management-db-model/src/main/java/org/duracloud/security/domain/SecurityUserBean.java
index 10421ea..c395e0d 100644
--- a/account-management-db-model/src/main/java/org/duracloud/security/domain/SecurityUserBean.java
+++ b/account-management-db-model/src/main/java/org/duracloud/security/domain/SecurityUserBean.java
@@ -7,14 +7,14 @@
*/
package org.duracloud.security.domain;
-import org.apache.commons.lang3.StringUtils;
-
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+
/**
* @author Andrew Woods
- * Date: Mar 28, 2010
+ * Date: Mar 28, 2010
*/
public class SecurityUserBean {
private String username;
@@ -135,7 +135,7 @@ public void setEmail(String email) {
}
public void setIpLimits(String ipLimits) {
- if(!StringUtils.isBlank(ipLimits)) {
+ if (!StringUtils.isBlank(ipLimits)) {
this.ipLimits = ipLimits;
}
}
diff --git a/account-management-db-model/src/main/java/org/duracloud/storage/domain/StorageProviderType.java b/account-management-db-model/src/main/java/org/duracloud/storage/domain/StorageProviderType.java
index dd5463c..7b23fbd 100644
--- a/account-management-db-model/src/main/java/org/duracloud/storage/domain/StorageProviderType.java
+++ b/account-management-db-model/src/main/java/org/duracloud/storage/domain/StorageProviderType.java
@@ -28,7 +28,7 @@ private StorageProviderType(String pt) {
public static StorageProviderType fromString(String pt) {
for (StorageProviderType pType : values()) {
- if (pType.text.equalsIgnoreCase(pt)||
+ if (pType.text.equalsIgnoreCase(pt) ||
pType.name().equalsIgnoreCase(pt)) {
return pType;
}
@@ -41,7 +41,7 @@ public String toString() {
return text;
}
- public String getName(){
+ public String getName() {
return name();
}
}
diff --git a/account-management-db-repo/pom.xml b/account-management-db-repo/pom.xml
index 3060185..5c948b3 100644
--- a/account-management-db-repo/pom.xml
+++ b/account-management-db-repo/pom.xml
@@ -3,53 +3,53 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- org.duracloud.db
- db
- 4.2.0-SNAPSHOT
- ../pom.xml
-
-
- 4.0.0
+
org.duracloud.db
- account-management-db-repo
+ db
4.2.0-SNAPSHOT
- Account DB Repositories
-
-
-
- org.duracloud.db
- account-management-db-model
- ${project.version}
-
-
-
- org.duracloud.db
- common
- ${project.version}
-
-
-
-
- org.hibernate
- hibernate-entitymanager
-
-
-
- org.springframework.data
- spring-data-jpa
-
-
-
- org.apache.commons
- commons-dbcp2
-
-
-
- mysql
- mysql-connector-java
-
-
-
+ ../pom.xml
+
+
+ 4.0.0
+ org.duracloud.db
+ account-management-db-repo
+ 4.2.0-SNAPSHOT
+ Account DB Repositories
+
+
+
+ org.duracloud.db
+ account-management-db-model
+ ${project.version}
+
+
+
+ org.duracloud.db
+ common
+ ${project.version}
+
+
+
+
+ org.hibernate
+ hibernate-entitymanager
+
+
+
+ org.springframework.data
+ spring-data-jpa
+
+
+
+ org.apache.commons
+ commons-dbcp2
+
+
+
+ mysql
+ mysql-connector-java
+
+
+
diff --git a/account-management-db-repo/src/main/java/org/duracloud/account/db/config/AccountJpaRepoConfig.java b/account-management-db-repo/src/main/java/org/duracloud/account/db/config/AccountJpaRepoConfig.java
index aca633c..c83ca02 100644
--- a/account-management-db-repo/src/main/java/org/duracloud/account/db/config/AccountJpaRepoConfig.java
+++ b/account-management-db-repo/src/main/java/org/duracloud/account/db/config/AccountJpaRepoConfig.java
@@ -8,8 +8,6 @@
package org.duracloud.account.db.config;
import java.text.MessageFormat;
-import java.util.Properties;
-
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
@@ -24,20 +22,16 @@
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
-import org.springframework.orm.jpa.vendor.Database;
import org.springframework.orm.jpa.vendor.HibernateJpaDialect;
-import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
- *
* @author Daniel Bernstein
- *
*/
@Configuration
-@EnableJpaRepositories(basePackages = { "org.duracloud.account.db" },
- entityManagerFactoryRef = AccountJpaRepoConfig.ENTITY_MANAGER_FACTORY_BEAN,
+@EnableJpaRepositories(basePackages = {"org.duracloud.account.db"},
+ entityManagerFactoryRef = AccountJpaRepoConfig.ENTITY_MANAGER_FACTORY_BEAN,
transactionManagerRef = AccountJpaRepoConfig.TRANSACTION_MANAGER_BEAN)
@EnableTransactionManagement
public class AccountJpaRepoConfig {
@@ -49,17 +43,17 @@ public class AccountJpaRepoConfig {
"accountJpaRepoTransactionManager";
public static final String ENTITY_MANAGER_FACTORY_BEAN =
ACCOUNT_REPO_ENTITY_MANAGER_FACTORY_BEAN;
-
+
@Autowired
private Environment env;
-
+
@Bean(name = ACCOUNT_REPO_DATA_SOURCE_BEAN, destroyMethod = "close")
public BasicDataSource accountRepoDataSource() {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName("com.mysql.jdbc.Driver");
dataSource.setUrl(MessageFormat.format("jdbc:mysql://{0}:{1}/{2}" +
- "?characterEncoding=utf8" +
- "&characxterSetResults=utf8",
+ "?characterEncoding=utf8" +
+ "&characxterSetResults=utf8",
env.getProperty(ConfigConstants.MC_DB_HOST, "localhost"),
env.getProperty(ConfigConstants.MC_DB_PORT, "3306"),
env.getProperty(ConfigConstants.MC_DB_NAME, "name")));
@@ -71,9 +65,9 @@ public BasicDataSource accountRepoDataSource() {
}
@Primary
- @Bean(name=TRANSACTION_MANAGER_BEAN)
- public PlatformTransactionManager
- accountRepoTransactionManager(@Qualifier(ACCOUNT_REPO_ENTITY_MANAGER_FACTORY_BEAN) EntityManagerFactory entityManagerFactory) {
+ @Bean(name = TRANSACTION_MANAGER_BEAN)
+ public PlatformTransactionManager accountRepoTransactionManager(
+ @Qualifier(ACCOUNT_REPO_ENTITY_MANAGER_FACTORY_BEAN) EntityManagerFactory entityManagerFactory) {
JpaTransactionManager tm =
new JpaTransactionManager(entityManagerFactory);
tm.setJpaDialect(new HibernateJpaDialect());
@@ -81,18 +75,16 @@ public BasicDataSource accountRepoDataSource() {
}
@Bean(name = ACCOUNT_REPO_ENTITY_MANAGER_FACTORY_BEAN)
- public LocalContainerEntityManagerFactoryBean
- accountRepoEntityManagerFactory(@Qualifier(ACCOUNT_REPO_DATA_SOURCE_BEAN) DataSource dataSource) {
+ public LocalContainerEntityManagerFactoryBean accountRepoEntityManagerFactory(
+ @Qualifier(ACCOUNT_REPO_DATA_SOURCE_BEAN) DataSource dataSource) {
LocalContainerEntityManagerFactoryBean emf =
new LocalContainerEntityManagerFactoryBean();
emf.setDataSource(dataSource);
emf.setPersistenceUnitName("account-repo-pu");
emf.setPackagesToScan("org.duracloud.account.db");
-
- JpaConfigurationUtil.configureEntityManagerFactory(env,emf);
+ JpaConfigurationUtil.configureEntityManagerFactory(env, emf);
return emf;
}
-
}
diff --git a/account-management-db-repo/src/main/java/org/duracloud/account/db/config/ConfigConstants.java b/account-management-db-repo/src/main/java/org/duracloud/account/db/config/ConfigConstants.java
index ee0bfdc..fb374e9 100644
--- a/account-management-db-repo/src/main/java/org/duracloud/account/db/config/ConfigConstants.java
+++ b/account-management-db-repo/src/main/java/org/duracloud/account/db/config/ConfigConstants.java
@@ -6,12 +6,16 @@
* http://duracloud.org/license/
*/
package org.duracloud.account.db.config;
+
/**
- *
* @author Daniel Bernstein
- *
*/
public class ConfigConstants {
+
+ private ConfigConstants() {
+ // Ensures class is not instantiated, as only static values exist
+ }
+
public static final String MC_DB_NAME = "db.name";
public static final String MC_DB_HOST = "db.host";
public static final String MC_DB_PORT = "db.port";
diff --git a/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudAccountRepo.java b/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudAccountRepo.java
index 5cb2ac9..18af5f9 100644
--- a/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudAccountRepo.java
+++ b/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudAccountRepo.java
@@ -7,17 +7,18 @@
*/
package org.duracloud.account.db.repo;
+import java.util.List;
+
import org.duracloud.account.db.model.AccountInfo;
import org.duracloud.account.db.model.AccountInfo.AccountStatus;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
-import java.util.List;
/**
* @author Erik Paulsson
- * Date: 7/8/13
+ * Date: 7/8/13
*/
-@Repository(value="accountRepo")
+@Repository(value = "accountRepo")
public interface DuracloudAccountRepo extends JpaRepository {
/**
@@ -31,20 +32,18 @@ public interface DuracloudAccountRepo extends JpaRepository {
/**
* This method returns the account with the given subdomain
*
- * @param status
+ * @param status
* @return list of account info
*/
public List findByStatus(AccountStatus status);
/**
- *
* @param id
* @return
*/
public AccountInfo findByPrimaryStorageProviderAccountId(Long id);
/**
- *
* @param id
* @return
*/
diff --git a/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudGroupRepo.java b/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudGroupRepo.java
index 4c15672..6ff2d0f 100644
--- a/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudGroupRepo.java
+++ b/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudGroupRepo.java
@@ -7,24 +7,24 @@
*/
package org.duracloud.account.db.repo;
+import java.util.List;
+
import org.duracloud.account.db.model.DuracloudGroup;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
-import java.util.List;
-
/**
* @author Erik Paulsson
- * Date: 7/8/13
+ * Date: 7/8/13
*/
-@Repository(value="groupRepo")
+@Repository(value = "groupRepo")
public interface DuracloudGroupRepo extends JpaRepository {
/**
* This method returns a single group within the given account, with the
* given groupname.
*
- * @param name of group
+ * @param name of group
* @param accountId associated with group
* @return group
*/
diff --git a/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudMillRepo.java b/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudMillRepo.java
index f7b850a..45c4f75 100644
--- a/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudMillRepo.java
+++ b/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudMillRepo.java
@@ -13,9 +13,9 @@
/**
* @author Daniel Bernstein
- * Date: 05/06/2015
+ * Date: 05/06/2015
*/
-@Repository(value="duracloudMillRepo")
+@Repository(value = "duracloudMillRepo")
public interface DuracloudMillRepo extends JpaRepository {
-
+
}
diff --git a/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudRepoMgr.java b/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudRepoMgr.java
index 8b618e3..156084f 100644
--- a/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudRepoMgr.java
+++ b/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudRepoMgr.java
@@ -7,18 +7,18 @@
*/
package org.duracloud.account.db.repo;
+import java.util.HashSet;
+import java.util.Set;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Component;
-import java.util.HashSet;
-import java.util.Set;
-
/**
* @author Erik Paulsson
- * Date: 7/17/13
+ * Date: 7/17/13
*/
-@Component(value="repoMgr")
+@Component(value = "repoMgr")
public class DuracloudRepoMgr {
@Autowired
@@ -62,12 +62,10 @@ public DuracloudUserInvitationRepo getUserInvitationRepo() {
return userInvitationRepo;
}
-
public DuracloudStorageProviderAccountRepo getStorageProviderAccountRepo() {
return storageProviderAccountRepo;
}
-
public Set getAllRepos() {
Set repos = new HashSet<>();
repos.add(userRepo);
diff --git a/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudRightsRepo.java b/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudRightsRepo.java
index 7cc1680..7fde1b3 100644
--- a/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudRightsRepo.java
+++ b/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudRightsRepo.java
@@ -7,18 +7,18 @@
*/
package org.duracloud.account.db.repo;
+import java.util.List;
+
import org.duracloud.account.db.model.AccountRights;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
-import java.util.List;
-
/**
* @author Erik Paulsson
- * Date: 7/8/13
+ * Date: 7/8/13
*/
-@Repository(value="rightsRepo")
-public interface DuracloudRightsRepo extends JpaRepository{
+@Repository(value = "rightsRepo")
+public interface DuracloudRightsRepo extends JpaRepository {
/**
* This method returns the set of rights for a given account
@@ -46,7 +46,6 @@ public interface DuracloudRightsRepo extends JpaRepository{
* @return rights
*/
public AccountRights findByAccountIdAndUserId(Long accountId,
- Long userId);
-
+ Long userId);
}
diff --git a/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudStorageProviderAccountRepo.java b/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudStorageProviderAccountRepo.java
index c7f5a8e..6046616 100644
--- a/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudStorageProviderAccountRepo.java
+++ b/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudStorageProviderAccountRepo.java
@@ -13,9 +13,9 @@
/**
* @author Erik Paulsson
- * Date: 7/9/13
+ * Date: 7/9/13
*/
-@Repository(value="storageProviderAccountRepo")
+@Repository(value = "storageProviderAccountRepo")
public interface DuracloudStorageProviderAccountRepo extends JpaRepository {
}
diff --git a/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudUserInvitationRepo.java b/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudUserInvitationRepo.java
index bf43076..d207a8f 100644
--- a/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudUserInvitationRepo.java
+++ b/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudUserInvitationRepo.java
@@ -7,17 +7,17 @@
*/
package org.duracloud.account.db.repo;
+import java.util.List;
+
import org.duracloud.account.db.model.UserInvitation;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
-import java.util.List;
-
/**
* @author Erik Paulsson
- * Date: 7/9/13
+ * Date: 7/9/13
*/
-@Repository(value="userInvitationRepo")
+@Repository(value = "userInvitationRepo")
public interface DuracloudUserInvitationRepo extends JpaRepository {
/**
diff --git a/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudUserRepo.java b/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudUserRepo.java
index 004bb64..b2d9225 100644
--- a/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudUserRepo.java
+++ b/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/DuracloudUserRepo.java
@@ -15,9 +15,9 @@
/**
* @author Erik Paulsson
- * Date: 7/3/13
+ * Date: 7/3/13
*/
-@Repository(value="userRepo")
+@Repository(value = "userRepo")
public interface DuracloudUserRepo extends JpaRepository {
/**
@@ -27,10 +27,12 @@ public interface DuracloudUserRepo extends JpaRepository {
* @return user
*/
public DuracloudUser findByUsername(String username);
-
+
/**
- * Returns all enabled, non-locked root users with non-expired credentials.
+ * Returns all enabled, non-locked root users with non-expired credentials.
+ *
* @return
*/
- public List findByRootTrueAndEnabledTrueAndAccountNonExpiredTrueAndCredentialsNonExpiredTrueAndAccountNonLockedTrue();
+ public List
+ findByRootTrueAndEnabledTrueAndAccountNonExpiredTrueAndCredentialsNonExpiredTrueAndAccountNonLockedTrue();
}
diff --git a/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/GlobalPropertiesRepo.java b/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/GlobalPropertiesRepo.java
index 6e34a37..4685e80 100644
--- a/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/GlobalPropertiesRepo.java
+++ b/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/GlobalPropertiesRepo.java
@@ -13,9 +13,9 @@
/**
* @author Daniel Bernstein
- * Date: 05/06/2015
+ * Date: 05/06/2015
*/
-@Repository(value="globalPropertiesRepo")
+@Repository(value = "globalPropertiesRepo")
public interface GlobalPropertiesRepo extends JpaRepository {
-
+
}
diff --git a/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/UserFinderUtil.java b/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/UserFinderUtil.java
index b275918..2c09335 100644
--- a/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/UserFinderUtil.java
+++ b/account-management-db-repo/src/main/java/org/duracloud/account/db/repo/UserFinderUtil.java
@@ -32,9 +32,8 @@ public UserFinderUtil(DuracloudRepoMgr repoMgr) {
/**
* Retrieves the users associated with the account
- *
+ *
* @param account for which users should be gathered
-
* @return the set of users associated with an account
*/
public Set getAccountUsers(AccountInfo account) {
@@ -54,7 +53,7 @@ public Set getAccountUsers(AccountInfo account) {
user.setAccountRights(accountOnlyRightsSet);
users.add(user);
}
-
+
List rootUsers =
repoMgr.getUserRepo()
.findByRootTrueAndEnabledTrueAndAccountNonExpiredTrueAndCredentialsNonExpiredTrueAndAccountNonLockedTrue();
@@ -62,9 +61,10 @@ public Set getAccountUsers(AccountInfo account) {
users.addAll(rootUsers);
return users;
}
-
+
public Set convertDuracloudUsersToSecurityUserBeans(AccountInfo accountInfo,
- Set users, boolean includeRootUsers) {
+ Set users,
+ boolean includeRootUsers) {
// collect groups for the account
Long accountId = accountInfo.getId();
DuracloudGroupRepo groupRepo = repoMgr.getGroupRepo();
@@ -80,11 +80,11 @@ public Set convertDuracloudUsersToSecurityUserBeans(AccountInf
String ipLimits = annotateAddressRange(accountInfo, user.getAllowableIPAddressRange());
Set roles = user.getRolesByAcct(accountId);
- if(roles == null) {
+ if (roles == null) {
roles = new HashSet();
}
- if(roles.isEmpty()) {
+ if (roles.isEmpty()) {
roles.add(Role.ROLE_USER);
}
@@ -93,16 +93,16 @@ public Set convertDuracloudUsersToSecurityUserBeans(AccountInf
grants.add(role.name());
}
- if(!user.isRoot() || includeRootUsers) {
+ if (!user.isRoot() || includeRootUsers) {
SecurityUserBean bean =
- new SecurityUserBean(username, password, grants);
+ new SecurityUserBean(username, password, grants);
bean.setEmail(email);
bean.setIpLimits(ipLimits);
- if(groups != null) {
+ if (groups != null) {
for (DuracloudGroup group : groups) {
Set grpUsers = group.getUsers();
- if(grpUsers.contains(user)) {
+ if (grpUsers.contains(user)) {
bean.addGroup(group.getName());
}
}
@@ -112,7 +112,7 @@ public Set convertDuracloudUsersToSecurityUserBeans(AccountInf
}
}
return userBeans;
- }
+ }
/**
* For a user account with an IP limitation, this method is used to update
@@ -124,7 +124,7 @@ public Set convertDuracloudUsersToSecurityUserBeans(AccountInf
* @return baseRange plus the instance elastic IP, or null if baseRange is null
*/
private String annotateAddressRange(AccountInfo accountInfo, String baseRange) {
- if(null == baseRange || baseRange.equals("")) {
+ if (null == baseRange || baseRange.equals("")) {
return baseRange;
} else {
return baseRange; // delimeter + elasticIp + "/32";
diff --git a/common/pom.xml b/common/pom.xml
index 7420b25..2b5e5e9 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -1,5 +1,5 @@
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
org.duracloud.db
@@ -9,7 +9,7 @@
org.duracloud.db
- db
+ db
4.2.0-SNAPSHOT
../pom.xml
@@ -30,11 +30,11 @@
net.sf.trove4j
trove4j
-
+
- commons-codec
- commons-codec
-
+ commons-codec
+ commons-codec
+
org.hibernate
diff --git a/common/src/main/java/org/duracloud/common/collection/StreamingIterator.java b/common/src/main/java/org/duracloud/common/collection/StreamingIterator.java
index cee6555..7a4eeb6 100644
--- a/common/src/main/java/org/duracloud/common/collection/StreamingIterator.java
+++ b/common/src/main/java/org/duracloud/common/collection/StreamingIterator.java
@@ -14,51 +14,51 @@
import java.util.Queue;
/**
- * An {code Iterator} implementation that delegates its underlying data provider to an
+ * An {code Iterator} implementation that delegates its underlying data provider to an
* {code IteratorSource}. It is useful for implementing an iterator that iterates over
- * a collection of items of indeterminate size.
- * @author Daniel Bernstein
- *
+ * a collection of items of indeterminate size.
+ *
* @param
+ * @author Daniel Bernstein
*/
-public class StreamingIterator implements Iterator{
+public class StreamingIterator implements Iterator {
private Queue queue = new LinkedList();
-
+
private IteratorSource source;
-
- public StreamingIterator(IteratorSource source){
+
+ public StreamingIterator(IteratorSource source) {
this.source = source;
}
-
+
@Override
public synchronized boolean hasNext() {
- if(!queue.isEmpty()){
+ if (!queue.isEmpty()) {
return true;
- }
-
+ }
+
Collection chunk = source.getNext();
- if(chunk != null){
+ if (chunk != null) {
Iterator it = chunk.iterator();
- while(it.hasNext()){
+ while (it.hasNext()) {
T item = it.next();
queue.add(item);
}
}
-
- if(queue.size() > 0){
+
+ if (queue.size() > 0) {
return true;
}
-
+
return false;
}
@Override
public T next() {
- if(hasNext()){
+ if (hasNext()) {
return queue.remove();
}
-
+
throw new NoSuchElementException();
}
diff --git a/common/src/main/java/org/duracloud/common/collection/WriteOnlyStringSet.java b/common/src/main/java/org/duracloud/common/collection/WriteOnlyStringSet.java
index e8dc7bc..674e6aa 100644
--- a/common/src/main/java/org/duracloud/common/collection/WriteOnlyStringSet.java
+++ b/common/src/main/java/org/duracloud/common/collection/WriteOnlyStringSet.java
@@ -7,42 +7,42 @@
*/
package org.duracloud.common.collection;
-import gnu.trove.set.hash.THashSet;
-
import java.security.MessageDigest;
+import gnu.trove.set.hash.THashSet;
import org.apache.commons.codec.digest.DigestUtils;
/**
- * This class gives you an efficient way to write to an in memory set-like structure of tens of
- * millions of strings. The catch is that once you write the strings to the set,
+ * This class gives you an efficient way to write to an in memory set-like structure of tens of
+ * millions of strings. The catch is that once you write the strings to the set,
* you can't retrieve them. However you can ask if the set contains any string. Additionally
- * you can remove strings from the set as well as determine the set's size.
- *
+ * you can remove strings from the set as well as determine the set's size.
+ *
* An example use case: You're comparing two large sets (A and B) of objects both of which won't fit in memory.
- * You want to be able to load A (each element of which can be reduced to a string value) into memory
- * and then iterate over B, checking for existence in A (probably of a single property of each B element) before
+ * You want to be able to load A (each element of which can be reduced to a string value) into memory
+ * and then iterate over B, checking for existence in A (probably of a single property of each B element) before
* performing some further logic on that B element.
- *
+ *
* @author Daniel Bernstein
- * Date: May 22, 2015
+ * Date: May 22, 2015
*/
public class WriteOnlyStringSet {
- private THashSet set;
- public WriteOnlyStringSet(int capacity){
+ private THashSet set;
+
+ public WriteOnlyStringSet(int capacity) {
set = new THashSet(capacity);
}
-
+
private static final MessageDigest MD5 = DigestUtils.getMd5Digest();
- public void add(String string){
- if(string == null){
+ public void add(String string) {
+ if (string == null) {
return;
}
-
+
set.add(getMd5String(string));
}
-
+
private String getMd5String(String string) {
return checksumBytesToString(MD5.digest(string.getBytes()));
}
@@ -53,9 +53,9 @@ private String getMd5String(String string) {
*/
public static String checksumBytesToString(byte[] digestBytes) {
StringBuffer hexString = new StringBuffer();
- for (int i=0; i
* @param
+ * @author Daniel Bernstein
+ * Date: Sep 3, 2014
*/
public abstract class JpaIteratorSource implements IteratorSource {
private int currentPage = 0;
private int maxResults;
private R repo;
- public JpaIteratorSource(R repo, int maxResults){
+ public JpaIteratorSource(R repo, int maxResults) {
this.repo = repo;
- if(maxResults <= 0){
+ if (maxResults <= 0) {
throw new IllegalArgumentException("maxResults must be greater than 0");
}
this.maxResults = maxResults;
}
- public JpaIteratorSource(R repo){
+ public JpaIteratorSource(R repo) {
this(repo, 1000);
}
-
+
@Override
public Collection getNext() {
- if(currentPage < 0){
+ if (currentPage < 0) {
return null;
}
- Page page = getNextPage(new PageRequest(currentPage, maxResults), repo);
+ Page page = getNextPage(new PageRequest(currentPage, maxResults), repo);
currentPage++;
- if(page.getTotalPages() == currentPage){
+ if (page.getTotalPages() == currentPage) {
currentPage = -1;
}
-
+
return page.getContent();
-
+
}
-
+
/**
* Specific Jpa call goes here.
+ *
* @param pageable
* @return
*/
diff --git a/common/src/main/java/org/duracloud/common/db/error/NotFoundException.java b/common/src/main/java/org/duracloud/common/db/error/NotFoundException.java
index 7bed0fb..c2fcf73 100644
--- a/common/src/main/java/org/duracloud/common/db/error/NotFoundException.java
+++ b/common/src/main/java/org/duracloud/common/db/error/NotFoundException.java
@@ -14,7 +14,7 @@
*/
public class NotFoundException extends Exception {
- public NotFoundException (String message) {
+ public NotFoundException(String message) {
super(message);
}
diff --git a/common/src/main/java/org/duracloud/common/db/hibernate/PhysicalNamingStrategyImpl.java b/common/src/main/java/org/duracloud/common/db/hibernate/PhysicalNamingStrategyImpl.java
index c53df7d..4753819 100644
--- a/common/src/main/java/org/duracloud/common/db/hibernate/PhysicalNamingStrategyImpl.java
+++ b/common/src/main/java/org/duracloud/common/db/hibernate/PhysicalNamingStrategyImpl.java
@@ -11,33 +11,29 @@
* In the move from hibernate 4.x to 5.x the naming strategies changed and are no longer backwards compatible.
* This fix is based on the solution provided by Samuel Andres here:
* http://stackoverflow.com/questions/32437202/improvednamingstrategy-no-longer-working-in-hibernate-5
- *
- *
+ *
* @author Daniel Bernstein
*/
public class PhysicalNamingStrategyImpl extends PhysicalNamingStrategyStandardImpl implements Serializable {
public static final PhysicalNamingStrategyImpl INSTANCE = new PhysicalNamingStrategyImpl();
-
+
@Override
public Identifier toPhysicalTableName(Identifier name, JdbcEnvironment context) {
return new Identifier(addUnderscores(name.getText()), name.isQuoted());
}
-
+
@Override
public Identifier toPhysicalColumnName(Identifier name, JdbcEnvironment context) {
return new Identifier(addUnderscores(name.getText()), name.isQuoted());
}
-
-
+
protected static String addUnderscores(String name) {
- final StringBuilder buf = new StringBuilder( name.replace('.', '_') );
- for (int i=1; i source;
-
+
@After
- public void teartDown(){
+ public void teartDown() {
verifyAll();
}
-
+
@Test
public void test() {
- EasyMock.expect(source.getNext()).andReturn(Arrays.asList("1","2", "3"));
- EasyMock.expect(source.getNext()).andReturn(Arrays.asList("4","5", "6"));
+ EasyMock.expect(source.getNext()).andReturn(Arrays.asList("1", "2", "3"));
+ EasyMock.expect(source.getNext()).andReturn(Arrays.asList("4", "5", "6"));
EasyMock.expect(source.getNext()).andReturn(null);
replayAll();
StreamingIterator it = new StreamingIterator(source);
int count = 0;
- while(it.hasNext()){
+ while (it.hasNext()) {
it.next();
count++;
}
Assert.assertEquals(6, count);
}
-
@Test
public void testNullSource() {
EasyMock.expect(source.getNext()).andReturn(null);
replayAll();
StreamingIterator it = new StreamingIterator(source);
int count = 0;
- while(it.hasNext()){
+ while (it.hasNext()) {
it.next();
count++;
}
Assert.assertEquals(0, count);
}
-
+
@Test
public void testNextOnEmptyIterator() {
EasyMock.expect(source.getNext()).andReturn(null);
replayAll();
StreamingIterator it = new StreamingIterator(source);
-
- try{
+
+ try {
it.next();
Assert.fail();
- }catch(NoSuchElementException ex){
+ } catch (NoSuchElementException ex) {
+ // Expected exception
}
}
-
+
@Test
public void testRemoveNotSupported() {
StreamingIterator it = new StreamingIterator(source);
replayAll();
- try{
+ try {
it.remove();
Assert.fail();
- }catch(UnsupportedOperationException ex){
+ } catch (UnsupportedOperationException ex) {
+ // Expected exception
}
}
diff --git a/common/src/test/java/org/duracloud/common/collection/WriteOnlyStringSetTest.java b/common/src/test/java/org/duracloud/common/collection/WriteOnlyStringSetTest.java
index 387c11b..0d075a3 100644
--- a/common/src/test/java/org/duracloud/common/collection/WriteOnlyStringSetTest.java
+++ b/common/src/test/java/org/duracloud/common/collection/WriteOnlyStringSetTest.java
@@ -7,17 +7,18 @@
*/
package org.duracloud.common.collection;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import org.apache.commons.lang3.StringUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import static org.junit.Assert.*;
-
-
/**
* @author Daniel Bernstein
- * Date: May 22, 2015
+ * Date: May 22, 2015
*/
public class WriteOnlyStringSetTest {
@@ -38,26 +39,25 @@ public void tearDown() throws Exception {
@Test
public void test() {
int capacity = 100;
-
+
WriteOnlyStringSet set = new WriteOnlyStringSet(capacity);
String idPrefix = StringUtils.repeat("a", 200);
- for (int i = 0; i < capacity; i++){
- set.add(idPrefix.concat(i+""));
+ for (int i = 0; i < capacity; i++) {
+ set.add(idPrefix.concat(i + ""));
}
-
- assertEquals(capacity, set.size());
+ assertEquals(capacity, set.size());
- for (int i = 0; i < capacity; i++){
- assertTrue(set.contains(idPrefix.concat(i+"")));
+ for (int i = 0; i < capacity; i++) {
+ assertTrue(set.contains(idPrefix.concat(i + "")));
}
- for (int i = 0; i < capacity; i++){
- set.remove(idPrefix.concat(i+""));
+ for (int i = 0; i < capacity; i++) {
+ set.remove(idPrefix.concat(i + ""));
}
- for (int i = 0; i < capacity; i++){
- assertFalse(set.contains(idPrefix.concat(i+"")));
+ for (int i = 0; i < capacity; i++) {
+ assertFalse(set.contains(idPrefix.concat(i + "")));
}
assertEquals(0, set.size());
@@ -66,16 +66,16 @@ public void test() {
@Test
public void testAdditionOf1MillionItemsTakesLessThan200Seconds() {
long start = System.currentTimeMillis();
- int capacity = 1000*1000*1;
-
+ int capacity = 1000 * 1000 * 1;
+
WriteOnlyStringSet set = new WriteOnlyStringSet(capacity);
String idPrefix = StringUtils.repeat("a", 200);
- for (int i = 0; i < capacity; i++){
- set.add(idPrefix.concat(i+""));
+ for (int i = 0; i < capacity; i++) {
+ set.add(idPrefix.concat(i + ""));
}
-
+
assertEquals(capacity, set.size());
- assertTrue(System.currentTimeMillis()-start < 20*1000);
+ assertTrue(System.currentTimeMillis() - start < 20 * 1000);
}
/**
diff --git a/mill-db-repo/pom.xml b/mill-db-repo/pom.xml
index b29ea58..e350a99 100644
--- a/mill-db-repo/pom.xml
+++ b/mill-db-repo/pom.xml
@@ -1,5 +1,5 @@
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
org.duracloud.db
diff --git a/mill-db-repo/src/main/java/org/duracloud/mill/auditor/AuditLogItem.java b/mill-db-repo/src/main/java/org/duracloud/mill/auditor/AuditLogItem.java
index 5c8371f..29c950c 100644
--- a/mill-db-repo/src/main/java/org/duracloud/mill/auditor/AuditLogItem.java
+++ b/mill-db-repo/src/main/java/org/duracloud/mill/auditor/AuditLogItem.java
@@ -9,89 +9,77 @@
/**
* An intereface defining a log item.
- *
+ *
* @author Daniel Bernstein
- *
*/
public interface AuditLogItem {
/**
- *
* @return
*/
public String getAccount();
/**
- *
* @return
*/
public String getStoreId();
/**
- *
* @return
*/
public String getSpaceId();
/**
- *
* @return
*/
public String getContentId();
/**
- *
* @return
*/
public String getContentMd5();
/**
- * @return
- */
- public String getMimetype();
+ * @return
+ */
+ public String getMimetype();
- /*
- *
- * @return
- */
- public String getContentSize();
+ /*
+ *
+ * @return
+ */
+ public String getContentSize();
- /**
- *
- * @return
- */
- public String getContentProperties();
+ /**
+ * @return
+ */
+ public String getContentProperties();
- /**
- *
- * @return
- */
- public String getSpaceAcls();
-
- /**
- *
+ /**
+ * @return
+ */
+ public String getSpaceAcls();
+
+ /**
* @return
*/
public String getAction();
/**
- *
* @return
*/
public String getUsername();
-
+
/**
- *
* @return
*/
public String getSourceSpaceId();
/**
- *
* @return
*/
public String getSourceContentId();
+
/**
- *
* @return
*/
public long getTimestamp();
diff --git a/mill-db-repo/src/main/java/org/duracloud/mill/auditor/AuditLogStore.java b/mill-db-repo/src/main/java/org/duracloud/mill/auditor/AuditLogStore.java
index 4efb339..bd8fc65 100644
--- a/mill-db-repo/src/main/java/org/duracloud/mill/auditor/AuditLogStore.java
+++ b/mill-db-repo/src/main/java/org/duracloud/mill/auditor/AuditLogStore.java
@@ -9,7 +9,6 @@
import java.util.Date;
import java.util.Iterator;
-import java.util.Map;
import org.duracloud.common.db.error.NotFoundException;
@@ -22,6 +21,7 @@ public interface AuditLogStore {
/**
* This method writes the logItem to the audit log.
+ *
* @param account
* @param storeId
* @param spaceId
@@ -50,10 +50,10 @@ public void write(String account,
String sourceSpaceId,
String sourceContentId,
Date timestamp) throws AuditLogWriteFailedException;
-
-
+
/**
* Retrieves log history for a content item.
+ *
* @param account
* @param storeId
* @param spaceId
@@ -67,6 +67,7 @@ public Iterator getLogItems(String account,
/**
* Retrieves log history for a content item in chronological order
+ *
* @param account
* @param storeId
* @param spaceId
@@ -74,16 +75,17 @@ public Iterator getLogItems(String account,
* @return
*/
public AuditLogItem getLatestLogItem(String account,
- String storeId,
- String spaceId,
- String contentId) throws NotFoundException;
-
+ String storeId,
+ String spaceId,
+ String contentId) throws NotFoundException;
+
/**
* Adds the following properties to the specified item.
+ *
* @param item
* @param properties
* @throws AuditLogWriteFailedException
*/
public void updateProperties(AuditLogItem item, String properties) throws AuditLogWriteFailedException;
-
+
}
diff --git a/mill-db-repo/src/main/java/org/duracloud/mill/auditor/AuditLogWriteFailedException.java b/mill-db-repo/src/main/java/org/duracloud/mill/auditor/AuditLogWriteFailedException.java
index 6700e52..512414d 100644
--- a/mill-db-repo/src/main/java/org/duracloud/mill/auditor/AuditLogWriteFailedException.java
+++ b/mill-db-repo/src/main/java/org/duracloud/mill/auditor/AuditLogWriteFailedException.java
@@ -9,7 +9,7 @@
/**
* @author Daniel Bernstein
- * March 11, 2014
+ * March 11, 2014
*/
public class AuditLogWriteFailedException extends Exception {
diff --git a/mill-db-repo/src/main/java/org/duracloud/mill/auditor/jpa/JpaAuditLogStore.java b/mill-db-repo/src/main/java/org/duracloud/mill/auditor/jpa/JpaAuditLogStore.java
index 0e5d51a..cecacd4 100644
--- a/mill-db-repo/src/main/java/org/duracloud/mill/auditor/jpa/JpaAuditLogStore.java
+++ b/mill-db-repo/src/main/java/org/duracloud/mill/auditor/jpa/JpaAuditLogStore.java
@@ -11,16 +11,15 @@
import java.util.Iterator;
import java.util.List;
-import org.duracloud.mill.auditor.AuditLogItem;
-import org.duracloud.mill.auditor.AuditLogStore;
-import org.duracloud.mill.auditor.AuditLogWriteFailedException;
import org.duracloud.common.collection.StreamingIterator;
import org.duracloud.common.collection.jpa.JpaIteratorSource;
import org.duracloud.common.db.error.NotFoundException;
+import org.duracloud.mill.auditor.AuditLogItem;
+import org.duracloud.mill.auditor.AuditLogStore;
+import org.duracloud.mill.auditor.AuditLogWriteFailedException;
import org.duracloud.mill.db.model.JpaAuditLogItem;
import org.duracloud.mill.db.repo.JpaAuditLogItemRepo;
import org.duracloud.mill.db.repo.MillJpaRepoConfig;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -31,9 +30,7 @@
import org.springframework.util.CollectionUtils;
/**
- *
* @author Daniel Bernstein
- *
*/
public class JpaAuditLogStore implements AuditLogStore {
private static Logger log = LoggerFactory.getLogger(JpaAuditLogStore.class);
@@ -83,50 +80,51 @@ public void write(String account,
log.debug("item saved: {}", item);
} catch (Exception ex) {
- if(ex instanceof org.springframework.dao.DataIntegrityViolationException){
- log.warn("failed to add audit log item {}: due to data integrity violation: suspected duplicate record: -> message={}",
- ex.getMessage());
- }else{
+ if (ex instanceof org.springframework.dao.DataIntegrityViolationException) {
+ log.warn(
+ "failed to add audit log item {}: due to data integrity violation: suspected duplicate record: ->" +
+ " message={}",
+ ex.getMessage());
+ } else {
throw new AuditLogWriteFailedException(ex, item);
}
}
}
-
@Override
@Transactional(value = MillJpaRepoConfig.TRANSACTION_MANAGER_BEAN, readOnly = true)
public Iterator getLogItems(final String account,
final String storeId,
final String spaceId,
final String contentId) {
- return (Iterator) new StreamingIterator(new JpaIteratorSource(auditLogRepo) {
- @Override
- protected Page getNextPage(Pageable pageable, JpaAuditLogItemRepo repo) {
- return repo
+ return (Iterator) new StreamingIterator(
+ new JpaIteratorSource(auditLogRepo) {
+ @Override
+ protected Page getNextPage(Pageable pageable, JpaAuditLogItemRepo repo) {
+ return repo
.findByAccountAndStoreIdAndSpaceIdAndContentIdOrderByContentIdAsc(account,
storeId,
spaceId,
contentId,
pageable);
- }
- });
+ }
+ });
}
@Override
@Transactional(value = MillJpaRepoConfig.TRANSACTION_MANAGER_BEAN, readOnly = true)
- public AuditLogItem
- getLatestLogItem(String account,
- String storeId,
- String spaceId,
- String contentId) throws NotFoundException {
+ public AuditLogItem getLatestLogItem(String account,
+ String storeId,
+ String spaceId,
+ String contentId) throws NotFoundException {
List result = auditLogRepo
- .findByAccountAndStoreIdAndSpaceIdAndContentIdOrderByTimestampDesc(account,
- storeId,
- spaceId,
- contentId);
- if(!CollectionUtils.isEmpty(result)){
+ .findByAccountAndStoreIdAndSpaceIdAndContentIdOrderByTimestampDesc(account,
+ storeId,
+ spaceId,
+ contentId);
+ if (!CollectionUtils.isEmpty(result)) {
return result.get(0);
- }else{
+ } else {
return null;
}
}
@@ -134,17 +132,17 @@ protected Page getNextPage(Pageable pageable, JpaAuditLogItemRe
@Override
@Transactional(value = MillJpaRepoConfig.TRANSACTION_MANAGER_BEAN, propagation = Propagation.REQUIRES_NEW)
public void updateProperties(AuditLogItem item, String properties)
- throws AuditLogWriteFailedException {
-
- if(!(item instanceof JpaAuditLogItem)){
+ throws AuditLogWriteFailedException {
+
+ if (!(item instanceof JpaAuditLogItem)) {
throw new AuditLogWriteFailedException("audit log item must be of type " +
"JpaAuditLogItem when used with this " +
"implementation: item is of type "
+ item.getClass().getCanonicalName(), item);
}
- Long id = ((JpaAuditLogItem)item).getId();
-
- JpaAuditLogItem refreshedItem = auditLogRepo.findOne(id);
+ Long id = ((JpaAuditLogItem) item).getId();
+
+ JpaAuditLogItem refreshedItem = auditLogRepo.findOne(id);
refreshedItem.setContentProperties(properties);
auditLogRepo.saveAndFlush(refreshedItem);
}
diff --git a/mill-db-repo/src/main/java/org/duracloud/mill/db/model/BaseEntity.java b/mill-db-repo/src/main/java/org/duracloud/mill/db/model/BaseEntity.java
index e8b5675..d4d32b5 100644
--- a/mill-db-repo/src/main/java/org/duracloud/mill/db/model/BaseEntity.java
+++ b/mill-db-repo/src/main/java/org/duracloud/mill/db/model/BaseEntity.java
@@ -8,39 +8,35 @@
package org.duracloud.mill.db.model;
import java.util.Date;
-
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
-import javax.persistence.Version;
import javax.persistence.MappedSuperclass;
+import javax.persistence.Version;
import org.apache.commons.lang3.builder.ToStringBuilder;
/**
- *
* @author Daniel Bernstein
- *
*/
@MappedSuperclass
public abstract class BaseEntity {
@Id
- @GeneratedValue(strategy=GenerationType.AUTO)
- @Column(columnDefinition="bigint(20) AUTO_INCREMENT")
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(columnDefinition = "bigint(20) AUTO_INCREMENT")
protected Long id;
-
- @Column(nullable=false, columnDefinition="datetime(3) NOT NULL")
+ @Column(nullable = false, columnDefinition = "datetime(3) NOT NULL")
private Date modified;
@Version
@Column(nullable = false, columnDefinition = "int NOT NULL DEFAULT 0")
private int version;
- public Long getId() {
+ public Long getId() {
return id;
}
@@ -58,16 +54,21 @@ public void setModified(Date modified) {
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
BaseEntity that = (BaseEntity) o;
- if (id != null ? !id.equals(that.id) : that.id != null) return false;
+ if (id != null ? !id.equals(that.id) : that.id != null) {
+ return false;
+ }
return true;
}
-
public int getVersion() {
return version;
@@ -81,12 +82,12 @@ public void setVersion(int version) {
public int hashCode() {
return id != null ? id.hashCode() : 0;
}
-
+
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return ToStringBuilder.reflectionToString(this);
+ return ToStringBuilder.reflectionToString(this);
}
}
\ No newline at end of file
diff --git a/mill-db-repo/src/main/java/org/duracloud/mill/db/model/BitIntegrityReport.java b/mill-db-repo/src/main/java/org/duracloud/mill/db/model/BitIntegrityReport.java
index 778bda1..ed6e01b 100644
--- a/mill-db-repo/src/main/java/org/duracloud/mill/db/model/BitIntegrityReport.java
+++ b/mill-db-repo/src/main/java/org/duracloud/mill/db/model/BitIntegrityReport.java
@@ -8,7 +8,6 @@
package org.duracloud.mill.db.model;
import java.util.Date;
-
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
@@ -19,74 +18,89 @@
/**
* @author Daniel Bernstein
- * Date: Sep 2, 2014
+ * Date: Sep 2, 2014
*/
@Entity
@Table(name = "bit_report")
public class BitIntegrityReport extends BaseEntity {
- @Column(nullable=false)
+ @Column(nullable = false)
private String account;
- @Column(nullable=false)
+ @Column(nullable = false)
private String storeId;
- @Column(nullable=false)
+ @Column(nullable = false)
private String spaceId;
- @Column(nullable=false, length=1024)
+ @Column(nullable = false, length = 1024)
private String reportContentId;
- @Column(nullable=false)
+ @Column(nullable = false)
private Date completionDate;
- @Column(nullable=false)
+ @Column(nullable = false)
private String reportSpaceId;
-
+
private boolean display = true;
-
+
@Enumerated(EnumType.STRING)
private BitIntegrityReportResult result;
-
+
public String getAccount() {
return account;
}
+
public void setAccount(String account) {
this.account = account;
}
+
public String getStoreId() {
return storeId;
}
+
public void setStoreId(String storeId) {
this.storeId = storeId;
}
+
public String getSpaceId() {
return spaceId;
}
+
public void setSpaceId(String spaceId) {
this.spaceId = spaceId;
}
+
public String getReportContentId() {
return reportContentId;
}
+
public void setReportContentId(String reportContentId) {
this.reportContentId = reportContentId;
}
+
public Date getCompletionDate() {
return completionDate;
}
+
public void setCompletionDate(Date completionDate) {
this.completionDate = completionDate;
}
+
public BitIntegrityReportResult getResult() {
return result;
}
+
public void setResult(BitIntegrityReportResult result) {
this.result = result;
}
+
public String getReportSpaceId() {
return reportSpaceId;
}
+
public void setReportSpaceId(String reportSpaceId) {
this.reportSpaceId = reportSpaceId;
}
+
public boolean isDisplay() {
return display;
}
+
public void setDisplay(boolean display) {
this.display = display;
}
diff --git a/mill-db-repo/src/main/java/org/duracloud/mill/db/model/JpaAuditLogItem.java b/mill-db-repo/src/main/java/org/duracloud/mill/db/model/JpaAuditLogItem.java
index eee4273..ae56b80 100644
--- a/mill-db-repo/src/main/java/org/duracloud/mill/db/model/JpaAuditLogItem.java
+++ b/mill-db-repo/src/main/java/org/duracloud/mill/db/model/JpaAuditLogItem.java
@@ -18,45 +18,43 @@
import org.duracloud.mill.auditor.AuditLogItem;
/**
- *
* @author Daniel Bernstein
- *
*/
@Entity
@Table(name = "audit_log_item",
- uniqueConstraints = @UniqueConstraint(columnNames = { "uniqueKey"}))
+ uniqueConstraints = @UniqueConstraint(columnNames = {"uniqueKey"}))
public class JpaAuditLogItem extends BaseEntity implements AuditLogItem {
- @Column(nullable=false)
+ @Column(nullable = false)
private String account;
- @Column(nullable=false)
+ @Column(nullable = false)
private String storeId;
- @Column(nullable=false)
+ @Column(nullable = false)
private String spaceId;
- @Column(length=1024)
+ @Column(length = 1024)
private String contentId;
private String contentMd5;
private String mimetype;
private String contentSize;
- @Column(length=2048)
+ @Column(length = 2048)
private String contentProperties;
- @Column(length=2048)
+ @Column(length = 2048)
private String spaceAcls;
- @Column(nullable=false)
+ @Column(nullable = false)
private String action;
- @Column(nullable=false)
+ @Column(nullable = false)
private String username;
private String sourceSpaceId;
private String sourceContentId;
private String uniqueKey;
-
+
/*
* indicates whether or not the item has been written to file.
*/
- private boolean written = false;
-
- @Column(nullable=false)
+ private boolean written = false;
+
+ @Column(nullable = false)
private Long timestamp;
-
+
@Override
public String getAccount() {
return this.account;
@@ -183,14 +181,14 @@ public void setTimestamp(Long timestamp) {
this.timestamp = timestamp;
}
- @Column(columnDefinition="char(32) NOT NULL")
+ @Column(columnDefinition = "char(32) NOT NULL")
@Access(AccessType.PROPERTY)
public String getUniqueKey() {
- if(uniqueKey == null){
+ if (uniqueKey == null) {
this.uniqueKey = DigestUtils.md5Hex(this.action + "/" + this.account + "/"
- + this.storeId + "/" + this.spaceId + "/"
- + (this.contentId == null ? " " : this.contentId) + "/"
- + this.timestamp);
+ + this.storeId + "/" + this.spaceId + "/"
+ + (this.contentId == null ? " " : this.contentId) + "/"
+ + this.timestamp);
}
return uniqueKey;
}
@@ -206,6 +204,5 @@ public boolean isWritten() {
public void setWritten(boolean written) {
this.written = written;
}
-
-
+
}
diff --git a/mill-db-repo/src/main/java/org/duracloud/mill/db/model/ManifestItem.java b/mill-db-repo/src/main/java/org/duracloud/mill/db/model/ManifestItem.java
index f847a04..0dda6ef 100644
--- a/mill-db-repo/src/main/java/org/duracloud/mill/db/model/ManifestItem.java
+++ b/mill-db-repo/src/main/java/org/duracloud/mill/db/model/ManifestItem.java
@@ -18,25 +18,25 @@
/**
* @author Daniel Bernstein
- * Date: Sep 2, 2014
+ * Date: Sep 2, 2014
*/
@Entity
@Table(name = "manifest_item",
- uniqueConstraints = @UniqueConstraint(columnNames = { "uniqueKey"}))
+ uniqueConstraints = @UniqueConstraint(columnNames = {"uniqueKey"}))
public class ManifestItem extends BaseEntity {
- @Column(nullable=false)
+ @Column(nullable = false)
private String account;
- @Column(nullable=false)
+ @Column(nullable = false)
private String storeId;
- @Column(nullable=false)
+ @Column(nullable = false)
private String spaceId;
- @Column(nullable=false, length=1024)
+ @Column(nullable = false, length = 1024)
private String contentId;
- @Column(nullable=false)
+ @Column(nullable = false)
private String contentChecksum;
- @Column(nullable=false)
+ @Column(nullable = false)
private String contentSize;
- @Column(nullable=false)
+ @Column(nullable = false)
private String contentMimetype;
/**
@@ -46,58 +46,65 @@ public class ManifestItem extends BaseEntity {
* resolve itself. However, it is also possible that the item was deleted
* directly on the storage provider and thus the inconsistency will not
* resolve itself.
- *
+ *
* Thus the missingFromStorageProvider field is used by the bit integrity space listing verification
* process to indicate a suspected problem. If the space listing verification encounters
* an item in the manifest that is not in the storage provider AND the missingFromStorageProvider is
* set to true, an error will be logged.
- *
*/
private boolean missingFromStorageProvider = false;
-
+
private boolean deleted = false;
private String uniqueKey;
-
public String getAccount() {
return account;
}
+
public void setAccount(String account) {
this.account = account;
}
+
public String getStoreId() {
return storeId;
}
+
public void setStoreId(String storeId) {
this.storeId = storeId;
}
+
public String getSpaceId() {
return spaceId;
}
+
public void setSpaceId(String spaceId) {
this.spaceId = spaceId;
}
+
public String getContentId() {
return contentId;
}
+
public void setContentId(String contentId) {
this.contentId = contentId;
}
+
public String getContentChecksum() {
return contentChecksum;
}
+
public void setContentChecksum(String contentChecksum) {
this.contentChecksum = contentChecksum;
}
-
+
@Access(AccessType.PROPERTY)
- @Column(columnDefinition="char(32) NOT NULL")
+ @Column(columnDefinition = "char(32) NOT NULL")
public String getUniqueKey() {
- if(uniqueKey == null){
+ if (uniqueKey == null) {
this.uniqueKey = DigestUtils.md5Hex(this.account + "/" +
- this.storeId + "/" +
- this.spaceId + "/"+
+ this.storeId + "/" +
+ this.spaceId + "/" +
this.contentId);
}
return uniqueKey;
@@ -106,27 +113,35 @@ public String getUniqueKey() {
public void setUniqueKey(String uniqueKey) {
this.uniqueKey = uniqueKey;
}
+
public boolean isDeleted() {
return deleted;
}
+
public void setDeleted(boolean deleted) {
this.deleted = deleted;
}
+
public String getContentMimetype() {
return contentMimetype;
}
+
public void setContentMimetype(String contentMimetype) {
this.contentMimetype = contentMimetype;
}
+
public String getContentSize() {
return contentSize;
}
+
public void setContentSize(String contentSize) {
this.contentSize = contentSize;
}
+
public boolean isMissingFromStorageProvider() {
return missingFromStorageProvider;
}
+
public void setMissingFromStorageProvider(boolean missingFromStorageProvider) {
this.missingFromStorageProvider = missingFromStorageProvider;
}
diff --git a/mill-db-repo/src/main/java/org/duracloud/mill/db/model/SpaceStats.java b/mill-db-repo/src/main/java/org/duracloud/mill/db/model/SpaceStats.java
index 46ac810..e251c31 100644
--- a/mill-db-repo/src/main/java/org/duracloud/mill/db/model/SpaceStats.java
+++ b/mill-db-repo/src/main/java/org/duracloud/mill/db/model/SpaceStats.java
@@ -8,32 +8,31 @@
package org.duracloud.mill.db.model;
import java.util.Date;
-
import javax.persistence.Column;
import javax.persistence.Entity;
/**
* Represents a space's byte and object count at a moment in time.
- * @author Daniel Bernstein
*
+ * @author Daniel Bernstein
*/
@Entity
public class SpaceStats extends BaseEntity {
-
- @Column(nullable=false, length=100)
+
+ @Column(nullable = false, length = 100)
private String accountId;
- @Column(nullable=false, length=63)
+ @Column(nullable = false, length = 63)
private String spaceId;
- @Column(nullable=false, length=10)
+ @Column(nullable = false, length = 10)
private String storeId;
- @Column(nullable=false)
+ @Column(nullable = false)
private long byteCount = 0;
- @Column(nullable=false)
+ @Column(nullable = false)
private long objectCount = 0;
-
-
- public SpaceStats (){}
-
+
+ public SpaceStats() {
+ }
+
public SpaceStats(Date modified, String account, String storeId, String spaceId, long byteCount, long objectCount) {
setModified(modified);
setAccountId(account);
@@ -42,34 +41,43 @@ public SpaceStats(Date modified, String account, String storeId, String spaceId,
setByteCount(byteCount);
setObjectCount(objectCount);
}
-
+
public String getSpaceId() {
return spaceId;
}
+
public void setSpaceId(String spaceId) {
this.spaceId = spaceId;
}
+
public String getStoreId() {
return storeId;
}
+
public void setStoreId(String storeId) {
this.storeId = storeId;
}
+
public String getAccountId() {
return accountId;
}
+
public void setAccountId(String accountId) {
this.accountId = accountId;
}
+
public long getByteCount() {
return byteCount;
}
+
public void setByteCount(long byteCount) {
this.byteCount = byteCount;
}
+
public long getObjectCount() {
return objectCount;
}
+
public void setObjectCount(long objectCount) {
this.objectCount = objectCount;
}
diff --git a/mill-db-repo/src/main/java/org/duracloud/mill/db/repo/JpaAuditLogItemRepo.java b/mill-db-repo/src/main/java/org/duracloud/mill/db/repo/JpaAuditLogItemRepo.java
index cad4cc4..9df8641 100644
--- a/mill-db-repo/src/main/java/org/duracloud/mill/db/repo/JpaAuditLogItemRepo.java
+++ b/mill-db-repo/src/main/java/org/duracloud/mill/db/repo/JpaAuditLogItemRepo.java
@@ -17,26 +17,22 @@
import org.springframework.stereotype.Repository;
/**
- *
* @author Daniel Bernstein
- *
*/
-@Repository(value="auditLogItemRepo")
+@Repository(value = "auditLogItemRepo")
public interface JpaAuditLogItemRepo extends JpaRepository {
public Page findByAccountAndStoreIdAndSpaceIdAndContentIdOrderByContentIdAsc(
- @Param("account") String account,
- @Param("storeId") String storeId,
- @Param("spaceId") String spaceId,
- @Param("spaceId") String contentId,
- Pageable pageable);
+ @Param("account") String account,
+ @Param("storeId") String storeId,
+ @Param("spaceId") String spaceId,
+ @Param("spaceId") String contentId,
+ Pageable pageable);
-
public List findByWrittenFalseOrderByTimestampAsc(Pageable pageable);
-
-
+
public Long deleteByWrittenTrueAndTimestampLessThan(long timestamp);
-
+
/**
* @param account
* @param storeId
@@ -44,14 +40,13 @@ public Page findByAccountAndStoreIdAndSpaceIdAndContentIdOrderB
* @param contentId
* @return
*/
- public List
- findByAccountAndStoreIdAndSpaceIdAndContentIdOrderByTimestampDesc(String account,
- String storeId,
- String spaceId,
- String contentId);
+ public List findByAccountAndStoreIdAndSpaceIdAndContentIdOrderByTimestampDesc(String account,
+ String storeId,
+ String spaceId,
+ String contentId);
public Page findByAccountAndSpaceIdOrderByTimestampAsc(String account,
- String spaceId,
- Pageable pageable);
+ String spaceId,
+ Pageable pageable);
}
diff --git a/mill-db-repo/src/main/java/org/duracloud/mill/db/repo/JpaBitIntegrityReportRepo.java b/mill-db-repo/src/main/java/org/duracloud/mill/db/repo/JpaBitIntegrityReportRepo.java
index 4688cd3..43b0114 100644
--- a/mill-db-repo/src/main/java/org/duracloud/mill/db/repo/JpaBitIntegrityReportRepo.java
+++ b/mill-db-repo/src/main/java/org/duracloud/mill/db/repo/JpaBitIntegrityReportRepo.java
@@ -12,12 +12,9 @@
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
-import org.springframework.transaction.annotation.Transactional;
/**
- *
* @author Daniel Bernstein
- *
*/
@Repository(value = "bitIntegrityReportRepo")
public interface JpaBitIntegrityReportRepo
@@ -30,13 +27,11 @@ public interface JpaBitIntegrityReportRepo
* @return
*/
- Page
- findByStoreIdAndSpaceIdAndDisplayTrueOrderByCompletionDateDesc(String storeId,
- String spaceId,
- Pageable pageable);
+ Page findByStoreIdAndSpaceIdAndDisplayTrueOrderByCompletionDateDesc(String storeId,
+ String spaceId,
+ Pageable pageable);
/**
- *
* @param account
* @param storeId
* @param spaceId
diff --git a/mill-db-repo/src/main/java/org/duracloud/mill/db/repo/JpaManifestItemRepo.java b/mill-db-repo/src/main/java/org/duracloud/mill/db/repo/JpaManifestItemRepo.java
index 91369da..35f6754 100644
--- a/mill-db-repo/src/main/java/org/duracloud/mill/db/repo/JpaManifestItemRepo.java
+++ b/mill-db-repo/src/main/java/org/duracloud/mill/db/repo/JpaManifestItemRepo.java
@@ -20,13 +20,10 @@
import org.springframework.stereotype.Repository;
/**
- *
* @author Daniel Bernstein
- *
*/
@Repository(value = "manifestItemRepo")
-public interface JpaManifestItemRepo extends
- JpaRepository {
+public interface JpaManifestItemRepo extends JpaRepository {
/**
* @param account
@@ -35,45 +32,42 @@ public interface JpaManifestItemRepo extends
* @param pageable
* @return
*/
- Page
- findByAccountAndStoreIdAndSpaceIdAndDeletedFalseOrderByContentIdAsc(String account,
- String storeId,
- String spaceId,
- Pageable pageable);
+ Page findByAccountAndStoreIdAndSpaceIdAndDeletedFalseOrderByContentIdAsc(String account,
+ String storeId,
+ String spaceId,
+ Pageable pageable);
/**
- *
* @param account
* @param storeId
* @param spaceId
- * @param lastId
- * The last id of the previous page. If there was no previous
- * page, we recommend that you use the minimum id minus 1 in the
- * unpaged set for optimum performance.
+ * @param lastId The last id of the previous page. If there was no previous
+ * page, we recommend that you use the minimum id minus 1 in the
+ * unpaged set for optimum performance.
* @param limit
* @return
*/
- @Query(nativeQuery=true,value="select * from manifest_item where account = ?1 and store_id=?2 and "
- + "space_id = ?3 and deleted = false and id > ?4 order by id limit ?5")
- List
- findByAccountAndStoreIdAndSpaceIdAndDeletedFalse(String account,
- String storeId,
- String spaceId,
- long lastId,
- int limit);
+ @Query(nativeQuery = true, value = "select * from manifest_item where account = ?1 and store_id=?2 and "
+ + "space_id = ?3 and deleted = false and id > ?4 order by id limit ?5")
+ List findByAccountAndStoreIdAndSpaceIdAndDeletedFalse(String account,
+ String storeId,
+ String spaceId,
+ long lastId,
+ int limit);
/**
* Returns the minimum id value for the specified data set.
+ *
* @param account
* @param storeId
* @param spaceId
* @return
*/
- @Query(nativeQuery=true,value="select ifnull(min(id),0) from manifest_item where account = ?1 and store_id=?2 and "
- + "space_id = ?3 and deleted = false")
- long getMinId(String account, String storeId, String spaceId);
+ @Query(nativeQuery = true,
+ value = "select ifnull(min(id),0) from manifest_item where account = ?1 and store_id=?2 and "
+ + "space_id = ?3 and deleted = false")
+ long getMinId(String account, String storeId, String spaceId);
-
/**
* @param account
* @param storeId
@@ -81,40 +75,37 @@ public interface JpaManifestItemRepo extends
* @param contentId
* @return
*/
- ManifestItem
- findByAccountAndStoreIdAndSpaceIdAndContentId(String account,
- String storeId,
- String spaceId,
- String contentId);
+ ManifestItem findByAccountAndStoreIdAndSpaceIdAndContentId(String account,
+ String storeId,
+ String spaceId,
+ String contentId);
/**
* @param expiration
*/
@Modifying
- @Query(nativeQuery=true,value="delete from manifest_item where deleted = true and modified < ?1 limit 50000")
+ @Query(nativeQuery = true, value = "delete from manifest_item where deleted = true and modified < ?1 limit 50000")
int deleteFirst50000ByDeletedTrueAndModifiedBefore(Date expiration);
void deleteByAccountAndStoreIdAndSpaceId(String account,
String storeId,
String spaceId);
-
/**
* Returns an array with the following values: [item_count,byte_count]
+ *
* @param account
* @param storeId
* @param spaceId
* @return
*/
- @Query(nativeQuery=true,
- value="select count(*) objectCount, sum(content_size) as byteCount "
- + "from manifest_item "
- + "where account = :account and store_id = :storeId and "
- + "space_id= :spaceId and deleted=false")
- public Object[] getStorageStatsByAccountAndStoreIdAndSpaceId(@Param("account")String account,
- @Param("storeId")String storeId,
- @Param("spaceId")String spaceId);
-
-
+ @Query(nativeQuery = true,
+ value = "select count(*) objectCount, sum(content_size) as byteCount "
+ + "from manifest_item "
+ + "where account = :account and store_id = :storeId and "
+ + "space_id= :spaceId and deleted=false")
+ public Object[] getStorageStatsByAccountAndStoreIdAndSpaceId(@Param("account") String account,
+ @Param("storeId") String storeId,
+ @Param("spaceId") String spaceId);
}
diff --git a/mill-db-repo/src/main/java/org/duracloud/mill/db/repo/JpaSpaceStatsRepo.java b/mill-db-repo/src/main/java/org/duracloud/mill/db/repo/JpaSpaceStatsRepo.java
index 7764c3e..96feb19 100644
--- a/mill-db-repo/src/main/java/org/duracloud/mill/db/repo/JpaSpaceStatsRepo.java
+++ b/mill-db-repo/src/main/java/org/duracloud/mill/db/repo/JpaSpaceStatsRepo.java
@@ -17,88 +17,84 @@
import org.springframework.stereotype.Repository;
/**
- *
* @author Daniel Bernstein
- *
*/
-@Repository(value="spaceStatsRepo")
+@Repository(value = "spaceStatsRepo")
public interface JpaSpaceStatsRepo extends JpaRepository {
public static final String INTERVAL_DAY = "%Y-%m-%d";
public static final String INTERVAL_WEEK = "%Y-%u";
public static final String INTERVAL_MONTH = "%Y-%m";
- @Query(nativeQuery=true,
- value="select"
- + " unix_timestamp(date_format(min(modified), '%Y-%m-%d 00:00:00')) as modified, "
- + " account_id,"
- + " store_id,"
- + " space_id,"
- + " avg(byte_count) as byte_count,"
- + " avg(object_count) as object_count,"
- + " date_format(modified, :interval) "
- + "from space_stats "
- + "where account_id = :accountId and "
- + " store_id = :storeId and "
- + " space_id = :spaceId and "
- + " modified between :start and :end "
- + "group by date_format(modified, :interval), "
- + " account_id, "
- + " store_id, "
- + " space_id" )
+ @Query(nativeQuery = true,
+ value = "select"
+ + " unix_timestamp(date_format(min(modified), '%Y-%m-%d 00:00:00')) as modified, "
+ + " account_id,"
+ + " store_id,"
+ + " space_id,"
+ + " avg(byte_count) as byte_count,"
+ + " avg(object_count) as object_count,"
+ + " date_format(modified, :interval) "
+ + "from space_stats "
+ + "where account_id = :accountId and "
+ + " store_id = :storeId and "
+ + " space_id = :spaceId and "
+ + " modified between :start and :end "
+ + "group by date_format(modified, :interval), "
+ + " account_id, "
+ + " store_id, "
+ + " space_id")
public List
org.springframework
@@ -500,12 +536,12 @@
-
+
- org.springframework.security
- spring-security-core
- ${org.springframework.security.version}
-
+ org.springframework.security
+ spring-security-core
+ ${org.springframework.security.version}
+
org.springframework.data
@@ -526,15 +562,15 @@
- org.springframework
- spring-tx
- ${org.springframework.version}
-
-
- commons-logging
- commons-logging
-
-
+ org.springframework
+ spring-tx
+ ${org.springframework.version}
+
+
+ commons-logging
+ commons-logging
+
+
@@ -552,8 +588,8 @@
org.hibernate
hibernate-validator
- ${hibernate.version}
-
+ ${hibernate.version}
+
org.jboss.logging
jboss-logging
@@ -562,14 +598,14 @@
com.fasterxml
classmate
-
+
org.hibernate.javax.persistence
hibernate-jpa-2.1-api
1.0.0.Final
-
+
mysql