Class Environment
- java.lang.Object
-
- org.gcube.informationsystem.resourceregistry.environments.Environment
-
- Direct Known Subclasses:
HierarchicalEnvironment,SystemEnvironment
public abstract class Environment extends Object
- Author:
- Luca Frosini (ISTI - CNR) Base class for any environment. In the current implementation it represents a portion of a graph which in OrientDB is implemented via security.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEnvironment.PermissionModestatic classEnvironment.SecurityType
-
Field Summary
Fields Modifier and Type Field Description protected static Set<String>allOperationAllowedRolesRoles allowed to operate on the security contextprotected Set<String>allowedRolesstatic StringCONTEXT_MANAGERprotected static StringDEFAULT_READER_ROLEprotected static StringDEFAULT_WRITER_ROLEprotected UUIDenvironmentUUIDstatic StringINFRASTRUCTURE_MANAGERstatic StringIS_MANAGERprotected Map<Environment.PermissionMode,com.orientechnologies.orient.core.db.ODatabasePool>poolMap
-
Constructor Summary
Constructors Modifier Constructor Description protectedEnvironment(UUID context)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddElement(com.orientechnologies.orient.core.record.OElement element)voidaddElement(com.orientechnologies.orient.core.record.OElement element, com.orientechnologies.orient.core.db.document.ODatabaseDocument oDatabaseDocument)protected com.orientechnologies.orient.core.metadata.security.ORoleaddExtraRules(com.orientechnologies.orient.core.metadata.security.ORole role, Environment.PermissionMode permissionMode)protected voidallow(com.orientechnologies.orient.core.metadata.security.OSecurity oSecurity, com.orientechnologies.orient.core.record.impl.ODocument oDocument)protected booleanallowed(com.orientechnologies.orient.core.metadata.security.ORole role, com.orientechnologies.orient.core.record.impl.ODocument oDocument)voidcreate()voidcreate(com.orientechnologies.orient.core.db.document.ODatabaseDocument oDatabaseDocument)protected voidcreateRolesAndUsers(com.orientechnologies.orient.core.metadata.security.OSecurity oSecurity)voiddelete()voiddelete(com.orientechnologies.orient.core.db.document.ODatabaseDocument orientGraph)protected voiddeleteRolesAndUsers(com.orientechnologies.orient.core.metadata.security.OSecurity oSecurity)protected voiddeny(com.orientechnologies.orient.core.metadata.security.OSecurity oSecurity, com.orientechnologies.orient.core.record.impl.ODocument oDocument)protected voiddrop(com.orientechnologies.orient.core.metadata.security.OSecurity oSecurity, String name, Environment.SecurityType securityType)static Set<String>getAllOperationsAllowedRoles()Set<String>getAllowedRoles()com.orientechnologies.orient.core.db.document.ODatabaseDocumentgetDatabaseDocument(Environment.PermissionMode permissionMode)protected com.orientechnologies.orient.core.db.ODatabasePoolgetPool(Environment.PermissionMode permissionMode, boolean recreate)static StringgetRoleOrUserName(Environment.PermissionMode permissionMode, Environment.SecurityType securityType)StringgetSecurityRoleOrUserName(Environment.PermissionMode permissionMode, Environment.SecurityType securityType)protected com.orientechnologies.orient.core.metadata.security.ORolegetSuperRole(com.orientechnologies.orient.core.metadata.security.OSecurity oSecurity, Environment.PermissionMode permissionMode)UUIDgetUUID()booleanisElementInContext(com.orientechnologies.orient.core.record.OElement element)booleanisUserAllowed(Collection<String> allowedRoles)voidremoveElement(com.orientechnologies.orient.core.record.OElement element)voidremoveElement(com.orientechnologies.orient.core.record.OElement element, com.orientechnologies.orient.core.db.document.ODatabaseDocument oDatabaseDocument)StringtoString()
-
-
-
Field Detail
-
DEFAULT_WRITER_ROLE
protected static final String DEFAULT_WRITER_ROLE
- See Also:
- Constant Field Values
-
DEFAULT_READER_ROLE
protected static final String DEFAULT_READER_ROLE
- See Also:
- Constant Field Values
-
environmentUUID
protected final UUID environmentUUID
-
poolMap
protected final Map<Environment.PermissionMode,com.orientechnologies.orient.core.db.ODatabasePool> poolMap
-
allOperationAllowedRoles
protected static Set<String> allOperationAllowedRoles
Roles allowed to operate on the security context
-
INFRASTRUCTURE_MANAGER
public static final String INFRASTRUCTURE_MANAGER
- See Also:
- Constant Field Values
-
IS_MANAGER
public static final String IS_MANAGER
- See Also:
- Constant Field Values
-
CONTEXT_MANAGER
public static final String CONTEXT_MANAGER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Environment
protected Environment(UUID context) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
-
Method Detail
-
getPool
protected com.orientechnologies.orient.core.db.ODatabasePool getPool(Environment.PermissionMode permissionMode, boolean recreate)
-
getUUID
public UUID getUUID()
-
getRoleOrUserName
public static String getRoleOrUserName(Environment.PermissionMode permissionMode, Environment.SecurityType securityType)
-
getSecurityRoleOrUserName
public String getSecurityRoleOrUserName(Environment.PermissionMode permissionMode, Environment.SecurityType securityType)
-
addElement
public void addElement(com.orientechnologies.orient.core.record.OElement element) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
allow
protected void allow(com.orientechnologies.orient.core.metadata.security.OSecurity oSecurity, com.orientechnologies.orient.core.record.impl.ODocument oDocument)
-
isElementInContext
public boolean isElementInContext(com.orientechnologies.orient.core.record.OElement element) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
addElement
public void addElement(com.orientechnologies.orient.core.record.OElement element, com.orientechnologies.orient.core.db.document.ODatabaseDocument oDatabaseDocument)
-
removeElement
public void removeElement(com.orientechnologies.orient.core.record.OElement element) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
deny
protected void deny(com.orientechnologies.orient.core.metadata.security.OSecurity oSecurity, com.orientechnologies.orient.core.record.impl.ODocument oDocument)
-
removeElement
public void removeElement(com.orientechnologies.orient.core.record.OElement element, com.orientechnologies.orient.core.db.document.ODatabaseDocument oDatabaseDocument)
-
allowed
protected boolean allowed(com.orientechnologies.orient.core.metadata.security.ORole role, com.orientechnologies.orient.core.record.impl.ODocument oDocument)
-
isUserAllowed
public boolean isUserAllowed(Collection<String> allowedRoles)
-
create
public void create() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
addExtraRules
protected com.orientechnologies.orient.core.metadata.security.ORole addExtraRules(com.orientechnologies.orient.core.metadata.security.ORole role, Environment.PermissionMode permissionMode)
-
getSuperRole
protected com.orientechnologies.orient.core.metadata.security.ORole getSuperRole(com.orientechnologies.orient.core.metadata.security.OSecurity oSecurity, Environment.PermissionMode permissionMode)
-
createRolesAndUsers
protected void createRolesAndUsers(com.orientechnologies.orient.core.metadata.security.OSecurity oSecurity)
-
create
public void create(com.orientechnologies.orient.core.db.document.ODatabaseDocument oDatabaseDocument)
-
drop
protected void drop(com.orientechnologies.orient.core.metadata.security.OSecurity oSecurity, String name, Environment.SecurityType securityType)
-
delete
public void delete() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
deleteRolesAndUsers
protected void deleteRolesAndUsers(com.orientechnologies.orient.core.metadata.security.OSecurity oSecurity)
-
delete
public void delete(com.orientechnologies.orient.core.db.document.ODatabaseDocument orientGraph)
-
getDatabaseDocument
public com.orientechnologies.orient.core.db.document.ODatabaseDocument getDatabaseDocument(Environment.PermissionMode permissionMode) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
-