Author: [email protected]
Date: Mon Jan 30 14:03:26 2012
New Revision: 2021

Log:
AMDATU-529 Initial refactor of Tenant interface

Modified:
   
trunk/amdatu-core/deployment-tenantconf/src/main/java/org/amdatu/core/deployment/tenantconf/TenantAutoConfResourceProcessor.java
   
trunk/amdatu-core/itest/base/src/main/java/org/amdatu/core/itest/base/CoreConfigs.java
   
trunk/amdatu-core/itest/tests/src/test/java/org/amdatu/core/itest/tests/DefaultCoreServicesTest.java
   
trunk/amdatu-core/itest/tests/src/test/java/org/amdatu/core/itest/tests/IntegrationFrameworkTest.java
   
trunk/amdatu-core/itest/tests/src/test/java/org/amdatu/core/itest/tests/tenant/MultiTenantTest.java
   
trunk/amdatu-core/itest/tests/src/test/java/org/amdatu/core/itest/tests/tenant/mock/MyDependentServiceImpl.java
   
trunk/amdatu-core/tenant-adaptor/src/main/java/org/amdatu/core/tenant/adaptor/MultiTenantBundleActivator.java
   
trunk/amdatu-core/tenant-adaptor/src/main/java/org/amdatu/core/tenant/adaptor/TenantAdapter.java
   
trunk/amdatu-core/tenant-factory/src/main/java/org/amdatu/core/tenant/factory/TenantServiceFactory.java
   trunk/amdatu-core/tenant/src/main/java/org/amdatu/core/tenant/Tenant.java
   
trunk/amdatu-core/tenant/src/main/java/org/amdatu/core/tenant/TenantConstants.java
   trunk/amdatu-release/pom.xml

Modified: 
trunk/amdatu-core/deployment-tenantconf/src/main/java/org/amdatu/core/deployment/tenantconf/TenantAutoConfResourceProcessor.java
==============================================================================
--- 
trunk/amdatu-core/deployment-tenantconf/src/main/java/org/amdatu/core/deployment/tenantconf/TenantAutoConfResourceProcessor.java
    (original)
+++ 
trunk/amdatu-core/deployment-tenantconf/src/main/java/org/amdatu/core/deployment/tenantconf/TenantAutoConfResourceProcessor.java
    Mon Jan 30 14:03:26 2012
@@ -36,6 +36,7 @@
 import java.util.regex.Pattern;
 
 import org.amdatu.core.tenant.Tenant;
+import org.amdatu.core.tenant.TenantConstants;
 import org.apache.felix.deployment.rp.autoconf.AutoConfResource;
 import org.apache.felix.deployment.rp.autoconf.ObjectClassDefinitionImpl;
 import org.apache.felix.deployment.rp.autoconf.PersistencyManager;
