mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-23 18:05:32 +00:00
Tenant Service Interface (with Single-Tenant implementation by default)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6378 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
parent
43784a170b
commit
b5201ed22d
@ -5,6 +5,12 @@
|
||||
<beans >
|
||||
|
||||
<import resource="classpath:alfresco/cache-context.xml" />
|
||||
|
||||
<import resource="classpath:alfresco/tenant-single-context.xml"/>
|
||||
|
||||
<!-- if available, will enable multi-tenancy -->
|
||||
<import resource="classpath*:alfresco/tenant-multi-context.xml"/>
|
||||
|
||||
<import resource="classpath:alfresco/core-services-context.xml" />
|
||||
<import resource="classpath:alfresco/public-services-context.xml" />
|
||||
<import resource="classpath:alfresco/model-specific-services-context.xml" />
|
||||
|
12
config/alfresco/tenant-single-context.xml
Normal file
12
config/alfresco/tenant-single-context.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
|
||||
|
||||
<beans>
|
||||
|
||||
<!-- -->
|
||||
<!-- Single-Tenant Service Implementation -->
|
||||
<!-- -->
|
||||
|
||||
<bean id="tenantService" class="org.alfresco.repo.tenant.SingleTServiceImpl" />
|
||||
|
||||
</beans>
|
160
source/java/org/alfresco/repo/tenant/SingleTServiceImpl.java
Normal file
160
source/java/org/alfresco/repo/tenant/SingleTServiceImpl.java
Normal file
@ -0,0 +1,160 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.repo.tenant;
|
||||
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
* Empty Tenant Service implementation (for Single-Tenant / Single-Instance)
|
||||
*/
|
||||
|
||||
public class SingleTServiceImpl implements TenantService
|
||||
{
|
||||
public NodeRef getName(NodeRef nodeRef)
|
||||
{
|
||||
return nodeRef;
|
||||
}
|
||||
|
||||
public NodeRef getName(NodeRef inNodeRef, NodeRef nodeRef)
|
||||
{
|
||||
return nodeRef;
|
||||
}
|
||||
|
||||
public StoreRef getName(StoreRef storeRef)
|
||||
{
|
||||
return storeRef;
|
||||
}
|
||||
|
||||
public StoreRef getName(String username, StoreRef storeRef)
|
||||
{
|
||||
return storeRef;
|
||||
}
|
||||
|
||||
public QName getName(NodeRef inNodeRef, QName name)
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getName(String name)
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public QName getBaseName(QName name, boolean forceForNonTenant)
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public NodeRef getBaseName(NodeRef nodeRef)
|
||||
{
|
||||
return nodeRef;
|
||||
}
|
||||
|
||||
public StoreRef getBaseName(StoreRef storeRef)
|
||||
{
|
||||
return storeRef;
|
||||
}
|
||||
|
||||
public String getBaseName(String name)
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public String getBaseName(String name, boolean forceForNonTenant)
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getBaseNameUser(String name)
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void checkDomainUser(String username)
|
||||
{
|
||||
// NOOP
|
||||
}
|
||||
|
||||
public void checkDomain(String name)
|
||||
{
|
||||
// NOOP
|
||||
}
|
||||
|
||||
public NodeRef getRootNode(NodeService nodeService, SearchService searchService, NamespaceService namespaceService, String rootPath, NodeRef rootNodeRef)
|
||||
{
|
||||
return rootNodeRef;
|
||||
}
|
||||
|
||||
public NodeRef getCompanyHomeNode(NodeService nodeService, String username, StoreRef storeRef)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isTenantUser()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isTenantUser(String username)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isTenantName(String name)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getCurrentUserDomain()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getDomain(String name)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getDomainUser(String baseUsername, String tenantDomain)
|
||||
{
|
||||
return baseUsername;
|
||||
}
|
||||
|
||||
public Tenant getTenant(String tenantDomain)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
61
source/java/org/alfresco/repo/tenant/Tenant.java
Normal file
61
source/java/org/alfresco/repo/tenant/Tenant.java
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.repo.tenant;
|
||||
|
||||
/**
|
||||
* Tenant
|
||||
*
|
||||
*/
|
||||
public class Tenant
|
||||
{
|
||||
private String tenantDomain;
|
||||
|
||||
private boolean enabled = false;
|
||||
|
||||
private String rootContentStoreDir = null; // if configured - can be null
|
||||
|
||||
|
||||
public Tenant(String tenantDomain, boolean enabled, String rootContentStoreDir)
|
||||
{
|
||||
this.tenantDomain = tenantDomain;
|
||||
this.enabled = enabled;
|
||||
this.rootContentStoreDir = rootContentStoreDir;
|
||||
}
|
||||
|
||||
public String getTenantDomain()
|
||||
{
|
||||
return tenantDomain;
|
||||
}
|
||||
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public String getRootContentStoreDir()
|
||||
{
|
||||
return rootContentStoreDir;
|
||||
}
|
||||
}
|
94
source/java/org/alfresco/repo/tenant/TenantService.java
Normal file
94
source/java/org/alfresco/repo/tenant/TenantService.java
Normal file
@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.repo.tenant;
|
||||
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
|
||||
/**
|
||||
* Tenant Service interface.
|
||||
* <p>
|
||||
* This interface provides methods to support either Single-Tenant or Multi-Tenant implementations.
|
||||
*
|
||||
*/
|
||||
public interface TenantService
|
||||
{
|
||||
public static final String SEPARATOR = "@";
|
||||
|
||||
public static final String ADMIN_BASENAME = "admin";
|
||||
|
||||
public NodeRef getName(NodeRef nodeRef);
|
||||
|
||||
public NodeRef getName(NodeRef inNodeRef, NodeRef nodeRef);
|
||||
|
||||
public StoreRef getName(StoreRef storeRef);
|
||||
|
||||
public StoreRef getName(String username, StoreRef storeRef);
|
||||
|
||||
public QName getName(NodeRef inNodeRef, QName name);
|
||||
|
||||
public String getName(String name);
|
||||
|
||||
public QName getBaseName(QName name, boolean forceIfNonTenant);
|
||||
|
||||
public NodeRef getBaseName(NodeRef nodeRef);
|
||||
|
||||
public StoreRef getBaseName(StoreRef storeRef);
|
||||
|
||||
public String getBaseName(String name);
|
||||
|
||||
public String getBaseName(String name, boolean forceIfNonTenant);
|
||||
|
||||
public String getBaseNameUser(String name);
|
||||
|
||||
public void checkDomainUser(String username);
|
||||
|
||||
public void checkDomain(String name);
|
||||
|
||||
public NodeRef getRootNode(NodeService nodeService, SearchService searchService, NamespaceService namespaceService, String rootPath, NodeRef rootNodeRef);
|
||||
|
||||
public NodeRef getCompanyHomeNode(NodeService nodeService, String username, StoreRef storeRef);
|
||||
|
||||
public boolean isTenantUser();
|
||||
|
||||
public boolean isTenantUser(String username);
|
||||
|
||||
public boolean isTenantName(String name);
|
||||
|
||||
public String getCurrentUserDomain();
|
||||
|
||||
public String getDomain(String name);
|
||||
|
||||
public String getDomainUser(String baseUsername, String tenantDomain);
|
||||
|
||||
public Tenant getTenant(String tenantDomain);
|
||||
|
||||
public boolean isEnabled();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user