exo-jcr SVN: r1223 - in kernel/trunk/exo.kernel.container/src: main/java/org/exoplatform/container/management and 6 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-12-28 20:00:21 -0500 (Mon, 28 Dec 2009)
New Revision: 1223
Added:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/KernelManagementContext.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/Bar.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/Foo.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagedResource.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagementProviderImpl.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/ResourceKey.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/ScopedData.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/TestManagementProvider.java
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/management/
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/management/configuration1.xml
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/management/configuration2.xml
Removed:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/KernelManagementContext.java
Modified:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableComponentAdapter.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableContainer.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManagementContextImpl.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagementProvider.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagementProviderContext.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/ExoModelMBean.java
Log:
EXOJCR-350 : Enable plugability of management layer : added new unit tests
Copied: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/KernelManagementContext.java (from rev 1218, kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/KernelManagementContext.java)
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/KernelManagementContext.java (rev 0)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/KernelManagementContext.java 2009-12-29 01:00:21 UTC (rev 1223)
@@ -0,0 +1,66 @@
+/*
+ * 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.spi.ManagementProvider;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class KernelManagementContext
+{
+
+ /** . */
+ final ManagementContextImpl root;
+
+ /** . */
+ private final Set<ManagementProvider> providers;
+
+ public KernelManagementContext()
+ {
+ this.root = new ManagementContextImpl(this);
+ this.providers = new HashSet<ManagementProvider>();
+ }
+
+ public synchronized Collection<ManagementProvider> getProviders() {
+ return providers;
+ }
+
+ public synchronized 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
+ root.install(provider);
+
+ //
+ return false;
+ }
+}
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableComponentAdapter.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableComponentAdapter.java 2009-12-28 23:20:59 UTC (rev 1222)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableComponentAdapter.java 2009-12-29 01:00:21 UTC (rev 1223)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.container.jmx;
+import org.exoplatform.management.spi.ManagementProvider;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.picocontainer.ComponentAdapter;
@@ -74,8 +75,16 @@
//
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.managementContext.kernelContext.addProvider(provider);
+ }
}
}
return instance;
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableContainer.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableContainer.java 2009-12-28 23:20:59 UTC (rev 1222)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableContainer.java 2009-12-29 01:00:21 UTC (rev 1223)
@@ -19,7 +19,6 @@
package org.exoplatform.container.jmx;
import org.exoplatform.container.CachingContainer;
-import org.exoplatform.container.management.KernelManagementContext;
import org.exoplatform.container.monitor.jvm.J2EEServerInfo;
import org.exoplatform.management.ManagementContext;
import org.exoplatform.management.annotations.Managed;
@@ -104,8 +103,14 @@
// Get server from parent
server = manageableParent.server;
} else {
+ KernelManagementContext kernelCtx = new KernelManagementContext();
+
+ //
server = findMBeanServer();
- managementContext = new ManagementContextImpl(new KernelManagementContext(Collections.<ManagementProvider>singleton(new JMXManagementProvider(server))));
+ managementContext = kernelCtx.root;
+
+ //
+ kernelCtx.addProvider(new JMXManagementProvider(server));
}
//
@@ -165,6 +170,13 @@
if (managementContext != null)
{
managementContext.register(componentInstance);
+
+ // Register if it is a management provider
+ if (componentInstance instanceof ManagementProvider)
+ {
+ ManagementProvider provider = (ManagementProvider)componentInstance;
+ managementContext.kernelContext.addProvider(provider);
+ }
}
return adapter;
}
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManagementContextImpl.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManagementContextImpl.java 2009-12-28 23:20:59 UTC (rev 1222)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManagementContextImpl.java 2009-12-29 01:00:21 UTC (rev 1223)
@@ -20,7 +20,6 @@
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.component.RequestLifeCycle;
-import org.exoplatform.container.management.KernelManagementContext;
import org.exoplatform.management.ManagementAware;
import org.exoplatform.management.spi.ManagedTypeMetaData;
import org.exoplatform.container.management.MetaDataBuilder;
@@ -58,6 +57,12 @@
/** . */
final KernelManagementContext kernelContext;
+ /** . */
+ private final Object resource;
+
+ /** . */
+ private final ManagedTypeMetaData typeMD;
+
/** An optional container setup when the management context is attached to a container. */
ManageableContainer container;
@@ -77,10 +82,17 @@
this.scopingProperties = new HashMap<Class<?>, Object>();
this.kernelContext = kernelContext;
+ this.resource = null;
+ this.typeMD = null;
}
public ManagementContextImpl(ManagementContextImpl parent)
{
+ this(parent, null, null);
+ }
+
+ public ManagementContextImpl(ManagementContextImpl parent, Object resource, ManagedTypeMetaData typeMD)
+ {
if (parent == null)
{
throw new NullPointerException();
@@ -90,6 +102,8 @@
this.parent = parent;
this.scopingProperties = new HashMap<Class<?>, Object>();
this.kernelContext = parent.kernelContext;
+ this.resource = resource;
+ this.typeMD = typeMD;
}
public ManagementContext getParent()
@@ -153,7 +167,7 @@
}
else
{
- viewContext = new ManagementContextImpl(this);
+ viewContext = new ManagementContextImpl(this, view, metaData);
}
//
@@ -238,4 +252,21 @@
{
return "ManagementContextImpl[container=" + container + "]";
}
+
+ void install(ManagementProvider provider) {
+ if (resource != null&& typeMD != null)
+ {
+ Object name = provider.manage(this, resource, typeMD);
+ if (name != null)
+ {
+ bilto.put(provider, name);
+ }
+ }
+
+ // Install for all
+ for (ManagementContextImpl registration : registrations.values())
+ {
+ registration.install(provider);
+ }
+ }
}
Deleted: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/KernelManagementContext.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/KernelManagementContext.java 2009-12-28 23:20:59 UTC (rev 1222)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/KernelManagementContext.java 2009-12-29 01:00:21 UTC (rev 1223)
@@ -1,51 +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 org.exoplatform.management.spi.jmx.JMXManagementProvider;
-import org.exoplatform.management.spi.ManagementProvider;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class KernelManagementContext
-{
-
- /** . */
- private final Set<ManagementProvider> providers;
-
- public KernelManagementContext()
- {
- providers = Collections.<ManagementProvider>singleton(new JMXManagementProvider());
- }
-
- public KernelManagementContext(Set<ManagementProvider> providers)
- {
- this.providers = providers;
- }
-
- public Collection<ManagementProvider> getProviders() {
- return providers;
- }
-}
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagementProvider.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagementProvider.java 2009-12-28 23:20:59 UTC (rev 1222)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagementProvider.java 2009-12-29 01:00:21 UTC (rev 1223)
@@ -32,11 +32,11 @@
* Instruct the management provider to manage the provided resource with the specified meta data.
*
* @param context the context
- * @param managedResource the managed resource
+ * @param source the resource to manage
* @param metaData the meta data describing the management interface
* @return the key under which the resource is registered
*/
- Object manage(ManagementProviderContext context, Object managedResource, ManagedTypeMetaData metaData);
+ Object manage(ManagementProviderContext context, Object source, ManagedTypeMetaData metaData);
/**
* Instruct the management provider to remove the specifed resource from management.
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagementProviderContext.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagementProviderContext.java 2009-12-28 23:20:59 UTC (rev 1222)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagementProviderContext.java 2009-12-29 01:00:21 UTC (rev 1223)
@@ -21,7 +21,6 @@
import org.exoplatform.management.ManagementContext;
import java.util.List;
-import java.util.Map;
/**
* The contract between a management provider and the kernel.
@@ -35,6 +34,8 @@
/**
* Returns the scoping properties of the context;
*
+ * @param scopeType the scope type
+ * @param <S> the generic type of the scope type
* @return the scoping properties
*/
<S> List<S> getScopingProperties(Class<S> scopeType);
@@ -43,6 +44,8 @@
* Callback to obtain a management provider context for the specified managed resource scoped with
* the provided properties.
*
+ * @param scopeType the scope type
+ * @param <S> the generic type of the scope type
* @param scopingProperties the scoping properties
*/
<S> void setScopingData(Class<S> scopeType, S scopingProperties);
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/ExoModelMBean.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/ExoModelMBean.java 2009-12-28 23:20:59 UTC (rev 1222)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/ExoModelMBean.java 2009-12-29 01:00:21 UTC (rev 1223)
@@ -142,23 +142,4 @@
//
super.postDeregister();
}
-
- //
-
- public ManagementContext getManagementContext()
- {
- return context;
- }
-
- //
-
- public void register(Object o) throws IllegalArgumentException, NullPointerException
- {
- context.register(o);
- }
-
- public void unregister(Object o) throws IllegalArgumentException, NullPointerException
- {
- context.unregister(o);
- }
}
Added: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/Bar.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/Bar.java (rev 0)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/Bar.java 2009-12-29 01:00:21 UTC (rev 1223)
@@ -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@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+@Managed
+public class Bar
+{
+}
Added: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/Foo.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/Foo.java (rev 0)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/Foo.java 2009-12-29 01:00:21 UTC (rev 1223)
@@ -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@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+@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/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagedResource.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagedResource.java (rev 0)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagedResource.java 2009-12-29 01:00:21 UTC (rev 1223)
@@ -0,0 +1,59 @@
+/*
+ * 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;
+import org.exoplatform.management.spi.ManagementProviderContext;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ManagedResource
+{
+
+ final ResourceKey key;
+
+ /** . */
+ final Object resource;
+
+ /** . */
+ final ManagementProviderContext context;
+
+ /** . */
+ final ManagedTypeMetaData metaData;
+
+ /** . */
+ final ScopedData data;
+
+ public ManagedResource(Object resource, ManagementProviderContext 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);
+ }
+}
Added: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagementProviderImpl.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagementProviderImpl.java (rev 0)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagementProviderImpl.java 2009-12-29 01:00:21 UTC (rev 1223)
@@ -0,0 +1,59 @@
+/*
+ * 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;
+import org.exoplatform.management.spi.ManagementProvider;
+import org.exoplatform.management.spi.ManagementProviderContext;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ManagementProviderImpl implements ManagementProvider
+{
+
+ /** . */
+ final List<ManagedResource> resources = new ArrayList<ManagedResource>();
+
+ public Object manage(ManagementProviderContext context, Object resource, ManagedTypeMetaData metaData)
+ {
+ ManagedResource mr = new ManagedResource(resource, context, metaData);
+ resources.add(mr);
+ return mr.key;
+ }
+
+ public void unmanage(Object key)
+ {
+ for (Iterator<ManagedResource> i = resources.iterator();i.hasNext();)
+ {
+ ManagedResource mr = i.next();
+ if (mr.key == key)
+ {
+ i.remove();
+ break;
+ }
+ }
+ }
+}
Added: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/ResourceKey.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/ResourceKey.java (rev 0)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/ResourceKey.java 2009-12-29 01:00:21 UTC (rev 1223)
@@ -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@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ResourceKey
+{
+}
Added: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/ScopedData.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/ScopedData.java (rev 0)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/ScopedData.java 2009-12-29 01:00:21 UTC (rev 1223)
@@ -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@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ScopedData
+{
+}
Added: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/TestManagementProvider.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/TestManagementProvider.java (rev 0)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/TestManagementProvider.java 2009-12-29 01:00:21 UTC (rev 1223)
@@ -0,0 +1,103 @@
+/*
+ * 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.RootContainer;
+import org.exoplatform.container.support.ContainerBuilder;
+
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@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(0, provider.resources.size());
+ Object foo = container.getComponentInstance("Foo");
+ assertNotNull(foo);
+ assertEquals(1, provider.resources.size());
+ ManagedResource fooMR = provider.resources.get(0);
+ assertSame(foo, fooMR.resource);
+ assertEquals(Collections.<ScopedData>emptyList(), fooMR.context.getScopingProperties(ScopedData.class));
+ fooMR.register();
+ assertEquals(Collections.singletonList(fooMR.data), fooMR.context.getScopingProperties(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(1, provider.resources.size());
+ ManagedResource fooMR = provider.resources.get(0);
+ assertSame(foo, fooMR.resource);
+ assertEquals(Collections.<ScopedData>emptyList(), fooMR.context.getScopingProperties(ScopedData.class));
+ fooMR.register();
+ assertEquals(Collections.singletonList(fooMR.data), fooMR.context.getScopingProperties(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(1, provider.resources.size());
+ ManagedResource fooMR = provider.resources.get(0);
+ fooMR.register();
+ assertTrue(foo.isAware());
+
+ //
+ foo.deploy();
+ assertEquals(2, provider.resources.size());
+ ManagedResource barMR = provider.resources.get(1);
+ assertSame(foo.bar, barMR.resource);
+ barMR.register();
+ assertEquals(Arrays.asList(barMR.data, fooMR.data), barMR.context.getScopingProperties(ScopedData.class));
+
+ //
+ foo.undeploy();
+ assertEquals(Arrays.asList(fooMR), provider.resources);
+ }
+}
Added: kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/management/configuration1.xml
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/management/configuration1.xml (rev 0)
+++ kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/management/configuration1.xml 2009-12-29 01:00:21 UTC (rev 1223)
@@ -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/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/management/configuration2.xml
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/management/configuration2.xml (rev 0)
+++ kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/management/configuration2.xml 2009-12-29 01:00:21 UTC (rev 1223)
@@ -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
16 years, 4 months
exo-jcr SVN: r1222 - jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2009-12-28 18:20:59 -0500 (Mon, 28 Dec 2009)
New Revision: 1222
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
Log:
EXOJCR-344: Removal of the bottlenecks found with JProfiler
Make the method SessionDataManager.traverseStoredDescendants avoid to store the result into Map<String, ItemData> ret when no merge are required: i.e. deep || !transientDescendants.isEmpty()
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2009-12-28 16:18:41 UTC (rev 1221)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2009-12-28 23:20:59 UTC (rev 1222)
@@ -1587,37 +1587,43 @@
// 2 get ALL persisted descendants
Map<String, ItemData> descendants = new LinkedHashMap<String, ItemData>();
- traverseStoredDescendants(rootData, dataManager, false, action, descendants, false, transientDescendants);
+ List<? extends ItemData> result = traverseStoredDescendants(rootData, dataManager, false, action, descendants, false, transientDescendants);
- // merge data
- for (ItemState state : transientDescendants)
+ if (deep || !transientDescendants.isEmpty())
{
- ItemData data = state.getData();
- if (!state.isDeleted())
- descendants.put(data.getIdentifier(), data);
- else
- descendants.remove(data.getIdentifier());
- }
- Collection<ItemData> desc = descendants.values();
- List<ItemData> retval;
- if (deep)
- {
- int size = desc.size();
- retval = new ArrayList<ItemData>(size < 10 ? 10 : size);
-
- for (ItemData itemData : desc)
+ // merge data
+ for (ItemState state : transientDescendants)
{
- retval.add(itemData);
- if (deep)
- retval.addAll(merge(itemData, dataManager, true, action));
+ ItemData data = state.getData();
+ if (!state.isDeleted())
+ descendants.put(data.getIdentifier(), data);
+ else
+ descendants.remove(data.getIdentifier());
}
+ Collection<? extends ItemData> desc = result != null ? result : descendants.values();
+ List<ItemData> retval;
+ if (deep)
+ {
+ int size = desc.size();
+ retval = new ArrayList<ItemData>(size < 10 ? 10 : size);
+
+ for (ItemData itemData : desc)
+ {
+ retval.add(itemData);
+ if (deep)
+ retval.addAll(merge(itemData, dataManager, true, action));
+ }
+ }
+ else
+ {
+ retval = new ArrayList<ItemData>(desc);
+ }
+ return retval;
}
else
{
- retval = new ArrayList<ItemData>(desc);
+ return new ArrayList<ItemData>(result);
}
-
- return retval;
}
/**
@@ -1641,36 +1647,43 @@
// 2 get ALL persisted descendants
Map<String, ItemData> descendants = new LinkedHashMap<String, ItemData>();
- traverseStoredDescendants(rootData, dataManager, false, action, descendants, true, transientDescendants);
+ List<? extends ItemData> result = traverseStoredDescendants(rootData, dataManager, false, action, descendants, true, transientDescendants);
- // merge data
- for (ItemState state : transientDescendants)
+ if (deep || !transientDescendants.isEmpty())
{
- ItemData data = state.getData();
- if (!state.isDeleted())
- descendants.put(data.getIdentifier(), data);
+ // merge data
+ for (ItemState state : transientDescendants)
+ {
+ ItemData data = state.getData();
+ if (!state.isDeleted())
+ descendants.put(data.getIdentifier(), data);
+ else
+ descendants.remove(data.getIdentifier());
+ }
+ Collection<? extends ItemData> desc = result != null ? result : descendants.values();
+ List<ItemData> retval;
+ if (deep)
+ {
+ int size = desc.size();
+ retval = new ArrayList<ItemData>(size < 10 ? 10 : size);
+
+ for (ItemData itemData : desc)
+ {
+ retval.add(itemData);
+ if (deep)
+ retval.addAll(mergeList(itemData, dataManager, true, action));
+ }
+ }
else
- descendants.remove(data.getIdentifier());
- }
- Collection<ItemData> desc = descendants.values();
- List<ItemData> retval;
- if (deep)
- {
- int size = desc.size();
- retval = new ArrayList<ItemData>(size < 10 ? 10 : size);
-
- for (ItemData itemData : desc)
{
- retval.add(itemData);
- if (deep)
- retval.addAll(mergeList(itemData, dataManager, true, action));
+ retval = new ArrayList<ItemData>(desc);
}
+ return retval;
}
else
{
- retval = new ArrayList<ItemData>(desc);
+ return new ArrayList<ItemData>(result);
}
- return retval;
}
/**
@@ -1683,50 +1696,81 @@
* @param ret
* @throws RepositoryException
*/
- private void traverseStoredDescendants(ItemData parent, DataManager dataManager, boolean deep, int action,
+ private List<? extends ItemData> traverseStoredDescendants(ItemData parent, DataManager dataManager, boolean deep, int action,
Map<String, ItemData> ret, boolean listOnly, List<ItemState> transientDescendants) throws RepositoryException
{
if (parent.isNode())
{
+ List<ItemData> childItems = null;
if (action != MERGE_PROPS)
{
List<NodeData> childNodes = dataManager.getChildNodesData((NodeData)parent);
- for (NodeData childNode : childNodes)
+ if (deep || !transientDescendants.isEmpty())
{
- ret.put(childNode.getIdentifier(), childNode);
+ for (NodeData childNode : childNodes)
+ {
+ ret.put(childNode.getIdentifier(), childNode);
- if (log.isDebugEnabled())
- log.debug("Traverse stored (N) " + childNode.getQPath().getAsString());
+ if (log.isDebugEnabled())
+ log.debug("Traverse stored (N) " + childNode.getQPath().getAsString());
- // TODO [PN] Not used
- if (deep)
- traverseStoredDescendants(childNode, dataManager, deep, action, ret, listOnly, transientDescendants);
+ // TODO [PN] Not used
+ if (deep)
+ traverseStoredDescendants(childNode, dataManager, deep, action, ret, listOnly, transientDescendants);
+ }
}
+ else
+ {
+ if (action != MERGE_NODES)
+ {
+ childItems = new ArrayList<ItemData>(childNodes);
+ }
+ else
+ {
+ return childNodes;
+ }
+ }
}
if (action != MERGE_NODES)
{
List<PropertyData> childProps =
listOnly ? dataManager.listChildPropertiesData((NodeData)parent) : dataManager
.getChildPropertiesData((NodeData)parent);
- outer : for (PropertyData childProp : childProps)
+ if (deep || !transientDescendants.isEmpty())
{
- for (ItemState transientState : transientDescendants)
+ outer : for (PropertyData childProp : childProps)
{
- if (!transientState.isNode() && !transientState.isDeleted()
- && transientState.getData().getQPath().getDepth() == childProp.getQPath().getDepth()
- && transientState.getData().getQPath().getName().equals(childProp.getQPath().getName()))
+ for (ItemState transientState : transientDescendants)
{
- continue outer;
+ if (!transientState.isNode() && !transientState.isDeleted()
+ && transientState.getData().getQPath().getDepth() == childProp.getQPath().getDepth()
+ && transientState.getData().getQPath().getName().equals(childProp.getQPath().getName()))
+ {
+ continue outer;
+ }
}
- }
- ret.put(childProp.getIdentifier(), childProp);
+ ret.put(childProp.getIdentifier(), childProp);
- if (log.isDebugEnabled())
- log.debug("Traverse stored (P) " + childProp.getQPath().getAsString());
+ if (log.isDebugEnabled())
+ log.debug("Traverse stored (P) " + childProp.getQPath().getAsString());
+ }
}
+ else
+ {
+ if (action != MERGE_PROPS)
+ {
+ childItems.addAll(childProps);
+ }
+ else
+ {
+ return childProps;
+ }
+ }
}
+ return childItems;
}
+ return null;
}
/**
16 years, 4 months
exo-jcr SVN: r1221 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2009-12-28 11:18:41 -0500 (Mon, 28 Dec 2009)
New Revision: 1221
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws1.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws2.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws3.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck1.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck2.xml
Log:
EXOJCR-331 : nonBlocking="true"
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws.xml 2009-12-28 16:12:42 UTC (rev 1220)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws.xml 2009-12-28 16:18:41 UTC (rev 1221)
@@ -9,7 +9,7 @@
Fetch in memory state is enable, because second cluster-node
currently doesn't work properly on clear cache
-->
- <stateRetrieval timeout="20000" fetchInMemoryState="true" />
+ <stateRetrieval timeout="20000" fetchInMemoryState="true" nonBlocking="true"/>
<!--
This JGroups configuration is taken from JBC branch, but
"enable_bundling" is set to false, because of notice, that appeared
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws1.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws1.xml 2009-12-28 16:12:42 UTC (rev 1220)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws1.xml 2009-12-28 16:18:41 UTC (rev 1221)
@@ -9,7 +9,7 @@
Fetch in memory state is enable, because second cluster-node
currently doesn't work properly on clear cache
-->
- <stateRetrieval timeout="20000" fetchInMemoryState="true" />
+ <stateRetrieval timeout="20000" fetchInMemoryState="true" nonBlocking="true"/>
<!--
This JGroups configuration is taken from JBC branch, but
"enable_bundling" is set to false, because of notice, that appeared
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws2.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws2.xml 2009-12-28 16:12:42 UTC (rev 1220)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws2.xml 2009-12-28 16:18:41 UTC (rev 1221)
@@ -9,7 +9,7 @@
Fetch in memory state is enable, because second cluster-node
currently doesn't work properly on clear cache
-->
- <stateRetrieval timeout="20000" fetchInMemoryState="true" />
+ <stateRetrieval timeout="20000" fetchInMemoryState="true" nonBlocking="true"/>
<!--
This JGroups configuration is taken from JBC branch, but
"enable_bundling" is set to false, because of notice, that appeared
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws3.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws3.xml 2009-12-28 16:12:42 UTC (rev 1220)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws3.xml 2009-12-28 16:18:41 UTC (rev 1221)
@@ -9,7 +9,7 @@
Fetch in memory state is enable, because second cluster-node
currently doesn't work properly on clear cache
-->
- <stateRetrieval timeout="20000" fetchInMemoryState="true" />
+ <stateRetrieval timeout="20000" fetchInMemoryState="true" nonBlocking="true"/>
<!--
This JGroups configuration is taken from JBC branch, but
"enable_bundling" is set to false, because of notice, that appeared
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck.xml 2009-12-28 16:12:42 UTC (rev 1220)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck.xml 2009-12-28 16:18:41 UTC (rev 1221)
@@ -9,7 +9,7 @@
Fetch in memory state is enable, because second cluster-node
currently doesn't work properly on clear cache
-->
- <stateRetrieval timeout="20000" fetchInMemoryState="true" />
+ <stateRetrieval timeout="20000" fetchInMemoryState="true" nonBlocking="true"/>
<!--
This JGroups configuration is taken from JBC branch, but
"enable_bundling" is set to false, because of notice, that appeared
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck1.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck1.xml 2009-12-28 16:12:42 UTC (rev 1220)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck1.xml 2009-12-28 16:18:41 UTC (rev 1221)
@@ -9,7 +9,7 @@
Fetch in memory state is enable, because second cluster-node
currently doesn't work properly on clear cache
-->
- <stateRetrieval timeout="20000" fetchInMemoryState="true" />
+ <stateRetrieval timeout="20000" fetchInMemoryState="true" nonBlocking="true"/>
<!--
This JGroups configuration is taken from JBC branch, but
"enable_bundling" is set to false, because of notice, that appeared
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck2.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck2.xml 2009-12-28 16:12:42 UTC (rev 1220)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck2.xml 2009-12-28 16:18:41 UTC (rev 1221)
@@ -9,7 +9,7 @@
Fetch in memory state is enable, because second cluster-node
currently doesn't work properly on clear cache
-->
- <stateRetrieval timeout="20000" fetchInMemoryState="true" />
+ <stateRetrieval timeout="20000" fetchInMemoryState="true" nonBlocking="true"/>
<!--
This JGroups configuration is taken from JBC branch, but
"enable_bundling" is set to false, because of notice, that appeared
16 years, 4 months
exo-jcr SVN: r1220 - in jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation: db and 1 other directory.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2009-12-28 11:12:42 -0500 (Mon, 28 Dec 2009)
New Revision: 1220
Added:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/GenericCQConnectionFactory.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleConnectionFactory.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OraclePoolConnectionFactory.java
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/HSQLDBConnectionFactory.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLConnectionFactory.java
Log:
EXOJCR-302: oracle factory added
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java 2009-12-28 15:44:24 UTC (rev 1219)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java 2009-12-28 16:12:42 UTC (rev 1220)
@@ -23,7 +23,6 @@
import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.impl.storage.jdbc.DBConstants;
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer;
-import org.exoplatform.services.jcr.impl.storage.jdbc.db.OracleConnectionFactory;
import org.exoplatform.services.jcr.impl.storage.jdbc.init.DBInitializer;
import org.exoplatform.services.jcr.impl.storage.jdbc.init.DBInitializerException;
import org.exoplatform.services.jcr.impl.storage.jdbc.init.IngresSQLDBInitializer;
@@ -31,6 +30,7 @@
import org.exoplatform.services.jcr.impl.storage.jdbc.init.PgSQLDBInitializer;
import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.HSQLDBConnectionFactory;
import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.MySQLConnectionFactory;
+import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.OracleConnectionFactory;
import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
import org.exoplatform.services.naming.InitialContextInitializer;
import org.picocontainer.Startable;
@@ -103,9 +103,11 @@
}
else if (dbDialect == DBConstants.DB_DIALECT_ORACLE)
{
+
this.connFactory = defaultConnectionFactory();
sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.ora.sql";
dbInitilizer = new OracleDBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
+
}
else if (dbDialect == DBConstants.DB_DIALECT_PGSQL)
{
Added: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/GenericCQConnectionFactory.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/GenericCQConnectionFactory.java (rev 0)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/GenericCQConnectionFactory.java 2009-12-28 16:12:42 UTC (rev 1220)
@@ -0,0 +1,221 @@
+/*
+ * 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.services.jcr.impl.storage.jdbc.optimisation.db;
+
+import org.exoplatform.services.jcr.impl.storage.jdbc.db.GenericConnectionFactory;
+import org.exoplatform.services.jcr.impl.storage.jdbc.monitor.ManagedConnection;
+import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
+import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
+import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
+
+import java.io.File;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+
+import javax.jcr.RepositoryException;
+import javax.sql.DataSource;
+
+/**
+ * Created by The eXo Platform SAS
+ *
+ * 15.03.2007
+ *
+ * @author <a href="mailto:peter.nedonosko@exoplatform.com.ua">Peter Nedonosko</a>
+ * @version $Id: GenericConnectionFactory.java 34801 2009-07-31 15:44:50Z dkatayev $
+ */
+public class GenericCQConnectionFactory extends GenericConnectionFactory
+{
+
+ /**
+ * GenericConnectionFactory constructor.
+ *
+ * @param dataSource
+ * - DataSource
+ * @param dbDriver
+ * - JDBC Driver
+ * @param dbUrl
+ * - JDBC URL
+ * @param dbUserName
+ * - database username
+ * @param dbPassword
+ * - database user password
+ * @param containerName
+ * - Container name (see configuration)
+ * @param multiDb
+ * - multidatabase state flag
+ * @param valueStorageProvider
+ * - external Value Storages provider
+ * @param maxBufferSize
+ * - Maximum buffer size (see configuration)
+ * @param swapDirectory
+ * - Swap directory (see configuration)
+ * @param swapCleaner
+ * - Swap cleaner (internal FileCleaner).
+ */
+ protected GenericCQConnectionFactory(DataSource dataSource, String dbDriver, String dbUrl, String dbUserName,
+ String dbPassword, String containerName, boolean multiDb, ValueStoragePluginProvider valueStorageProvider,
+ int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
+ {
+ super(dataSource, dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb, valueStorageProvider,
+ maxBufferSize, swapDirectory, swapCleaner);
+ }
+
+ /**
+ * GenericConnectionFactory constructor.
+ *
+ * @param dataSource
+ * - DataSource
+ * @param containerName
+ * - Container name (see configuration)
+ * @param multiDb
+ * - multidatabase state flag
+ * @param valueStorageProvider
+ * - external Value Storages provider
+ * @param maxBufferSize
+ * - Maximum buffer size (see configuration)
+ * @param swapDirectory
+ * - Swap directory (see configuration)
+ * @param swapCleaner
+ * - Swap cleaner (internal FileCleaner).
+ */
+ public GenericCQConnectionFactory(DataSource dataSource, String containerName, boolean multiDb,
+ ValueStoragePluginProvider valueStorageProvider, int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
+ {
+
+ this(dataSource, null, null, null, null, containerName, multiDb, valueStorageProvider, maxBufferSize,
+ swapDirectory, swapCleaner);
+ }
+
+ /**
+ * GenericConnectionFactory constructor.
+ *
+ * @param dbDriver
+ * - JDBC Driver
+ * @param dbUrl
+ * - JDBC URL
+ * @param dbUserName
+ * - database username
+ * @param dbPassword
+ * - database user password
+ * @param containerName
+ * - Container name (see configuration)
+ * @param multiDb
+ * - multidatabase state flag
+ * @param valueStorageProvider
+ * - external Value Storages provider
+ * @param maxBufferSize
+ * - Maximum buffer size (see configuration)
+ * @param swapDirectory
+ * - Swap directory (see configuration)
+ * @param swapCleaner
+ * - Swap cleaner (internal FileCleaner).
+ */
+ public GenericCQConnectionFactory(String dbDriver, String dbUrl, String dbUserName, String dbPassword,
+ String containerName, boolean multiDb, ValueStoragePluginProvider valueStorageProvider, int maxBufferSize,
+ File swapDirectory, FileCleaner swapCleaner) throws RepositoryException
+ {
+
+ this(null, dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb, valueStorageProvider, maxBufferSize,
+ swapDirectory, swapCleaner);
+
+ try
+ {
+ Class.forName(dbDriver).newInstance();
+ }
+ catch (InstantiationException e)
+ {
+ throw new RepositoryException(e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new RepositoryException(e);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new RepositoryException(e);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public WorkspaceStorageConnection openConnection() throws RepositoryException
+ {
+ return openConnection(false);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public WorkspaceStorageConnection openConnection(boolean readOnly) throws RepositoryException
+ {
+ try
+ {
+
+ if (multiDb)
+ {
+ return new MultiDbJDBCConnection(getJdbcConnection(readOnly), readOnly, containerName,
+ valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
+
+ return new SingleDbJDBCConnection(getJdbcConnection(readOnly), readOnly, containerName, valueStorageProvider,
+ maxBufferSize, swapDirectory, swapCleaner);
+
+ }
+ catch (SQLException e)
+ {
+ throw new RepositoryException(e);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Connection getJdbcConnection(boolean readOnly) throws RepositoryException
+ {
+ try
+ {
+ final Connection conn =
+ dbDataSource != null ? dbDataSource.getConnection() : (dbUserName != null ? DriverManager.getConnection(
+ dbUrl, dbUserName, dbPassword) : DriverManager.getConnection(dbUrl));
+
+ if (readOnly) // set this feature only if it asked
+ conn.setReadOnly(readOnly);
+
+ return monitorInterest == 0 ? conn : new ManagedConnection(conn, monitorInterest);
+ }
+ catch (SQLException e)
+ {
+ String err =
+ "Error of JDBC connection open. SQLException: " + e.getMessage() + ", SQLState: " + e.getSQLState()
+ + ", VendorError: " + e.getErrorCode();
+ throw new RepositoryException(err, e);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Connection getJdbcConnection() throws RepositoryException
+ {
+ return getJdbcConnection(false);
+ }
+
+}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/HSQLDBConnectionFactory.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/HSQLDBConnectionFactory.java 2009-12-28 15:44:24 UTC (rev 1219)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/HSQLDBConnectionFactory.java 2009-12-28 16:12:42 UTC (rev 1220)
@@ -16,7 +16,6 @@
*/
package org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db;
-import org.exoplatform.services.jcr.impl.storage.jdbc.db.GenericConnectionFactory;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
@@ -35,7 +34,7 @@
* @author <a href="mailto:dezder@bk.ru">Denis Grebenyuk</a>
* @version $Id:$
*/
-public class HSQLDBConnectionFactory extends GenericConnectionFactory
+public class HSQLDBConnectionFactory extends GenericCQConnectionFactory
{
/**
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLConnectionFactory.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLConnectionFactory.java 2009-12-28 15:44:24 UTC (rev 1219)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLConnectionFactory.java 2009-12-28 16:12:42 UTC (rev 1220)
@@ -18,7 +18,6 @@
*/
package org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db;
-import org.exoplatform.services.jcr.impl.storage.jdbc.db.GenericConnectionFactory;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
@@ -37,7 +36,7 @@
* @author <a href="mailto:peter.nedonosko@exoplatform.com.ua">Peter Nedonosko</a>
* @version $Id: MySQLConnectionFactory.java 34801 2009-07-31 15:44:50Z dkatayev $
*/
-public class MySQLConnectionFactory extends GenericConnectionFactory
+public class MySQLConnectionFactory extends GenericCQConnectionFactory
{
/**
Added: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleConnectionFactory.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleConnectionFactory.java (rev 0)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleConnectionFactory.java 2009-12-28 16:12:42 UTC (rev 1220)
@@ -0,0 +1,213 @@
+/*
+ * 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.services.jcr.impl.storage.jdbc.optimisation.db;
+
+import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
+import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
+
+import java.io.File;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.sql.Connection;
+import java.util.Properties;
+
+import javax.jcr.RepositoryException;
+
+/**
+ * Created by The eXo Platform SAS
+ *
+ * 23.03.2007
+ *
+ * Access Oracle implicit connection caching and pooling stuff using reflection to prevent Maven
+ * dependecies on ora drivers from POM.
+ *
+ * @author <a href="mailto:peter.nedonosko@exoplatform.com.ua">Peter Nedonosko</a>
+ * @version $Id: OracleConnectionFactory.java 34801 2009-07-31 15:44:50Z dkatayev $
+ */
+public class OracleConnectionFactory extends GenericCQConnectionFactory
+{
+
+ public static int CONNCACHE_MAX_LIMIT = 25;
+
+ public static int CONNCACHE_MIN_LIMIT = 2;
+
+ public static int CONNCACHE_INACTIVITY_TIMEOUT = 3600;
+
+ public static int CONNCACHE_ABADONDED_TIMEOUT = 1800;
+
+ protected final Object ociDataSource;
+
+ /**
+ * OracleConnectionFactory constructor. For CLI interface ONLY!
+ *
+ * @param dbDriver
+ * - JDBC Driver
+ * @param dbUrl
+ * - JDBC URL
+ * @param dbUserName
+ * - database username
+ * @param dbPassword
+ * - database user password
+ * @param containerName
+ * - Container name (see configuration)
+ * @param multiDb
+ * - multidatabase state flag
+ * @param valueStorageProvider
+ * - external Value Storages provider
+ * @param maxBufferSize
+ * - Maximum buffer size (see configuration)
+ * @param swapDirectory
+ * - Swap directory (see configuration)
+ * @param swapCleaner
+ * - Swap cleaner (internal FileCleaner).
+ * @throws RepositoryException
+ * if error occurs
+ */
+ public OracleConnectionFactory(String dbDriver, String dbUrl, String dbUserName, String dbPassword,
+ String containerName, boolean multiDb, ValueStoragePluginProvider valueStorageProvider, int maxBufferSize,
+ File swapDirectory, FileCleaner swapCleaner) throws RepositoryException
+ {
+
+ // ;D:\Devel\oracle_instantclient_10_2\;C:\oracle\ora92\bin;
+
+ /*
+ * ERROR: if no oci in path and oci url requested Error:
+ * java.lang.reflect.InvocationTargetException java.lang.reflect.InvocationTargetException at
+ * sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at
+ * sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
+ * at
+ * sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl
+ * .java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:494) at
+ * ocipool.ConnPoolAppl.main(ConnPoolAppl.java:58) Caused by: java.lang.UnsatisfiedLinkError: no
+ * ocijdbc10 in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
+ * --------------------------------------------------------------------------- ERROR: if thin
+ * url used and trying obtain oci data source java.lang.reflect.InvocationTargetException at
+ * sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at
+ * sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
+ * at
+ * sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl
+ * .java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:494) at
+ * ocipool.ConnPoolAppl.main(ConnPoolAppl.java:58) Caused by: java.lang.ClassCastException:
+ * oracle.jdbc.driver.T4CConnection at
+ * oracle.jdbc.pool.OracleOCIConnectionPool.createConnectionPool
+ * (OracleOCIConnectionPool.java:893)
+ */
+
+ super(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb, valueStorageProvider, maxBufferSize,
+ swapDirectory, swapCleaner);
+
+ Object cds = null;
+ try
+ {
+ Class cdsClass = OracleConnectionFactory.class.getClassLoader().loadClass("oracle.jdbc.pool.OracleDataSource");
+ Constructor cdsConstructor = cdsClass.getConstructor(new Class[]{});
+ cds = cdsConstructor.newInstance(new Object[]{});
+
+ // set cache properties
+ Properties prop = new java.util.Properties();
+ prop.setProperty("InitialLimit", String.valueOf(CONNCACHE_MIN_LIMIT));
+ prop.setProperty("MinLimit", String.valueOf(CONNCACHE_MIN_LIMIT));
+ prop.setProperty("MaxLimit", String.valueOf(CONNCACHE_MAX_LIMIT));
+ prop.setProperty("InactivityTimeout", String.valueOf(CONNCACHE_INACTIVITY_TIMEOUT));
+ prop.setProperty("AbandonedConnectionTimeout", String.valueOf(CONNCACHE_ABADONDED_TIMEOUT));
+
+ Method setURL = cds.getClass().getMethod("setURL", new Class[]{String.class});
+ setURL.invoke(cds, new Object[]{this.dbUrl});
+
+ Method setUser = cds.getClass().getMethod("setUser", new Class[]{String.class});
+ setUser.invoke(cds, new Object[]{this.dbUserName});
+
+ Method setPassword = cds.getClass().getMethod("setPassword", new Class[]{String.class});
+ setPassword.invoke(cds, new Object[]{this.dbPassword});
+
+ Method setConnectionCachingEnabled =
+ cds.getClass().getMethod("setConnectionCachingEnabled", new Class[]{boolean.class});
+ setConnectionCachingEnabled.invoke(cds, new Object[]{true});
+
+ Method setConnectionCacheProperties =
+ cds.getClass().getMethod("setConnectionCacheProperties", new Class[]{Properties.class});
+ setConnectionCacheProperties.invoke(cds, new Object[]{prop});
+
+ Method setConnectionCacheName = cds.getClass().getMethod("setConnectionCacheName", new Class[]{String.class});
+ setConnectionCacheName.invoke(cds, new Object[]{"EXOJCR_OCI__" + containerName});
+
+ }
+ catch (Throwable e)
+ {
+ cds = null;
+ String err = "Oracle OCI connection cache is unavailable due to error " + e;
+ if (e.getCause() != null)
+ {
+ err += " (" + e.getCause() + ")";
+ }
+ err += ". Standard JDBC DriverManager will be used for connections opening.";
+ if (log.isDebugEnabled())
+ log.warn(err, e);
+ else
+ log.warn(err);
+ }
+ this.ociDataSource = cds; // actually instance of javax.sql.DataSource
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Connection getJdbcConnection(boolean readOnly) throws RepositoryException
+ {
+ if (ociDataSource != null)
+ try
+ {
+ Connection conn = getCachedConnection();
+
+ if (readOnly) // set this feature only if it asked
+ conn.setReadOnly(true);
+
+ return conn;
+ }
+ catch (Throwable e)
+ {
+ throw new RepositoryException("Oracle OCI cached connection open error " + e, e);
+ }
+
+ return super.getJdbcConnection(readOnly);
+ }
+
+ /**
+ * Get CachedConnection.
+ *
+ * @return
+ * @throws NoSuchMethodException
+ * @throws IllegalArgumentException
+ * @throws IllegalAccessException
+ * @throws InvocationTargetException
+ */
+ protected Connection getCachedConnection() throws NoSuchMethodException, IllegalArgumentException,
+ IllegalAccessException, InvocationTargetException
+ {
+
+ // NOTE: ociDataSource - actually instance of javax.sql.DataSource
+ Method getConnection = ociDataSource.getClass().getMethod("getConnection", new Class[]{});
+ Connection conn = (Connection)getConnection.invoke(ociDataSource, new Object[]{});
+
+ return conn;
+ }
+
+}
Added: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OraclePoolConnectionFactory.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OraclePoolConnectionFactory.java (rev 0)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OraclePoolConnectionFactory.java 2009-12-28 16:12:42 UTC (rev 1220)
@@ -0,0 +1,240 @@
+/*
+ * 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.services.jcr.impl.storage.jdbc.optimisation.db;
+
+import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
+import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
+
+import java.io.File;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.sql.Connection;
+import java.util.Properties;
+
+import javax.jcr.RepositoryException;
+
+/**
+ * Created by The eXo Platform SAS
+ *
+ * 16.03.2007
+ *
+ * @author <a href="mailto:peter.nedonosko@exoplatform.com.ua">Peter Nedonosko</a>
+ * @version $Id: OraclePoolConnectionFactory.java 34801 2009-07-31 15:44:50Z dkatayev $
+ */
+public class OraclePoolConnectionFactory extends GenericCQConnectionFactory
+{
+
+ public static int CONNPOOL_MAX_LIMIT = 20;
+
+ public static int CONNPOOL_MIN_LIMIT = 2;
+
+ public static int CONNPOOL_INCREMENT = 1;
+
+ protected final Object ociPool;
+
+ /**
+ * OraclePoolConnectionFactory constructor. For CLI interface ONLY!
+ *
+ * @param dbDriver
+ * - JDBC Driver
+ * @param dbUrl
+ * - JDBC URL
+ * @param dbUserName
+ * - database username
+ * @param dbPassword
+ * - database user password
+ * @param containerName
+ * - Container name (see configuration)
+ * @param multiDb
+ * - multidatabase state flag
+ * @param valueStorageProvider
+ * - external Value Storages provider
+ * @param maxBufferSize
+ * - Maximum buffer size (see configuration)
+ * @param swapDirectory
+ * - Swap directory (see configuration)
+ * @param swapCleaner
+ * - Swap cleaner (internal FileCleaner).
+ * @throws RepositoryException
+ * if error occurs
+ */
+ public OraclePoolConnectionFactory(String dbDriver, String dbUrl, String dbUserName, String dbPassword,
+ String containerName, boolean multiDb, ValueStoragePluginProvider valueStorageProvider, int maxBufferSize,
+ File swapDirectory, FileCleaner swapCleaner) throws RepositoryException
+ {
+
+ // ;D:\Devel\oracle_instantclient_10_2\;C:\oracle\ora92\bin;
+
+ /*
+ * ERROR: if no oci in path and oci url requested Error:
+ * java.lang.reflect.InvocationTargetException java.lang.reflect.InvocationTargetException at
+ * sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at
+ * sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
+ * at
+ * sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl
+ * .java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:494) at
+ * ocipool.ConnPoolAppl.main(ConnPoolAppl.java:58) Caused by: java.lang.UnsatisfiedLinkError: no
+ * ocijdbc10 in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
+ * --------------------------------------------------------------------------- ERROR: if thin
+ * url used and trying obtain oci data source java.lang.reflect.InvocationTargetException at
+ * sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at
+ * sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
+ * at
+ * sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl
+ * .java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:494) at
+ * ocipool.ConnPoolAppl.main(ConnPoolAppl.java:58) Caused by: java.lang.ClassCastException:
+ * oracle.jdbc.driver.T4CConnection at
+ * oracle.jdbc.pool.OracleOCIConnectionPool.createConnectionPool
+ * (OracleOCIConnectionPool.java:893)
+ */
+
+ super(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb, valueStorageProvider, maxBufferSize,
+ swapDirectory, swapCleaner);
+
+ Object cpool = null;
+ try
+ {
+ Class cpoolClass =
+ OraclePoolConnectionFactory.class.getClassLoader().loadClass("oracle.jdbc.pool.OracleOCIConnectionPool");
+ Constructor cpoolConstructor =
+ cpoolClass.getConstructor(new Class[]{String.class, String.class, String.class, Properties.class});
+
+ cpool = cpoolConstructor.newInstance(new Object[]{this.dbUserName, this.dbPassword, this.dbUrl, null});
+ Method setConnectionCachingEnabled =
+ cpool.getClass().getMethod("setConnectionCachingEnabled", new Class[]{boolean.class});
+ setConnectionCachingEnabled.invoke(cpool, new Object[]{true});
+ }
+ catch (Throwable e)
+ {
+ cpool = null;
+ String err = "Oracle OCI connection pool is unavailable due to error " + e;
+ if (e.getCause() != null)
+ {
+ err += " (" + e.getCause() + ")";
+ }
+ err += ". Standard JDBC DriverManager will be used for connections opening.";
+ if (log.isDebugEnabled())
+ log.warn(err, e);
+ else
+ log.warn(err);
+ }
+ this.ociPool = cpool;
+
+ // configure using CONNPOOL_MAX_LIMIT, CONNPOOL_MIN_LIMIT, CONNPOOL_INCREMENT
+ try
+ {
+ reconfigure();
+ displayPoolConfig();
+ }
+ catch (Throwable e)
+ {
+ if (log.isDebugEnabled())
+ log.warn("Oracle OCI connection pool configuration error " + e, e);
+ else
+ log.warn("Oracle OCI connection pool configuration error " + e);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Connection getJdbcConnection(boolean readOnly) throws RepositoryException
+ {
+ if (ociPool != null)
+ try
+ {
+ Connection conn = getPoolConnection();
+
+ if (readOnly) // set this feature only if it asked
+ conn.setReadOnly(true);
+
+ return conn;
+ }
+ catch (Throwable e)
+ {
+ throw new RepositoryException("Oracle OCI pool connection open error " + e, e);
+ }
+
+ return super.getJdbcConnection(readOnly);
+ }
+
+ /**
+ * getPoolConnection.
+ *
+ * @return
+ * @throws NoSuchMethodException
+ * @throws IllegalArgumentException
+ * @throws IllegalAccessException
+ * @throws InvocationTargetException
+ */
+ protected Connection getPoolConnection() throws NoSuchMethodException, IllegalArgumentException,
+ IllegalAccessException, InvocationTargetException
+ {
+ Method getConnection = ociPool.getClass().getMethod("getConnection", new Class[]{});
+ return (Connection)getConnection.invoke(ociPool, new Object[]{});
+ }
+
+ protected void reconfigure() throws NoSuchMethodException, IllegalArgumentException, IllegalAccessException,
+ InvocationTargetException, NoSuchFieldException
+ {
+ if (ociPool != null)
+ {
+ // Set up the initial pool configuration
+ Properties p1 = new Properties();
+ String minLimitName = (String)ociPool.getClass().getField("CONNPOOL_MIN_LIMIT").get(null);
+ String maxLimitName = (String)ociPool.getClass().getField("CONNPOOL_MAX_LIMIT").get(null);
+ String incrName = (String)ociPool.getClass().getField("CONNPOOL_INCREMENT").get(null);
+
+ p1.put(minLimitName, Integer.toString(CONNPOOL_MIN_LIMIT));
+ p1.put(maxLimitName, Integer.toString(CONNPOOL_MAX_LIMIT));
+ p1.put(incrName, Integer.toString(CONNPOOL_INCREMENT));
+
+ // Enable the initial configuration
+ ociPool.getClass().getMethod("setPoolConfig", new Class[]{Properties.class}).invoke(ociPool, new Object[]{p1});
+ }
+ }
+
+ /**
+ * Display the current status of the OracleOCIConnectionPool.
+ */
+ protected void displayPoolConfig() throws NoSuchMethodException, IllegalArgumentException, IllegalAccessException,
+ InvocationTargetException
+ {
+ if (ociPool != null)
+ {
+
+ log.info(" =========== Oracle OCI connection pool config =========== ");
+
+ log.info(" Min poolsize Limit:\t"
+ + ociPool.getClass().getMethod("getMinLimit", new Class[]{}).invoke(ociPool, new Object[]{}));
+
+ log.info(" Max poolsize Limit:\t"
+ + ociPool.getClass().getMethod("getMaxLimit", new Class[]{}).invoke(ociPool, new Object[]{}));
+
+ log.info(" PoolSize:\t\t\t"
+ + ociPool.getClass().getMethod("getPoolSize", new Class[]{}).invoke(ociPool, new Object[]{}));
+
+ log.info(" ActiveSize:\t\t"
+ + ociPool.getClass().getMethod("getActiveSize", new Class[]{}).invoke(ociPool, new Object[]{}));
+ }
+ }
+
+}
16 years, 4 months
exo-jcr SVN: r1219 - in jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl: util and 1 other directory.
by do-not-reply@jboss.org
Author: tolusha
Date: 2009-12-28 10:44:24 -0500 (Mon, 28 Dec 2009)
New Revision: 1219
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/NodeIteratorOnDemand.java
Log:
EXOJCR-338: log.error() added
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2009-12-28 15:18:00 UTC (rev 1218)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2009-12-28 15:44:24 UTC (rev 1219)
@@ -1416,7 +1416,6 @@
if (pool)
{
NodeImpl pooledItem = (NodeImpl)itemsPool.getItem(data.getIdentifier());
-
if (pooledItem == null)
{
NodeData pooledData = (NodeData)itemsPool.getData(data.getIdentifier());
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/NodeIteratorOnDemand.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/NodeIteratorOnDemand.java 2009-12-28 15:18:00 UTC (rev 1218)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/NodeIteratorOnDemand.java 2009-12-28 15:44:24 UTC (rev 1219)
@@ -20,13 +20,14 @@
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.impl.core.NodeImpl;
import org.exoplatform.services.jcr.impl.core.SessionDataManager;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.jcr.Node;
-import javax.jcr.NodeIterator;
import javax.jcr.RepositoryException;
/**
@@ -38,8 +39,9 @@
* @author <a href="mailto:anatoliy.bazko@exoplatform.com.ua">Anatoliy Bazko</a>
* @version $Id$
*/
-public class NodeIteratorOnDemand implements NodeIterator
+public class NodeIteratorOnDemand extends EntityCollection
{
+ protected static Log log = ExoLogger.getLogger("jcr.NodeIteratorOnDemand");
private Iterator iter;
@@ -158,24 +160,23 @@
*/
private void wrapNodeData()
{
- if (pos == list.size())
+ if (pos >= list.size())
{
return;
}
- Object obj = list.get(pos);
-
- if (!(obj instanceof NodeImpl))
+ Object item = list.get(pos);
+ if (!(item instanceof NodeImpl))
{
try
{
- list.set(pos, dataManager.wrapNodeData((NodeData)obj, parentPrimaryTypeName, parentMixinTypeNames, pool));
+ list.set(pos, dataManager.wrapNodeData((NodeData)item, parentPrimaryTypeName, parentMixinTypeNames, pool));
}
catch (RepositoryException e)
{
- // TODO Auto-generated catch block
- e.printStackTrace();
+ log.error(e);
}
}
}
+
}
16 years, 4 months
exo-jcr SVN: r1218 - in kernel/trunk: exo.kernel.commons/src/test/java/org/exoplatform/commons/utils and 14 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-12-28 10:18:00 -0500 (Mon, 28 Dec 2009)
New Revision: 1218
Added:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/KernelManagementContext.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/ExoMBeanInfoBuilder.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/ExoModelMBean.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/JMX.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/JMXManagementProvider.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/MBeanScopingData.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/ObjectNameBuilder.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/PropertiesInfo.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/PropertyInfo.java
Removed:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ExoMBeanInfoBuilder.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ExoModelMBean.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/JMX.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/JMXManagementProvider.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ObjectNameBuilder.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/PropertiesInfo.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/PropertyInfo.java
Modified:
kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/PropertiesLoader.java
kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java
kernel/trunk/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestPropertiesLoader.java
kernel/trunk/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestTools.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainerClassLoader.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainerContext.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/PropertyConfigurator.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/UnifiedClassLoader.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/WebAppInitContext.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycle.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycleStack.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/EntityResolverImpl.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/Namespaces.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ProfileDOMFilter.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinition.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinitionPlugin.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableContainer.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManagementContextImpl.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractFilter.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractHttpServlet.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractHttpSessionListener.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/web/PortalContainerConfigOwner.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/web/PortalContainerCreator.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagementProvider.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagementProviderContext.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/ComponentWithRequestLifeCycle.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/LifeCycle.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainerInitTaskContextComparator.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestPropertyManagerConfigurator.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestRequestLifeCycle.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestUnifiedClassLoader.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestWebAppInitContextComparator.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/AbstractProfileTest.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/InitParamsHolder.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestCollectionValue.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestComponentPluginProfile.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestComponentProfile.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestField.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestImportProfile.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestInitParamProfile.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/AbstractTestExoMBean.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestNameTemplate.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestPortalContainerManagedIntegration.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/support/ManagedComponentRequestLifeCycle.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/support/SimpleManagementAware.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/support/ContainerBuilder.java
Log:
- EXOJCR-350 : Enable plugability of management layer : more cleanup, almost decoupled
- EXOJCR-351 : Sanitize Affero GPL headers in Kernel
Modified: kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/PropertiesLoader.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/PropertiesLoader.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/PropertiesLoader.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestPropertiesLoader.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestPropertiesLoader.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestPropertiesLoader.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestTools.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestTools.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestTools.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainerClassLoader.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainerClassLoader.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainerClassLoader.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainerContext.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainerContext.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainerContext.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/PropertyConfigurator.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/PropertyConfigurator.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/PropertyConfigurator.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/UnifiedClassLoader.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/UnifiedClassLoader.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/UnifiedClassLoader.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/WebAppInitContext.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/WebAppInitContext.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/WebAppInitContext.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycle.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycle.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycle.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycleStack.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycleStack.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycleStack.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/EntityResolverImpl.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/EntityResolverImpl.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/EntityResolverImpl.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/Namespaces.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/Namespaces.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/Namespaces.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ProfileDOMFilter.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ProfileDOMFilter.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ProfileDOMFilter.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinition.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinition.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinition.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinitionPlugin.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinitionPlugin.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinitionPlugin.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ExoMBeanInfoBuilder.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ExoMBeanInfoBuilder.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ExoMBeanInfoBuilder.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -1,228 +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.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.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@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)
- {
- 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
- {
- 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/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ExoModelMBean.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ExoModelMBean.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ExoModelMBean.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -1,176 +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.spi.ManagementProviderContext;
-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@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ExoModelMBean extends RequiredModelMBean implements ManagementContext
-{
-
- /** . */
- private Object mr;
-
- /** . */
- private ManagementProviderContext parentContext;
-
- /** . */
- private ManagementProviderContext context;
-
- public ExoModelMBean(ManagementProviderContext 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
- {
- 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);
-
- //
- Map<String, String> scopingProperties = info != null ? info.resolve(mr) : Collections.<String, String>emptyMap();
-
- //
- context = parentContext.createContext(mr, 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 void register(Object o) throws IllegalArgumentException, NullPointerException
- {
- context.register(o);
- }
-
- public void unregister(Object o) throws IllegalArgumentException, NullPointerException
- {
- context.unregister(o);
- }
-}
Deleted: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/JMX.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/JMX.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/JMX.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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@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/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/JMXManagementProvider.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/JMXManagementProvider.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/JMXManagementProvider.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -1,179 +0,0 @@
-/*
- * Copyright (C) 2003-2007 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 program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.container.jmx;
-
-import org.exoplatform.management.spi.ManagedTypeMetaData;
-import org.exoplatform.management.spi.ManagementProvider;
-import org.exoplatform.management.spi.ManagementProviderContext;
-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@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(ManagementProviderContext context, Object managedResource, ManagedTypeMetaData metaData)
- {
- ExoModelMBean mbean = null;
- try
- {
- ExoMBeanInfoBuilder infoBuilder = new ExoMBeanInfoBuilder(metaData);
- ModelMBeanInfo info = infoBuilder.build();
- mbean = new ExoModelMBean(context, managedResource, info);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
-
- //
- if (mbean != null)
- {
- ObjectName on = null;
- PropertiesInfo oni = PropertiesInfo.resolve(managedResource.getClass(), NameTemplate.class);
- if (oni != null)
- {
- try
- {
- Map<String, String> foo = oni.resolve(managedResource);
- 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<Map<String, String>> list = context.getScopingProperties();
- for (Map<String, String> scopingProperties : list)
- {
- props.putAll(scopingProperties);
- }
-
- // 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();
- }
- }
-}
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableContainer.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableContainer.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableContainer.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -19,11 +19,14 @@
package org.exoplatform.container.jmx;
import org.exoplatform.container.CachingContainer;
+import org.exoplatform.container.management.KernelManagementContext;
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.spi.ManagementProvider;
+import org.exoplatform.management.spi.jmx.JMXManagementProvider;
import org.picocontainer.ComponentAdapter;
import org.picocontainer.PicoContainer;
import org.picocontainer.PicoException;
@@ -33,6 +36,7 @@
import java.lang.management.ManagementFactory;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@@ -101,7 +105,7 @@
server = manageableParent.server;
} else {
server = findMBeanServer();
- managementContext = new ManagementContextImpl(new JMXManagementProvider(server));
+ managementContext = new ManagementContextImpl(new KernelManagementContext(Collections.<ManagementProvider>singleton(new JMXManagementProvider(server))));
}
//
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManagementContextImpl.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManagementContextImpl.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManagementContextImpl.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -20,8 +20,11 @@
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.component.RequestLifeCycle;
+import org.exoplatform.container.management.KernelManagementContext;
+import org.exoplatform.management.ManagementAware;
import org.exoplatform.management.spi.ManagedTypeMetaData;
import org.exoplatform.container.management.MetaDataBuilder;
+import org.exoplatform.management.spi.ManagementProvider;
import org.exoplatform.management.spi.ManagementProviderContext;
import org.exoplatform.management.ManagementContext;
import org.exoplatform.management.annotations.ManagedBy;
@@ -29,7 +32,6 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -42,40 +44,39 @@
{
/** . */
- Map<String, String> scopingProperties;
+ private final Map<Class<?>, Object> scopingProperties;
/** The registrations done by this mbean. */
- private final Map<Object, Object> registrations;
+ private final Map<Object, ManagementContextImpl> registrations;
/** . */
+ final Map<ManagementProvider, Object> bilto;
+
+ /** . */
private final ManagementContextImpl parent;
/** . */
- final JMXManagementProvider provider;
+ final KernelManagementContext kernelContext;
/** An optional container setup when the management context is attached to a container. */
ManageableContainer container;
- public ManagementContextImpl()
+ public ManagementContextImpl(KernelManagementContext kernelContext)
{
- this(new JMXManagementProvider());
- }
-
- public ManagementContextImpl(JMXManagementProvider provider)
- {
- if (provider == null)
+ if (kernelContext == null)
{
throw new NullPointerException();
}
- this.registrations = new HashMap<Object, Object>();
+ this.bilto = new HashMap<ManagementProvider, Object>();
+ this.registrations = new HashMap<Object, ManagementContextImpl>();
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.provider = provider;
+ this.scopingProperties = new HashMap<Class<?>, Object>();
+ this.kernelContext = kernelContext;
}
public ManagementContextImpl(ManagementContextImpl parent)
@@ -84,10 +85,11 @@
{
throw new NullPointerException();
}
- this.registrations = new HashMap<Object, Object>();
+ this.bilto = new HashMap<ManagementProvider, Object>();
+ this.registrations = new HashMap<Object, ManagementContextImpl>();
this.parent = parent;
- this.scopingProperties = null;
- this.provider = parent.provider;
+ this.scopingProperties = new HashMap<Class<?>, Object>();
+ this.kernelContext = parent.kernelContext;
}
public ManagementContext getParent()
@@ -95,23 +97,9 @@
return parent;
}
- public ManagementProviderContext createContext(Object managedResource, Map<String, String> scopingProperties)
+ public <S> void setScopingData(Class<S> scopeType, S scopingProperties)
{
- ManagementContextImpl context;
- if (managedResource instanceof ManageableContainer)
- {
- context = ((ManageableContainer)managedResource).managementContext;
- }
- else
- {
- context = new ManagementContextImpl(this);
- }
-
- //
- context.scopingProperties = scopingProperties;
-
- //
- return context;
+ this.scopingProperties.put(scopeType, scopingProperties);
}
public void register(Object o)
@@ -156,31 +144,61 @@
MetaDataBuilder builder = new MetaDataBuilder(view.getClass());
if (builder.isBuildable()) {
ManagedTypeMetaData metaData = builder.build();
- Object name = provider.manage(this, view, metaData);
- if (name != null)
+
+ //
+ ManagementContextImpl viewContext;
+ if (view instanceof ManageableContainer)
{
- registrations.put(o, name);
+ viewContext = ((ManageableContainer)view).managementContext;
}
+ else
+ {
+ viewContext = new ManagementContextImpl(this);
+ }
+
+ //
+ registrations.put(view, viewContext);
+
+ //
+ for (ManagementProvider provider : kernelContext.getProviders())
+ {
+ Object name = provider.manage(this, view, metaData);
+ if (name != null)
+ {
+ viewContext.bilto.put(provider, name);
+ }
+ }
+
+ // Allow for more resource management
+ if (view instanceof ManagementAware)
+ {
+ ((ManagementAware)view).setContext(viewContext);
+ }
}
}
}
public void unregister(Object o)
{
- Object name = registrations.remove(o);
- if (name != null)
+ ManagementContextImpl context = registrations.remove(o);
+ if (context != null)
{
- provider.unmanage(name);
+ for (Map.Entry<ManagementProvider, Object> entry : context.bilto.entrySet()) {
+ entry.getKey().unmanage(entry.getValue());
+ }
}
}
- public List<Map<String, String>> getScopingProperties() {
- ArrayList<Map<String, String>> list = new ArrayList<Map<String, String>>();
+ public <S> List<S> getScopingProperties(Class<S> scopeType)
+ {
+ ArrayList<S> list = new ArrayList<S>();
for (ManagementContextImpl current = this; current != null; current = current.parent)
{
- if (current.scopingProperties != null)
+ Object scopedData = current.scopingProperties.get(scopeType);
+ if (scopedData != null)
{
- list.add(current.scopingProperties);
+ // It must be that type since we put it
+ list.add((S)scopedData);
}
}
return list;
Deleted: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ObjectNameBuilder.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ObjectNameBuilder.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ObjectNameBuilder.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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@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/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/PropertiesInfo.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/PropertiesInfo.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/PropertiesInfo.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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@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/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/PropertyInfo.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/PropertyInfo.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/PropertyInfo.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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@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/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/KernelManagementContext.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/KernelManagementContext.java (rev 0)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/KernelManagementContext.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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;
+
+import org.exoplatform.management.spi.jmx.JMXManagementProvider;
+import org.exoplatform.management.spi.ManagementProvider;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class KernelManagementContext
+{
+
+ /** . */
+ private final Set<ManagementProvider> providers;
+
+ public KernelManagementContext()
+ {
+ providers = Collections.<ManagementProvider>singleton(new JMXManagementProvider());
+ }
+
+ public KernelManagementContext(Set<ManagementProvider> providers)
+ {
+ this.providers = providers;
+ }
+
+ public Collection<ManagementProvider> getProviders() {
+ return providers;
+ }
+}
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractFilter.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractFilter.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractFilter.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractHttpServlet.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractHttpServlet.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractHttpServlet.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractHttpSessionListener.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractHttpSessionListener.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractHttpSessionListener.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/web/PortalContainerConfigOwner.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/web/PortalContainerConfigOwner.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/web/PortalContainerConfigOwner.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/web/PortalContainerCreator.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/web/PortalContainerCreator.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/web/PortalContainerCreator.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagementProvider.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagementProvider.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagementProvider.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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.management.spi;
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagementProviderContext.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagementProviderContext.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagementProviderContext.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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.management.spi;
@@ -35,9 +37,17 @@
*
* @return the scoping properties
*/
- List<Map<String, String>> getScopingProperties();
+ <S> List<S> getScopingProperties(Class<S> scopeType);
/**
+ * Callback to obtain a management provider context for the specified managed resource scoped with
+ * the provided properties.
+ *
+ * @param scopingProperties the scoping properties
+ */
+ <S> void setScopingData(Class<S> scopeType, S scopingProperties);
+
+ /**
* Before a managed resource is invoked by the management layer.
*
* @param managedResource the managed resource
@@ -51,14 +61,4 @@
*/
void afterInvoke(Object managedResource);
- /**
- * Callback to obtain a management provider context for the specified managed resource scoped with
- * the provided properties.
- *
- * @param managedResource the managed resource
- * @param scopingProperties the scoping properties
- * @return the context
- */
- ManagementProviderContext createContext(Object managedResource, Map<String, String> scopingProperties);
-
}
Copied: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/ExoMBeanInfoBuilder.java (from rev 1210, kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ExoMBeanInfoBuilder.java)
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/ExoMBeanInfoBuilder.java (rev 0)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/ExoMBeanInfoBuilder.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -0,0 +1,228 @@
+/*
+ * 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.jmx;
+
+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.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@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)
+ {
+ 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
+ {
+ 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]);
+ }
+}
Copied: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/ExoModelMBean.java (from rev 1210, kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ExoModelMBean.java)
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/ExoModelMBean.java (rev 0)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/ExoModelMBean.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -0,0 +1,164 @@
+/*
+ * 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.jmx;
+
+import org.exoplatform.management.spi.ManagementProviderContext;
+import org.exoplatform.management.ManagementAware;
+import org.exoplatform.management.ManagementContext;
+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@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ExoModelMBean extends RequiredModelMBean
+{
+
+ /** . */
+ private Object mr;
+
+ /** . */
+ private final ManagementProviderContext context;
+
+ public ExoModelMBean(ManagementProviderContext 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 scopingProperties = info != null ? info.resolve(mr) : new MBeanScopingData();
+
+ //
+ context.setScopingData(MBeanScopingData.class, scopingProperties);
+
+ //
+ 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 void register(Object o) throws IllegalArgumentException, NullPointerException
+ {
+ context.register(o);
+ }
+
+ public void unregister(Object o) throws IllegalArgumentException, NullPointerException
+ {
+ context.unregister(o);
+ }
+}
Copied: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/JMX.java (from rev 1209, kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/JMX.java)
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/JMX.java (rev 0)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/JMX.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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.spi.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@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);
+ }
+}
Copied: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/JMXManagementProvider.java (from rev 1211, kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/JMXManagementProvider.java)
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/JMXManagementProvider.java (rev 0)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/JMXManagementProvider.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -0,0 +1,181 @@
+/*
+ * 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.jmx;
+
+import org.exoplatform.management.spi.ManagedTypeMetaData;
+import org.exoplatform.management.spi.ManagementProvider;
+import org.exoplatform.management.spi.ManagementProviderContext;
+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@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(ManagementProviderContext context, Object managedResource, ManagedTypeMetaData metaData)
+ {
+ ExoModelMBean mbean = null;
+ try
+ {
+ ExoMBeanInfoBuilder infoBuilder = new ExoMBeanInfoBuilder(metaData);
+ ModelMBeanInfo info = infoBuilder.build();
+ mbean = new ExoModelMBean(context, managedResource, info);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ //
+ if (mbean != null)
+ {
+ ObjectName on = null;
+ PropertiesInfo oni = PropertiesInfo.resolve(managedResource.getClass(), NameTemplate.class);
+ if (oni != null)
+ {
+ try
+ {
+ Map<String, String> foo = oni.resolve(managedResource);
+ 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.getScopingProperties(MBeanScopingData.class);
+ for (MBeanScopingData scopingProperties : list)
+ {
+ props.putAll(scopingProperties);
+ }
+
+ // 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/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/MBeanScopingData.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/MBeanScopingData.java (rev 0)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/MBeanScopingData.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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.spi.jmx;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@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);
+ }
+}
Copied: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/ObjectNameBuilder.java (from rev 1209, kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ObjectNameBuilder.java)
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/ObjectNameBuilder.java (rev 0)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/ObjectNameBuilder.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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.spi.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@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;
+ }
+}
Copied: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/PropertiesInfo.java (from rev 1209, kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/PropertiesInfo.java)
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/PropertiesInfo.java (rev 0)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/PropertiesInfo.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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.spi.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@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;
+ }
+}
Copied: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/PropertyInfo.java (from rev 1209, kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/PropertyInfo.java)
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/PropertyInfo.java (rev 0)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/spi/jmx/PropertyInfo.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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.spi.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@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;
+ }
+ }
+
+}
Modified: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/ComponentWithRequestLifeCycle.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/ComponentWithRequestLifeCycle.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/ComponentWithRequestLifeCycle.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/LifeCycle.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/LifeCycle.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/LifeCycle.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainerInitTaskContextComparator.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainerInitTaskContextComparator.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainerInitTaskContextComparator.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestPropertyManagerConfigurator.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestPropertyManagerConfigurator.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestPropertyManagerConfigurator.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestRequestLifeCycle.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestRequestLifeCycle.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestRequestLifeCycle.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestUnifiedClassLoader.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestUnifiedClassLoader.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestUnifiedClassLoader.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestWebAppInitContextComparator.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestWebAppInitContextComparator.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestWebAppInitContextComparator.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/AbstractProfileTest.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/AbstractProfileTest.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/AbstractProfileTest.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/InitParamsHolder.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/InitParamsHolder.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/InitParamsHolder.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestCollectionValue.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestCollectionValue.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestCollectionValue.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestComponentPluginProfile.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestComponentPluginProfile.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestComponentPluginProfile.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestComponentProfile.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestComponentProfile.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestComponentProfile.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestField.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestField.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestField.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestImportProfile.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestImportProfile.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestImportProfile.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestInitParamProfile.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestInitParamProfile.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestInitParamProfile.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/AbstractTestExoMBean.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/AbstractTestExoMBean.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/AbstractTestExoMBean.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -19,6 +19,7 @@
package org.exoplatform.container.jmx;
import junit.framework.TestCase;
+import org.exoplatform.management.spi.jmx.ExoMBeanInfoBuilder;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
Modified: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestNameTemplate.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestNameTemplate.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestNameTemplate.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -22,6 +22,7 @@
import org.exoplatform.management.jmx.annotations.NameTemplate;
import org.exoplatform.management.jmx.annotations.Property;
+import org.exoplatform.management.spi.jmx.ObjectNameBuilder;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
Modified: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestPortalContainerManagedIntegration.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestPortalContainerManagedIntegration.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestPortalContainerManagedIntegration.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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;
@@ -47,12 +49,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/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/support/ManagedComponentRequestLifeCycle.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/support/ManagedComponentRequestLifeCycle.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/support/ManagedComponentRequestLifeCycle.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/support/SimpleManagementAware.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/support/SimpleManagementAware.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/support/SimpleManagementAware.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/support/ContainerBuilder.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/support/ContainerBuilder.java 2009-12-28 15:07:27 UTC (rev 1217)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/support/ContainerBuilder.java 2009-12-28 15:18:00 UTC (rev 1218)
@@ -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;
16 years, 4 months
exo-jcr SVN: r1217 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2009-12-28 10:07:27 -0500 (Mon, 28 Dec 2009)
New Revision: 1217
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexInfos.java
Log:
EXOJCR-327: Fixed set io mode.
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexInfos.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexInfos.java 2009-12-28 15:01:26 UTC (rev 1216)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexInfos.java 2009-12-28 15:07:27 UTC (rev 1217)
@@ -96,6 +96,7 @@
{
super(fileName);
this.cache = cache;
+ this.ioMode = ioMode;
// store parsed FQN to avoid it's parsing each time cache event is generated
namesFqn = Fqn.fromString(system ? SYSINDEX_NAMES : INDEX_NAMES);
if (ioMode == IndexerIoMode.READ_ONLY)
16 years, 4 months
exo-jcr SVN: r1216 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/prepare.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2009-12-28 10:01:26 -0500 (Mon, 28 Dec 2009)
New Revision: 1216
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/prepare/TestIndexUpdateMonitor.java
Log:
EXOJCR-331 : add IndexerIoMode to JbossCacheIndexUpdateMonitor
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/prepare/TestIndexUpdateMonitor.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/prepare/TestIndexUpdateMonitor.java 2009-12-28 14:58:50 UTC (rev 1215)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/prepare/TestIndexUpdateMonitor.java 2009-12-28 15:01:26 UTC (rev 1216)
@@ -20,6 +20,7 @@
import junit.framework.TestCase;
+import org.exoplatform.services.jcr.impl.core.query.IndexerIoMode;
import org.exoplatform.services.jcr.impl.core.query.jbosscache.JbossCacheIndexUpdateMonitor;
import org.exoplatform.services.jcr.impl.core.query.lucene.IndexUpdateMonitor;
import org.exoplatform.services.log.ExoLogger;
@@ -53,7 +54,7 @@
{
// TODO Auto-generated method stub
super.setUp();
- indexUpdateMonitor = new JbossCacheIndexUpdateMonitor(createCache());
+ indexUpdateMonitor = new JbossCacheIndexUpdateMonitor(createCache(), IndexerIoMode.READ_WRITE);
}
public void testSimpleBoolean() throws Exception
16 years, 4 months
exo-jcr SVN: r1215 - in jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query: lucene and 1 other directory.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2009-12-28 09:58:50 -0500 (Mon, 28 Dec 2009)
New Revision: 1215
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexChangesFilter.java
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexUpdateMonitor.java
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/DefaultIndexUpdateMonitor.java
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexUpdateMonitor.java
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
Log:
EXOJCR-331 : add IndexerIoMode to JbossCacheIndexUpdateMonitor
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexChangesFilter.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexChangesFilter.java 2009-12-28 14:55:23 UTC (rev 1214)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexChangesFilter.java 2009-12-28 14:58:50 UTC (rev 1215)
@@ -123,14 +123,14 @@
{
// TODO: uncomment it, when JbossCacheIndexInfos is finished.
parentHandler.setIndexInfos(new JbossCacheIndexInfos(cache, true, ioMode));
- parentHandler.setIndexUpdateMonitor(new JbossCacheIndexUpdateMonitor(cache));
+ parentHandler.setIndexUpdateMonitor(new JbossCacheIndexUpdateMonitor(cache, ioMode));
parentHandler.init();
}
if (!handler.isInitialized())
{
// TODO: uncomment it, when JbossCacheIndexInfos is finished.
handler.setIndexInfos(new JbossCacheIndexInfos(cache, false, ioMode));
- handler.setIndexUpdateMonitor(new JbossCacheIndexUpdateMonitor(cache));
+ handler.setIndexUpdateMonitor(new JbossCacheIndexUpdateMonitor(cache, ioMode));
handler.init();
}
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexUpdateMonitor.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexUpdateMonitor.java 2009-12-28 14:55:23 UTC (rev 1214)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexUpdateMonitor.java 2009-12-28 14:58:50 UTC (rev 1215)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.jcr.impl.core.query.jbosscache;
+import org.exoplatform.services.jcr.impl.core.query.IndexerIoMode;
import org.exoplatform.services.jcr.impl.core.query.lucene.IndexUpdateMonitor;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -25,6 +26,7 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
+import java.io.IOException;
import java.io.Serializable;
import javax.transaction.RollbackException;
@@ -49,13 +51,19 @@
private final static String PARAMETER_NAME = "index-update-in-progress";
+ public IndexerIoMode ioMode;
+
/**
* @param cache instance of JbossCache that is used to deliver index names
*/
- public JbossCacheIndexUpdateMonitor(Cache<Serializable, Object> cache)
+ public JbossCacheIndexUpdateMonitor(Cache<Serializable, Object> cache, IndexerIoMode ioMode)
{
this.cache = cache;
- setUpdateInProgress(false);
+ this.ioMode = ioMode;
+ if (IndexerIoMode.READ_WRITE == ioMode)
+ {
+ setUpdateInProgress(false);
+ }
}
@@ -73,6 +81,11 @@
*/
public void setUpdateInProgress(boolean updateInProgress)
{
+ if (IndexerIoMode.READ_ONLY == ioMode)
+ {
+ throw new IllegalStateException("Unable to set updateInProgress value in IndexerIoMode.READ_ONLY mode");
+ }
+
log.info("setUpdateInProgress=" + updateInProgress);
TransactionManager tm = ((CacheSPI<Serializable, Object>)cache).getTransactionManager();
try
@@ -109,4 +122,14 @@
}
}
+
+ /**
+ * Sets {@link IndexerIoMode} to indexInfos;
+ * @param ioMode
+ * @throws IOException
+ */
+ public void setIoMode(IndexerIoMode ioMode) throws IOException
+ {
+ this.ioMode = ioMode;
+ }
}
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/DefaultIndexUpdateMonitor.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/DefaultIndexUpdateMonitor.java 2009-12-28 14:55:23 UTC (rev 1214)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/DefaultIndexUpdateMonitor.java 2009-12-28 14:58:50 UTC (rev 1215)
@@ -18,6 +18,9 @@
*/
package org.exoplatform.services.jcr.impl.core.query.lucene;
+import org.exoplatform.services.jcr.impl.core.query.IndexerIoMode;
+
+import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;
/**
@@ -29,6 +32,8 @@
{
private AtomicBoolean updateInProgress;
+ private IndexerIoMode ioMode;
+
/**
* @param semaphore
*/
@@ -56,4 +61,13 @@
{
this.updateInProgress.set(updateInProgress);
}
+
+ /**
+ * @see org.exoplatform.services.jcr.impl.core.query.lucene.IndexUpdateMonitor#setIoMode(org.exoplatform.services.jcr.impl.core.query.IndexerIoMode)
+ */
+ public void setIoMode(IndexerIoMode ioMode) throws IOException
+ {
+ this.ioMode = ioMode;
+ }
+
}
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexUpdateMonitor.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexUpdateMonitor.java 2009-12-28 14:55:23 UTC (rev 1214)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexUpdateMonitor.java 2009-12-28 14:58:50 UTC (rev 1215)
@@ -18,6 +18,10 @@
*/
package org.exoplatform.services.jcr.impl.core.query.lucene;
+import org.exoplatform.services.jcr.impl.core.query.IndexerIoMode;
+
+import java.io.IOException;
+
/**
* @author <a href="mailto:Sergey.Kabashnyuk@exoplatform.org">Sergey Kabashnyuk</a>
* @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z ksm $
@@ -35,4 +39,11 @@
*/
void setUpdateInProgress(boolean updateInProgress);
+ /**
+ * Sets {@link IndexerIoMode} to indexInfos;
+ * @param ioMode
+ * @throws IOException
+ */
+ public void setIoMode(IndexerIoMode ioMode) throws IOException;
+
}
\ No newline at end of file
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2009-12-28 14:55:23 UTC (rev 1214)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2009-12-28 14:58:50 UTC (rev 1215)
@@ -2358,6 +2358,7 @@
{
this.ioMode = ioMode;
indexNames.setIoMode(ioMode);
+ indexUpdateMonitor.setIoMode(ioMode);
switch (ioMode)
{
case READ_ONLY :
16 years, 4 months
exo-jcr SVN: r1214 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2009-12-28 09:55:23 -0500 (Mon, 28 Dec 2009)
New Revision: 1214
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws.xml
Log:
EXOJCR-331 : configured index cache
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws.xml 2009-12-28 14:21:58 UTC (rev 1213)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws.xml 2009-12-28 14:55:23 UTC (rev 1214)
@@ -2,7 +2,7 @@
<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:jboss:jbosscache-core:config:3.1">
- <locking useLockStriping="false" concurrencyLevel="50000" />
+ <locking useLockStriping="false" concurrencyLevel="50000" lockParentForChildInsertRemove="false" lockAcquisitionTimeout="20000" />
<!-- Configure the TransactionManager -->
<transaction
16 years, 4 months