@@ -147,7 +148,7 @@
                 synchronized (m_configurationAdmins) {
                     for (Entry<ServiceReference, ConfigurationAdmin> entry : 
m_configurationAdmins.entrySet()) {
                         ServiceReference reference = entry.getKey();
-                        Object prop = 
reference.getProperty(Tenant.TENANT_ID_SERVICEPROPERTY);
+                        Object prop = 
reference.getProperty(TenantConstants.PID_KEY);
                         if (prop != null && tenantId.equals(prop)) {
                             try {
                                 m_logService.log(LogService.LOG_INFO, "Running 
update task for tenant... " + tenantId);

Modified: 
trunk/amdatu-core/itest/base/src/main/java/org/amdatu/core/itest/base/CoreConfigs.java
==============================================================================
--- 
trunk/amdatu-core/itest/base/src/main/java/org/amdatu/core/itest/base/CoreConfigs.java
      (original)
+++ 
trunk/amdatu-core/itest/base/src/main/java/org/amdatu/core/itest/base/CoreConfigs.java
      Mon Jan 30 14:03:26 2012
@@ -114,7 +114,6 @@
         Properties properties = new Properties();
         properties.put("id", "Default");
         properties.put("name", "Default Tenant");
-        properties.put("host", "localhost");
         return properties;
     }
 }
\ No newline at end of file

Modified: 
trunk/amdatu-core/itest/tests/src/test/java/org/amdatu/core/itest/tests/DefaultCoreServicesTest.java
==============================================================================
--- 
trunk/amdatu-core/itest/tests/src/test/java/org/amdatu/core/itest/tests/DefaultCoreServicesTest.java
        (original)
+++ 
trunk/amdatu-core/itest/tests/src/test/java/org/amdatu/core/itest/tests/DefaultCoreServicesTest.java
        Mon Jan 30 14:03:26 2012
@@ -32,6 +32,7 @@
 import org.amdatu.core.itest.base.TestContext;
 import org.amdatu.core.itest.tests.mock.TestService;
 import org.amdatu.core.itest.tests.mock.TestServiceImpl;
+import org.amdatu.core.tenant.TenantConstants;
 import org.apache.felix.dm.Component;
 import org.apache.felix.dm.ServiceDependency;
 import org.junit.After;
@@ -135,22 +136,26 @@
         Properties properties = new Properties();
         properties.put("id", "tenant@localhost");
         properties.put("name", "Tenant localhost");
-        properties.put("host", "localhost");
 
         m_testContext.updateFactoryConfig(CoreConfigs.TENANT.getPid(), 
properties);
 
         properties.put("id", "[email protected]");
         properties.put("name", "Tenant 127.0.0.1");
-        properties.put("host", "127.0.0.1");
         m_testContext.updateFactoryConfig(CoreConfigs.TENANT.getPid(), 
properties);
 
-        UserAdmin userAdmin1 = m_testContext.getService(UserAdmin.class, 
"(tenant_id=tenant@localhost)");
+        UserAdmin userAdmin1 =
+            m_testContext.getService(UserAdmin.class,
+                String.format("(%1$s=%2$s)", TenantConstants.PID_KEY, 
"tenant@localhost"));
+
         assertThat("Expected a UserAdmin for tenant@localhost to be 
available", userAdmin1, is(notNullValue()));
 
-        UserAdmin userAdmin2 = m_testContext.getService(UserAdmin.class, 
"([email protected])");
+        UserAdmin userAdmin2 =
+            m_testContext.getService(UserAdmin.class,
+                String.format("(%1$s=%2$s)", TenantConstants.PID_KEY, 
"[email protected]"));
         assertThat("Expected a UserAdmin for [email protected] to be 
available", userAdmin2, is(notNullValue()));
 
-        UserAdmin userAdmin3 = m_testContext.getService(UserAdmin.class, 
"(tenant_id=tenant@overtherainbow)");
+        UserAdmin userAdmin3 = m_testContext.getService(UserAdmin.class,
+            String.format("(%1$s=%2$s)", TenantConstants.PID_KEY, 
"tenant@overtherainbow"));
         assertThat("Expected no UserAdmin for tenant@overtherainbow to be 
available", userAdmin3, is(nullValue()));
     }
 }

Modified: 
trunk/amdatu-core/itest/tests/src/test/java/org/amdatu/core/itest/tests/IntegrationFrameworkTest.java
==============================================================================
--- 
trunk/amdatu-core/itest/tests/src/test/java/org/amdatu/core/itest/tests/IntegrationFrameworkTest.java
       (original)
+++ 
trunk/amdatu-core/itest/tests/src/test/java/org/amdatu/core/itest/tests/IntegrationFrameworkTest.java
       Mon Jan 30 14:03:26 2012
@@ -8,7 +8,6 @@
 import javax.inject.Inject;
 
 import org.amdatu.core.itest.base.CoreBundles;
-import org.amdatu.core.itest.base.Fixture;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;

Modified: 
trunk/amdatu-core/itest/tests/src/test/java/org/amdatu/core/itest/tests/tenant/MultiTenantTest.java
==============================================================================
--- 
trunk/amdatu-core/itest/tests/src/test/java/org/amdatu/core/itest/tests/tenant/MultiTenantTest.java
 (original)
+++ 
trunk/amdatu-core/itest/tests/src/test/java/org/amdatu/core/itest/tests/tenant/MultiTenantTest.java
 Mon Jan 30 14:03:26 2012
@@ -265,7 +265,8 @@
         msg = m_eventHandler.getMessages();
         assertNotNull(msg);
 
-        assertStringFound(msg, "START{tenant_id;" + tenantId + 
"}{tenant_name;Tenant " + tenantId + "}");
+        assertStringFound(msg, "START{" + TenantConstants.PID_KEY + ";" + 
tenantId + "}{" + TenantConstants.NAME_KEY
+            + ";Tenant " + tenantId + "}");
     }
 
     /**
@@ -281,7 +282,8 @@
         updateTenantConfig(properties);
 
         ServiceReference[] serviceRefs =
-            
m_bundleContext.getServiceReferences(MyDependentService.class.getName(), 
"(tenant_id=" + tenantId + ")");
+            
m_bundleContext.getServiceReferences(MyDependentService.class.getName(),
+                String.format("(%1$s=%2$s)", TenantConstants.PID_KEY, 
tenantId));
         assertNull(serviceRefs);
     }
 
@@ -299,7 +301,8 @@
         updateTenantConfig(properties);
 
         ServiceReference[] serviceRef =
-            
m_bundleContext.getServiceReferences(MyDependentService.class.getName(), 
"(tenant_id=*)");
+            
m_bundleContext.getServiceReferences(MyDependentService.class.getName(),
+                String.format("(%1$s=%2$s)", TenantConstants.PID_KEY, "*"));
         assertNotNull("Failed to obtain the MT-platform service?!", 
serviceRef);
     }
 
@@ -330,7 +333,8 @@
 
         msg = m_eventHandler.getMessages();
 
-        assertStringFound(msg, "STOP{tenant_id;" + tenantId + 
"}{tenant_name;Tenant " + tenantId + "}");
+        assertStringFound(msg, "STOP{" + TenantConstants.PID_KEY + ";" + 
tenantId + "}{" + TenantConstants.NAME_KEY
+            + ";Tenant " + tenantId + "}");
     }
 
     /**
@@ -341,7 +345,6 @@
         Properties properties = new Properties();
         properties.put("id", tenantId);
         properties.put("name", "Tenant " + tenantId);
-        properties.put("host", "localhost");
         return properties;
     }
 

Modified: 
trunk/amdatu-core/itest/tests/src/test/java/org/amdatu/core/itest/tests/tenant/mock/MyDependentServiceImpl.java
==============================================================================
--- 
trunk/amdatu-core/itest/tests/src/test/java/org/amdatu/core/itest/tests/tenant/mock/MyDependentServiceImpl.java
     (original)
+++ 
trunk/amdatu-core/itest/tests/src/test/java/org/amdatu/core/itest/tests/tenant/mock/MyDependentServiceImpl.java
     Mon Jan 30 14:03:26 2012
@@ -18,6 +18,7 @@
 
 import junit.framework.Assert;
 
+import org.amdatu.core.tenant.TenantConstants;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.log.LogService;
@@ -37,7 +38,8 @@
      * Called by Felix DependencyManager upon starting this component!
      */
     protected void start() throws Exception {
-        ServiceReference[] serviceReferences = 
m_bundleContext.getServiceReferences(MyDependencyService.class.getName(), null);
+        ServiceReference[] serviceReferences =
+            
m_bundleContext.getServiceReferences(MyDependencyService.class.getName(), null);
         Assert.assertNotNull(serviceReferences);
         Assert.assertEquals(1, serviceReferences.length);
 
@@ -63,11 +65,10 @@
         StringBuilder sb = new StringBuilder("MTL:");
         sb.append(id);
         if (serviceRef != null) {
-            for (String key : serviceRef.getPropertyKeys()) {
-                if (key.startsWith("tenant_")) {
-                    
sb.append("{").append(key).append(";").append(serviceRef.getProperty(key)).append("}");
-                }
-            }
+            sb.append("{").append(TenantConstants.PID_KEY).append(";")
+                
.append(serviceRef.getProperty(TenantConstants.PID_KEY)).append("}");
+            sb.append("{").append(TenantConstants.NAME_KEY).append(";")
+                
.append(serviceRef.getProperty(TenantConstants.NAME_KEY)).append("}");
         }
         return sb.toString();
     }

Modified: 
trunk/amdatu-core/tenant-adaptor/src/main/java/org/amdatu/core/tenant/adaptor/MultiTenantBundleActivator.java
==============================================================================
--- 
trunk/amdatu-core/tenant-adaptor/src/main/java/org/amdatu/core/tenant/adaptor/MultiTenantBundleActivator.java
       (original)
+++ 
trunk/amdatu-core/tenant-adaptor/src/main/java/org/amdatu/core/tenant/adaptor/MultiTenantBundleActivator.java
       Mon Jan 30 14:03:26 2012
@@ -15,8 +15,14 @@
  */
 package org.amdatu.core.tenant.adaptor;
 
-import static org.amdatu.core.tenant.Tenant.*;
-import static org.amdatu.core.tenant.TenantConstants.*;
+import static 
org.amdatu.core.tenant.TenantConstants.MULTITENANT_BUNDLE_ACTIVATOR_KEY;
+import static org.amdatu.core.tenant.TenantConstants.MULTITENANT_SCOPE_KEY;
+import static 
org.amdatu.core.tenant.TenantConstants.MULTITENANT_SCOPE_VALUE_BOTH;
+import static 
org.amdatu.core.tenant.TenantConstants.MULTITENANT_SCOPE_VALUE_PLATFORM;
+import static 
org.amdatu.core.tenant.TenantConstants.MULTITENANT_SCOPE_VALUE_TENANTS;
+import static org.amdatu.core.tenant.TenantConstants.PID_KEY;
+import static org.amdatu.core.tenant.TenantConstants.PID_VALUE_PLATFORM;
+
 import java.util.Properties;
 
 import org.amdatu.core.tenant.Tenant;
@@ -51,7 +57,7 @@
         String scope = determineScope();
 
         if (createPlatformInstance(scope)) {
-            log(LogService.LOG_DEBUG, "[" + 
MULTITENANT_SCOPE_PLATFORM_TENANTID + "] Starting "
+            log(LogService.LOG_DEBUG, "[" + PID_VALUE_PLATFORM + "] Starting "
                 + getBundleHeader(Constants.BUNDLE_NAME), null);
 
             m_bundleActivatorClass = 
getBundleHeader(MULTITENANT_BUNDLE_ACTIVATOR_KEY);
@@ -59,16 +65,16 @@
                 log(LogService.LOG_ERROR, "Missing manifest header " + 
MULTITENANT_BUNDLE_ACTIVATOR_KEY, null);
                 return;
             }
-            
+
             try {
                 m_tenantBundleActivator =
                     (BundleActivator) 
context.getBundle().loadClass(m_bundleActivatorClass).newInstance();
 
                 Properties props = new Properties();
-                props.put(TENANT_ID_SERVICEPROPERTY, 
MULTITENANT_SCOPE_PLATFORM_TENANTID);
+                props.put(PID_KEY, PID_VALUE_PLATFORM);
 
                 m_tenantAwareBundleContext =
-                    new TenantAwareBundleContext(context, 
MULTITENANT_SCOPE_PLATFORM_TENANTID, props, getPlatformTenantFilter());
+                    new TenantAwareBundleContext(context, PID_VALUE_PLATFORM, 
props, getPlatformTenantFilter());
 
                 m_tenantBundleActivator.start(m_tenantAwareBundleContext);
             }
@@ -96,7 +102,7 @@
      * @return
      */
     private String getPlatformTenantFilter() {
-        return String.format("(|(%1$s=%2$s)(!(%1$s=*)))", 
TENANT_ID_SERVICEPROPERTY, MULTITENANT_SCOPE_PLATFORM_TENANTID);
+        return String.format("(|(%1$s=%2$s)(!(%1$s=*)))", PID_KEY, 
PID_VALUE_PLATFORM);
     }
 
     /**

Modified: 
trunk/amdatu-core/tenant-adaptor/src/main/java/org/amdatu/core/tenant/adaptor/TenantAdapter.java
==============================================================================
--- 
trunk/amdatu-core/tenant-adaptor/src/main/java/org/amdatu/core/tenant/adaptor/TenantAdapter.java
    (original)
+++ 
trunk/amdatu-core/tenant-adaptor/src/main/java/org/amdatu/core/tenant/adaptor/TenantAdapter.java
    Mon Jan 30 14:03:26 2012
@@ -15,8 +15,9 @@
  */
 package org.amdatu.core.tenant.adaptor;
 
-import static org.amdatu.core.tenant.Tenant.*;
 import static 
org.amdatu.core.tenant.TenantConstants.MULTITENANT_BUNDLE_ACTIVATOR_KEY;
+import static org.amdatu.core.tenant.TenantConstants.NAME_KEY;
+import static org.amdatu.core.tenant.TenantConstants.PID_KEY;
 
 import java.util.Properties;
 
@@ -37,7 +38,7 @@
     private volatile BundleContext m_context;
     private volatile Tenant m_tenant;
     private volatile LogService m_log;
-    
+
     private String m_bundleActivatorClass;
     private BundleActivator m_tenantBundleActivator;
     private TenantAwareBundleContext m_tenantAwareBundleContext;
@@ -46,7 +47,8 @@
      * Called by Felix dependency manager when this service adapter is started.
      */
     public void start() {
-        m_log.log(LogService.LOG_DEBUG, "[" + m_tenant.getId() + "] Starting " 
+ getBundleHeader(Constants.BUNDLE_NAME));
+        m_log
+            .log(LogService.LOG_DEBUG, "[" + m_tenant.getId() + "] Starting " 
+ getBundleHeader(Constants.BUNDLE_NAME));
 
         m_bundleActivatorClass = 
getBundleHeader(MULTITENANT_BUNDLE_ACTIVATOR_KEY);
         if (m_bundleActivatorClass == null) {
@@ -55,13 +57,15 @@
         }
 
         try {
-            m_tenantBundleActivator = (BundleActivator) 
m_context.getBundle().loadClass(m_bundleActivatorClass).newInstance();
+            m_tenantBundleActivator =
+                (BundleActivator) 
m_context.getBundle().loadClass(m_bundleActivatorClass).newInstance();
 
             Properties props = new Properties();
-            props.put(TENANT_ID_SERVICEPROPERTY, m_tenant.getId());
-            props.put(TENANT_NAME_SERVICEPROPERTY, m_tenant.getName());
+            props.put(PID_KEY, m_tenant.getId());
+            props.put(NAME_KEY, m_tenant.getName());
 
-            m_tenantAwareBundleContext = new 
TenantAwareBundleContext(m_context, m_tenant.getId(), props, getTenantFilter());
+            m_tenantAwareBundleContext =
+                new TenantAwareBundleContext(m_context, m_tenant.getId(), 
props, getTenantFilter());
 
             m_tenantBundleActivator.start(m_tenantAwareBundleContext);
         }
@@ -74,7 +78,8 @@
      * Called by Felix dependency manager when this service adapter is stopped.
      */
     public void stop() {
-        m_log.log(LogService.LOG_DEBUG, "[" + m_tenant.getId() + "] Stopping " 
+ getBundleHeader(Constants.BUNDLE_NAME));
+        m_log
+            .log(LogService.LOG_DEBUG, "[" + m_tenant.getId() + "] Stopping " 
+ getBundleHeader(Constants.BUNDLE_NAME));
 
         try {
             if (m_tenantBundleActivator != null) {
@@ -95,7 +100,7 @@
     private String getTenantFilter() {
         return "(|(objectClass=org.amdatu.web.rest.jaxrs.JaxRsSpi)"
             + "(objectClass=org.osgi.service.log.LogService)("
-            + TENANT_ID_SERVICEPROPERTY + "="
+            + PID_KEY + "="
             + m_tenant.getId() + "))";
     }
 

Modified: 
trunk/amdatu-core/tenant-factory/src/main/java/org/amdatu/core/tenant/factory/TenantServiceFactory.java
==============================================================================
--- 
trunk/amdatu-core/tenant-factory/src/main/java/org/amdatu/core/tenant/factory/TenantServiceFactory.java
     (original)
+++ 
trunk/amdatu-core/tenant-factory/src/main/java/org/amdatu/core/tenant/factory/TenantServiceFactory.java
     Mon Jan 30 14:03:26 2012
@@ -20,6 +20,7 @@
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.amdatu.core.tenant.Tenant;
+import org.amdatu.core.tenant.TenantConstants;
 import org.apache.felix.dm.Component;
 import org.apache.felix.dm.DependencyManager;
 import org.osgi.service.cm.ConfigurationException;
@@ -62,15 +63,12 @@
 
         String id = (String) properties.get(ID_KEY);
         String name = (String) properties.get(NAME_KEY);
-        String host = (String) properties.get(HOST_KEY);
 
         Properties serviceProperties = new Properties();
-        serviceProperties.put(Tenant.TENANT_ID_SERVICEPROPERTY, id);
-        serviceProperties.put(Tenant.TENANT_NAME_SERVICEPROPERTY, name);
-        serviceProperties.put(Tenant.TENANT_SERVICEPROPERTY + "hostname", 
host);
+        serviceProperties.put(TenantConstants.PID_KEY, id);
+        serviceProperties.put(TenantConstants.NAME_KEY, name);
 
         Tenant tenant = new TenantService(id, name);
-        tenant.putProperty("hostname", host);
 
         Component component = m_dependencyManager.createComponent()
             .setInterface(Tenant.class.getName(), serviceProperties)

Modified: 
trunk/amdatu-core/tenant/src/main/java/org/amdatu/core/tenant/Tenant.java
==============================================================================
--- trunk/amdatu-core/tenant/src/main/java/org/amdatu/core/tenant/Tenant.java   
(original)
+++ trunk/amdatu-core/tenant/src/main/java/org/amdatu/core/tenant/Tenant.java   
Mon Jan 30 14:03:26 2012
@@ -1,94 +1,34 @@
-/*
- * Copyright (c) 2010, 2011 The Amdatu Foundation
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+/*
+ * Copyright (c) 2010, 2011 The Amdatu Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.amdatu.core.tenant;
 
-import java.util.Map;
-
 /**
- * This interface represents a tenant. A tenant has an id, name and a map of 
properties that
- * identify the tenant. Tenants can be managed (i.e. persisted) using the 
{@link TenantManagementService}.
- *
- * Tenant objects are intended to be stand-alone value objects.
- *
- * A tenant is solely identified by its ID, any changes to the name are 
inconsequential.
- *
- * For each tenant, an OSGi service is registered. The <code>id</code>, 
<code>name</code> and other properties
- * will be registered with the service as service properties; the keys will be 
prefixed with {@link #SERVICE_PREFIX}
- * If the properties contain keys 'name' or 'id', the Tenant's name or id will 
prevail.
+ * This interface represents a tenant. A tenant has an PID that unqiely 
identifies it and an optional name.
  * 
- * @author <a href="mailto:[email protected]";>Amdatu Project 
Team</a>
+ * @author <a href="mailto:[email protected]";>Amdatu Project 
Team</a>
  */
 public interface Tenant {
-    /**
-     * Service property with the id of the tenant available on each Tenant 
service. When a tenant is registered as
-     * a service, this property will always be set on this service. It can be 
retrieved from the service reference by
-     * using ref.getProperty(TENANT_ID_SERVICEPROPERTY).
-     * If a service dependency is defined
-     */
-    final String TENANT_ID_SERVICEPROPERTY = "tenant_id";
-    
-    /**
-     * Service property with the name of the tenant available on each Tenant 
service. When a tenant is registered as
-     * a service, this property will always be set on this service. It can be 
retrieved from the service reference by
-     * using ref.getProperty(TENANT_NAME_SERVICEPROPERTY). 
-     */
-    final String TENANT_NAME_SERVICEPROPERTY = "tenant_name";
-    
-    /**
-     * Service property containing any property contained by the properties 
map of the tenant available on each Tenant 
-     * service. When a tenant is registered as a service, all properties 
available in the properties map (see getProperties)
-     * are set as service property with key [TENANT_SERVICEPROPERTY][property 
name]. It can be retrieved from the service
-     * reference by using ref.getProperty(TENANT_SERVICEPROPERTY + "[property 
name]"). 
-     */
-    final String TENANT_SERVICEPROPERTY = "tenant_property_";
-    
-    /**
-     * Default property used by the platform to associate a hostname with a 
Tenant. If you create a tenant in a multi-tenant
-     * environment and want to make use of amdatu-web bundles, be sure to set 
this property on your tenant such that
-     * the tenant resolvers in amdatu-web can map the servername of a http 
request to the corresponding tenant.
-     */
-    final String HOSTNAME_PROPERTY = "hostname";
 
     /**
-     * The unique ID for this tenant.
+     * The unique PID for this tenant.
      */
     String getId();
-    
-    /**
-     * The name for this tenant; not necessarily unique.
-     */
-    String getName();
 
     /**
-     * Map of properties that identify this tenant. Properties may be a 
hostname or a cookie.
-     * @return A map of properties that identify this tenant. If no properties 
are available
-     * then an empty map is returned. Note that the map is <em>not</em> backed 
by the Tenant
-     * object, and changes made to this map will not result in changes to the 
Tenant.
+     * The name for this tenant.
      */
-    Map<String, String> getProperties();
-
-    /**
-     * Sets a property in the tenant; this will be reflected by subsequent 
calls to {@link @getProperties}
-     */
-    void putProperty(String key, String value);
-    
-    /**
-     * Returns whether this tenant matches <em>all</em> specified properties.
-     * @return <code>true</code> if this tenant has all properties of the 
specified map and if all values
-     * are the same, <code>false</code> otherwise.
-     */
-    boolean matches(Map<String, String> properties);
+    String getName();
 }

Modified: 
trunk/amdatu-core/tenant/src/main/java/org/amdatu/core/tenant/TenantConstants.java
==============================================================================
--- 
trunk/amdatu-core/tenant/src/main/java/org/amdatu/core/tenant/TenantConstants.java
  (original)
+++ 
trunk/amdatu-core/tenant/src/main/java/org/amdatu/core/tenant/TenantConstants.java
  Mon Jan 30 14:03:26 2012
@@ -21,14 +21,17 @@
  * @author <a href="mailto:[email protected]";>Amdatu Project 
Team</a>
  */
 public interface TenantConstants {
+
+    public static final String PID_KEY = "org.amdatu.tenant.pid";
+    public static final String NAME_KEY = "org.amdatu.tenant.name";
+    public static final String PID_VALUE_PLATFORM = 
"org.amdatu.tenant.PLATFORM";
+
+    // adaptor stuff to be moved
     public static final String MULTITENANT_BUNDLE_ACTIVATOR_KEY = 
"MultiTenant-Bundle-Activator";
-    
     public static final String MULTITENANT_SCOPE_KEY = "MultiTenant-Scope";
     public static final String MULTITENANT_SCOPE_VALUE_PLATFORM = "PLATFORM";
     public static final String MULTITENANT_SCOPE_VALUE_TENANTS = "TENANTS";
     public static final String MULTITENANT_SCOPE_VALUE_BOTH = "BOTH";
-    public static final String MULTITENANT_SCOPE_PLATFORM_TENANTID = 
"_PLATFORM";
-    
     public static final String MULTITENANT_VERSION_KEY = "MultiTenant-Version";
     public static final String MULTITENANT_VERSION_VALUE = "1";
 }

Modified: trunk/amdatu-release/pom.xml
==============================================================================
--- trunk/amdatu-release/pom.xml        (original)
+++ trunk/amdatu-release/pom.xml        Mon Jan 30 14:03:26 2012
@@ -272,6 +272,13 @@
     </dependency>
     <dependency>
       <groupId>org.amdatu.web</groupId>
+      <artifactId>org.amdatu.web.tenantmapper.hostname</artifactId>
+      <version>${org.amdatu.web.version}</version>
+      <scope>runtime</scope>
+      <type>bundle</type>
+    </dependency>
+    <dependency>
+      <groupId>org.amdatu.web</groupId>
       <artifactId>org.amdatu.web.resource</artifactId>
       <version>${org.amdatu.web.version}</version>
       <scope>runtime</scope>
_______________________________________________
Amdatu-commits mailing list
[email protected]
http://lists.amdatu.org/mailman/listinfo/amdatu-commits

Reply via email to