[exo-jcr-commits] exo-jcr SVN: r1331 - in kernel/branches/mc-int-branch: exo.kernel.commons/src/test/java/org/exoplatform/commons/utils and 28 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Sun Jan 10 13:27:39 EST 2010
Author: mstruk
Date: 2010-01-10 13:27:37 -0500 (Sun, 10 Jan 2010)
New Revision: 1331
Added:
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableComponentAdapter.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableComponentAdapterFactory.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagementContextImpl.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/annotations/Impact.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/annotations/ImpactType.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/annotations/package-info.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/annotations/package-info.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/ExoMBeanInfoBuilder.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/ExoModelMBean.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/JMX.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/JMXManagementProvider.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/MBeanScopingData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/ObjectNameBuilder.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/PropertiesInfo.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/PropertyInfo.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/package-info.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMetaData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMethodMetaData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMethodParameterMetaData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedParameterMetaData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedPropertyMetaData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedResource.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedTypeMetaData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagementProvider.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/package-info.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/Bar.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/Foo.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagedResource.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagementProviderImpl.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ResourceKey.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ScopedData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/TestManagementProvider.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/metadata/
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/metadata/Bar.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/metadata/Foo.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/metadata/TestMetaData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/
kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/configuration1.xml
kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/configuration2.xml
kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/portal-configuration1.xml
kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/portal-configuration2.xml
kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/root-configuration.xml
kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/xsd_1_0/sample-configuration-17.xml
kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/xsd_1_1/sample-configuration-18.xml
kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/src/test/resources/
kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/src/test/resources/jboss-log4j.xml
Removed:
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ExoMBeanInfoBuilder.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ExoModelMBean.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/JMX.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableComponentAdapter.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableComponentAdapterFactory.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableContainer.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManagementContextImpl.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ObjectNameBuilder.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/PropertiesInfo.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/PropertyInfo.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedMetaData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedMethodMetaData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedMethodParameterMetaData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedParameterMetaData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedPropertyMetaData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedTypeMetaData.java
Modified:
kernel/branches/mc-int-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/PropertiesLoader.java
kernel/branches/mc-int-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java
kernel/branches/mc-int-branch/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestPropertiesLoader.java
kernel/branches/mc-int-branch/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestTools.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/ExoContainer.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainerClassLoader.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainerContext.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/PropertyConfigurator.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/UnifiedClassLoader.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/WebAppInitContext.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycle.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycleStack.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/EntityResolverImpl.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/Namespaces.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ProfileDOMFilter.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinition.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinitionPlugin.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/MetaDataBuilder.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractFilter.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractHttpServlet.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractHttpSessionListener.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/PortalContainerConfigOwner.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/PortalContainerCreator.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/resources/org/exoplatform/container/configuration/kernel-configuration_1_0.xsd
kernel/branches/mc-int-branch/exo.kernel.container/src/main/resources/org/exoplatform/container/configuration/kernel-configuration_1_1.xsd
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/ComponentWithRequestLifeCycle.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/LifeCycle.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainerInitTaskContextComparator.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestPropertyManagerConfigurator.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestRequestLifeCycle.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestUnifiedClassLoader.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestWebAppInitContextComparator.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/AbstractProfileTest.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/InitParamsHolder.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestCollectionValue.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestComponentPluginProfile.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestComponentProfile.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestField.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestImportProfile.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestInitParamProfile.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestXSD_1_0.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestXSD_1_1.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/AbstractTestExoMBean.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestExoMBeanOperation.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestNameTemplate.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestPortalContainerManagedIntegration.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/support/ManagedComponentRequestLifeCycle.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/support/SimpleManagementAware.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/support/ContainerBuilder.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/xsd_1_1/sample-configuration-17.xml
kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/pom.xml
Log:
merged in from trunk up to r1330
Modified: kernel/branches/mc-int-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/PropertiesLoader.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/PropertiesLoader.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/PropertiesLoader.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.commons.utils;
Modified: kernel/branches/mc-int-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.commons.utils;
Modified: kernel/branches/mc-int-branch/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestPropertiesLoader.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestPropertiesLoader.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestPropertiesLoader.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.commons.utils;
Modified: kernel/branches/mc-int-branch/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestTools.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestTools.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestTools.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.commons.utils;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/ExoContainer.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/ExoContainer.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/ExoContainer.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -21,8 +21,7 @@
import org.exoplatform.commons.utils.PropertyManager;
import org.exoplatform.container.component.ComponentLifecyclePlugin;
import org.exoplatform.container.configuration.ConfigurationManager;
-import org.exoplatform.container.jmx.ManageableContainer;
-import org.exoplatform.container.jmx.ManagementContextImpl;
+import org.exoplatform.container.management.ManageableContainer;
import org.exoplatform.container.util.ContainerUtil;
import org.exoplatform.container.xml.InitParams;
import org.exoplatform.services.log.ExoLogger;
@@ -30,7 +29,6 @@
import org.picocontainer.PicoContainer;
import org.picocontainer.defaults.ComponentAdapterFactory;
-import javax.management.MBeanServer;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.Collections;
@@ -86,15 +84,6 @@
public ExoContainer()
{
- super(new ManagementContextImpl());
-
- //
-
- }
-
- public ExoContainer(MBeanServer mbeanServer)
- {
- super(new ManagementContextImpl(mbeanServer));
context = new ExoContainerContext(this);
context.setName(this.getClass().getName());
registerComponentInstance(context);
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainerClassLoader.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainerClassLoader.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainerClassLoader.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainerContext.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainerContext.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainerContext.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/PropertyConfigurator.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/PropertyConfigurator.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/PropertyConfigurator.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -35,7 +35,6 @@
import org.picocontainer.ComponentAdapter;
import java.io.File;
-import java.lang.management.ManagementFactory;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashSet;
@@ -47,7 +46,6 @@
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.PriorityBlockingQueue;
-import javax.management.MBeanServer;
import javax.servlet.ServletContext;
/**
@@ -59,17 +57,6 @@
public class RootContainer extends ExoContainer
{
- private static MBeanServer findMBeanServer()
- {
- J2EEServerInfo serverenv_ = new J2EEServerInfo();
- MBeanServer server = serverenv_.getMBeanServer();
- if (server == null)
- {
- server = ManagementFactory.getPlatformMBeanServer();
- }
- return server;
- }
-
/** The field is volatile to properly implement the double checked locking pattern. */
private static volatile RootContainer singleton_;
@@ -98,9 +85,6 @@
public RootContainer()
{
- super(findMBeanServer());
-
- //
Set<String> profiles = new HashSet<String>();
// Add the profile defined by the server name
@@ -349,7 +333,7 @@
pcontainer.start();
// Register the portal as an mbean
- managementContext.register(pcontainer);
+ getManagementContext().register(pcontainer);
//
executeInitTasks(pcontainer, PortalContainerPostInitTask.TYPE);
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/UnifiedClassLoader.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/UnifiedClassLoader.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/UnifiedClassLoader.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/WebAppInitContext.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/WebAppInitContext.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/WebAppInitContext.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycle.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycle.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycle.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.component;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycleStack.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycleStack.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycleStack.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.component;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.container.configuration;
+import org.exoplatform.commons.utils.PropertyManager;
import org.exoplatform.container.xml.Configuration;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -172,10 +173,13 @@
public Configuration unmarshall(URL url) throws Exception
{
- boolean valid = isValid(url);
- if (!valid)
+ if (PropertyManager.isDevelopping())
{
- log.info("The configuration file " + url + " was not found valid according to its XSD");
+ boolean valid = isValid(url);
+ if (!valid)
+ {
+ log.info("The configuration file " + url + " was not found valid according to its XSD");
+ }
}
//
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/EntityResolverImpl.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/EntityResolverImpl.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/EntityResolverImpl.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.configuration;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/Namespaces.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/Namespaces.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/Namespaces.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.configuration;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ProfileDOMFilter.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ProfileDOMFilter.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ProfileDOMFilter.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.configuration;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.definition;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinition.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinition.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinition.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.definition;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinitionPlugin.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinitionPlugin.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinitionPlugin.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.definition;
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ExoMBeanInfoBuilder.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ExoMBeanInfoBuilder.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ExoMBeanInfoBuilder.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,231 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.jmx;
-
-import org.exoplatform.container.management.ManagedMethodMetaData;
-import org.exoplatform.container.management.ManagedMethodParameterMetaData;
-import org.exoplatform.container.management.ManagedPropertyMetaData;
-import org.exoplatform.container.management.ManagedTypeMetaData;
-import org.exoplatform.container.management.MetaDataBuilder;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.management.Descriptor;
-import javax.management.IntrospectionException;
-import javax.management.MBeanParameterInfo;
-import javax.management.modelmbean.ModelMBeanAttributeInfo;
-import javax.management.modelmbean.ModelMBeanConstructorInfo;
-import javax.management.modelmbean.ModelMBeanInfo;
-import javax.management.modelmbean.ModelMBeanInfoSupport;
-import javax.management.modelmbean.ModelMBeanNotificationInfo;
-import javax.management.modelmbean.ModelMBeanOperationInfo;
-
-/**
- * <p>A class that build mbean meta data</p>
- *
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ExoMBeanInfoBuilder
-{
-
- private static enum Role {
- SET("setter"), IS("getter"), GET("getter"), OP("operation");
-
- private final String name;
-
- private Role(String role)
- {
- this.name = role;
- }
- }
-
- private MetaDataBuilder metaDataBuilder;
-
- /**
- * Create a new builder.
- *
- * @param clazz the clazz
- * @throws IllegalArgumentException if the class is null or does not contain meta data
- */
- public ExoMBeanInfoBuilder(Class clazz) throws IllegalArgumentException
- {
- this.metaDataBuilder = new MetaDataBuilder(clazz);
- }
-
- public boolean isBuildable()
- {
- return metaDataBuilder.isBuildable();
- }
-
- private ModelMBeanOperationInfo buildOperationInfo(Method method, String description, Role role,
- Collection<ManagedMethodParameterMetaData> parametersMD)
- {
- ModelMBeanOperationInfo operationInfo = new ModelMBeanOperationInfo(description, method);
-
- //
- if (description == null)
- {
- description = "Management operation";
- }
-
- //
- MBeanParameterInfo[] parameterInfos = operationInfo.getSignature();
- for (ManagedMethodParameterMetaData parameterMD : parametersMD)
- {
- int i = parameterMD.getIndex();
- MBeanParameterInfo parameterInfo = parameterInfos[i];
- String parameterName = parameterInfo.getName();
- String parameterDescription = operationInfo.getSignature()[i].getDescription();
- if (parameterMD.getName() != null)
- {
- parameterName = parameterMD.getName();
- }
- else if (parameterMD.getDescription() != null)
- {
- parameterDescription = parameterMD.getDescription();
- }
- parameterInfos[i] = new MBeanParameterInfo(parameterName, parameterInfo.getType(), parameterDescription);
- }
-
- //
- Descriptor operationDescriptor = operationInfo.getDescriptor();
- operationDescriptor.setField("role", role.name);
-
- //
- return new ModelMBeanOperationInfo(operationInfo.getName(), description, parameterInfos, operationInfo
- .getReturnType(), operationInfo.getImpact(), operationDescriptor);
- }
-
- /**
- * Build the info.
- *
- * @return returns the info
- * @throws IllegalStateException raised by any build time issue
- */
- public ModelMBeanInfo build() throws IllegalStateException
- {
- ManagedTypeMetaData typeMD = metaDataBuilder.build();
-
- //
- String mbeanDescription = "Exo model mbean";
- if (typeMD.getDescription() != null)
- {
- mbeanDescription = typeMD.getDescription();
- }
-
- //
- ArrayList<ModelMBeanOperationInfo> operations = new ArrayList<ModelMBeanOperationInfo>();
- for (ManagedMethodMetaData methodMD : typeMD.getMethods())
- {
- ModelMBeanOperationInfo operationInfo =
- buildOperationInfo(methodMD.getMethod(), methodMD.getDescription(), Role.OP, methodMD.getParameters());
- operations.add(operationInfo);
- }
-
- //
- Map<String, ModelMBeanAttributeInfo> attributeInfos = new HashMap<String, ModelMBeanAttributeInfo>();
- for (ManagedPropertyMetaData propertyMD : typeMD.getProperties())
- {
-
- Method getter = propertyMD.getGetter();
- if (getter != null)
- {
- Role role;
- String getterName = getter.getName();
- if (getterName.startsWith("get") && getterName.length() > 3)
- {
- role = Role.GET;
- }
- else if (getterName.startsWith("is") && getterName.length() > 2)
- {
- role = Role.IS;
- }
- else
- {
- throw new AssertionError();
- }
- Collection<ManagedMethodParameterMetaData> blah = Collections.emptyList();
- ModelMBeanOperationInfo operationInfo =
- buildOperationInfo(getter, propertyMD.getGetterDescription(), role, blah);
- operations.add(operationInfo);
- }
-
- //
- Method setter = propertyMD.getSetter();
- if (setter != null)
- {
- ManagedMethodParameterMetaData s = new ManagedMethodParameterMetaData(0);
- s.setDescription(propertyMD.getSetterParameter().getDescription());
- s.setName(propertyMD.getSetterParameter().getName());
- Collection<ManagedMethodParameterMetaData> blah = Collections.singletonList(s);
- ModelMBeanOperationInfo operationInfo =
- buildOperationInfo(setter, propertyMD.getSetterDescription(), Role.SET, blah);
- operations.add(operationInfo);
- }
-
- //
- try
- {
- String attributeDescription =
- propertyMD.getDescription() != null ? propertyMD.getDescription() : ("Managed attribute " + propertyMD
- .getName());
-
- //
- ModelMBeanAttributeInfo attributeInfo =
- new ModelMBeanAttributeInfo(propertyMD.getName(), attributeDescription, getter, setter);
-
- //
- Descriptor attributeDescriptor = attributeInfo.getDescriptor();
- if (getter != null)
- {
- attributeDescriptor.setField("getMethod", getter.getName());
- }
- if (setter != null)
- {
- attributeDescriptor.setField("setMethod", setter.getName());
- }
- attributeDescriptor.setField("currencyTimeLimit", "-1");
- attributeDescriptor.setField("persistPolicy", "Never");
- attributeInfo.setDescriptor(attributeDescriptor);
-
- //
- ModelMBeanAttributeInfo previous = attributeInfos.put(propertyMD.getName(), attributeInfo);
- if (previous != null)
- {
- throw new IllegalArgumentException();
- }
- }
- catch (IntrospectionException e)
- {
- throw new AssertionError(e);
- }
- }
-
- //
- return new ModelMBeanInfoSupport(typeMD.getType().getName(), mbeanDescription, attributeInfos.values().toArray(
- new ModelMBeanAttributeInfo[attributeInfos.size()]), new ModelMBeanConstructorInfo[0], operations
- .toArray(new ModelMBeanOperationInfo[operations.size()]), new ModelMBeanNotificationInfo[0]);
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ExoModelMBean.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ExoModelMBean.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ExoModelMBean.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,201 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.jmx;
-
-import org.exoplatform.container.ExoContainer;
-import org.exoplatform.container.component.RequestLifeCycle;
-import org.exoplatform.management.ManagementAware;
-import org.exoplatform.management.ManagementContext;
-import org.exoplatform.management.jmx.annotations.NamingContext;
-
-import java.util.Collections;
-import java.util.Map;
-
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanException;
-import javax.management.MBeanRegistration;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.management.ReflectionException;
-import javax.management.RuntimeOperationsException;
-import javax.management.modelmbean.InvalidTargetObjectTypeException;
-import javax.management.modelmbean.ModelMBeanInfo;
-import javax.management.modelmbean.RequiredModelMBean;
-
-/**
- * A convenient subclass of {@link RequiredModelMBean) that routes the invocation of the interface
- * {@link MBeanRegistration} to the managed resource when it implements the method.
- *
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ExoModelMBean extends RequiredModelMBean implements ManagementContext
-{
-
- /** . */
- private Object mr;
-
- /** . */
- private ManagementContextImpl parentContext;
-
- /** . */
- private ManagementContextImpl context;
-
- public ExoModelMBean(ManagementContextImpl parentContext, Object mr, ModelMBeanInfo mbi) throws MBeanException,
- RuntimeOperationsException, InstanceNotFoundException, InvalidTargetObjectTypeException
- {
- super(mbi);
-
- //
- this.parentContext = parentContext;
- this.mr = mr;
-
- //
- setManagedResource(mr, "ObjectReference");
- }
-
- @Override
- public Object invoke(String opName, Object[] opArgs, String[] sig) throws MBeanException, ReflectionException
- {
- final ExoContainer container = context.findContainer();
- if (container != null)
- {
- RequestLifeCycle.begin(container);
- try
- {
- return super.invoke(opName, opArgs, sig);
- }
- finally
- {
- RequestLifeCycle.end();
- }
- }
- else
- {
- return super.invoke(opName, opArgs, sig);
- }
- }
-
- @Override
- public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
- {
- name = super.preRegister(server, name);
-
- //
- if (mr instanceof MBeanRegistration)
- {
- ((MBeanRegistration)mr).preRegister(server, name);
- }
-
- //
- return name;
- }
-
- @Override
- public void postRegister(Boolean registrationDone)
- {
- super.postRegister(registrationDone);
-
- //
- PropertiesInfo info = PropertiesInfo.resolve(mr.getClass(), NamingContext.class);
-
- //
- Map<String, String> scopingProperties = info != null ? info.resolve(mr) : Collections.<String, String>emptyMap();
-
- //
- if (mr instanceof ManageableContainer)
- {
- context = ((ManageableContainer)mr).managementContext;
- }
- else
- {
- context = new ManagementContextImpl(parentContext);
- }
-
- //
- context.scopingProperties = scopingProperties;
-
- //
- if (mr instanceof ManagementAware)
- {
- ((ManagementAware)mr).setContext(this);
- }
-
- //
- if (mr instanceof MBeanRegistration)
- {
- ((MBeanRegistration)mr).postRegister(registrationDone);
- }
- }
-
- @Override
- public void preDeregister() throws Exception
- {
- if (mr instanceof MBeanRegistration)
- {
- ((MBeanRegistration)mr).preDeregister();
- }
-
- //
- if (mr instanceof ManagementAware)
- {
- ((ManagementAware)mr).setContext(null);
- }
-
- //
- super.preDeregister();
- }
-
- @Override
- public void postDeregister()
- {
- if (mr instanceof MBeanRegistration)
- {
- ((MBeanRegistration)mr).postDeregister();
- }
-
- //
- super.postDeregister();
- }
-
- //
-
-
- public ManagementContext getManagementContext()
- {
- return context;
- }
-
- public Object getManagedResource()
- {
- return mr;
- }
-
- //
-
- public void register(Object o) throws IllegalArgumentException, NullPointerException
- {
- context.register(o);
- }
-
- public void unregister(Object o) throws IllegalArgumentException, NullPointerException
- {
- context.unregister(o);
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/JMX.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/JMX.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/JMX.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.jmx;
-
-import java.util.Hashtable;
-import java.util.Map;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-/**
- * Various JMX utilities.
- *
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class JMX
-{
-
- private JMX()
- {
- }
-
- /**
- * This method create an object name from a generic map argument. The main reason is that
- * the method {@link javax.management.ObjectName#getInstance(String, java.util.Hashtable)} has
- * uses a non generic Hashtable with Java 5 and use a Hashtable<String, String> constructor in Java 6.
- *
- * The suitable solution is therefore to use a non generic Hashtable but that creates compilation warning therefore
- * we encapsulate there this code in order to use the warning supression in that single place.
- *
- * @see ObjectName#getInstance(String, java.util.Hashtable)
- *
- * @param domain The domain part of the object name.
- * @param table A hash table containing one or more key
- * properties. The key of each entry in the table is the key of a
- * key property in the object name. The associated value in the
- * table is the associated value in the object name.
- *
- * @return an ObjectName corresponding to the given domain and
- * key mappings.
- * @exception MalformedObjectNameException The <code>domain</code>
- * contains an illegal character, or one of the keys or values in
- * <code>table</code> contains an illegal character, or one of the
- * values in <code>table</code> does not follow the rules for
- * quoting.
- * @exception NullPointerException One of the parameters is null.
- */
- @SuppressWarnings("unchecked")
- public static ObjectName createObjectName(String domain, Map<String, String> table)
- throws MalformedObjectNameException, NullPointerException
- {
- Hashtable tmp = new Hashtable(table);
- return ObjectName.getInstance(domain, tmp);
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableComponentAdapter.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableComponentAdapter.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableComponentAdapter.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.jmx;
-
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-import org.picocontainer.ComponentAdapter;
-import org.picocontainer.PicoContainer;
-import org.picocontainer.PicoInitializationException;
-import org.picocontainer.PicoIntrospectionException;
-import org.picocontainer.PicoVisitor;
-
-/**
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ManageableComponentAdapter implements ComponentAdapter
-{
-
- /** . */
- private Log log = ExoLogger.getLogger(ManageableComponentAdapter.class);
-
- /** . */
- private ComponentAdapter delegate;
-
- /** . */
- private final ManageableContainer container;
-
- /** . */
- private volatile boolean registered = false;
-
- public ManageableComponentAdapter(ManageableContainer container, ComponentAdapter delegate)
- {
- this.delegate = delegate;
- this.container = container;
- }
-
- public Object getComponentKey()
- {
- return delegate.getComponentKey();
- }
-
- public Class getComponentImplementation()
- {
- return delegate.getComponentImplementation();
- }
-
- public Object getComponentInstance(PicoContainer pico) throws PicoInitializationException,
- PicoIntrospectionException
- {
- Object instance = delegate.getComponentInstance(pico);
-
- //
- if (!registered)
- {
- registered = true;
-
- //
- if (container.managementContext != null)
- {
- log.debug("==> add " + instance + " to a mbean server");
- container.managementContext.register(instance);
- }
- }
- return instance;
- }
-
- public void verify(PicoContainer container) throws PicoIntrospectionException
- {
- delegate.verify(container);
- }
-
- public void accept(PicoVisitor visitor)
- {
- delegate.accept(visitor);
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableComponentAdapterFactory.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableComponentAdapterFactory.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableComponentAdapterFactory.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.jmx;
-
-import org.picocontainer.ComponentAdapter;
-import org.picocontainer.Parameter;
-import org.picocontainer.PicoIntrospectionException;
-import org.picocontainer.defaults.AssignabilityRegistrationException;
-import org.picocontainer.defaults.ComponentAdapterFactory;
-import org.picocontainer.defaults.NotConcreteRegistrationException;
-
-/**
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ManageableComponentAdapterFactory implements ComponentAdapterFactory
-{
-
- /** . */
- private ComponentAdapterFactory delegate;
-
- /** . */
- ManageableContainer container;
-
- public ManageableComponentAdapterFactory(ComponentAdapterFactory delegate)
- {
- this.delegate = delegate;
- }
-
- public ComponentAdapter createComponentAdapter(Object componentKey, Class componentImplementation,
- Parameter[] parameters) throws PicoIntrospectionException, AssignabilityRegistrationException,
- NotConcreteRegistrationException
- {
- ComponentAdapter adapter = delegate.createComponentAdapter(componentKey, componentImplementation, parameters);
- return new ManageableComponentAdapter(container, adapter);
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableContainer.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableContainer.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableContainer.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,203 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.jmx;
-
-import org.exoplatform.container.CachingContainer;
-import org.exoplatform.management.ManagementContext;
-import org.exoplatform.management.annotations.Managed;
-import org.exoplatform.management.annotations.ManagedDescription;
-import org.exoplatform.management.annotations.ManagedName;
-import org.picocontainer.ComponentAdapter;
-import org.picocontainer.PicoContainer;
-import org.picocontainer.PicoException;
-import org.picocontainer.PicoRegistrationException;
-import org.picocontainer.defaults.ComponentAdapterFactory;
-import org.picocontainer.defaults.DuplicateComponentKeyRegistrationException;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanInfo;
-import javax.management.MBeanOperationInfo;
-import javax.management.MBeanParameterInfo;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-/**
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ManageableContainer extends CachingContainer
-{
-
- /** . */
- private static final ThreadLocal<ManageableComponentAdapterFactory> hack =
- new ThreadLocal<ManageableComponentAdapterFactory>();
-
- /** . */
- protected ManagementContextImpl managementContext;
-
- public ManageableContainer(ManagementContextImpl managementContext)
- {
- super(getComponentAdapterFactory(new MX4JComponentAdapterFactory()));
- this.managementContext = managementContext;
- managementContext.container = this;
- init(null);
- }
-
- public ManageableContainer(PicoContainer parent)
- {
- super(getComponentAdapterFactory(new MX4JComponentAdapterFactory()), parent);
- init(parent);
- }
-
- public ManageableContainer(ComponentAdapterFactory componentAdapterFactory, PicoContainer parent)
- {
- super(getComponentAdapterFactory(componentAdapterFactory), parent);
- init(parent);
- }
-
- public ManageableContainer(ComponentAdapterFactory componentAdapterFactory)
- {
- super(getComponentAdapterFactory(componentAdapterFactory));
- init(null);
- }
-
- @Managed
- @ManagedName("RegisteredComponentNames")
- @ManagedDescription("Return the list of the registered component names")
- public Set<String> getRegisteredComponentNames() throws PicoException
- {
- Set<String> names = new HashSet<String>();
- Collection<ComponentAdapter> adapters = getComponentAdapters();
- for (ComponentAdapter adapter : adapters)
- {
- Object key = adapter.getComponentKey();
- String name = String.valueOf(key);
- names.add(name);
- }
- return names;
- }
-
- private static ManageableComponentAdapterFactory getComponentAdapterFactory(
- ComponentAdapterFactory componentAdapterFactory)
- {
- ManageableComponentAdapterFactory factory = new ManageableComponentAdapterFactory(componentAdapterFactory);
- hack.set(factory);
- return factory;
- }
-
- private void init(PicoContainer parent)
- {
- // Yeah this is not pretty but a necessary evil to make it work
- ManageableComponentAdapterFactory factory = hack.get();
- factory.container = this;
- hack.set(null);
-
- // Reference the same mbean server that the parent has
- if (parent instanceof ManageableContainer)
- {
- ManagementContextImpl parentManagementContext = ((ManageableContainer)parent).managementContext;
- if (parentManagementContext != null)
- {
- managementContext = new ManagementContextImpl(parentManagementContext);
- managementContext.container = this;
- }
- }
- }
-
- public ManagementContext getManagementContext()
- {
- return managementContext;
- }
-
- public final MBeanServer getMBeanServer()
- {
- return managementContext != null ? managementContext.server : null;
- }
-
- @Override
- public ComponentAdapter registerComponent(ComponentAdapter componentAdapter)
- throws DuplicateComponentKeyRegistrationException
- {
- return super.registerComponent(componentAdapter);
- }
-
- public ComponentAdapter registerComponentInstance(Object componentKey, Object componentInstance)
- throws PicoRegistrationException
- {
- ComponentAdapter adapter = super.registerComponentInstance(componentKey, componentInstance);
- if (managementContext != null)
- {
- managementContext.register(componentInstance);
- }
- return adapter;
- }
-
- //
-
- public void printMBeanServer()
- {
- MBeanServer server = getMBeanServer();
- final Set names = server.queryNames(null, null);
- for (final Iterator i = names.iterator(); i.hasNext();)
- {
- ObjectName name = (ObjectName)i.next();
- try
- {
- MBeanInfo info = server.getMBeanInfo(name);
- MBeanAttributeInfo[] attrs = info.getAttributes();
- if (attrs == null)
- continue;
- for (int j = 0; j < attrs.length; j++)
- {
- if (attrs[j].isReadable())
- {
- try
- {
- Object o = server.getAttribute(name, attrs[j].getName());
- }
- catch (Exception x)
- {
- x.printStackTrace();
- }
- }
- }
- MBeanOperationInfo[] methods = info.getOperations();
- for (int j = 0; j < methods.length; j++)
- {
- MBeanParameterInfo[] params = methods[j].getSignature();
- for (int k = 0; k < params.length; k++)
- {
- }
- }
- }
- catch (Exception x)
- {
- // x.printStackTrace(System. err);
- }
- }
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManagementContextImpl.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManagementContextImpl.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManagementContextImpl.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,310 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.jmx;
-
-import org.exoplatform.container.ExoContainer;
-import org.exoplatform.management.ManagementContext;
-import org.exoplatform.management.annotations.ManagedBy;
-import org.exoplatform.management.jmx.annotations.NameTemplate;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Map;
-
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanRegistrationException;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.management.modelmbean.ModelMBeanInfo;
-
-/**
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ManagementContextImpl implements ManagementContext
-{
-
- /** . */
- Map<String, String> scopingProperties;
-
- /** The registrations done by this mbean. */
- private final Map<Object, ObjectName> registrations;
-
- /** . */
- private final ManagementContextImpl parent;
-
- /** . */
- final MBeanServer server;
-
- /** An optional container setup when the management context is attached to a container. */
- ManageableContainer container;
-
- public ManagementContextImpl()
- {
- this(MBeanServerFactory.createMBeanServer());
- }
-
- public ManagementContextImpl(MBeanServer server)
- {
- if (server == null)
- {
- throw new NullPointerException();
- }
- this.registrations = new HashMap<Object, ObjectName>();
- this.parent = null;
-
- // This is the root container that never have scoping properties
- // Also without that we would have an NPE when the portal container are registered
- // as the scoping properties would not exist since the root container would not be yet
-
- this.scopingProperties = Collections.emptyMap();
- this.server = server;
- }
-
- public ManagementContextImpl(ManagementContextImpl parent)
- {
- if (parent == null)
- {
- throw new NullPointerException();
- }
- this.registrations = new HashMap<Object, ObjectName>();
- this.parent = parent;
- this.scopingProperties = null;
- this.server = parent.server;
- }
-
- public ManagementContext getParent()
- {
- return parent;
- }
-
- public void register(Object o)
- {
- ObjectName name = manageMBean(o);
- if (name != null)
- {
- registrations.put(o, name);
- }
- }
-
- public void unregister(Object o)
- {
- ObjectName name = registrations.remove(o);
- if (name != null)
- {
- unmanageMBean(name);
- }
- }
-
- private ExoModelMBean createExoMBean(Object bean)
- {
- Object view = null;
-
- // Apply managed by annotation
- ManagedBy managedBy = bean.getClass().getAnnotation(ManagedBy.class);
- if (managedBy != null)
- {
- try
- {
- Class managedByClass = managedBy.value();
- Constructor<?> blah = managedByClass.getConstructor(bean.getClass());
- view = blah.newInstance(bean);
- }
- catch (NoSuchMethodException e)
- {
- e.printStackTrace();
- }
- catch (InstantiationException e)
- {
- e.printStackTrace();
- }
- catch (IllegalAccessException e)
- {
- e.printStackTrace();
- }
- catch (InvocationTargetException e)
- {
- e.printStackTrace();
- }
- }
- else
- {
- view = bean;
- }
-
- //
- if (view != null)
- {
- ExoMBeanInfoBuilder infoBuilder = new ExoMBeanInfoBuilder(view.getClass());
- if (infoBuilder.isBuildable())
- {
- try
- {
- ModelMBeanInfo info = infoBuilder.build();
- return new ExoModelMBean(this, view, info);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- }
-
- //
- return null;
- }
-
- public ObjectName manageMBean(Object bean)
- {
-
- //
- ExoModelMBean mbean = createExoMBean(bean);
-
- //
- if (mbean != null)
- {
- Object mr = mbean.getManagedResource();
- ObjectName on = null;
- PropertiesInfo oni = PropertiesInfo.resolve(mr.getClass(), NameTemplate.class);
- if (oni != null)
- {
- try
- {
- Map<String, String> foo = oni.resolve(mr);
- on = JMX.createObjectName("exo", foo);
- }
- catch (MalformedObjectNameException e)
- {
- e.printStackTrace();
- }
- }
-
- //
- if (on != null)
- {
- // Merge with the container hierarchy context
- try
- {
- Map<String, String> props = new Hashtable<String, String>();
-
- // Julien : I know it's does not look great but it's necessary
- // for compiling under Java 5 and Java 6 properly. The methods
- // ObjectName#getKeyPropertyList() returns an Hashtable with Java 5
- // and a Hashtable<String, String> with Java 6.
- for (Object o : on.getKeyPropertyList().entrySet())
- {
- Map.Entry entry = (Map.Entry)o;
- String key = (String)entry.getKey();
- String value = (String)entry.getValue();
- props.put(key, value);
- }
- for (ManagementContextImpl current = this; current != null; current = current.parent)
- {
- if (current.scopingProperties != null)
- {
- props.putAll(current.scopingProperties);
- }
- }
- on = JMX.createObjectName(on.getDomain(), props);
- attemptToRegister(on, mbean);
- return on;
- }
- catch (MalformedObjectNameException e)
- {
- e.printStackTrace();
- }
- }
- }
-
- //
- return null;
- }
-
- public void unmanageMBean(ObjectName name)
- {
- try
- {
- server.unregisterMBean(name);
- }
- catch (InstanceNotFoundException e)
- {
- e.printStackTrace();
- }
- catch (MBeanRegistrationException e)
- {
- e.printStackTrace();
- }
- }
-
- synchronized void attemptToRegister(ObjectName name, Object mbean)
- {
- synchronized (server)
- {
- try
- {
- server.registerMBean(mbean, name);
- }
- catch (InstanceAlreadyExistsException e)
- {
- try
- {
-
- server.unregisterMBean(name);
- server.registerMBean(mbean, name);
-
- }
- catch (Exception e1)
- {
- throw new RuntimeException("Failed to register MBean '" + name + " due to " + e.getMessage(), e);
- }
- }
- catch (Exception e)
- {
- throw new RuntimeException("Failed to register MBean '" + name + " due to " + e.getMessage(), e);
- }
- }
- }
-
- public ExoContainer findContainer()
- {
- for (ManagementContextImpl current = this;true;current = current.parent)
- {
- if (current.container instanceof ExoContainer)
- {
- return (ExoContainer)current.container;
- }
- else if (current.parent == null)
- {
- return null;
- }
- }
- }
-
- @Override
- public String toString()
- {
- return "ManagementContextImpl[container=" + container + "]";
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ObjectNameBuilder.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ObjectNameBuilder.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ObjectNameBuilder.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.jmx;
-
-import org.exoplatform.management.jmx.annotations.NameTemplate;
-
-import java.util.Map;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-/**
- * A builder for object name templates.
- *
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ObjectNameBuilder<T>
-{
-
- /** . */
- private String domain;
-
- /** . */
- private Class<? extends T> clazz;
-
- /**
- * Create a new builder.
- *
- * @param clazz the class
- * @throws IllegalArgumentException if the object is null
- */
- public ObjectNameBuilder(String domain, Class<? extends T> clazz) throws IllegalArgumentException
- {
- if (clazz == null)
- {
- throw new IllegalArgumentException("Clazz cannot be null");
- }
- this.domain = domain;
- this.clazz = clazz;
- }
-
- /**
- * Build the object name or return null if the class is not annotated by
- * {@link NameTemplate}.
- *
- * @param object the object
- * @return the built name
- * @throws IllegalStateException raised by a build time issue
- */
- public ObjectName build(T object) throws IllegalStateException
- {
- PropertiesInfo info = PropertiesInfo.resolve(clazz, NameTemplate.class);
-
- //
- if (info != null)
- {
-
- try
- {
- Map<String, String> props = info.resolve(object);
- return JMX.createObjectName(domain, props);
- }
- catch (MalformedObjectNameException e)
- {
- throw new IllegalArgumentException("ObjectName template is malformed", e);
- }
- }
-
- //
- return null;
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/PropertiesInfo.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/PropertiesInfo.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/PropertiesInfo.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.jmx;
-
-import org.exoplatform.commons.reflect.AnnotationIntrospector;
-import org.exoplatform.management.jmx.annotations.NameTemplate;
-import org.exoplatform.management.jmx.annotations.NamingContext;
-import org.exoplatform.management.jmx.annotations.Property;
-
-import java.lang.annotation.Annotation;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class PropertiesInfo
-{
-
- /** . */
- private Map<String, PropertyInfo> properties;
-
- public PropertiesInfo(Map<String, PropertyInfo> properties)
- {
- this.properties = properties;
- }
-
- public static PropertiesInfo resolve(Class clazz, Class<? extends Annotation> annotationClass)
- {
- Annotation tpl2 = AnnotationIntrospector.resolveClassAnnotations(clazz, annotationClass);
- Property[] blah = null;
- if (tpl2 instanceof NamingContext)
- {
- blah = ((NamingContext)tpl2).value();
- }
- else if (tpl2 instanceof NameTemplate)
- {
- blah = ((NameTemplate)tpl2).value();
- }
- if (blah != null)
- {
- Map<String, PropertyInfo> properties = new HashMap<String, PropertyInfo>();
- for (Property property : blah)
- {
- PropertyInfo propertyInfo = new PropertyInfo(clazz, property);
- properties.put(propertyInfo.getKey(), propertyInfo);
- }
- return new PropertiesInfo(properties);
- }
- else
- {
- return null;
- }
- }
-
- public Collection<PropertyInfo> getProperties()
- {
- return properties.values();
- }
-
- public Map<String, String> resolve(Object instance)
- {
- Map<String, String> props = new HashMap<String, String>();
- for (PropertyInfo propertyInfo : properties.values())
- {
- String key = propertyInfo.getKey();
- String value = propertyInfo.resolveValue(instance);
- props.put(key, value);
- }
- return props;
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/PropertyInfo.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/PropertyInfo.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/PropertyInfo.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,161 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.jmx;
-
-import org.exoplatform.management.jmx.annotations.Property;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-
-import javax.management.ObjectName;
-
-/**
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class PropertyInfo
-{
-
- /** . */
- private final String key;
-
- /** . */
- private final Value value;
-
- public PropertyInfo(Class clazz, Property def)
- {
- String tmp = def.value();
- Value value;
- int length = tmp.length();
- if (length > 2 && tmp.charAt(0) == '{' && tmp.charAt(length - 1) == '}')
- {
- String s = tmp.substring(1, length - 1);
- String getterName = "get" + s;
- Method getter;
- try
- {
- getter = clazz.getMethod(getterName);
- }
- catch (NoSuchMethodException e)
- {
- throw new IllegalArgumentException("Getter parameter for property " + s + " on class " + clazz.getName()
- + " does not exist", e);
- }
-
- //
- if (getter.getReturnType() == void.class)
- {
- throw new IllegalArgumentException("Getter return type for property " + s + " on class " + clazz.getName()
- + " cannot be void");
- }
- if (getter.getParameterTypes().length > 0)
- {
- throw new IllegalArgumentException("Getter parameter type for property " + s + " on class "
- + clazz.getName() + " is not empty");
- }
- if (Modifier.isStatic(getter.getModifiers()))
- {
- throw new IllegalArgumentException("Getter for property " + s + " on class " + clazz.getName()
- + " is static");
- }
-
- //
- value = new DynamicValue(getter);
- }
- else
- {
- value = new LitteralValue(tmp);
- }
-
- //
- this.key = def.key();
- this.value = value;
- }
-
- public String resolveValue(Object instance)
- {
- return value.resolve(instance);
- }
-
- public String getKey()
- {
- return key;
- }
-
- private abstract static class Value
- {
- abstract String resolve(Object instance);
- }
-
- private class DynamicValue extends Value
- {
-
- /** . */
- private final Method getter;
-
- private DynamicValue(Method getter)
- {
- this.getter = getter;
- }
-
- String resolve(Object instance)
- {
- Object value;
- try
- {
- value = getter.invoke(instance);
- }
- catch (IllegalAccessException e)
- {
- throw new IllegalArgumentException("Getter for property " + key + " on class "
- + getter.getClass().getName() + " cannot be invoked", e);
- }
- catch (InvocationTargetException e)
- {
- throw new IllegalArgumentException("Getter for property " + key + " on class "
- + getter.getClass().getName() + " threw an exception during invocation", e);
- }
- if (value == null)
- {
- throw new IllegalArgumentException("Getter for property " + key + " on class "
- + getter.getClass().getName() + " returned a null value");
- }
- return ObjectName.quote(value.toString());
- }
- }
-
- private static class LitteralValue extends Value
- {
-
- /** . */
- private final String litteral;
-
- private LitteralValue(String litteral)
- {
- this.litteral = litteral;
- }
-
- String resolve(Object instance)
- {
- return litteral;
- }
- }
-
-}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableComponentAdapter.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableComponentAdapter.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableComponentAdapter.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.container.management;
+
+import org.exoplatform.management.spi.ManagementProvider;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+import org.picocontainer.ComponentAdapter;
+import org.picocontainer.PicoContainer;
+import org.picocontainer.PicoInitializationException;
+import org.picocontainer.PicoIntrospectionException;
+import org.picocontainer.PicoVisitor;
+
+/**
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ManageableComponentAdapter implements ComponentAdapter
+{
+
+ /** . */
+ private Log log = ExoLogger.getLogger(ManageableComponentAdapter.class);
+
+ /** . */
+ private ComponentAdapter delegate;
+
+ /** . */
+ private final ManageableContainer container;
+
+ /** . */
+ private volatile boolean registered = false;
+
+ public ManageableComponentAdapter(ManageableContainer container, ComponentAdapter delegate)
+ {
+ this.delegate = delegate;
+ this.container = container;
+ }
+
+ public Object getComponentKey()
+ {
+ return delegate.getComponentKey();
+ }
+
+ public Class getComponentImplementation()
+ {
+ return delegate.getComponentImplementation();
+ }
+
+ public Object getComponentInstance(PicoContainer pico) throws PicoInitializationException,
+ PicoIntrospectionException
+ {
+ Object instance = delegate.getComponentInstance(pico);
+
+ //
+ if (!registered)
+ {
+ registered = true;
+
+ //
+ if (container.managementContext != null)
+ {
+ // Registry the instance against the management context
+ log.debug("==> add " + instance + " to a mbean server");
+ container.managementContext.register(instance);
+
+ // Register if it is a management provider
+ if (instance instanceof ManagementProvider)
+ {
+ ManagementProvider provider = (ManagementProvider)instance;
+ container.addProvider(provider);
+ }
+ }
+ }
+ return instance;
+ }
+
+ public void verify(PicoContainer container) throws PicoIntrospectionException
+ {
+ delegate.verify(container);
+ }
+
+ public void accept(PicoVisitor visitor)
+ {
+ delegate.accept(visitor);
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableComponentAdapterFactory.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableComponentAdapterFactory.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableComponentAdapterFactory.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.container.management;
+
+import org.picocontainer.ComponentAdapter;
+import org.picocontainer.Parameter;
+import org.picocontainer.PicoIntrospectionException;
+import org.picocontainer.defaults.AssignabilityRegistrationException;
+import org.picocontainer.defaults.ComponentAdapterFactory;
+import org.picocontainer.defaults.NotConcreteRegistrationException;
+
+/**
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ManageableComponentAdapterFactory implements ComponentAdapterFactory
+{
+
+ /** . */
+ private ComponentAdapterFactory delegate;
+
+ /** . */
+ ManageableContainer container;
+
+ public ManageableComponentAdapterFactory(ComponentAdapterFactory delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public ComponentAdapter createComponentAdapter(Object componentKey, Class componentImplementation,
+ Parameter[] parameters) throws PicoIntrospectionException, AssignabilityRegistrationException,
+ NotConcreteRegistrationException
+ {
+ ComponentAdapter adapter = delegate.createComponentAdapter(componentKey, componentImplementation, parameters);
+ return new ManageableComponentAdapter(container, adapter);
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,230 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.container.management;
+
+import org.exoplatform.container.CachingContainer;
+import org.exoplatform.container.jmx.MX4JComponentAdapterFactory;
+import org.exoplatform.container.monitor.jvm.J2EEServerInfo;
+import org.exoplatform.management.ManagementContext;
+import org.exoplatform.management.annotations.Managed;
+import org.exoplatform.management.annotations.ManagedDescription;
+import org.exoplatform.management.annotations.ManagedName;
+import org.exoplatform.management.jmx.impl.JMXManagementProvider;
+import org.exoplatform.management.spi.ManagementProvider;
+import org.picocontainer.ComponentAdapter;
+import org.picocontainer.PicoContainer;
+import org.picocontainer.PicoException;
+import org.picocontainer.PicoRegistrationException;
+import org.picocontainer.defaults.ComponentAdapterFactory;
+import org.picocontainer.defaults.DuplicateComponentKeyRegistrationException;
+
+import java.lang.management.ManagementFactory;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.management.MBeanServer;
+
+/**
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ManageableContainer extends CachingContainer
+{
+
+ private static MBeanServer findMBeanServer()
+ {
+ J2EEServerInfo serverenv_ = new J2EEServerInfo();
+ MBeanServer server = serverenv_.getMBeanServer();
+ if (server == null)
+ {
+ server = ManagementFactory.getPlatformMBeanServer();
+ }
+ return server;
+ }
+
+ /** . */
+ private static final ThreadLocal<ManageableComponentAdapterFactory> hack = new ThreadLocal<ManageableComponentAdapterFactory>();
+
+ /** . */
+ final ManagementContextImpl managementContext;
+
+ /** . */
+ private MBeanServer server;
+
+ /** . */
+ private final Set<ManagementProvider> providers;
+
+ /** . */
+ private final ManageableContainer parent;
+
+ public ManageableContainer()
+ {
+ this((PicoContainer)null);
+ }
+
+ public ManageableContainer(PicoContainer parent)
+ {
+ this(new MX4JComponentAdapterFactory(), parent);
+ }
+
+ public ManageableContainer(ComponentAdapterFactory componentAdapterFactory, PicoContainer parent)
+ {
+ super(getComponentAdapterFactory(componentAdapterFactory), parent);
+
+ // Yeah this is not pretty but a necessary evil to make it work
+ ManageableComponentAdapterFactory factory = hack.get();
+ factory.container = this;
+ hack.set(null);
+
+ // The synchronized wrapper, here will not impact runtime performances
+ // so it's fine
+ this.providers = Collections.synchronizedSet(new HashSet<ManagementProvider>());
+
+ //
+ ManagementContextImpl parentCtx = null;
+ if (parent instanceof ManageableContainer)
+ {
+ ManageableContainer manageableParent = (ManageableContainer)parent;
+ parentCtx = manageableParent.managementContext;
+ }
+
+ //
+ this.parent = parent instanceof ManageableContainer ? (ManageableContainer)parent : null;
+
+ //
+ if (parentCtx != null)
+ {
+ server = parentCtx.container.server;
+ managementContext = new ManagementContextImpl(parentCtx, this);
+ }
+ else
+ {
+ server = findMBeanServer();
+ managementContext = new ManagementContextImpl(this);
+ addProvider(new JMXManagementProvider(server));
+ }
+ }
+
+ public ManageableContainer(ComponentAdapterFactory componentAdapterFactory)
+ {
+ this(componentAdapterFactory, null);
+ }
+
+ @Managed
+ @ManagedName("RegisteredComponentNames")
+ @ManagedDescription("Return the list of the registered component names")
+ public Set<String> getRegisteredComponentNames() throws PicoException
+ {
+ Set<String> names = new HashSet<String>();
+ Collection<ComponentAdapter> adapters = getComponentAdapters();
+ for (ComponentAdapter adapter : adapters)
+ {
+ Object key = adapter.getComponentKey();
+ String name = String.valueOf(key);
+ names.add(name);
+ }
+ return names;
+ }
+
+ private static ManageableComponentAdapterFactory getComponentAdapterFactory(
+ ComponentAdapterFactory componentAdapterFactory)
+ {
+ ManageableComponentAdapterFactory factory = new ManageableComponentAdapterFactory(componentAdapterFactory);
+ hack.set(factory);
+ return factory;
+ }
+
+ public ManagementContext getManagementContext()
+ {
+ return managementContext;
+ }
+
+ public final MBeanServer getMBeanServer()
+ {
+ return server;
+ }
+
+ @Override
+ public ComponentAdapter registerComponent(ComponentAdapter componentAdapter)
+ throws DuplicateComponentKeyRegistrationException
+ {
+ return super.registerComponent(componentAdapter);
+ }
+
+ public ComponentAdapter registerComponentInstance(Object componentKey, Object componentInstance)
+ throws PicoRegistrationException
+ {
+ ComponentAdapter adapter = super.registerComponentInstance(componentKey, componentInstance);
+ if (managementContext != null)
+ {
+ managementContext.register(componentInstance);
+
+ // Register if it is a management provider
+ if (componentInstance instanceof ManagementProvider)
+ {
+ ManagementProvider provider = (ManagementProvider)componentInstance;
+ addProvider(provider);
+ }
+ }
+ return adapter;
+ }
+
+ /**
+ * Returns the list of the providers which are relevant for this container.
+ *
+ * @return the providers
+ */
+ Collection<ManagementProvider> getProviders()
+ {
+ HashSet<ManagementProvider> allProviders = new HashSet<ManagementProvider>();
+ computeAllProviders(allProviders);
+ return allProviders;
+ }
+
+ private void computeAllProviders(Set<ManagementProvider> allProviders)
+ {
+ if (parent != null)
+ {
+ parent.computeAllProviders(allProviders);
+ }
+
+ //
+ allProviders.addAll(providers);
+ }
+
+ boolean addProvider(ManagementProvider provider)
+ {
+ // Prevent double registration just in case...
+ if (providers.contains(provider))
+ {
+ return false;
+ }
+
+ //
+ providers.add(provider);
+
+ // Perform registration of already registered managed components
+ managementContext.install(provider);
+
+ //
+ return true;
+ }
+}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedMetaData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedMetaData.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedMetaData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.management;
-
-/**
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ManagedMetaData
-{
-
- /** . */
- private String description;
-
- public String getDescription()
- {
- return description;
- }
-
- public void setDescription(String description)
- {
- this.description = description;
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedMethodMetaData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedMethodMetaData.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedMethodMetaData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.management;
-
-import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ManagedMethodMetaData extends ManagedMetaData
-{
-
- /** . */
- private final Method method;
-
- /** . */
- private final Map<Integer, ManagedMethodParameterMetaData> parameters;
-
- /**
- * Build a new instance.
- *
- * @param method the method
- * @throws NullPointerException if the method is null
- */
- public ManagedMethodMetaData(Method method) throws NullPointerException
- {
- if (method == null)
- {
- throw new NullPointerException();
- }
-
- //
- this.method = method;
- this.parameters = new HashMap<Integer, ManagedMethodParameterMetaData>();
- }
-
- public Method getMethod()
- {
- return method;
- }
-
- public void addParameter(ManagedMethodParameterMetaData parameter)
- {
- if (parameter == null)
- {
- throw new NullPointerException("No null parameter accepted");
- }
- parameters.put(parameter.getIndex(), parameter);
- }
-
- public Collection<ManagedMethodParameterMetaData> getParameters()
- {
- return Collections.unmodifiableCollection(parameters.values());
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedMethodParameterMetaData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedMethodParameterMetaData.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedMethodParameterMetaData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.management;
-
-/**
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ManagedMethodParameterMetaData extends ManagedParameterMetaData
-{
-
- /** . */
- private final int index;
-
- /**
- * Build a managed method parameter meta data.
- *
- * @param index the parameter index
- * @throws IllegalArgumentException if the index is negative
- */
- public ManagedMethodParameterMetaData(int index) throws IllegalArgumentException
- {
- if (index < 0)
- {
- throw new IllegalArgumentException("Non negative index value accepted " + index);
- }
- this.index = index;
- }
-
- public int getIndex()
- {
- return index;
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedParameterMetaData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedParameterMetaData.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedParameterMetaData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.management;
-
-/**
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ManagedParameterMetaData extends ManagedMetaData
-{
-
- /** . */
- private String name;
-
- public ManagedParameterMetaData()
- {
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedPropertyMetaData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedPropertyMetaData.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedPropertyMetaData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,116 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.management;
-
-import java.lang.reflect.Method;
-
-/**
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ManagedPropertyMetaData extends ManagedMetaData
-{
-
- /** . */
- private final String name;
-
- /** . */
- private final Method getter;
-
- /** . */
- private final String getterDescription;
-
- /** . */
- private final Method setter;
-
- /** . */
- private final String setterDescription;
-
- /** . */
- private final ManagedParameterMetaData setterParameter;
-
- public ManagedPropertyMetaData(String name, Method getter, String getterDescription, Method setter,
- String setterDescription, ManagedParameterMetaData setterParameter) throws NullPointerException,
- IllegalArgumentException
- {
- if (name == null)
- {
- throw new NullPointerException("No null name accepted");
- }
- if (setter != null)
- {
- if (setterParameter == null)
- {
- throw new IllegalArgumentException("No setter parameter provided");
- }
- }
- else
- {
- if (setterParameter != null)
- {
- throw new IllegalArgumentException("No setter provided but a setter parameter was provided");
- }
- }
-
- //
- this.name = name;
- this.getter = getter;
- this.getterDescription = getterDescription;
- this.setter = setter;
- this.setterDescription = setterDescription;
- this.setterParameter = setterParameter;
- }
-
- public String getName()
- {
- return name;
- }
-
- public Method getGetter()
- {
- return getter;
- }
-
- public Method getSetter()
- {
- return setter;
- }
-
- public String getGetterDescription()
- {
- return getterDescription;
- }
-
- public String getSetterDescription()
- {
- return setterDescription;
- }
-
- public ManagedParameterMetaData getSetterParameter()
- {
- return setterParameter;
- }
-
- @Override
- public String toString()
- {
- return "ManagedPropertyMetaData[" + "name=" + name + "getter=" + getter.getName() + "setter=" + setter.getName()
- + "]";
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedTypeMetaData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedTypeMetaData.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedTypeMetaData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,126 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.management;
-
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ManagedTypeMetaData extends ManagedMetaData
-{
-
- /** . */
- private final Class type;
-
- /** . */
- private final Map<String, ManagedPropertyMetaData> properties;
-
- /** . */
- private final Map<MethodKey, ManagedMethodMetaData> methods;
-
- public ManagedTypeMetaData(Class type) throws NullPointerException
- {
- if (type == null)
- {
- throw new NullPointerException();
- }
-
- //
- this.type = type;
- this.properties = new HashMap<String, ManagedPropertyMetaData>();
- this.methods = new HashMap<MethodKey, ManagedMethodMetaData>();
- }
-
- public Class getType()
- {
- return type;
- }
-
- public ManagedPropertyMetaData getProperty(String propertyName)
- {
- return properties.get(propertyName);
- }
-
- public void addProperty(ManagedPropertyMetaData property)
- {
- properties.put(property.getName(), property);
- }
-
- public void addMethod(ManagedMethodMetaData method)
- {
- methods.put(new MethodKey(method.getMethod()), method);
- }
-
- public Collection<ManagedMethodMetaData> getMethods()
- {
- return methods.values();
- }
-
- public Collection<ManagedPropertyMetaData> getProperties()
- {
- return properties.values();
- }
-
- private static class MethodKey
- {
-
- private final String name;
-
- private final List<Class<?>> types;
-
- private MethodKey(Method method)
- {
- this.name = method.getName();
- this.types = Arrays.asList(method.getParameterTypes());
- }
-
- @Override
- public int hashCode()
- {
- int hashCode = name.hashCode();
- for (Class<?> type : types)
- {
- hashCode = hashCode * 41 + type.hashCode();
- }
- return hashCode;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
- if (obj instanceof MethodKey)
- {
- MethodKey that = (MethodKey)obj;
- return this.name.equals(that.name) && this.types.equals(that.types);
- }
- return false;
- }
- }
-}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagementContextImpl.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagementContextImpl.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagementContextImpl.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,322 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.container.management;
+
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.component.RequestLifeCycle;
+import org.exoplatform.management.ManagementAware;
+import org.exoplatform.management.spi.ManagedResource;
+import org.exoplatform.management.spi.ManagedTypeMetaData;
+import org.exoplatform.management.spi.ManagementProvider;
+import org.exoplatform.management.ManagementContext;
+import org.exoplatform.management.annotations.ManagedBy;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ManagementContextImpl implements ManagementContext, ManagedResource
+{
+
+ /** . */
+ private final Map<Class<?>, Object> scopingDataList;
+
+ /** The registrations done by this mbean. */
+ private final Map<Object, ManagementContextImpl> registrations;
+
+ /** . */
+ final Map<ManagementProvider, Object> managedSet;
+
+ /** . */
+ private final ManagementContextImpl parent;
+
+ /** . */
+ private final Object resource;
+
+ /** . */
+ private final ManagedTypeMetaData typeMD;
+
+ /** An optional container setup when the management context is attached to a container. */
+ final ManageableContainer container;
+
+ public ManagementContextImpl(ManageableContainer container)
+ {
+ if (container == null)
+ {
+ throw new NullPointerException();
+ }
+
+ //
+ Object resource = null;
+ ManagedTypeMetaData typeMD = null;
+ MetaDataBuilder builder = new MetaDataBuilder(container.getClass());
+ if (builder.isBuildable())
+ {
+ resource = container;
+ typeMD = builder.build();
+ }
+
+ //
+ this.managedSet = new HashMap<ManagementProvider, Object>();
+ this.registrations = new HashMap<Object, ManagementContextImpl>();
+ this.parent = null;
+ this.scopingDataList = new HashMap<Class<?>, Object>();
+ this.resource = resource;
+ this.typeMD = typeMD;
+ this.container = container;
+ }
+
+ public ManagementContextImpl(ManagementContextImpl parent, ManageableContainer container)
+ {
+ if (parent == null)
+ {
+ throw new NullPointerException();
+ }
+ if (container == null)
+ {
+ throw new NullPointerException();
+ }
+
+ //
+ Object resource = null;
+ ManagedTypeMetaData typeMD = null;
+ MetaDataBuilder builder = new MetaDataBuilder(container.getClass());
+ if (builder.isBuildable())
+ {
+ resource = container;
+ typeMD = builder.build();
+ }
+
+ //
+ this.managedSet = new HashMap<ManagementProvider, Object>();
+ this.registrations = new HashMap<Object, ManagementContextImpl>();
+ this.parent = parent;
+ this.scopingDataList = new HashMap<Class<?>, Object>();
+ this.resource = resource;
+ this.typeMD = typeMD;
+ this.container = container;
+ }
+
+ public ManagementContextImpl(ManagementContextImpl parent, Object resource, ManagedTypeMetaData typeMD)
+ {
+ if (parent == null)
+ {
+ throw new NullPointerException();
+ }
+ if ((resource != null && typeMD == null) && (resource == null && typeMD != null))
+ {
+ throw new IllegalArgumentException("Can't have resource null and meta data not null or the converse");
+ }
+
+ //
+ this.managedSet = new HashMap<ManagementProvider, Object>();
+ this.registrations = new HashMap<Object, ManagementContextImpl>();
+ this.parent = parent;
+ this.scopingDataList = new HashMap<Class<?>, Object>();
+ this.resource = resource;
+ this.typeMD = typeMD;
+ this.container = null;
+ }
+
+ public ManagementContext getParent()
+ {
+ return parent;
+ }
+
+ public <S> void setScopingData(Class<S> scopeType, S scopingData)
+ {
+ this.scopingDataList.put(scopeType, scopingData);
+ }
+
+ public void register(Object o)
+ {
+ Object resource = null;
+
+ // Apply managed by annotation
+ ManagedBy managedBy = o.getClass().getAnnotation(ManagedBy.class);
+ if (managedBy != null)
+ {
+ try
+ {
+ Class managedByClass = managedBy.value();
+ Constructor<?> blah = managedByClass.getConstructor(o.getClass());
+ resource = blah.newInstance(o);
+ }
+ catch (NoSuchMethodException e)
+ {
+ e.printStackTrace();
+ }
+ catch (InstantiationException e)
+ {
+ e.printStackTrace();
+ }
+ catch (IllegalAccessException e)
+ {
+ e.printStackTrace();
+ }
+ catch (InvocationTargetException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ else
+ {
+ resource = o;
+ }
+
+ //
+ if (resource != null) {
+
+ MetaDataBuilder builder = new MetaDataBuilder(resource.getClass());
+ if (builder.isBuildable()) {
+ ManagedTypeMetaData metaData = builder.build();
+
+ //
+ ManagementContextImpl managementContext;
+ if (resource instanceof ManageableContainer)
+ {
+ managementContext = ((ManageableContainer)resource).managementContext;
+ }
+ else
+ {
+ managementContext = new ManagementContextImpl(this, resource, metaData);
+ }
+
+ //
+ registrations.put(resource, managementContext);
+
+ //
+ ManageableContainer container = findContainer();
+
+ // Install for all the providers related
+ for (ManagementProvider provider : container.getProviders())
+ {
+ Object name = provider.manage(managementContext);
+ if (name != null)
+ {
+ managementContext.managedSet.put(provider, name);
+ }
+ }
+
+ // Allow for more resource management
+ if (resource instanceof ManagementAware)
+ {
+ ((ManagementAware)resource).setContext(managementContext);
+ }
+ }
+ }
+ }
+
+ public void unregister(Object o)
+ {
+ ManagementContextImpl context = registrations.remove(o);
+ if (context != null)
+ {
+ for (Map.Entry<ManagementProvider, Object> entry : context.managedSet.entrySet()) {
+ entry.getKey().unmanage(entry.getValue());
+ }
+ }
+ }
+
+ public <S> List<S> getScopingData(Class<S> scopeType)
+ {
+ ArrayList<S> list = new ArrayList<S>();
+ for (ManagementContextImpl current = this; current != null; current = current.parent)
+ {
+ Object scopedData = current.scopingDataList.get(scopeType);
+ if (scopedData != null)
+ {
+ // It must be that type since we put it
+ list.add((S)scopedData);
+ }
+ }
+ return list;
+ }
+
+ public ExoContainer findContainer()
+ {
+ for (ManagementContextImpl current = this;true;current = current.parent)
+ {
+ if (current.container instanceof ExoContainer)
+ {
+ return (ExoContainer)current.container;
+ }
+ else if (current.parent == null)
+ {
+ return null;
+ }
+ }
+ }
+
+ public void beforeInvoke(Object managedResource)
+ {
+ ExoContainer container = findContainer();
+ if (container != null)
+ {
+ RequestLifeCycle.begin(container);
+ }
+ }
+
+ public void afterInvoke(Object managedResource)
+ {
+ RequestLifeCycle.end();
+ }
+
+ @Override
+ public String toString()
+ {
+ return "ManagementContextImpl[container=" + container + "]";
+ }
+
+ public Object getResource()
+ {
+ return resource;
+ }
+
+ public ManagedTypeMetaData getMetaData()
+ {
+ return typeMD;
+ }
+
+ void install(ManagementProvider provider) {
+
+ // Install the current resource if necessary
+ if (resource != null&& typeMD != null)
+ {
+ Object name = provider.manage(this);
+ if (name != null)
+ {
+ managedSet.put(provider, name);
+ }
+ }
+
+ // Install thie children except the container ones
+ for (ManagementContextImpl registration : registrations.values())
+ {
+ registration.install(provider);
+ }
+ }
+}
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/MetaDataBuilder.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/MetaDataBuilder.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/MetaDataBuilder.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -19,9 +19,16 @@
package org.exoplatform.container.management;
import org.exoplatform.commons.reflect.AnnotationIntrospector;
+import org.exoplatform.management.annotations.Impact;
+import org.exoplatform.management.annotations.ImpactType;
import org.exoplatform.management.annotations.Managed;
import org.exoplatform.management.annotations.ManagedDescription;
import org.exoplatform.management.annotations.ManagedName;
+import org.exoplatform.management.spi.ManagedMethodMetaData;
+import org.exoplatform.management.spi.ManagedMethodParameterMetaData;
+import org.exoplatform.management.spi.ManagedParameterMetaData;
+import org.exoplatform.management.spi.ManagedPropertyMetaData;
+import org.exoplatform.management.spi.ManagedTypeMetaData;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
@@ -126,8 +133,12 @@
ManagedDescription methodDescriptionAnn = methodDescriptions.get(method);
String methodDescription = methodDescriptionAnn != null ? methodDescriptionAnn.value() : null;
+ //
+ Impact impactAnn = method.getAnnotation(Impact.class);
+ ImpactType impactType = impactAnn != null ? impactAnn.value() : ImpactType.WRITE;
+
// Build the default mbean info
- ManagedMethodMetaData managedMethod = new ManagedMethodMetaData(method);
+ ManagedMethodMetaData managedMethod = new ManagedMethodMetaData(method, impactType);
managedMethod.setDescription(methodDescription);
// Overload with annotations meta data
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractFilter.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractFilter.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractFilter.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.web;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractHttpServlet.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractHttpServlet.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractHttpServlet.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.web;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractHttpSessionListener.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractHttpSessionListener.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractHttpSessionListener.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.web;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/PortalContainerConfigOwner.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/PortalContainerConfigOwner.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/PortalContainerConfigOwner.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.web;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/PortalContainerCreator.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/PortalContainerCreator.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/PortalContainerCreator.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.web;
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/annotations/Impact.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/annotations/Impact.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/annotations/Impact.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.management.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * The impact annotates a managed method to describe how it affects the state of the managed resource.
+ *
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target({ElementType.TYPE, ElementType.METHOD})
+public @interface Impact
+{
+
+ ImpactType value() default ImpactType.WRITE;
+
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/annotations/ImpactType.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/annotations/ImpactType.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/annotations/ImpactType.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.management.annotations;
+
+/**
+ * The type of the impact of a managed method.
+ *
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public enum ImpactType
+{
+
+ /**
+ * Read operation, does not affect state of the managed resource.
+ * Equivalent of {@link javax.management.MBeanOperationInfo#INFO} for JMX and GET method for Rest.
+ */
+ READ,
+
+ /**
+ * Write operation, changes the state of the managed resource.
+ * Equivalent of {@link javax.management.MBeanOperationInfo#INFO} for JMX and POST method for Rest.
+ */
+ WRITE,
+
+ /**
+ * Write operation, changes the state of the managed resource in an idempotent manner.
+ * Equivalent of {@link javax.management.MBeanOperationInfo#INFO} for JMX and PUT method for Rest.
+ */
+ IDEMPOTENT_WRITE
+
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/annotations/package-info.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/annotations/package-info.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/annotations/package-info.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,8 @@
+/**
+ * <p>This package defines the annotations the defines the management interface of a service. The annotations are
+ * agnostic of any management layer implementation to avoid the coupling to a specific management layer.</p>
+ *
+ * <p>It is possible for a management layer to define additional annotations that are used by that layer to
+ * provide more information to manage the resource.</p>
+ */
+package org.exoplatform.management.annotations;
\ No newline at end of file
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/annotations/package-info.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/annotations/package-info.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/annotations/package-info.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,4 @@
+/**
+ * This package defines additional meta data for the JMX management layer.
+ */
+package org.exoplatform.management.jmx.annotations;
\ No newline at end of file
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/ExoMBeanInfoBuilder.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/ExoMBeanInfoBuilder.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/ExoMBeanInfoBuilder.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,245 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.jmx.impl;
+
+import org.exoplatform.management.annotations.ImpactType;
+import org.exoplatform.management.spi.ManagedMethodMetaData;
+import org.exoplatform.management.spi.ManagedMethodParameterMetaData;
+import org.exoplatform.management.spi.ManagedPropertyMetaData;
+import org.exoplatform.management.spi.ManagedTypeMetaData;
+import org.exoplatform.container.management.MetaDataBuilder;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.Descriptor;
+import javax.management.IntrospectionException;
+import javax.management.MBeanOperationInfo;
+import javax.management.MBeanParameterInfo;
+import javax.management.modelmbean.ModelMBeanAttributeInfo;
+import javax.management.modelmbean.ModelMBeanConstructorInfo;
+import javax.management.modelmbean.ModelMBeanInfo;
+import javax.management.modelmbean.ModelMBeanInfoSupport;
+import javax.management.modelmbean.ModelMBeanNotificationInfo;
+import javax.management.modelmbean.ModelMBeanOperationInfo;
+
+/**
+ * <p>A class that build mbean meta data</p>
+ *
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ExoMBeanInfoBuilder
+{
+
+ private static enum Role {
+ SET("setter"), IS("getter"), GET("getter"), OP("operation");
+
+ private final String name;
+
+ private Role(String role)
+ {
+ this.name = role;
+ }
+ }
+
+ private ManagedTypeMetaData typeMD;
+
+ /**
+ * Create a new builder.
+ *
+ * @param clazz the clazz
+ * @throws IllegalArgumentException if the class is null or does not contain meta data
+ */
+ public ExoMBeanInfoBuilder(Class clazz) throws IllegalArgumentException
+ {
+ this.typeMD = new MetaDataBuilder(clazz).build();
+ }
+
+ public ExoMBeanInfoBuilder(ManagedTypeMetaData typeMD) throws IllegalArgumentException
+ {
+ this.typeMD = typeMD;
+ }
+
+ private ModelMBeanOperationInfo buildOperationInfo(Method method, String description, Role role,
+ Collection<ManagedMethodParameterMetaData> parametersMD, ImpactType impactType)
+ {
+ ModelMBeanOperationInfo operationInfo = new ModelMBeanOperationInfo(description, method);
+
+ //
+ if (description == null)
+ {
+ description = "Management operation";
+ }
+
+ //
+ MBeanParameterInfo[] parameterInfos = operationInfo.getSignature();
+ for (ManagedMethodParameterMetaData parameterMD : parametersMD)
+ {
+ int i = parameterMD.getIndex();
+ MBeanParameterInfo parameterInfo = parameterInfos[i];
+ String parameterName = parameterInfo.getName();
+ String parameterDescription = operationInfo.getSignature()[i].getDescription();
+ if (parameterMD.getName() != null)
+ {
+ parameterName = parameterMD.getName();
+ }
+ else if (parameterMD.getDescription() != null)
+ {
+ parameterDescription = parameterMD.getDescription();
+ }
+ parameterInfos[i] = new MBeanParameterInfo(parameterName, parameterInfo.getType(), parameterDescription);
+ }
+
+ //
+ int jmxImpact;
+ switch (impactType)
+ {
+ case READ:
+ jmxImpact = MBeanOperationInfo.INFO;
+ break;
+ case IDEMPOTENT_WRITE:
+ case WRITE:
+ jmxImpact = MBeanOperationInfo.ACTION;
+ break;
+ default:
+ throw new AssertionError();
+ }
+
+ //
+ Descriptor operationDescriptor = operationInfo.getDescriptor();
+ operationDescriptor.setField("role", role.name);
+
+ //
+ return new ModelMBeanOperationInfo(operationInfo.getName(), description, parameterInfos, operationInfo
+ .getReturnType(), jmxImpact, operationDescriptor);
+ }
+
+ /**
+ * Build the info.
+ *
+ * @return returns the info
+ * @throws IllegalStateException raised by any build time issue
+ */
+ public ModelMBeanInfo build() throws IllegalStateException
+ {
+ String mbeanDescription = "Exo model mbean";
+ if (typeMD.getDescription() != null)
+ {
+ mbeanDescription = typeMD.getDescription();
+ }
+
+ //
+ ArrayList<ModelMBeanOperationInfo> operations = new ArrayList<ModelMBeanOperationInfo>();
+ for (ManagedMethodMetaData methodMD : typeMD.getMethods())
+ {
+ ModelMBeanOperationInfo operationInfo =
+ buildOperationInfo(methodMD.getMethod(), methodMD.getDescription(), Role.OP, methodMD.getParameters(), methodMD.getImpact());
+ operations.add(operationInfo);
+ }
+
+ //
+ Map<String, ModelMBeanAttributeInfo> attributeInfos = new HashMap<String, ModelMBeanAttributeInfo>();
+ for (ManagedPropertyMetaData propertyMD : typeMD.getProperties())
+ {
+
+ Method getter = propertyMD.getGetter();
+ if (getter != null)
+ {
+ Role role;
+ String getterName = getter.getName();
+ if (getterName.startsWith("get") && getterName.length() > 3)
+ {
+ role = Role.GET;
+ }
+ else if (getterName.startsWith("is") && getterName.length() > 2)
+ {
+ role = Role.IS;
+ }
+ else
+ {
+ throw new AssertionError();
+ }
+ Collection<ManagedMethodParameterMetaData> blah = Collections.emptyList();
+ ModelMBeanOperationInfo operationInfo =
+ buildOperationInfo(getter, propertyMD.getGetterDescription(), role, blah, ImpactType.READ);
+ operations.add(operationInfo);
+ }
+
+ //
+ Method setter = propertyMD.getSetter();
+ if (setter != null)
+ {
+ ManagedMethodParameterMetaData s = new ManagedMethodParameterMetaData(0);
+ s.setDescription(propertyMD.getSetterParameter().getDescription());
+ s.setName(propertyMD.getSetterParameter().getName());
+ Collection<ManagedMethodParameterMetaData> blah = Collections.singletonList(s);
+ ModelMBeanOperationInfo operationInfo =
+ buildOperationInfo(setter, propertyMD.getSetterDescription(), Role.SET, blah, ImpactType.IDEMPOTENT_WRITE);
+ operations.add(operationInfo);
+ }
+
+ //
+ try
+ {
+ String attributeDescription =
+ propertyMD.getDescription() != null ? propertyMD.getDescription() : ("Managed attribute " + propertyMD
+ .getName());
+
+ //
+ ModelMBeanAttributeInfo attributeInfo =
+ new ModelMBeanAttributeInfo(propertyMD.getName(), attributeDescription, getter, setter);
+
+ //
+ Descriptor attributeDescriptor = attributeInfo.getDescriptor();
+ if (getter != null)
+ {
+ attributeDescriptor.setField("getMethod", getter.getName());
+ }
+ if (setter != null)
+ {
+ attributeDescriptor.setField("setMethod", setter.getName());
+ }
+ attributeDescriptor.setField("currencyTimeLimit", "-1");
+ attributeDescriptor.setField("persistPolicy", "Never");
+ attributeInfo.setDescriptor(attributeDescriptor);
+
+ //
+ ModelMBeanAttributeInfo previous = attributeInfos.put(propertyMD.getName(), attributeInfo);
+ if (previous != null)
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+ catch (IntrospectionException e)
+ {
+ throw new AssertionError(e);
+ }
+ }
+
+ //
+ return new ModelMBeanInfoSupport(typeMD.getType().getName(), mbeanDescription, attributeInfos.values().toArray(
+ new ModelMBeanAttributeInfo[attributeInfos.size()]), new ModelMBeanConstructorInfo[0], operations
+ .toArray(new ModelMBeanOperationInfo[operations.size()]), new ModelMBeanNotificationInfo[0]);
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/ExoModelMBean.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/ExoModelMBean.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/ExoModelMBean.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.jmx.impl;
+
+import org.exoplatform.management.spi.ManagedResource;
+import org.exoplatform.management.ManagementAware;
+import org.exoplatform.management.jmx.annotations.NamingContext;
+
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanException;
+import javax.management.MBeanRegistration;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.management.ReflectionException;
+import javax.management.RuntimeOperationsException;
+import javax.management.modelmbean.InvalidTargetObjectTypeException;
+import javax.management.modelmbean.ModelMBeanInfo;
+import javax.management.modelmbean.RequiredModelMBean;
+
+/**
+ * A convenient subclass of {@link RequiredModelMBean) that routes the invocation of the interface
+ * {@link MBeanRegistration} to the managed resource when it implements the method.
+ *
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ExoModelMBean extends RequiredModelMBean
+{
+
+ /** . */
+ private Object mr;
+
+ /** . */
+ private final ManagedResource context;
+
+ public ExoModelMBean(ManagedResource context, Object mr, ModelMBeanInfo mbi) throws MBeanException,
+ RuntimeOperationsException, InstanceNotFoundException, InvalidTargetObjectTypeException
+ {
+ super(mbi);
+
+ //
+ this.context = context;
+ this.mr = mr;
+
+ //
+ setManagedResource(mr, "ObjectReference");
+ }
+
+ @Override
+ public Object invoke(String opName, Object[] opArgs, String[] sig) throws MBeanException, ReflectionException
+ {
+ context.beforeInvoke(mr);
+ try
+ {
+ return super.invoke(opName, opArgs, sig);
+ }
+ finally
+ {
+ context.afterInvoke(mr);
+ }
+ }
+
+ @Override
+ public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
+ {
+ name = super.preRegister(server, name);
+
+ //
+ if (mr instanceof MBeanRegistration)
+ {
+ ((MBeanRegistration)mr).preRegister(server, name);
+ }
+
+ //
+ return name;
+ }
+
+ @Override
+ public void postRegister(Boolean registrationDone)
+ {
+ super.postRegister(registrationDone);
+
+ //
+ PropertiesInfo info = PropertiesInfo.resolve(mr.getClass(), NamingContext.class);
+
+ //
+ MBeanScopingData scopingData = info != null ? info.resolve(mr) : new MBeanScopingData();
+
+ //
+ context.setScopingData(MBeanScopingData.class, scopingData);
+
+ //
+ if (mr instanceof MBeanRegistration)
+ {
+ ((MBeanRegistration)mr).postRegister(registrationDone);
+ }
+ }
+
+ @Override
+ public void preDeregister() throws Exception
+ {
+ if (mr instanceof MBeanRegistration)
+ {
+ ((MBeanRegistration)mr).preDeregister();
+ }
+
+ //
+ if (mr instanceof ManagementAware)
+ {
+ ((ManagementAware)mr).setContext(null);
+ }
+
+ //
+ super.preDeregister();
+ }
+
+ @Override
+ public void postDeregister()
+ {
+ if (mr instanceof MBeanRegistration)
+ {
+ ((MBeanRegistration)mr).postDeregister();
+ }
+
+ //
+ super.postDeregister();
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/JMX.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/JMX.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/JMX.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.jmx.impl;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+/**
+ * Various JMX utilities.
+ *
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class JMX
+{
+
+ private JMX()
+ {
+ }
+
+ /**
+ * This method create an object name from a generic map argument. The main reason is that
+ * the method {@link javax.management.ObjectName#getInstance(String, java.util.Hashtable)} has
+ * uses a non generic Hashtable with Java 5 and use a Hashtable<String, String> constructor in Java 6.
+ *
+ * The suitable solution is therefore to use a non generic Hashtable but that creates compilation warning therefore
+ * we encapsulate there this code in order to use the warning supression in that single place.
+ *
+ * @see ObjectName#getInstance(String, java.util.Hashtable)
+ *
+ * @param domain The domain part of the object name.
+ * @param table A hash table containing one or more key
+ * properties. The key of each entry in the table is the key of a
+ * key property in the object name. The associated value in the
+ * table is the associated value in the object name.
+ *
+ * @return an ObjectName corresponding to the given domain and
+ * key mappings.
+ * @exception MalformedObjectNameException The <code>domain</code>
+ * contains an illegal character, or one of the keys or values in
+ * <code>table</code> contains an illegal character, or one of the
+ * values in <code>table</code> does not follow the rules for
+ * quoting.
+ * @exception NullPointerException One of the parameters is null.
+ */
+ @SuppressWarnings("unchecked")
+ public static ObjectName createObjectName(String domain, Map<String, String> table)
+ throws MalformedObjectNameException, NullPointerException
+ {
+ Hashtable tmp = new Hashtable(table);
+ return ObjectName.getInstance(domain, tmp);
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/JMXManagementProvider.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/JMXManagementProvider.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/JMXManagementProvider.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,180 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.jmx.impl;
+
+import org.exoplatform.management.spi.ManagedResource;
+import org.exoplatform.management.spi.ManagementProvider;
+import org.exoplatform.management.jmx.annotations.NameTemplate;
+
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanRegistrationException;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.modelmbean.ModelMBeanInfo;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class JMXManagementProvider implements ManagementProvider
+{
+
+ /** . */
+ private final MBeanServer server;
+
+ public JMXManagementProvider()
+ {
+ this(MBeanServerFactory.createMBeanServer());
+ }
+
+ public JMXManagementProvider(MBeanServer server)
+ {
+ this.server = server;
+ }
+
+ public Object manage(ManagedResource context)
+ {
+ ExoModelMBean mbean = null;
+ try
+ {
+ ExoMBeanInfoBuilder infoBuilder = new ExoMBeanInfoBuilder(context.getMetaData());
+ ModelMBeanInfo info = infoBuilder.build();
+ mbean = new ExoModelMBean(context, context.getResource(), info);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ //
+ if (mbean != null)
+ {
+ ObjectName on = null;
+ PropertiesInfo oni = PropertiesInfo.resolve(context.getResource().getClass(), NameTemplate.class);
+ if (oni != null)
+ {
+ try
+ {
+ Map<String, String> foo = oni.resolve(context.getResource());
+ on = JMX.createObjectName("exo", foo);
+ }
+ catch (MalformedObjectNameException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ if (on != null)
+ {
+ // Merge with the container hierarchy context
+ try
+ {
+ Map<String, String> props = new Hashtable<String, String>();
+
+ // Merge scoping properties
+ List<MBeanScopingData> list = context.getScopingData(MBeanScopingData.class);
+ for (MBeanScopingData scopingData : list)
+ {
+ props.putAll(scopingData);
+ }
+
+ // Julien : I know it's does not look great but it's necessary
+ // for compiling under Java 5 and Java 6 properly. The methods
+ // ObjectName#getKeyPropertyList() returns an Hashtable with Java 5
+ // and a Hashtable<String, String> with Java 6.
+ for (Object o : on.getKeyPropertyList().entrySet())
+ {
+ Map.Entry entry = (Map.Entry)o;
+ String key = (String)entry.getKey();
+ String value = (String)entry.getValue();
+ props.put(key, value);
+ }
+
+ //
+ on = JMX.createObjectName(on.getDomain(), props);
+
+ //
+ attemptToRegister(on, mbean);
+
+ //
+ return on;
+ }
+ catch (MalformedObjectNameException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ //
+ return null;
+ }
+
+ private void attemptToRegister(ObjectName name, Object mbean)
+ {
+ synchronized (server)
+ {
+ try
+ {
+ server.registerMBean(mbean, name);
+ }
+ catch (InstanceAlreadyExistsException e)
+ {
+ try
+ {
+
+ server.unregisterMBean(name);
+ server.registerMBean(mbean, name);
+
+ }
+ catch (Exception e1)
+ {
+ throw new RuntimeException("Failed to register MBean '" + name + " due to " + e.getMessage(), e);
+ }
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Failed to register MBean '" + name + " due to " + e.getMessage(), e);
+ }
+ }
+ }
+
+ public void unmanage(Object key)
+ {
+ ObjectName name = (ObjectName)key;
+ try
+ {
+ server.unregisterMBean(name);
+ }
+ catch (InstanceNotFoundException e)
+ {
+ e.printStackTrace();
+ }
+ catch (MBeanRegistrationException e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/MBeanScopingData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/MBeanScopingData.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/MBeanScopingData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.jmx.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class MBeanScopingData extends HashMap<String, String>
+{
+ public MBeanScopingData(int initialCapacity, float loadFactor)
+ {
+ super(initialCapacity, loadFactor);
+ }
+
+ public MBeanScopingData(int initialCapacity)
+ {
+ super(initialCapacity);
+ }
+
+ public MBeanScopingData()
+ {
+ }
+
+ public MBeanScopingData(Map<? extends String, ? extends String> m)
+ {
+ super(m);
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/ObjectNameBuilder.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/ObjectNameBuilder.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/ObjectNameBuilder.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.jmx.impl;
+
+import org.exoplatform.management.jmx.annotations.NameTemplate;
+
+import java.util.Map;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+/**
+ * A builder for object name templates.
+ *
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ObjectNameBuilder<T>
+{
+
+ /** . */
+ private String domain;
+
+ /** . */
+ private Class<? extends T> clazz;
+
+ /**
+ * Create a new builder.
+ *
+ * @param clazz the class
+ * @throws IllegalArgumentException if the object is null
+ */
+ public ObjectNameBuilder(String domain, Class<? extends T> clazz) throws IllegalArgumentException
+ {
+ if (clazz == null)
+ {
+ throw new IllegalArgumentException("Clazz cannot be null");
+ }
+ this.domain = domain;
+ this.clazz = clazz;
+ }
+
+ /**
+ * Build the object name or return null if the class is not annotated by
+ * {@link NameTemplate}.
+ *
+ * @param object the object
+ * @return the built name
+ * @throws IllegalStateException raised by a build time issue
+ */
+ public ObjectName build(T object) throws IllegalStateException
+ {
+ PropertiesInfo info = PropertiesInfo.resolve(clazz, NameTemplate.class);
+
+ //
+ if (info != null)
+ {
+
+ try
+ {
+ Map<String, String> props = info.resolve(object);
+ return JMX.createObjectName(domain, props);
+ }
+ catch (MalformedObjectNameException e)
+ {
+ throw new IllegalArgumentException("ObjectName template is malformed", e);
+ }
+ }
+
+ //
+ return null;
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/PropertiesInfo.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/PropertiesInfo.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/PropertiesInfo.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.jmx.impl;
+
+import org.exoplatform.commons.reflect.AnnotationIntrospector;
+import org.exoplatform.management.jmx.annotations.NameTemplate;
+import org.exoplatform.management.jmx.annotations.NamingContext;
+import org.exoplatform.management.jmx.annotations.Property;
+
+import java.lang.annotation.Annotation;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PropertiesInfo
+{
+
+ /** . */
+ private Map<String, PropertyInfo> properties;
+
+ public PropertiesInfo(Map<String, PropertyInfo> properties)
+ {
+ this.properties = properties;
+ }
+
+ public static PropertiesInfo resolve(Class clazz, Class<? extends Annotation> annotationClass)
+ {
+ Annotation tpl2 = AnnotationIntrospector.resolveClassAnnotations(clazz, annotationClass);
+ Property[] blah = null;
+ if (tpl2 instanceof NamingContext)
+ {
+ blah = ((NamingContext)tpl2).value();
+ }
+ else if (tpl2 instanceof NameTemplate)
+ {
+ blah = ((NameTemplate)tpl2).value();
+ }
+ if (blah != null)
+ {
+ Map<String, PropertyInfo> properties = new HashMap<String, PropertyInfo>();
+ for (Property property : blah)
+ {
+ PropertyInfo propertyInfo = new PropertyInfo(clazz, property);
+ properties.put(propertyInfo.getKey(), propertyInfo);
+ }
+ return new PropertiesInfo(properties);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public Collection<PropertyInfo> getProperties()
+ {
+ return properties.values();
+ }
+
+ public MBeanScopingData resolve(Object instance)
+ {
+ MBeanScopingData props = new MBeanScopingData();
+ for (PropertyInfo propertyInfo : properties.values())
+ {
+ String key = propertyInfo.getKey();
+ String value = propertyInfo.resolveValue(instance);
+ props.put(key, value);
+ }
+ return props;
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/PropertyInfo.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/PropertyInfo.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/PropertyInfo.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,161 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.jmx.impl;
+
+import org.exoplatform.management.jmx.annotations.Property;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+import javax.management.ObjectName;
+
+/**
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PropertyInfo
+{
+
+ /** . */
+ private final String key;
+
+ /** . */
+ private final Value value;
+
+ public PropertyInfo(Class clazz, Property def)
+ {
+ String tmp = def.value();
+ Value value;
+ int length = tmp.length();
+ if (length > 2 && tmp.charAt(0) == '{' && tmp.charAt(length - 1) == '}')
+ {
+ String s = tmp.substring(1, length - 1);
+ String getterName = "get" + s;
+ Method getter;
+ try
+ {
+ getter = clazz.getMethod(getterName);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new IllegalArgumentException("Getter parameter for property " + s + " on class " + clazz.getName()
+ + " does not exist", e);
+ }
+
+ //
+ if (getter.getReturnType() == void.class)
+ {
+ throw new IllegalArgumentException("Getter return type for property " + s + " on class " + clazz.getName()
+ + " cannot be void");
+ }
+ if (getter.getParameterTypes().length > 0)
+ {
+ throw new IllegalArgumentException("Getter parameter type for property " + s + " on class "
+ + clazz.getName() + " is not empty");
+ }
+ if (Modifier.isStatic(getter.getModifiers()))
+ {
+ throw new IllegalArgumentException("Getter for property " + s + " on class " + clazz.getName()
+ + " is static");
+ }
+
+ //
+ value = new DynamicValue(getter);
+ }
+ else
+ {
+ value = new LitteralValue(tmp);
+ }
+
+ //
+ this.key = def.key();
+ this.value = value;
+ }
+
+ public String resolveValue(Object instance)
+ {
+ return value.resolve(instance);
+ }
+
+ public String getKey()
+ {
+ return key;
+ }
+
+ private abstract static class Value
+ {
+ abstract String resolve(Object instance);
+ }
+
+ private class DynamicValue extends Value
+ {
+
+ /** . */
+ private final Method getter;
+
+ private DynamicValue(Method getter)
+ {
+ this.getter = getter;
+ }
+
+ String resolve(Object instance)
+ {
+ Object value;
+ try
+ {
+ value = getter.invoke(instance);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new IllegalArgumentException("Getter for property " + key + " on class "
+ + getter.getClass().getName() + " cannot be invoked", e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new IllegalArgumentException("Getter for property " + key + " on class "
+ + getter.getClass().getName() + " threw an exception during invocation", e);
+ }
+ if (value == null)
+ {
+ throw new IllegalArgumentException("Getter for property " + key + " on class "
+ + getter.getClass().getName() + " returned a null value");
+ }
+ return ObjectName.quote(value.toString());
+ }
+ }
+
+ private static class LitteralValue extends Value
+ {
+
+ /** . */
+ private final String litteral;
+
+ private LitteralValue(String litteral)
+ {
+ this.litteral = litteral;
+ }
+
+ String resolve(Object instance)
+ {
+ return litteral;
+ }
+ }
+
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/package-info.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/package-info.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/package-info.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,4 @@
+/**
+ * The implementation of the management SPI (@link org.exoplatform.management.spi} for the JMX management system.
+ */
+package org.exoplatform.management.jmx.impl;
\ No newline at end of file
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMetaData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMetaData.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMetaData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.spi;
+
+/**
+ * Generic base meta data class.
+ *
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ManagedMetaData
+{
+
+ /** . */
+ private String description;
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMethodMetaData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMethodMetaData.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMethodMetaData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.spi;
+
+import org.exoplatform.management.annotations.ImpactType;
+
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Meta data that describes a managed method.
+ *
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ManagedMethodMetaData extends ManagedMetaData
+{
+
+ /** . */
+ private final Method method;
+
+ /** . */
+ private final Map<Integer, ManagedMethodParameterMetaData> parameters;
+
+ /** . */
+ private final ImpactType impact;
+
+ /**
+ * Build a new instance.
+ *
+ * @param method the method
+ * @param impactType the access mode
+ * @throws NullPointerException if the method is null or the impact is null
+ */
+ public ManagedMethodMetaData(Method method, ImpactType impactType) throws NullPointerException
+ {
+ if (method == null)
+ {
+ throw new NullPointerException();
+ }
+ if (impactType == null)
+ {
+ throw new NullPointerException();
+ }
+
+ //
+ this.method = method;
+ this.impact = impactType;
+ this.parameters = new HashMap<Integer, ManagedMethodParameterMetaData>();
+ }
+
+ public String getName()
+ {
+ return method.getName();
+ }
+
+ public ImpactType getImpact()
+ {
+ return impact;
+ }
+
+ public Method getMethod()
+ {
+ return method;
+ }
+
+ public void addParameter(ManagedMethodParameterMetaData parameter)
+ {
+ if (parameter == null)
+ {
+ throw new NullPointerException("No null parameter accepted");
+ }
+ parameters.put(parameter.getIndex(), parameter);
+ }
+
+ public Collection<ManagedMethodParameterMetaData> getParameters()
+ {
+ return Collections.unmodifiableCollection(parameters.values());
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMethodParameterMetaData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMethodParameterMetaData.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMethodParameterMetaData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.spi;
+
+/**
+ * Meta data that describes the parameter of a managed method.
+ *
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ManagedMethodParameterMetaData extends ManagedParameterMetaData
+{
+
+ /** . */
+ private final int index;
+
+ /**
+ * Build a managed method parameter meta data.
+ *
+ * @param index the parameter index
+ * @throws IllegalArgumentException if the index is negative
+ */
+ public ManagedMethodParameterMetaData(int index) throws IllegalArgumentException
+ {
+ if (index < 0)
+ {
+ throw new IllegalArgumentException("Non negative index value accepted " + index);
+ }
+ this.index = index;
+ }
+
+ public int getIndex()
+ {
+ return index;
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedParameterMetaData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedParameterMetaData.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedParameterMetaData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.spi;
+
+/**
+ * Meta data that describes a managed parameter.
+ *
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ManagedParameterMetaData extends ManagedMetaData
+{
+
+ /** . */
+ private String name;
+
+ public ManagedParameterMetaData()
+ {
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedPropertyMetaData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedPropertyMetaData.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedPropertyMetaData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.spi;
+
+import java.lang.reflect.Method;
+
+/**
+ * Meta data that describes a managed property.
+ *
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ManagedPropertyMetaData extends ManagedMetaData
+{
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final Method getter;
+
+ /** . */
+ private final String getterDescription;
+
+ /** . */
+ private final Method setter;
+
+ /** . */
+ private final String setterDescription;
+
+ /** . */
+ private final ManagedParameterMetaData setterParameter;
+
+ public ManagedPropertyMetaData(String name, Method getter, String getterDescription, Method setter,
+ String setterDescription, ManagedParameterMetaData setterParameter) throws NullPointerException,
+ IllegalArgumentException
+ {
+ if (name == null)
+ {
+ throw new NullPointerException("No null name accepted");
+ }
+ if (setter != null)
+ {
+ if (setterParameter == null)
+ {
+ throw new IllegalArgumentException("No setter parameter provided");
+ }
+ }
+ else
+ {
+ if (setterParameter != null)
+ {
+ throw new IllegalArgumentException("No setter provided but a setter parameter was provided");
+ }
+ }
+
+ //
+ this.name = name;
+ this.getter = getter;
+ this.getterDescription = getterDescription;
+ this.setter = setter;
+ this.setterDescription = setterDescription;
+ this.setterParameter = setterParameter;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Method getGetter()
+ {
+ return getter;
+ }
+
+ public Method getSetter()
+ {
+ return setter;
+ }
+
+ public String getGetterDescription()
+ {
+ return getterDescription;
+ }
+
+ public String getSetterDescription()
+ {
+ return setterDescription;
+ }
+
+ public ManagedParameterMetaData getSetterParameter()
+ {
+ return setterParameter;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "ManagedPropertyMetaData[" + "name=" + name + "getter=" + getter.getName() + "setter=" + setter.getName()
+ + "]";
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedResource.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedResource.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedResource.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.spi;
+
+import org.exoplatform.management.ManagementContext;
+
+import java.util.List;
+
+/**
+ * The managed resource provided by the kernel to a management provider. It gives access
+ * to the resource itself, the meta data of the managed resource, the attached scoped data
+ * and the before/after invoke contract when a resource is invoked from the management layer.
+ *
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public interface ManagedResource extends ManagementContext
+{
+
+ /**
+ * The resource implementation.
+ *
+ * @return the resource
+ */
+ Object getResource();
+
+ /**
+ * Returns the resource meta data.
+ *
+ * @return the meta data
+ */
+ ManagedTypeMetaData getMetaData();
+
+ /**
+ * Returns the scoping data of the context. The list contains the scoping properties
+ * registered by the provider if a call has been made to the {@link #setScopingData(Class, Object)}
+ * method plus the scoping properties of the parent context.
+ *
+ * @param scopeType the scope type
+ * @param <S> the generic type of the scope type
+ * @return the scoping properties
+ */
+ <S> List<S> getScopingData(Class<S> scopeType);
+
+ /**
+ * Callback made by the provider to the resource to signal that scoping data that is used for the managed resource.
+ *
+ * @param scopeType the scope type
+ * @param <S> the generic type of the scope type
+ * @param scopingData the scoping data
+ */
+ <S> void setScopingData(Class<S> scopeType, S scopingData);
+
+ /**
+ * Before a managed resource is invoked by the management layer.
+ *
+ * @param managedResource the managed resource
+ */
+ void beforeInvoke(Object managedResource);
+
+ /**
+ * After a managed resource is invoked by the management layer.
+ *
+ * @param managedResource the managed resource
+ */
+ void afterInvoke(Object managedResource);
+
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedTypeMetaData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedTypeMetaData.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedTypeMetaData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.spi;
+
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Meta data that describes a managed type.
+ *
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ManagedTypeMetaData extends ManagedMetaData
+{
+
+ /** . */
+ private final Class type;
+
+ /** . */
+ private final Map<String, ManagedPropertyMetaData> properties;
+
+ /** . */
+ private final Map<MethodKey, ManagedMethodMetaData> methods;
+
+ public ManagedTypeMetaData(Class type) throws NullPointerException
+ {
+ if (type == null)
+ {
+ throw new NullPointerException();
+ }
+
+ //
+ this.type = type;
+ this.properties = new HashMap<String, ManagedPropertyMetaData>();
+ this.methods = new HashMap<MethodKey, ManagedMethodMetaData>();
+ }
+
+ public Class getType()
+ {
+ return type;
+ }
+
+ public ManagedPropertyMetaData getProperty(String propertyName)
+ {
+ return properties.get(propertyName);
+ }
+
+ public void addProperty(ManagedPropertyMetaData property)
+ {
+ properties.put(property.getName(), property);
+ }
+
+ public void addMethod(ManagedMethodMetaData method)
+ {
+ methods.put(new MethodKey(method.getMethod()), method);
+ }
+
+ public Collection<ManagedMethodMetaData> getMethods()
+ {
+ return methods.values();
+ }
+
+ public Collection<ManagedPropertyMetaData> getProperties()
+ {
+ return properties.values();
+ }
+
+ private static class MethodKey
+ {
+
+ private final String name;
+
+ private final List<Class<?>> types;
+
+ private MethodKey(Method method)
+ {
+ this.name = method.getName();
+ this.types = Arrays.asList(method.getParameterTypes());
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int hashCode = name.hashCode();
+ for (Class<?> type : types)
+ {
+ hashCode = hashCode * 41 + type.hashCode();
+ }
+ return hashCode;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof MethodKey)
+ {
+ MethodKey that = (MethodKey)obj;
+ return this.name.equals(that.name) && this.types.equals(that.types);
+ }
+ return false;
+ }
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagementProvider.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagementProvider.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagementProvider.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.spi;
+
+/**
+ * This interface is implemented by a management provider such a JMX.
+ *
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public interface ManagementProvider
+{
+
+ /**
+ * Instruct the management provider to manage the provided managed resource. If any registration is done
+ * the provider should return an unique key that will be used later for unregistration purpose in the
+ * {@link #unmanage(Object)} method. If no registration is performed then null should be returned.
+ *
+ * @param managedResource the managed resource
+ * @return the key under which the resource is registered
+ */
+ Object manage(ManagedResource managedResource);
+
+ /**
+ * Instruct the management provider to remove the specifed resource from management.
+ *
+ * @param key the key under which the resource is registered
+ */
+ void unmanage(Object key);
+
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/package-info.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/package-info.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/package-info.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,11 @@
+/**
+ * <p>The Service Provider Interface for the eXo management framework. The entry point for plugged management system
+ * is the implementation of the interface {@link org.exoplatform.management.spi.ManagementProvider}.</p>
+ *
+ * <p>A part of the package defines the meta data that is given to the provider to build the management interface
+ * of the managed resource.</p>
+ *
+ * <p>The {@link org.exoplatform.management.spi.ManagedResource} interface wraps a resource and is provided by the
+ * kernel to the provider.</p>
+ */
+package org.exoplatform.management.spi;
\ No newline at end of file
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/resources/org/exoplatform/container/configuration/kernel-configuration_1_0.xsd
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/resources/org/exoplatform/container/configuration/kernel-configuration_1_0.xsd 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/resources/org/exoplatform/container/configuration/kernel-configuration_1_0.xsd 2010-01-10 18:27:37 UTC (rev 1331)
@@ -9,7 +9,7 @@
<xsd:element name="configuration" type="configurationType"/>
- <xsd:complexType abstract="true" name="baseObjectType">
+ <xsd:complexType name="baseObjectType">
<xsd:choice>
<xsd:element name="string" type="xsd:string"/>
<xsd:element name="int" type="xsd:int"/>
@@ -39,16 +39,16 @@
<xsd:complexType name="mapType">
<xsd:sequence>
- <xsd:element name="type" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="entry" type="entryType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
+ <xsd:attribute name="type" type="xsd:string" use="required"/>
</xsd:complexType>
<xsd:complexType name="collectionType">
<xsd:sequence>
<xsd:element name="value" type="valueType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
- <xsd:attribute name="type" type="xsd:string"/>
+ <xsd:attribute name="type" type="xsd:string" use="required"/>
<xsd:attribute name="item-type" type="xsd:string"/>
</xsd:complexType>
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/resources/org/exoplatform/container/configuration/kernel-configuration_1_1.xsd
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/resources/org/exoplatform/container/configuration/kernel-configuration_1_1.xsd 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/resources/org/exoplatform/container/configuration/kernel-configuration_1_1.xsd 2010-01-10 18:27:37 UTC (rev 1331)
@@ -13,7 +13,7 @@
<xsd:attribute name="profiles" type="xsd:string"/>
</xsd:complexType>
- <xsd:complexType abstract="true" name="baseObjectType">
+ <xsd:complexType name="baseObjectType">
<xsd:choice>
<xsd:element name="string" type="xsd:string"/>
<xsd:element name="int" type="xsd:int"/>
@@ -37,9 +37,9 @@
<xsd:complexType name="mapType">
<xsd:sequence>
- <xsd:element name="type" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="entry" type="entryType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
+ <xsd:attribute name="type" type="xsd:string" use="required"/>
</xsd:complexType>
<xsd:complexType name="collectionType">
@@ -54,7 +54,7 @@
</xsd:complexType>
</xsd:element>
</xsd:sequence>
- <xsd:attribute name="type" type="xsd:string"/>
+ <xsd:attribute name="type" type="xsd:string" use="required"/>
<xsd:attribute name="item-type" type="xsd:string"/>
</xsd:complexType>
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/ComponentWithRequestLifeCycle.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/ComponentWithRequestLifeCycle.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/ComponentWithRequestLifeCycle.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/LifeCycle.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/LifeCycle.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/LifeCycle.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainerInitTaskContextComparator.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainerInitTaskContextComparator.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainerInitTaskContextComparator.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestPropertyManagerConfigurator.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestPropertyManagerConfigurator.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestPropertyManagerConfigurator.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestRequestLifeCycle.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestRequestLifeCycle.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestRequestLifeCycle.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestUnifiedClassLoader.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestUnifiedClassLoader.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestUnifiedClassLoader.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestWebAppInitContextComparator.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestWebAppInitContextComparator.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestWebAppInitContextComparator.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/AbstractProfileTest.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/AbstractProfileTest.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/AbstractProfileTest.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.configuration;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/InitParamsHolder.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/InitParamsHolder.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/InitParamsHolder.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.configuration;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestCollectionValue.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestCollectionValue.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestCollectionValue.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.configuration;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestComponentPluginProfile.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestComponentPluginProfile.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestComponentPluginProfile.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.configuration;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestComponentProfile.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestComponentProfile.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestComponentProfile.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.configuration;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestField.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestField.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestField.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.configuration;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestImportProfile.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestImportProfile.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestImportProfile.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.configuration;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestInitParamProfile.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestInitParamProfile.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestInitParamProfile.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.configuration;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestXSD_1_0.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestXSD_1_0.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestXSD_1_0.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -58,6 +58,6 @@
fail("Was not expecting such exception " + e.getMessage());
}
}
- assertEquals(16, count);
+ assertEquals(17, count);
}
}
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestXSD_1_1.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestXSD_1_1.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestXSD_1_1.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -58,6 +58,6 @@
fail("Was not expecting such exception " + e.getMessage());
}
}
- assertEquals(17, count);
+ assertEquals(18, count);
}
}
\ No newline at end of file
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/AbstractTestExoMBean.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/AbstractTestExoMBean.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/AbstractTestExoMBean.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -19,6 +19,7 @@
package org.exoplatform.container.jmx;
import junit.framework.TestCase;
+import org.exoplatform.management.jmx.impl.ExoMBeanInfoBuilder;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestExoMBeanOperation.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestExoMBeanOperation.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestExoMBeanOperation.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -18,6 +18,8 @@
*/
package org.exoplatform.container.jmx;
+import org.exoplatform.management.annotations.Impact;
+import org.exoplatform.management.annotations.ImpactType;
import org.exoplatform.management.annotations.Managed;
import org.exoplatform.management.annotations.ManagedDescription;
import org.exoplatform.management.annotations.ManagedName;
@@ -188,4 +190,51 @@
return Integer.toString(arg);
}
}
+
+ public void test6() throws Exception
+ {
+ Bean bean = register("domain:name=mbean", MBean6.class);
+ MBeanOperationInfo[] operationInfos = bean.info.getOperations();
+ assertNotNull(operationInfos);
+ assertEquals(4, operationInfos.length);
+ MBeanOperationInfo readInfo = bean.info.getOperation("read");
+ assertNotNull(readInfo);
+ assertEquals(MBeanOperationInfo.INFO, readInfo.getImpact());
+ MBeanOperationInfo writeInfo = bean.info.getOperation("write");
+ assertNotNull(writeInfo);
+ assertEquals(MBeanOperationInfo.ACTION, writeInfo.getImpact());
+ MBeanOperationInfo idempotentWriteInfo = bean.info.getOperation("idempotentWrite");
+ assertNotNull(idempotentWriteInfo);
+ assertEquals(MBeanOperationInfo.ACTION, idempotentWriteInfo.getImpact());
+ MBeanOperationInfo defaultImpactInfo = bean.info.getOperation("defaultImpact");
+ assertNotNull(defaultImpactInfo);
+ assertEquals(MBeanOperationInfo.ACTION, defaultImpactInfo.getImpact());
+ }
+
+ @Managed
+ public static class MBean6
+ {
+ @Managed
+ @Impact(ImpactType.READ)
+ public void read()
+ {
+ }
+
+ @Managed
+ @Impact(ImpactType.WRITE)
+ public void write()
+ {
+ }
+
+ @Managed
+ @Impact(ImpactType.IDEMPOTENT_WRITE)
+ public void idempotentWrite()
+ {
+ }
+
+ @Managed
+ public void defaultImpact()
+ {
+ }
+ }
}
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestNameTemplate.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestNameTemplate.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestNameTemplate.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -22,6 +22,7 @@
import org.exoplatform.management.jmx.annotations.NameTemplate;
import org.exoplatform.management.jmx.annotations.Property;
+import org.exoplatform.management.jmx.impl.ObjectNameBuilder;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestPortalContainerManagedIntegration.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestPortalContainerManagedIntegration.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestPortalContainerManagedIntegration.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,24 +1,27 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.jmx;
import org.exoplatform.container.PortalContainer;
import org.exoplatform.container.RootContainer;
import org.exoplatform.container.jmx.support.SimpleManagementAware;
+import org.exoplatform.container.management.ManagementContextImpl;
import org.exoplatform.container.support.ContainerBuilder;
import java.net.URL;
@@ -47,12 +50,12 @@
//
SimpleManagementAware rootManagementAware = (SimpleManagementAware)root.getComponentInstance("RootManagementAware");
- ManagementContextImpl rootManagementAwareContext = (ManagementContextImpl)((ExoModelMBean)rootManagementAware.context).getManagementContext();
+ ManagementContextImpl rootManagementAwareContext = (ManagementContextImpl)rootManagementAware.context;
assertSame(rootManagementContext, rootManagementAwareContext.getParent());
//
SimpleManagementAware portalManagementAware = (SimpleManagementAware)portal.getComponentInstance("PortalManagementAware");
- ManagementContextImpl portalManagementAwareContext = (ManagementContextImpl)((ExoModelMBean)portalManagementAware.context).getManagementContext();
+ ManagementContextImpl portalManagementAwareContext = (ManagementContextImpl)portalManagementAware.context;
assertSame(portalManagementContext, portalManagementAwareContext.getParent());
}
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/support/ManagedComponentRequestLifeCycle.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/support/ManagedComponentRequestLifeCycle.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/support/ManagedComponentRequestLifeCycle.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.jmx.support;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/support/SimpleManagementAware.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/support/SimpleManagementAware.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/support/SimpleManagementAware.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.jmx.support;
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/Bar.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/Bar.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/Bar.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.container.management;
+
+import org.exoplatform.management.annotations.Managed;
+
+/**
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+ at Managed
+public class Bar
+{
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/Foo.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/Foo.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/Foo.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.container.management;
+
+import org.exoplatform.management.ManagementAware;
+import org.exoplatform.management.ManagementContext;
+import org.exoplatform.management.annotations.Managed;
+
+/**
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+ at Managed
+public class Foo implements ManagementAware
+{
+
+ /** . */
+ private ManagementContext context;
+
+ final Bar bar = new Bar();
+
+ public void setContext(ManagementContext context)
+ {
+ this.context = context;
+ }
+
+ public boolean isAware()
+ {
+ return context != null;
+ }
+
+ public void deploy()
+ {
+ context.register(bar);
+ }
+
+ public void undeploy()
+ {
+ context.unregister(bar);
+ }
+
+}
\ No newline at end of file
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagedResource.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagedResource.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagedResource.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.container.management;
+
+import org.exoplatform.management.spi.ManagedTypeMetaData;
+
+/**
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ManagedResource
+{
+
+ final ResourceKey key;
+
+ /** . */
+ final Object resource;
+
+ /** . */
+ final org.exoplatform.management.spi.ManagedResource context;
+
+ /** . */
+ final ManagedTypeMetaData metaData;
+
+ /** . */
+ final ScopedData data;
+
+ public ManagedResource(Object resource, org.exoplatform.management.spi.ManagedResource context, ManagedTypeMetaData metaData)
+ {
+ this.key = new ResourceKey();
+ this.resource = resource;
+ this.context = context;
+ this.metaData = metaData;
+ this.data = new ScopedData();
+ }
+
+ public void register()
+ {
+ context.setScopingData(ScopedData.class, data);
+ }
+
+ @Override
+ public String toString()
+ {
+ return "ManagedResource[key=" + key + ",resource=" + resource + "]";
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagementProviderImpl.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagementProviderImpl.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagementProviderImpl.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.container.management;
+
+import org.exoplatform.management.spi.*;
+import org.exoplatform.management.spi.ManagedResource;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ManagementProviderImpl implements ManagementProvider
+{
+
+ /** . */
+ final List<org.exoplatform.container.management.ManagedResource> managedResources = new ArrayList<org.exoplatform.container.management.ManagedResource>();
+
+ /** . */
+ final List<Object> resources = new ArrayList<Object>();
+
+ public Object manage(ManagedResource context)
+ {
+ org.exoplatform.container.management.ManagedResource mr = new org.exoplatform.container.management.ManagedResource(context.getResource(), context, context.getMetaData());
+ managedResources.add(mr);
+ resources.add(mr.resource);
+ return mr.key;
+ }
+
+ public void unmanage(Object key)
+ {
+ for (Iterator<org.exoplatform.container.management.ManagedResource> i = managedResources.iterator();i.hasNext();)
+ {
+ org.exoplatform.container.management.ManagedResource mr = i.next();
+ if (mr.key == key)
+ {
+ i.remove();
+ break;
+ }
+ }
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ResourceKey.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ResourceKey.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ResourceKey.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.container.management;
+
+/**
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ResourceKey
+{
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ScopedData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ScopedData.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ScopedData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.container.management;
+
+/**
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ScopedData
+{
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/TestManagementProvider.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/TestManagementProvider.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/TestManagementProvider.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.container.management;
+
+import junit.framework.TestCase;
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.RootContainer;
+import org.exoplatform.container.support.ContainerBuilder;
+
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class TestManagementProvider extends TestCase
+{
+
+ public void testProviderRegistration()
+ {
+ URL url = getClass().getResource("configuration1.xml");
+ RootContainer container = new ContainerBuilder().withRoot(url).build();
+ ManagementProviderImpl provider = (ManagementProviderImpl)container.getComponentInstanceOfType(ManagementProviderImpl.class);
+ assertNotNull(provider);
+ }
+
+ public void testManagedRegistrationAfterProviderRegistration()
+ {
+ URL url = getClass().getResource("configuration1.xml");
+ RootContainer container = new ContainerBuilder().withRoot(url).build();
+ ManagementProviderImpl provider = (ManagementProviderImpl)container.getComponentInstanceOfType(ManagementProviderImpl.class);
+ assertEquals(1, provider.managedResources.size());
+ Object foo = container.getComponentInstance("Foo");
+ assertNotNull(foo);
+ assertEquals(2, provider.managedResources.size());
+ ManagedResource fooMR = provider.managedResources.get(1);
+ assertSame(foo, fooMR.resource);
+ assertEquals(Collections.<ScopedData>emptyList(), fooMR.context.getScopingData(ScopedData.class));
+ fooMR.register();
+ assertEquals(Collections.singletonList(fooMR.data), fooMR.context.getScopingData(ScopedData.class));
+ }
+
+ public void testManagedRegistrationBeforeProviderRegistration()
+ {
+ URL url = getClass().getResource("configuration2.xml");
+ RootContainer container = new ContainerBuilder().withRoot(url).build();
+ ManagementProviderImpl provider = (ManagementProviderImpl)container.getComponentInstanceOfType(ManagementProviderImpl.class);
+ assertNull(provider);
+ Object foo = container.getComponentInstance("Foo");
+ assertNotNull(foo);
+ provider = new ManagementProviderImpl();
+ container.registerComponentInstance(provider);
+ assertEquals(2, provider.managedResources.size());
+ ManagedResource fooMR = provider.managedResources.get(1);
+ assertSame(foo, fooMR.resource);
+ assertEquals(Collections.<ScopedData>emptyList(), fooMR.context.getScopingData(ScopedData.class));
+ fooMR.register();
+ assertEquals(Collections.singletonList(fooMR.data), fooMR.context.getScopingData(ScopedData.class));
+ }
+
+ public void testManagementAware()
+ {
+ URL url = getClass().getResource("configuration1.xml");
+ RootContainer container = new ContainerBuilder().withRoot(url).build();
+ ManagementProviderImpl provider = (ManagementProviderImpl)container.getComponentInstanceOfType(ManagementProviderImpl.class);
+ Foo foo = (Foo)container.getComponentInstance("Foo");
+ assertEquals(2, provider.managedResources.size());
+ ManagedResource fooMR = provider.managedResources.get(1);
+ fooMR.register();
+ assertTrue(foo.isAware());
+
+ //
+ foo.deploy();
+ assertEquals(3, provider.managedResources.size());
+ ManagedResource barMR = provider.managedResources.get(2);
+ assertSame(foo.bar, barMR.resource);
+ barMR.register();
+ assertEquals(Arrays.asList(barMR.data, fooMR.data), barMR.context.getScopingData(ScopedData.class));
+
+ //
+ foo.undeploy();
+ assertEquals(2, provider.managedResources.size());
+ assertEquals(fooMR, provider.managedResources.get(1));
+ }
+
+ public void testContainerScopedRegistration()
+ {
+ URL rootURL = getClass().getResource("root-configuration.xml");
+ URL portal1URL = getClass().getResource("portal-configuration1.xml");
+ URL portal2URL = getClass().getResource("portal-configuration2.xml");
+ RootContainer root = new ContainerBuilder().withRoot(rootURL).withPortal("portal1", portal1URL).withPortal("portal2", portal2URL).build();
+ Foo fooRoot = (Foo)root.getComponentInstanceOfType(Foo.class);
+ ManagementProviderImpl provider = (ManagementProviderImpl)root.getComponentInstanceOfType(ManagementProviderImpl.class);
+ PortalContainer portal1 = root.getPortalContainer("portal1");
+ Foo fooPortal1 = (Foo)portal1.getComponentInstanceOfType(Foo.class);
+ ManagementProviderImpl provider1 = (ManagementProviderImpl)portal1.getComponentInstanceOfType(ManagementProviderImpl.class);
+ PortalContainer portal2 = root.getPortalContainer("portal2");
+ Foo fooPortal2 = (Foo)portal2.getComponentInstanceOfType(Foo.class);
+ ManagementProviderImpl provider2 = (ManagementProviderImpl)portal2.getComponentInstanceOfType(ManagementProviderImpl.class);
+
+ //
+ assertEquals(6, provider.managedResources.size());
+ assertTrue(provider.resources.contains(root));
+ assertTrue(provider.resources.contains(root));
+ assertTrue(provider.resources.contains(portal1));
+ assertTrue(provider.resources.contains(portal2));
+ assertTrue(provider.resources.contains(fooRoot));
+ assertTrue(provider.resources.contains(fooPortal1));
+ assertTrue(provider.resources.contains(fooPortal2));
+ assertEquals(2, provider1.managedResources.size());
+ assertEquals(portal1, provider1.managedResources.get(0).resource);
+ assertEquals(fooPortal1, provider1.managedResources.get(1).resource);
+ assertEquals(2, provider2.managedResources.size());
+ assertEquals(portal2, provider2.managedResources.get(0).resource);
+ assertEquals(fooPortal2, provider2.managedResources.get(1).resource);
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/metadata/Bar.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/metadata/Bar.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/metadata/Bar.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.container.management.metadata;
+
+import org.exoplatform.management.annotations.Managed;
+import org.exoplatform.management.annotations.ManagedName;
+
+/**
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+ at Managed
+public class Bar
+{
+
+ @Managed
+ @ManagedName("b")
+ public void a()
+ {
+ }
+}
\ No newline at end of file
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/metadata/Foo.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/metadata/Foo.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/metadata/Foo.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.container.management.metadata;
+
+import org.exoplatform.management.annotations.Impact;
+import org.exoplatform.management.annotations.ImpactType;
+import org.exoplatform.management.annotations.Managed;
+
+/**
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+ at Managed
+public class Foo
+{
+
+ @Managed
+ @Impact(ImpactType.READ)
+ public void read()
+ {
+ }
+
+ @Managed
+ @Impact(ImpactType.WRITE)
+ public void write()
+ {
+ }
+
+ @Managed
+ @Impact(ImpactType.IDEMPOTENT_WRITE)
+ public void idempotentWrite()
+ {
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/metadata/TestMetaData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/metadata/TestMetaData.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/metadata/TestMetaData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.container.management.metadata;
+
+import junit.framework.TestCase;
+import org.exoplatform.container.management.MetaDataBuilder;
+import org.exoplatform.management.annotations.ImpactType;
+import org.exoplatform.management.spi.ManagedMethodMetaData;
+import org.exoplatform.management.spi.ManagedTypeMetaData;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class TestMetaData extends TestCase
+{
+
+ private Map<String, ManagedMethodMetaData> getMethodMap(ManagedTypeMetaData type)
+ {
+ Map<String, ManagedMethodMetaData> methodMap = new HashMap<String, ManagedMethodMetaData>();
+ for (ManagedMethodMetaData method : type.getMethods())
+ {
+ methodMap.put(method.getName(), method);
+ }
+ return methodMap;
+ }
+
+ public void testImpact()
+ {
+ MetaDataBuilder builder = new MetaDataBuilder(Foo.class);
+ ManagedTypeMetaData type = builder.build();
+ Map<String, ManagedMethodMetaData> methodMap = getMethodMap(type);
+ ManagedMethodMetaData read = methodMap.get("read");
+ assertEquals(ImpactType.READ, read.getImpact());
+ ManagedMethodMetaData write = methodMap.get("write");
+ assertEquals(ImpactType.WRITE, write.getImpact());
+ ManagedMethodMetaData idempotentWrite = methodMap.get("idempotentWrite");
+ assertEquals(ImpactType.IDEMPOTENT_WRITE, idempotentWrite.getImpact());
+ }
+
+ public void testMethodNameOverride()
+ {
+ MetaDataBuilder builder = new MetaDataBuilder(Bar.class);
+ try
+ {
+ builder.build();
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ }
+}
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/support/ContainerBuilder.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/support/ContainerBuilder.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/support/ContainerBuilder.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.support;
@@ -28,20 +30,28 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
+import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
import java.util.Set;
/**
- * An helper for building a root container and a portal container. I have done several attempt to make easily
- * and safe root/portal container boot for unit test. This one is my best attempt so far.
+ * <p>An helper for building a root container and a portal container. I have done several attempt to make easily
+ * and safe root/portal container boot for unit test. This one is my best attempt so far.</p>
*
+ * <p>Note that the portal container are booted in the order they are declared first.</p>
+ *
* @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
* @version $Revision$
*/
public class ContainerBuilder
{
+ /** A hack used during the boot of a portal container. */
+ private final ThreadLocal<String> bootedPortalName = new ThreadLocal<String>();
+
/** . */
private ClassLoader loader;
@@ -49,7 +59,7 @@
private List<URL> configURLs;
/** . */
- private List<URL> portalConfigURLs;
+ private LinkedHashMap<String, List<URL>> portalConfigURLs;
/** . */
private Set<String> profiles;
@@ -58,7 +68,7 @@
{
this.loader = Thread.currentThread().getContextClassLoader();
this.configURLs = new ArrayList<URL>();
- this.portalConfigURLs = new ArrayList<URL>();
+ this.portalConfigURLs = new LinkedHashMap<String, List<URL>>();
}
public ContainerBuilder withRoot(String configPath)
@@ -75,28 +85,33 @@
public ContainerBuilder withPortal(String configPath)
{
- portalConfigURLs.addAll(urls(configPath));
+ return withPortal("portal", configPath);
+ }
+
+ public ContainerBuilder withPortal(String portalName, String configPath)
+ {
+ for (URL configURL : urls(configPath))
+ {
+ withPortal(portalName, configURL);
+ }
return this;
}
public ContainerBuilder withPortal(URL configURL)
{
- portalConfigURLs.add(configURL);
- return this;
+ return withPortal("portal", configURL);
}
- private List<URL> urls(String path)
+ public ContainerBuilder withPortal(String portalName, URL configURL)
{
- try
+ List<URL> urls = portalConfigURLs.get(portalName);
+ if (urls == null)
{
- return Collections.list(loader.getResources(path));
+ urls = new ArrayList<URL>();
+ portalConfigURLs.put(portalName, urls);
}
- catch (IOException e)
- {
- AssertionFailedError err = new AssertionFailedError();
- err.initCause(e);
- throw err;
- }
+ urls.add(configURL);
+ return this;
}
public ContainerBuilder withLoader(ClassLoader loader)
@@ -111,6 +126,20 @@
return this;
}
+ private List<URL> urls(String path)
+ {
+ try
+ {
+ return Collections.list(loader.getResources(path));
+ }
+ catch (IOException e)
+ {
+ AssertionFailedError err = new AssertionFailedError();
+ err.initCause(e);
+ throw err;
+ }
+ }
+
public RootContainer build()
{
try
@@ -176,7 +205,8 @@
}
else if ("conf/portal/configuration.xml".equals(name))
{
- return Collections.enumeration(portalConfigURLs);
+ String portalName = bootedPortalName.get();
+ return Collections.enumeration(portalConfigURLs.get(portalName));
}
else if ("conf/portal/test-configuration.xml".equals(name))
{
@@ -202,9 +232,17 @@
root = RootContainer.getInstance();
//
- if (portalConfigURLs.size() > 0)
+ for (String portalName : portalConfigURLs.keySet())
{
- root.getPortalContainer("portal");
+ try
+ {
+ bootedPortalName.set(portalName);
+ root.getPortalContainer(portalName);
+ }
+ finally
+ {
+ bootedPortalName.set(null);
+ }
}
}
finally
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/configuration1.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/configuration1.xml (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/configuration1.xml 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+
+ <component>
+ <key>Foo</key>
+ <type>org.exoplatform.container.management.Foo</type>
+ </component>
+
+ <component>
+ <key>org.exoplatform.container.management.ManagementProviderImpl</key>
+ <type>org.exoplatform.container.management.ManagementProviderImpl</type>
+ </component>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/configuration2.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/configuration2.xml (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/configuration2.xml 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+
+ <component>
+ <key>Foo</key>
+ <type>org.exoplatform.container.management.Foo</type>
+ </component>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/portal-configuration1.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/portal-configuration1.xml (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/portal-configuration1.xml 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+
+ <component>
+ <key>org.exoplatform.container.management.ManagementProviderImpl</key>
+ <type>org.exoplatform.container.management.ManagementProviderImpl</type>
+ </component>
+
+ <component>
+ <key>FooPortal1</key>
+ <type>org.exoplatform.container.management.Foo</type>
+ </component>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/portal-configuration2.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/portal-configuration2.xml (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/portal-configuration2.xml 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+
+ <component>
+ <key>org.exoplatform.container.management.ManagementProviderImpl</key>
+ <type>org.exoplatform.container.management.ManagementProviderImpl</type>
+ </component>
+
+ <component>
+ <key>FooPortal2</key>
+ <type>org.exoplatform.container.management.Foo</type>
+ </component>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/root-configuration.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/root-configuration.xml (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/root-configuration.xml 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+
+ <component>
+ <type>org.exoplatform.container.definition.PortalContainerConfig</type>
+ </component>
+
+ <component>
+ <key>org.exoplatform.container.management.ManagementProviderImpl</key>
+ <type>org.exoplatform.container.management.ManagementProviderImpl</type>
+ </component>
+
+ <component>
+ <key>FooRoot</key>
+ <type>org.exoplatform.container.management.Foo</type>
+ </component>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/xsd_1_0/sample-configuration-17.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/xsd_1_0/sample-configuration-17.xml (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/xsd_1_0/sample-configuration-17.xml 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+
+ <component>
+ <key>org.exoplatform.services.naming.InitialContextInitializer</key>
+ <type>org.exoplatform.services.naming.InitialContextInitializer</type>
+ <init-params>
+ <object-param>
+ <name>configuration</name>
+ <object type="org.exoplatform.services.organization.idm.Config">
+ <field name="typeMappings">
+ <map type="java">
+ <entry>
+ <key><string>/</string></key>
+ <value><string>root</string></value>
+ </entry>
+ </map>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+
+ <component>
+ <key>org.exoplatform.services.naming.InitialContextInitializer</key>
+ <type>org.exoplatform.services.naming.InitialContextInitializer</type>
+ <init-params>
+ <object-param>
+ <name>configuration</name>
+ <object type="package.name">
+ <field name="string"><string>This is a string</string></field>
+ <field name="int"><int>1234</int></field>
+ <field name="long"><long>123456</long></field>
+ <field name="double"><double>1.1234</double></field>
+ <field name="boolean"><boolean>true</boolean></field>
+ <field name="name">
+ <object type="package.name">
+ <field name="nested 1"><string>value</string></field>
+ <field name="nested 2"><int>1234</int></field>
+ </object>
+ </field>
+ <field name="map">
+ <map type="java.util.HashMap">
+ <entry>
+ <key><string>akey</string></key>
+ <value><string>a value</string></value>
+ </entry>
+ <entry>
+ <key><int>1234</int></key>
+ <value><string>a value</string></value>
+ </entry>
+ </map>
+ </field>
+ <field name="list">
+ <collection type="java.util.ArrayList">
+ <value><string>a value</string></value>
+ </collection>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+</component>
+
+</configuration>
\ No newline at end of file
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/xsd_1_1/sample-configuration-17.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/xsd_1_1/sample-configuration-17.xml 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/xsd_1_1/sample-configuration-17.xml 2010-01-10 18:27:37 UTC (rev 1331)
@@ -25,71 +25,63 @@
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
<component>
- <key>org.exoplatform.services.naming.InitialContextInitializer</key>
- <type>org.exoplatform.services.naming.InitialContextInitializer</type>
- </component>
+ <key>org.exoplatform.services.naming.InitialContextInitializer</key>
+ <type>org.exoplatform.services.naming.InitialContextInitializer</type>
+ <init-params>
+ <object-param>
+ <name>configuration</name>
+ <object type="org.exoplatform.services.organization.idm.Config">
+ <field name="typeMappings">
+ <map type="java">
+ <entry>
+ <key><string>/</string></key>
+ <value><string>root</string></value>
+ </entry>
+ </map>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+</component>
- <component profiles="a">
- <key>org.exoplatform.services.naming.InitialContextInitializer</key>
- <type>org.exoplatform.services.naming.InitialContextInitializer</type>
- </component>
+<component>
+<key>org.exoplatform.services.naming.InitialContextInitializer</key>
+<type>org.exoplatform.services.naming.InitialContextInitializer</type>
+<init-params>
+ <object-param>
+ <name>configuration</name>
+ <object type="package.name">
+ <field name="string"><string>This is a string</string></field>
+ <field name="int"><int>1234</int></field>
+ <field name="long"><long>123456</long></field>
+ <field name="double"><double>1.1234</double></field>
+ <field name="boolean"><boolean>true</boolean></field>
+ <field name="name">
+ <object type="package.name">
+ <field name="nested 1"><string>value</string></field>
+ <field name="nested 2"><int>1234</int></field>
+ </object>
+ </field>
+ <field name="map">
+ <map type="java.util.HashMap">
+ <entry>
+ <key><string>akey</string></key>
+ <value><string>a value</string></value>
+ </entry>
+ <entry>
+ <key><int>1234</int></key>
+ <value><string>a value</string></value>
+ </entry>
+ </map>
+ </field>
+ <field name="list">
+ <collection type="java.util.ArrayList">
+ <value><string>a value</string></value>
+ </collection>
+ </field>
+ </object>
+ </object-param>
+</init-params>
+</component>
- <component profiles="a,b">
- <key>org.exoplatform.services.naming.InitialContextInitializer</key>
- <type>org.exoplatform.services.naming.InitialContextInitializer</type>
- </component>
-
- <component>
- <key>org.exoplatform.services.naming.InitialContextInitializer</key>
- <type>org.exoplatform.services.naming.InitialContextInitializer</type>
- <init-params>
- <object-param>
- <name>object</name>
- <object type="object"></object>
- </object-param>
- <object-param profiles="a">
- <name>object</name>
- <object type="object"></object>
- </object-param>
- <object-param profiles="a,b">
- <name>object</name>
- <object type="object"></object>
- </object-param>
- <properties-param>
- <name>properties</name>
- </properties-param>
- <properties-param profiles="a">
- <name>properties</name>
- </properties-param>
- <properties-param profiles="a,b">
- <name>properties</name>
- </properties-param>
- <value-param>
- <name>value</name>
- <value>value</value>
- </value-param>
- <value-param profiles="a">
- <name>value</name>
- <value>value</value>
- </value-param>
- <value-param profiles="a,b">
- <name>value</name>
- <value>value</value>
- </value-param>
- <values-param>
- <name>values</name>
- </values-param>
- <values-param profiles="a">
- <name>values</name>
- </values-param>
- <values-param profiles="a,b">
- <name>values</name>
- </values-param>
- </init-params>
- </component>
-
- <import>import_1</import>
- <import profiles="a">import_1</import>
- <import profiles="a,b">import_1</import>
-
</configuration>
\ No newline at end of file
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/xsd_1_1/sample-configuration-18.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/xsd_1_1/sample-configuration-18.xml (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/xsd_1_1/sample-configuration-18.xml 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+
+ <component>
+ <key>org.exoplatform.services.naming.InitialContextInitializer</key>
+ <type>org.exoplatform.services.naming.InitialContextInitializer</type>
+ </component>
+
+ <component profiles="a">
+ <key>org.exoplatform.services.naming.InitialContextInitializer</key>
+ <type>org.exoplatform.services.naming.InitialContextInitializer</type>
+ </component>
+
+ <component profiles="a,b">
+ <key>org.exoplatform.services.naming.InitialContextInitializer</key>
+ <type>org.exoplatform.services.naming.InitialContextInitializer</type>
+ </component>
+
+ <component>
+ <key>org.exoplatform.services.naming.InitialContextInitializer</key>
+ <type>org.exoplatform.services.naming.InitialContextInitializer</type>
+ <init-params>
+ <object-param>
+ <name>object</name>
+ <object type="object"></object>
+ </object-param>
+ <object-param profiles="a">
+ <name>object</name>
+ <object type="object"></object>
+ </object-param>
+ <object-param profiles="a,b">
+ <name>object</name>
+ <object type="object"></object>
+ </object-param>
+ <properties-param>
+ <name>properties</name>
+ </properties-param>
+ <properties-param profiles="a">
+ <name>properties</name>
+ </properties-param>
+ <properties-param profiles="a,b">
+ <name>properties</name>
+ </properties-param>
+ <value-param>
+ <name>value</name>
+ <value>value</value>
+ </value-param>
+ <value-param profiles="a">
+ <name>value</name>
+ <value>value</value>
+ </value-param>
+ <value-param profiles="a,b">
+ <name>value</name>
+ <value>value</value>
+ </value-param>
+ <values-param>
+ <name>values</name>
+ </values-param>
+ <values-param profiles="a">
+ <name>values</name>
+ </values-param>
+ <values-param profiles="a,b">
+ <name>values</name>
+ </values-param>
+ </init-params>
+ </component>
+
+ <import>import_1</import>
+ <import profiles="a">import_1</import>
+ <import profiles="a,b">import_1</import>
+
+</configuration>
\ No newline at end of file
Modified: kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/pom.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/pom.xml 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/pom.xml 2010-01-10 18:27:37 UTC (rev 1331)
@@ -28,6 +28,11 @@
<groupId>org.exoplatform.kernel</groupId>
<artifactId>exo.kernel.mc-int-demo</artifactId>
</dependency>
+ <dependency> <!-- TODO: remove this -->
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <version>1.0</version>
+ </dependency>
</dependencies>
<build>
@@ -94,5 +99,259 @@
</plugins>
</build>
</profile>
+
+ <profile>
+ <id>tests-with-jboss</id>
+ <build>
+ <finalName>eXo-kernel-integration-tests-${project.version}</finalName>
+ <defaultGoal>integration-test</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>jbossas-check-environment-ready</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <requireProperty>
+ <property>jboss.home</property>
+ <message>"You must define the property jboss.home to give the path to the package/pkg built GateIn JBoss instance"</message>
+ </requireProperty>
+ <requireFilesExist>
+ <files>
+ <file>${jboss.home}</file>
+ </files>
+ <message>"JBossAS directory doesn't exist : ${jboss.home}"</message>
+ </requireFilesExist>
+ <requireFilesExist>
+ <files>
+ <file>${jboss.home}/server/${jboss.conf}/deploy/gatein.ear</file>
+ </files>
+ <message>"JBossAS directory has no gatein.ear deployed: ${jboss.home}/server/${jboss.conf}/deploy/gatein.ear"</message>
+ </requireFilesExist>
+ </rules>
+ <fail>true</fail>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <version>1.0</version>
+ <configuration>
+ <wait>false</wait>
+ <container>
+ <containerId>jboss5x</containerId>
+ <type>installed</type>
+ <home>${jboss.home}</home>
+ <timeout>300000</timeout>
+ <output>${jboss.home}/server/${jboss.conf}/log/output.log</output>
+ </container>
+ <configuration>
+ <type>existing</type>
+ <home>${jboss.home}/server/${jboss.conf}</home>
+ <properties>
+ <cargo.jboss.configuration>${jboss.conf}</cargo.jboss.configuration>
+ <cargo.servlet.port>${jboss.port}</cargo.servlet.port>
+ <cargo.rmi.port>1099</cargo.rmi.port>
+ <cargo.jvmargs>-Xmx768m -XX:MaxPermSize=128m</cargo.jvmargs>
+ </properties>
+ <!--
+ This module's artifact (.war) gets deployed automatically by cargo,
+ but we don't use it for integration tests.
+ We use some previously installed build of the same artifact,
+ deployed under a different name as part of package/pkg build.
+ It is bound to a different context than the one deployed by cargo.
+ We only use cargo to start and stop jboss.
+ -->
+ <!--deployables>
+ <deployable>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>${project.artifactId}</artifactId>
+ <type>${project.packaging}</type>
+ </deployable>
+ </deployables-->
+ </configuration>
+ </configuration>
+
+ <executions>
+ <execution>
+ <id>start-container</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop-container</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>**/it/Test*.java</exclude>
+ </excludes>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-tests</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ <excludes>
+ <exclude>none</exclude>
+ </excludes>
+ <includes>
+ <include>**/it/Test*.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <properties>
+ <jboss.conf>default</jboss.conf>
+ <jboss.port>8080</jboss.port>
+ </properties>
+ </profile>
+
+ <profile>
+ <id>tests-with-tomcat</id>
+ <build>
+ <finalName>eXo-kernel-integration-tests-${project.version}</finalName>
+ <defaultGoal>integration-test</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>tomcat-check-environment-ready</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <requireProperty>
+ <property>tomcat.home</property>
+ <message>"You must define the property tomcat.home to give the path to the package/pkg built GateIn Tomcat instance"</message>
+ </requireProperty>
+ <requireFilesExist>
+ <files>
+ <file>${tomcat.home}</file>
+ </files>
+ <message>"Tomcat directory doesn't exist : ${tomcat.home}"</message>
+ </requireFilesExist>
+ <requireFilesExist>
+ <files>
+ <file>${tomcat.home}/webapps/portal.war</file>
+ </files>
+ <message>"Tomcat directory has no portal.war deployed: ${tomcat.home}/webapps/portal.war"</message>
+ </requireFilesExist>
+ </rules>
+ <fail>true</fail>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <version>1.0</version>
+ <configuration>
+ <wait>false</wait>
+ <container>
+ <containerId>tomcat6x</containerId>
+ <type>installed</type>
+ <home>${tomcat.home}</home>
+ <timeout>300000</timeout>
+ <output>${tomcat.home}/logs/output.log</output>
+ </container>
+ <configuration>
+ <type>existing</type>
+ <home>${tomcat.home}</home>
+ <properties>
+ <cargo.servlet.port>${tomcat.port}</cargo.servlet.port>
+ <cargo.jvmargs>-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xmx512m -XX:MaxPermSize=128m</cargo.jvmargs>
+ <cargo.logging>low</cargo.logging>
+ </properties>
+ <!--
+ This module's artifact (.war) gets deployed automatically by cargo,
+ but we don't use it for integration tests.
+ We use some previously installed build of the same artifact,
+ deployed under a different name as part of package/pkg build.
+ It is bound to a different context than the one deployed by cargo.
+ We only use cargo to start and stop tomcat.
+ -->
+ </configuration>
+ </configuration>
+
+ <executions>
+ <execution>
+ <id>start-container</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop-container</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>**/it/Test*.java</exclude>
+ </excludes>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-tests</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ <excludes>
+ <exclude>none</exclude>
+ </excludes>
+ <includes>
+ <include>**/it/Test*.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <properties>
+ <tomcat.port>8080</tomcat.port>
+ </properties>
+ </profile>
</profiles>
</project>
Added: kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/src/test/resources/jboss-log4j.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/src/test/resources/jboss-log4j.xml (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/src/test/resources/jboss-log4j.xml 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,328 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: jboss-log4j.xml 62403 2007-04-18 15:26:43Z dimitris at jboss.org $ -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <!-- A time/date based rolling appender -->
+ <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="File" value="${jboss.server.log.dir}/server.log"/>
+ <param name="Append" value="false"/>
+
+ <!-- Rollover at midnight each day -->
+ <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+
+ <!-- Rollover at the top of each hour
+ <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
+ -->
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+
+ <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
+ <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+ -->
+ </layout>
+ </appender>
+
+ <!-- A size based file rolling appender
+ <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="File" value="${jboss.server.log.dir}/server.log"/>
+ <param name="Append" value="false"/>
+ <param name="MaxFileSize" value="500KB"/>
+ <param name="MaxBackupIndex" value="1"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+ </layout>
+ </appender>
+ -->
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="INFO"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ====================== -->
+ <!-- More Appender examples -->
+ <!-- ====================== -->
+
+ <!-- Buffer events and log them asynchronously
+ <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <appender-ref ref="FILE"/>
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="SMTP"/>
+ </appender>
+ -->
+
+ <!-- EMail events to an administrator
+ <appender name="SMTP" class="org.apache.log4j.net.SMTPAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="Threshold" value="ERROR"/>
+ <param name="To" value="admin at myhost.domain.com"/>
+ <param name="From" value="nobody at myhost.domain.com"/>
+ <param name="Subject" value="JBoss Sever Errors"/>
+ <param name="SMTPHost" value="localhost"/>
+ <param name="BufferSize" value="10"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="[%d{ABSOLUTE},%c{1}] %m%n"/>
+ </layout>
+ </appender>
+ -->
+
+ <!-- Syslog events
+ <appender name="SYSLOG" class="org.apache.log4j.net.SyslogAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="Facility" value="LOCAL7"/>
+ <param name="FacilityPrinting" value="true"/>
+ <param name="SyslogHost" value="localhost"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="[%d{ABSOLUTE},%c{1}] %m%n"/>
+ </layout>
+ </appender>
+ -->
+
+ <!-- Log events to JMS (requires a topic to be created)
+ <appender name="JMS" class="org.apache.log4j.net.JMSAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="Threshold" value="ERROR"/>
+ <param name="TopicConnectionFactoryBindingName" value="java:/ConnectionFactory"/>
+ <param name="TopicBindingName" value="topic/MyErrorsTopic"/>
+ </appender>
+ -->
+
+ <!-- Log events through SNMP
+ <appender name="TRAP_LOG" class="org.apache.log4j.ext.SNMPTrapAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="ImplementationClassName" value="org.apache.log4j.ext.JoeSNMPTrapSender"/>
+ <param name="ManagementHost" value="127.0.0.1"/>
+ <param name="ManagementHostTrapListenPort" value="162"/>
+ <param name="EnterpriseOID" value="1.3.6.1.4.1.24.0"/>
+ <param name="LocalIPAddress" value="127.0.0.1"/>
+ <param name="LocalTrapSendPort" value="161"/>
+ <param name="GenericTrapType" value="6"/>
+ <param name="SpecificTrapType" value="12345678"/>
+ <param name="CommunityString" value="public"/>
+ <param name="ForwardStackTraceWithTrap" value="true"/>
+ <param name="Threshold" value="DEBUG"/>
+ <param name="ApplicationTrapOID" value="1.3.6.1.4.1.24.12.10.22.64"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d,%p,[%t],[%c],%m%n"/>
+ </layout>
+ </appender>
+ -->
+
+ <!-- Emit events as JMX notifications
+ <appender name="JMX" class="org.jboss.monitor.services.JMXNotificationAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+
+ <param name="Threshold" value="WARN"/>
+ <param name="ObjectName" value="jboss.system:service=Logging,type=JMXNotificationAppender"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d %-5p [%c] %m"/>
+ </layout>
+ </appender>
+ -->
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <!-- Limit the org.apache category to INFO as its DEBUG is verbose -->
+ <category name="org.apache">
+ <priority value="INFO"/>
+ </category>
+
+ <!-- Limit the org.jboss.serial (jboss-serialization) to INFO as its DEBUG is verbose -->
+ <category name="org.jboss.serial">
+ <priority value="INFO"/>
+ </category>
+
+ <!-- Limit the org.jgroups category to WARN as its INFO is verbose -->
+ <category name="org.jgroups">
+ <priority value="WARN"/>
+ </category>
+
+ <!-- Limit the jacorb category to WARN as its INFO is verbose -->
+ <category name="jacorb">
+ <priority value="WARN"/>
+ </category>
+
+ <!-- Limit JBoss categories
+ <category name="org.jboss">
+ <priority value="INFO"/>
+ </category>
+ -->
+
+ <!-- Limit the JSR77 categories -->
+ <category name="org.jboss.management">
+ <priority value="INFO"/>
+ </category>
+
+ <!-- Limit the JSR77 categories -->
+ <category name="jcr">
+ <priority value="INFO"/>
+ </category>
+
+ <!-- Limit the JSR-168 and JSR-286 categories -->
+ <category name="org.exoplatform.services">
+ <priority value="INFO"/>
+ </category>
+
+ <!-- Enable JBossWS message tracing
+ <category name="jbossws.SOAPMessage">
+ <priority value="TRACE"/>
+ </category>
+ -->
+
+ <!-- Decrease the priority threshold for the org.jboss.varia category
+ <category name="org.jboss.varia">
+ <priority value="DEBUG"/>
+ </category>
+ -->
+
+ <!-- Show the evolution of the DataSource pool in the logs [inUse/Available/Max]
+ <category name="org.jboss.resource.connectionmanager.JBossManagedConnectionPool">
+ <priority value="TRACE"/>
+ </category>
+ -->
+
+ <!--
+ | An example of enabling the custom TRACE level priority that is used
+ | by the JBoss internals to diagnose low level details. This example
+ | turns on TRACE level msgs for the org.jboss.ejb.plugins package and its
+ | subpackages. This will produce A LOT of logging output.
+ |
+ | Note: since jboss AS 4.2.x, the trace level is supported natively by
+ | log4j, so although the custom org.jboss.logging.XLevel priority will
+ | still work, there is no need to use it. The two examples that follow
+ | will both enable trace logging.
+ <category name="org.jboss.system">
+ <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+ </category>
+ <category name="org.jboss.ejb.plugins">
+ <priority value="TRACE"/>
+ </category>
+ -->
+
+ <!--
+ | Logs these events to SNMP:
+ - server starts/stops
+ - cluster evolution (node death/startup)
+ - When an EJB archive is deployed (and associated verified messages)
+ - When an EAR archive is deployed
+
+ <category name="org.jboss.system.server.Server">
+ <priority value="INFO" />
+ <appender-ref ref="TRAP_LOG"/>
+ </category>
+
+ <category name="org.jboss.ha.framework.interfaces.HAPartition.lifecycle">
+ <priority value="INFO" />
+ <appender-ref ref="TRAP_LOG"/>
+ </category>
+
+ <category name="org.jboss.deployment.MainDeployer">
+ <priority value="ERROR" />
+ <appender-ref ref="TRAP_LOG"/>
+ </category>
+
+ <category name="org.jboss.ejb.EJBDeployer">
+ <priority value="INFO" />
+ <appender-ref ref="TRAP_LOG"/>
+ </category>
+
+ <category name="org.jboss.deployment.EARDeployer">
+ <priority value="INFO" />
+ <appender-ref ref="TRAP_LOG"/>
+ </category>
+
+ -->
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE"/>
+ </root>
+
+ <!-- Clustering logging -->
+ <!-- Uncomment the following to redirect the org.jgroups and
+ org.jboss.ha categories to a cluster.log file.
+
+ <appender name="CLUSTER" class="org.jboss.logging.appender.RollingFileAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="File" value="${jboss.server.log.dir}/cluster.log"/>
+ <param name="Append" value="false"/>
+ <param name="MaxFileSize" value="500KB"/>
+ <param name="MaxBackupIndex" value="1"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+ </layout>
+ </appender>
+ <category name="org.jgroups">
+ <priority value="DEBUG" />
+ <appender-ref ref="CLUSTER"/>
+ </category>
+ <category name="org.jboss.ha">
+ <priority value="DEBUG" />
+ <appender-ref ref="CLUSTER"/>
+ </category>
+ -->
+
+</log4j:configuration>
More information about the exo-jcr-commits
mailing list