exo-jcr SVN: r1334 - in ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl: method and 1 other directory.
by do-not-reply@jboss.org
Author: max_shaposhnik
Date: 2010-01-11 04:47:10 -0500 (Mon, 11 Jan 2010)
New Revision: 1334
Added:
ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/AbstractResourceTest.java
ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/WebApplicationExceptionTest.java
Log:
https://jira.jboss.org/jira/browse/EXOJCR-353;
Added: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/AbstractResourceTest.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/AbstractResourceTest.java (rev 0)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/AbstractResourceTest.java 2010-01-11 09:47:10 UTC (rev 1334)
@@ -0,0 +1,79 @@
+/*
+ * 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.rest.impl;
+
+import org.exoplatform.services.rest.impl.ContainerRequest;
+import org.exoplatform.services.rest.impl.ContainerResponse;
+import org.exoplatform.services.rest.impl.EnvironmentContext;
+import org.exoplatform.services.rest.impl.InputHeadersMap;
+import org.exoplatform.services.rest.impl.MultivaluedMapImpl;
+import org.exoplatform.services.rest.tools.DummyContainerResponseWriter;
+import org.exoplatform.services.test.mock.MockHttpServletRequest;
+import org.exoplatform.services.rest.ContainerResponseWriter;
+
+import java.io.ByteArrayInputStream;
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.core.MultivaluedMap;
+
+/**
+ * @author <a href="mailto:andrew00x@gmail.com">Andrey Parfonov</a>
+ * @version $Id$
+ */
+public abstract class AbstractResourceTest extends BaseTest
+{
+
+ // public void setUp() throws Exception {
+ // super.setUp();
+ // }
+
+ public ContainerResponse service(String method, String requestURI, String baseURI,
+ Map<String, List<String>> headers, byte[] data, ContainerResponseWriter writer) throws Exception
+ {
+
+ if (headers == null)
+ headers = new MultivaluedMapImpl();
+
+ ByteArrayInputStream in = null;
+ if (data != null)
+ in = new ByteArrayInputStream(data);
+
+ EnvironmentContext envctx = new EnvironmentContext();
+ HttpServletRequest httpRequest =
+ new MockHttpServletRequest("", in, in != null ? in.available() : 0, method, headers);
+ envctx.put(HttpServletRequest.class, httpRequest);
+ EnvironmentContext.setCurrent(envctx);
+ ContainerRequest request =
+ new ContainerRequest(method, new URI(requestURI), new URI(baseURI), in, new InputHeadersMap(headers));
+ ContainerResponse response = new ContainerResponse(writer);
+ requestHandler.handleRequest(request, response);
+ return response;
+ }
+
+ public ContainerResponse service(String method, String requestURI, String baseURI,
+ MultivaluedMap<String, String> headers, byte[] data) throws Exception
+ {
+ return service(method, requestURI, baseURI, headers, data, new DummyContainerResponseWriter());
+
+ }
+
+}
Property changes on: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/AbstractResourceTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/WebApplicationExceptionTest.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/WebApplicationExceptionTest.java (rev 0)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/WebApplicationExceptionTest.java 2010-01-11 09:47:10 UTC (rev 1334)
@@ -0,0 +1,81 @@
+/*
+ * 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.rest.impl.method;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+
+import org.exoplatform.services.rest.impl.AbstractResourceTest;
+import org.exoplatform.services.rest.impl.method.MethodExceptionTest.UncheckedException;
+
+/**
+ * Created by The eXo Platform SAS. <br/>
+ * Date: 24 Dec 2009
+ *
+ * @author <a href="mailto:max.shaposhnik@exoplatform.com">Max Shaposhnik</a>
+ * @version $Id: WebApplicationExceptionTest.java
+ */
+public class WebApplicationExceptionTest extends AbstractResourceTest
+{
+
+ @Path("/a")
+ public static class Resource1
+ {
+
+ @GET
+ @Path("/0")
+ public void m0() throws WebApplicationException
+ {
+ Exception e = new Exception("testmsg");
+ throw new WebApplicationException(e, 500);
+ }
+
+ @GET
+ @Path("/1")
+ public Response m1() throws WebApplicationException
+ {
+ throw new WebApplicationException(500);
+ }
+
+ @GET
+ @Path("/2")
+ public void m2() throws Exception
+ {
+ throw new UncheckedException("Unchecked exception");
+ }
+
+ }
+
+ public void testExceptionMessage() throws Exception
+ {
+ Resource1 resource = new Resource1();
+ registry(resource);
+
+ assertEquals(500, service("GET", "/a/0", "", null, null).getStatus());
+ String entity = (String)service("GET", "/a/0", "", null, null).getEntity();
+ assertTrue(entity.indexOf("testmsg") > 0);
+
+ assertEquals(500, service("GET", "/a/1", "", null, null).getStatus());
+ assertEquals(null, service("GET", "/a/1", "", null, null).getEntity());
+ unregistry(resource);
+ }
+
+}
Property changes on: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/WebApplicationExceptionTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
16 years, 3 months
exo-jcr SVN: r1333 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2010-01-11 04:21:36 -0500 (Mon, 11 Jan 2010)
New Revision: 1333
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/CompressedChangesList.java
Log:
EXOJCR-371: Some comments removed from CompressedChangesList
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/CompressedChangesList.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/CompressedChangesList.java 2010-01-10 19:25:20 UTC (rev 1332)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/CompressedChangesList.java 2010-01-11 09:21:36 UTC (rev 1333)
@@ -58,7 +58,6 @@
public boolean add(ChangesContainer e)
{
historyIndex++;
- // TODO: most interesting is here
optimize(e);
changesList.add(e);
return false;
16 years, 3 months
exo-jcr SVN: r1332 - in jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src: test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache and 1 other directory.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2010-01-10 14:25:20 -0500 (Sun, 10 Jan 2010)
New Revision: 1332
Added:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/CompressedChangesList.java
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestCompressedList.java
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java
Log:
EXOJCR-371: Added CompressedChangesList and test for it and BufferedCache modified: inner classes are now public and CompressedChangesList is used.
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java 2010-01-10 18:27:37 UTC (rev 1331)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java 2010-01-10 19:25:20 UTC (rev 1332)
@@ -14,7 +14,6 @@
import org.jgroups.Address;
import java.io.Serializable;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -32,7 +31,7 @@
*/
private final Cache<Serializable, Object> parentCache;
- private ThreadLocal<List<ChangesContainer>> changesList = new ThreadLocal<List<ChangesContainer>>();
+ private ThreadLocal<CompressedChangesList> changesList = new ThreadLocal<CompressedChangesList>();
public BufferedJBossCache(Cache<Serializable, Object> parentCache)
{
@@ -45,7 +44,7 @@
*/
public void beginTransaction()
{
- changesList.set(new ArrayList<ChangesContainer>());
+ changesList.set(new CompressedChangesList());
}
/**
@@ -53,7 +52,7 @@
*/
public void commitTransaction()
{
- List<ChangesContainer> changesContainer = changesList.get();
+ CompressedChangesList changesContainer = changesList.get();
if (changesContainer == null)
{
throw new IllegalStateException("changesContainer should not be empty");
@@ -347,12 +346,12 @@
public void put(Fqn fqn, Map<? extends Serializable, ? extends Object> data)
{
//parentCache.put(fqn, data);
- List<ChangesContainer> changesContainer = changesList.get();
+ CompressedChangesList changesContainer = changesList.get();
if (changesContainer == null)
{
throw new IllegalStateException("changesContainer should not be empty");
}
- changesContainer.add(new PutObjectContainer(fqn, data, parentCache, changesContainer.size()));
+ changesContainer.add(new PutObjectContainer(fqn, data, parentCache, changesContainer.getHistoryIndex()));
}
/* (non-Javadoc)
@@ -360,12 +359,12 @@
*/
public Object put(Fqn fqn, Serializable key, Object value)
{
- List<ChangesContainer> changesContainer = changesList.get();
+ CompressedChangesList changesContainer = changesList.get();
if (changesContainer == null)
{
throw new IllegalStateException("changesContainer should not be empty");
}
- changesContainer.add(new PutKeyValueContainer(fqn, key, value, parentCache, changesContainer.size()));
+ changesContainer.add(new PutKeyValueContainer(fqn, key, value, parentCache, changesContainer.getHistoryIndex()));
return parentCache.get(fqn, key);
}
@@ -400,12 +399,12 @@
*/
public Object remove(Fqn fqn, Serializable key)
{
- List<ChangesContainer> changesContainer = changesList.get();
+ CompressedChangesList changesContainer = changesList.get();
if (changesContainer == null)
{
throw new IllegalStateException("changesContainer should not be empty");
}
- changesContainer.add(new RemoveKeyContainer(fqn, key, parentCache, changesContainer.size()));
+ changesContainer.add(new RemoveKeyContainer(fqn, key, parentCache, changesContainer.getHistoryIndex()));
return parentCache.get(fqn, key);
}
@@ -446,12 +445,12 @@
*/
public boolean removeNode(Fqn fqn)
{
- List<ChangesContainer> changesContainer = changesList.get();
+ CompressedChangesList changesContainer = changesList.get();
if (changesContainer == null)
{
throw new IllegalStateException("changesContainer should not be empty");
}
- changesContainer.add(new RemoveNodeContainer(fqn, parentCache, changesContainer.size()));
+ changesContainer.add(new RemoveNodeContainer(fqn, parentCache, changesContainer.getHistoryIndex()));
return true;
}
@@ -508,8 +507,8 @@
return ((CacheSPI<Serializable, Object>)parentCache).getTransactionManager();
}
- private static enum ChangesType {
- REMOVED, ADDED;
+ public static enum ChangesType {
+ REMOVE, REMOVE_KEY, PUT, PUT_KEY;
}
/**
@@ -517,7 +516,7 @@
* @author sj
*
*/
- private static abstract class ChangesContainer implements Comparable<ChangesContainer>
+ public static abstract class ChangesContainer implements Comparable<ChangesContainer>
{
protected final Fqn fqn;
@@ -583,14 +582,14 @@
* @author sj
*
*/
- private static class PutObjectContainer extends ChangesContainer
+ public static class PutObjectContainer extends ChangesContainer
{
private final Map<? extends Serializable, ? extends Object> data;
public PutObjectContainer(Fqn fqn, Map<? extends Serializable, ? extends Object> data,
Cache<Serializable, Object> cache, int historicalIndex)
{
- super(fqn, ChangesType.ADDED, cache, historicalIndex);
+ super(fqn, ChangesType.PUT, cache, historicalIndex);
this.data = data;
}
@@ -607,7 +606,7 @@
* @author sj
*
*/
- private static class PutKeyValueContainer extends ChangesContainer
+ public static class PutKeyValueContainer extends ChangesContainer
{
private final Serializable key;
@@ -616,7 +615,7 @@
public PutKeyValueContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
int historicalIndex)
{
- super(fqn, ChangesType.ADDED, cache, historicalIndex);
+ super(fqn, ChangesType.PUT_KEY, cache, historicalIndex);
this.key = key;
this.value = value;
}
@@ -633,13 +632,13 @@
* @author sj
*
*/
- private static class RemoveKeyContainer extends ChangesContainer
+ public static class RemoveKeyContainer extends ChangesContainer
{
private final Serializable key;
public RemoveKeyContainer(Fqn fqn, Serializable key, Cache<Serializable, Object> cache, int historicalIndex)
{
- super(fqn, ChangesType.REMOVED, cache, historicalIndex);
+ super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex);
this.key = key;
}
@@ -657,12 +656,12 @@
* @author sj
*
*/
- private static class RemoveNodeContainer extends ChangesContainer
+ public static class RemoveNodeContainer extends ChangesContainer
{
public RemoveNodeContainer(Fqn fqn, Cache<Serializable, Object> cache, int historicalIndex)
{
- super(fqn, ChangesType.REMOVED, cache, historicalIndex);
+ super(fqn, ChangesType.REMOVE, cache, historicalIndex);
}
@Override
Added: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/CompressedChangesList.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/CompressedChangesList.java (rev 0)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/CompressedChangesList.java 2010-01-10 19:25:20 UTC (rev 1332)
@@ -0,0 +1,286 @@
+/*
+ * Copyright (C) 2010 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.dataflow.persistent.jbosscache;
+
+import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.ChangesContainer;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.ChangesType;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+/**
+ * This class implement algorithm of list compressing, omitting unnecessary
+ * changes and optimizing list. I.e. if added REMOVE /a/b, then list removes
+ * all changes made for /a/b/*
+ *
+ * @author <a href="mailto:nikolazius@gmail.com">Nikolay Zamosenchuk</a>
+ * @version $Id: CompressedChangesList.java 0 2009-07-22 23:58:59Z nzamosenchuk $
+ *
+ */
+public class CompressedChangesList implements List<ChangesContainer>
+{
+ private List<ChangesContainer> changesList = new ArrayList<ChangesContainer>();
+
+ private int historyIndex = 0;
+
+ /**
+ * After each add this field is incremented, so each change can use it as a
+ * history timestamp to identify original order
+ * @return
+ */
+ public int getHistoryIndex()
+ {
+ return historyIndex;
+ }
+
+ /**
+ * @see java.util.List#add(java.lang.Object)
+ */
+ public boolean add(ChangesContainer e)
+ {
+ historyIndex++;
+ // TODO: most interesting is here
+ optimize(e);
+ changesList.add(e);
+ return false;
+ }
+
+ private int optimize(ChangesContainer newChange)
+ {
+
+ Iterator<ChangesContainer> iter = changesList.iterator();
+ // if /a/b REMOVE performed, then remove all changes from list
+ // made on any child /a/b/* (remove usecase)
+ if (newChange.getChangesType() == ChangesType.REMOVE)
+ {
+ while (iter.hasNext())
+ {
+ ChangesContainer c = iter.next();
+ if (c.getFqn().isChildOrEquals(newChange.getFqn()))
+ {
+ iter.remove();
+ }
+ }
+ }
+ // if /a/b PUT performed, then remove all previous PUT or PUT_VALUE
+ // performed on exact /a/b path (rewrite usecase)
+ else if (newChange.getChangesType() == ChangesType.PUT)
+ {
+ while (iter.hasNext())
+ {
+ ChangesContainer c = iter.next();
+ if (c.getFqn().equals(newChange.getFqn()))
+ {
+ iter.remove();
+ }
+ }
+ }
+
+ return 0;
+ }
+
+ /**
+ * @see java.util.List#add(int, java.lang.Object)
+ */
+ public void add(int index, ChangesContainer element)
+ {
+ throw new UnsupportedOperationException("Unexpected method call ");
+ }
+
+ /**
+ * @see java.util.List#addAll(java.util.Collection)
+ */
+ public boolean addAll(Collection<? extends ChangesContainer> c)
+ {
+ throw new UnsupportedOperationException("Unexpected method call ");
+ }
+
+ /**
+ * @see java.util.List#addAll(int, java.util.Collection)
+ */
+ public boolean addAll(int index, Collection<? extends ChangesContainer> c)
+ {
+ throw new UnsupportedOperationException("Unexpected method call ");
+ }
+
+ /**
+ * @see java.util.List#clear()
+ */
+ public void clear()
+ {
+ changesList.clear();
+ }
+
+ /**
+ * @see java.util.List#contains(java.lang.Object)
+ */
+ public boolean contains(Object o)
+ {
+ return changesList.contains(o);
+ }
+
+ /**
+ * @see java.util.List#containsAll(java.util.Collection)
+ */
+ public boolean containsAll(Collection<?> c)
+ {
+ return changesList.containsAll(c);
+ }
+
+ /**
+ * @see java.util.List#get(int)
+ */
+ public ChangesContainer get(int index)
+ {
+ return changesList.get(index);
+ }
+
+ /**
+ * @see java.util.List#indexOf(java.lang.Object)
+ */
+ public int indexOf(Object o)
+ {
+ return changesList.indexOf(o);
+ }
+
+ /**
+ * @see java.util.List#isEmpty()
+ */
+ public boolean isEmpty()
+ {
+ return changesList.isEmpty();
+ }
+
+ /**
+ * @see java.util.List#iterator()
+ */
+ public Iterator<ChangesContainer> iterator()
+ {
+ return changesList.iterator();
+ }
+
+ /**
+ * @see java.util.List#lastIndexOf(java.lang.Object)
+ */
+ public int lastIndexOf(Object o)
+ {
+ return changesList.lastIndexOf(o);
+ }
+
+ /**
+ * @see java.util.List#listIterator()
+ */
+ public ListIterator<ChangesContainer> listIterator()
+ {
+ return changesList.listIterator();
+ }
+
+ /**
+ * @see java.util.List#listIterator(int)
+ */
+ public ListIterator<ChangesContainer> listIterator(int index)
+ {
+ return changesList.listIterator(index);
+ }
+
+ /**
+ * @see java.util.List#remove(java.lang.Object)
+ */
+ public boolean remove(Object o)
+ {
+ throw new UnsupportedOperationException("Unexpected method call ");
+ }
+
+ /**
+ * @see java.util.List#remove(int)
+ */
+ public ChangesContainer remove(int index)
+ {
+ throw new UnsupportedOperationException("Unexpected method call ");
+ }
+
+ /**
+ * @see java.util.List#removeAll(java.util.Collection)
+ */
+ public boolean removeAll(Collection<?> c)
+ {
+ throw new UnsupportedOperationException("Unexpected method call ");
+ }
+
+ /**
+ * @see java.util.List#retainAll(java.util.Collection)
+ */
+ public boolean retainAll(Collection<?> c)
+ {
+ throw new UnsupportedOperationException("Unexpected method call ");
+ }
+
+ /**
+ * @see java.util.List#set(int, java.lang.Object)
+ */
+ public ChangesContainer set(int index, ChangesContainer element)
+ {
+ return changesList.set(index, element);
+ }
+
+ /**
+ * @see java.util.List#size()
+ */
+ public int size()
+ {
+ return changesList.size();
+ }
+
+ /**
+ * @see java.util.List#subList(int, int)
+ */
+ public List<ChangesContainer> subList(int fromIndex, int toIndex)
+ {
+ return changesList.subList(fromIndex, toIndex);
+ }
+
+ /**
+ * @see java.util.List#toArray()
+ */
+ public Object[] toArray()
+ {
+ return changesList.toArray();
+ }
+
+ /**
+ * @see java.util.List#toArray(T[])
+ */
+ public <T> T[] toArray(T[] a)
+ {
+ return changesList.toArray(a);
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString()
+ {
+ return changesList.toString();
+ }
+
+}
Property changes on: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/CompressedChangesList.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestCompressedList.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestCompressedList.java (rev 0)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestCompressedList.java 2010-01-10 19:25:20 UTC (rev 1332)
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2010 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.dataflow.persistent.jbosscache;
+
+import junit.framework.TestCase;
+
+import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.ChangesContainer;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.PutObjectContainer;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.RemoveNodeContainer;
+import org.jboss.cache.Fqn;
+
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:foo@bar.org">Foo Bar</a>
+ * @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z aheritier $
+ *
+ */
+public class TestCompressedList extends TestCase
+{
+
+ public void testPutOmit()
+ {
+ CompressedChangesList changesList = new CompressedChangesList();
+ ChangesContainer put1 =
+ new PutObjectContainer(Fqn.fromString("/a/b"), new HashMap<String, String>(), null, changesList
+ .getHistoryIndex());
+ ChangesContainer put2 =
+ new PutObjectContainer(Fqn.fromString("/a/b/c"), new HashMap<String, String>(), null, changesList
+ .getHistoryIndex());
+ ChangesContainer rm1 = new RemoveNodeContainer(Fqn.fromString("/a/b"), null, changesList.getHistoryIndex());
+ changesList.add(put1);
+ changesList.add(put2);
+ assertTrue("List MUST contain put container", changesList.contains(put1));
+ assertTrue("List MUST contain put container", changesList.contains(put2));
+ changesList.add(rm1);
+ assertFalse("List still contains put container", changesList.contains(put1));
+ assertFalse("List still contains put container", changesList.contains(put2));
+ assertTrue("List MUST contain remove container", changesList.contains(rm1));
+ }
+
+ public void testDoublePutOmit()
+ {
+ CompressedChangesList changesList = new CompressedChangesList();
+ ChangesContainer put1 =
+ new PutObjectContainer(Fqn.fromString("/a/b"), new HashMap<String, String>(), null, changesList
+ .getHistoryIndex());
+ ChangesContainer put2 =
+ new PutObjectContainer(Fqn.fromString("/a/b"), new HashMap<String, String>(), null, changesList
+ .getHistoryIndex());
+
+ changesList.add(put1);
+ assertTrue("List MUST contain put container", changesList.contains(put1));
+ changesList.add(put2);
+ assertFalse("List still contains old put container", changesList.contains(put1));
+ assertTrue("List MUST contain new put container", changesList.contains(put2));
+ }
+
+ public void testPutKeyOmit()
+ {
+ CompressedChangesList changesList = new CompressedChangesList();
+ ChangesContainer put1 =
+ new PutObjectContainer(Fqn.fromString("/a/b"), new HashMap<String, String>(), null, changesList
+ .getHistoryIndex());
+ ChangesContainer put2 =
+ new PutObjectContainer(Fqn.fromString("/a/b"), new HashMap<String, String>(), null, changesList
+ .getHistoryIndex());
+
+ changesList.add(put1);
+ assertTrue("List MUST contain put container", changesList.contains(put1));
+ changesList.add(put2);
+ assertFalse("List still contains old put container", changesList.contains(put1));
+ assertTrue("List MUST contain new put container", changesList.contains(put2));
+ }
+
+ public void testPutChildOmit()
+ {
+ CompressedChangesList changesList = new CompressedChangesList();
+ ChangesContainer put1 =
+ new PutObjectContainer(Fqn.fromString("/a/b"), new HashMap<String, String>(), null, changesList
+ .getHistoryIndex());
+ ChangesContainer put2 =
+ new PutObjectContainer(Fqn.fromString("/a/b/c"), new HashMap<String, String>(), null, changesList
+ .getHistoryIndex());
+ ChangesContainer rm1 = new RemoveNodeContainer(Fqn.fromString("/a/b"), null, changesList.getHistoryIndex());
+ changesList.add(put1);
+ changesList.add(put2);
+ assertTrue("List MUST contain put container", changesList.contains(put1));
+ assertTrue("List MUST contain put container", changesList.contains(put2));
+ changesList.add(rm1);
+ assertFalse("List still contains old put container", changesList.contains(put1));
+ assertFalse("List still contains old put container", changesList.contains(put2));
+ assertTrue("List MUST contain remove container", changesList.contains(rm1));
+ }
+
+}
Property changes on: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestCompressedList.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 3 months
exo-jcr SVN: r1331 - in kernel/branches/mc-int-branch: exo.kernel.commons/src/test/java/org/exoplatform/commons/utils and 28 other directories.
by do-not-reply@jboss.org
Author: mstruk
Date: 2010-01-10 13:27:37 -0500 (Sun, 10 Jan 2010)
New Revision: 1331
Added:
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableComponentAdapter.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableComponentAdapterFactory.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagementContextImpl.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/annotations/Impact.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/annotations/ImpactType.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/annotations/package-info.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/annotations/package-info.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/ExoMBeanInfoBuilder.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/ExoModelMBean.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/JMX.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/JMXManagementProvider.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/MBeanScopingData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/ObjectNameBuilder.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/PropertiesInfo.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/PropertyInfo.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/package-info.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMetaData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMethodMetaData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMethodParameterMetaData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedParameterMetaData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedPropertyMetaData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedResource.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedTypeMetaData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagementProvider.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/package-info.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/Bar.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/Foo.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagedResource.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagementProviderImpl.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ResourceKey.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ScopedData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/TestManagementProvider.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/metadata/
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/metadata/Bar.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/metadata/Foo.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/metadata/TestMetaData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/
kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/configuration1.xml
kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/configuration2.xml
kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/portal-configuration1.xml
kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/portal-configuration2.xml
kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/root-configuration.xml
kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/xsd_1_0/sample-configuration-17.xml
kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/xsd_1_1/sample-configuration-18.xml
kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/src/test/resources/
kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/src/test/resources/jboss-log4j.xml
Removed:
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ExoMBeanInfoBuilder.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ExoModelMBean.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/JMX.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableComponentAdapter.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableComponentAdapterFactory.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableContainer.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManagementContextImpl.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ObjectNameBuilder.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/PropertiesInfo.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/PropertyInfo.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedMetaData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedMethodMetaData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedMethodParameterMetaData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedParameterMetaData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedPropertyMetaData.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedTypeMetaData.java
Modified:
kernel/branches/mc-int-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/PropertiesLoader.java
kernel/branches/mc-int-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java
kernel/branches/mc-int-branch/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestPropertiesLoader.java
kernel/branches/mc-int-branch/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestTools.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/ExoContainer.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainerClassLoader.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainerContext.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/PropertyConfigurator.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/UnifiedClassLoader.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/WebAppInitContext.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycle.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycleStack.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/EntityResolverImpl.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/Namespaces.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ProfileDOMFilter.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinition.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinitionPlugin.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/MetaDataBuilder.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractFilter.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractHttpServlet.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractHttpSessionListener.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/PortalContainerConfigOwner.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/PortalContainerCreator.java
kernel/branches/mc-int-branch/exo.kernel.container/src/main/resources/org/exoplatform/container/configuration/kernel-configuration_1_0.xsd
kernel/branches/mc-int-branch/exo.kernel.container/src/main/resources/org/exoplatform/container/configuration/kernel-configuration_1_1.xsd
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/ComponentWithRequestLifeCycle.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/LifeCycle.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainerInitTaskContextComparator.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestPropertyManagerConfigurator.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestRequestLifeCycle.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestUnifiedClassLoader.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestWebAppInitContextComparator.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/AbstractProfileTest.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/InitParamsHolder.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestCollectionValue.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestComponentPluginProfile.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestComponentProfile.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestField.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestImportProfile.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestInitParamProfile.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestXSD_1_0.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestXSD_1_1.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/AbstractTestExoMBean.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestExoMBeanOperation.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestNameTemplate.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestPortalContainerManagedIntegration.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/support/ManagedComponentRequestLifeCycle.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/support/SimpleManagementAware.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/support/ContainerBuilder.java
kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/xsd_1_1/sample-configuration-17.xml
kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/pom.xml
Log:
merged in from trunk up to r1330
Modified: kernel/branches/mc-int-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/PropertiesLoader.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/PropertiesLoader.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/PropertiesLoader.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.commons.utils;
Modified: kernel/branches/mc-int-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.commons.utils;
Modified: kernel/branches/mc-int-branch/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestPropertiesLoader.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestPropertiesLoader.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestPropertiesLoader.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.commons.utils;
Modified: kernel/branches/mc-int-branch/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestTools.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestTools.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestTools.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.commons.utils;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/ExoContainer.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/ExoContainer.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/ExoContainer.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -21,8 +21,7 @@
import org.exoplatform.commons.utils.PropertyManager;
import org.exoplatform.container.component.ComponentLifecyclePlugin;
import org.exoplatform.container.configuration.ConfigurationManager;
-import org.exoplatform.container.jmx.ManageableContainer;
-import org.exoplatform.container.jmx.ManagementContextImpl;
+import org.exoplatform.container.management.ManageableContainer;
import org.exoplatform.container.util.ContainerUtil;
import org.exoplatform.container.xml.InitParams;
import org.exoplatform.services.log.ExoLogger;
@@ -30,7 +29,6 @@
import org.picocontainer.PicoContainer;
import org.picocontainer.defaults.ComponentAdapterFactory;
-import javax.management.MBeanServer;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.Collections;
@@ -86,15 +84,6 @@
public ExoContainer()
{
- super(new ManagementContextImpl());
-
- //
-
- }
-
- public ExoContainer(MBeanServer mbeanServer)
- {
- super(new ManagementContextImpl(mbeanServer));
context = new ExoContainerContext(this);
context.setName(this.getClass().getName());
registerComponentInstance(context);
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainerClassLoader.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainerClassLoader.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainerClassLoader.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainerContext.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainerContext.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainerContext.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/PropertyConfigurator.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/PropertyConfigurator.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/PropertyConfigurator.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -35,7 +35,6 @@
import org.picocontainer.ComponentAdapter;
import java.io.File;
-import java.lang.management.ManagementFactory;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashSet;
@@ -47,7 +46,6 @@
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.PriorityBlockingQueue;
-import javax.management.MBeanServer;
import javax.servlet.ServletContext;
/**
@@ -59,17 +57,6 @@
public class RootContainer extends ExoContainer
{
- private static MBeanServer findMBeanServer()
- {
- J2EEServerInfo serverenv_ = new J2EEServerInfo();
- MBeanServer server = serverenv_.getMBeanServer();
- if (server == null)
- {
- server = ManagementFactory.getPlatformMBeanServer();
- }
- return server;
- }
-
/** The field is volatile to properly implement the double checked locking pattern. */
private static volatile RootContainer singleton_;
@@ -98,9 +85,6 @@
public RootContainer()
{
- super(findMBeanServer());
-
- //
Set<String> profiles = new HashSet<String>();
// Add the profile defined by the server name
@@ -349,7 +333,7 @@
pcontainer.start();
// Register the portal as an mbean
- managementContext.register(pcontainer);
+ getManagementContext().register(pcontainer);
//
executeInitTasks(pcontainer, PortalContainerPostInitTask.TYPE);
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/UnifiedClassLoader.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/UnifiedClassLoader.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/UnifiedClassLoader.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/WebAppInitContext.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/WebAppInitContext.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/WebAppInitContext.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycle.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycle.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycle.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.component;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycleStack.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycleStack.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/component/RequestLifeCycleStack.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.component;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.container.configuration;
+import org.exoplatform.commons.utils.PropertyManager;
import org.exoplatform.container.xml.Configuration;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -172,10 +173,13 @@
public Configuration unmarshall(URL url) throws Exception
{
- boolean valid = isValid(url);
- if (!valid)
+ if (PropertyManager.isDevelopping())
{
- log.info("The configuration file " + url + " was not found valid according to its XSD");
+ boolean valid = isValid(url);
+ if (!valid)
+ {
+ log.info("The configuration file " + url + " was not found valid according to its XSD");
+ }
}
//
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/EntityResolverImpl.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/EntityResolverImpl.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/EntityResolverImpl.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.configuration;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/Namespaces.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/Namespaces.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/Namespaces.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.configuration;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ProfileDOMFilter.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ProfileDOMFilter.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ProfileDOMFilter.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.configuration;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.definition;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinition.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinition.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinition.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.definition;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinitionPlugin.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinitionPlugin.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinitionPlugin.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.definition;
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ExoMBeanInfoBuilder.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ExoMBeanInfoBuilder.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ExoMBeanInfoBuilder.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,231 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.jmx;
-
-import org.exoplatform.container.management.ManagedMethodMetaData;
-import org.exoplatform.container.management.ManagedMethodParameterMetaData;
-import org.exoplatform.container.management.ManagedPropertyMetaData;
-import org.exoplatform.container.management.ManagedTypeMetaData;
-import org.exoplatform.container.management.MetaDataBuilder;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.management.Descriptor;
-import javax.management.IntrospectionException;
-import javax.management.MBeanParameterInfo;
-import javax.management.modelmbean.ModelMBeanAttributeInfo;
-import javax.management.modelmbean.ModelMBeanConstructorInfo;
-import javax.management.modelmbean.ModelMBeanInfo;
-import javax.management.modelmbean.ModelMBeanInfoSupport;
-import javax.management.modelmbean.ModelMBeanNotificationInfo;
-import javax.management.modelmbean.ModelMBeanOperationInfo;
-
-/**
- * <p>A class that build mbean meta data</p>
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ExoMBeanInfoBuilder
-{
-
- private static enum Role {
- SET("setter"), IS("getter"), GET("getter"), OP("operation");
-
- private final String name;
-
- private Role(String role)
- {
- this.name = role;
- }
- }
-
- private MetaDataBuilder metaDataBuilder;
-
- /**
- * Create a new builder.
- *
- * @param clazz the clazz
- * @throws IllegalArgumentException if the class is null or does not contain meta data
- */
- public ExoMBeanInfoBuilder(Class clazz) throws IllegalArgumentException
- {
- this.metaDataBuilder = new MetaDataBuilder(clazz);
- }
-
- public boolean isBuildable()
- {
- return metaDataBuilder.isBuildable();
- }
-
- private ModelMBeanOperationInfo buildOperationInfo(Method method, String description, Role role,
- Collection<ManagedMethodParameterMetaData> parametersMD)
- {
- ModelMBeanOperationInfo operationInfo = new ModelMBeanOperationInfo(description, method);
-
- //
- if (description == null)
- {
- description = "Management operation";
- }
-
- //
- MBeanParameterInfo[] parameterInfos = operationInfo.getSignature();
- for (ManagedMethodParameterMetaData parameterMD : parametersMD)
- {
- int i = parameterMD.getIndex();
- MBeanParameterInfo parameterInfo = parameterInfos[i];
- String parameterName = parameterInfo.getName();
- String parameterDescription = operationInfo.getSignature()[i].getDescription();
- if (parameterMD.getName() != null)
- {
- parameterName = parameterMD.getName();
- }
- else if (parameterMD.getDescription() != null)
- {
- parameterDescription = parameterMD.getDescription();
- }
- parameterInfos[i] = new MBeanParameterInfo(parameterName, parameterInfo.getType(), parameterDescription);
- }
-
- //
- Descriptor operationDescriptor = operationInfo.getDescriptor();
- operationDescriptor.setField("role", role.name);
-
- //
- return new ModelMBeanOperationInfo(operationInfo.getName(), description, parameterInfos, operationInfo
- .getReturnType(), operationInfo.getImpact(), operationDescriptor);
- }
-
- /**
- * Build the info.
- *
- * @return returns the info
- * @throws IllegalStateException raised by any build time issue
- */
- public ModelMBeanInfo build() throws IllegalStateException
- {
- ManagedTypeMetaData typeMD = metaDataBuilder.build();
-
- //
- String mbeanDescription = "Exo model mbean";
- if (typeMD.getDescription() != null)
- {
- mbeanDescription = typeMD.getDescription();
- }
-
- //
- ArrayList<ModelMBeanOperationInfo> operations = new ArrayList<ModelMBeanOperationInfo>();
- for (ManagedMethodMetaData methodMD : typeMD.getMethods())
- {
- ModelMBeanOperationInfo operationInfo =
- buildOperationInfo(methodMD.getMethod(), methodMD.getDescription(), Role.OP, methodMD.getParameters());
- operations.add(operationInfo);
- }
-
- //
- Map<String, ModelMBeanAttributeInfo> attributeInfos = new HashMap<String, ModelMBeanAttributeInfo>();
- for (ManagedPropertyMetaData propertyMD : typeMD.getProperties())
- {
-
- Method getter = propertyMD.getGetter();
- if (getter != null)
- {
- Role role;
- String getterName = getter.getName();
- if (getterName.startsWith("get") && getterName.length() > 3)
- {
- role = Role.GET;
- }
- else if (getterName.startsWith("is") && getterName.length() > 2)
- {
- role = Role.IS;
- }
- else
- {
- throw new AssertionError();
- }
- Collection<ManagedMethodParameterMetaData> blah = Collections.emptyList();
- ModelMBeanOperationInfo operationInfo =
- buildOperationInfo(getter, propertyMD.getGetterDescription(), role, blah);
- operations.add(operationInfo);
- }
-
- //
- Method setter = propertyMD.getSetter();
- if (setter != null)
- {
- ManagedMethodParameterMetaData s = new ManagedMethodParameterMetaData(0);
- s.setDescription(propertyMD.getSetterParameter().getDescription());
- s.setName(propertyMD.getSetterParameter().getName());
- Collection<ManagedMethodParameterMetaData> blah = Collections.singletonList(s);
- ModelMBeanOperationInfo operationInfo =
- buildOperationInfo(setter, propertyMD.getSetterDescription(), Role.SET, blah);
- operations.add(operationInfo);
- }
-
- //
- try
- {
- String attributeDescription =
- propertyMD.getDescription() != null ? propertyMD.getDescription() : ("Managed attribute " + propertyMD
- .getName());
-
- //
- ModelMBeanAttributeInfo attributeInfo =
- new ModelMBeanAttributeInfo(propertyMD.getName(), attributeDescription, getter, setter);
-
- //
- Descriptor attributeDescriptor = attributeInfo.getDescriptor();
- if (getter != null)
- {
- attributeDescriptor.setField("getMethod", getter.getName());
- }
- if (setter != null)
- {
- attributeDescriptor.setField("setMethod", setter.getName());
- }
- attributeDescriptor.setField("currencyTimeLimit", "-1");
- attributeDescriptor.setField("persistPolicy", "Never");
- attributeInfo.setDescriptor(attributeDescriptor);
-
- //
- ModelMBeanAttributeInfo previous = attributeInfos.put(propertyMD.getName(), attributeInfo);
- if (previous != null)
- {
- throw new IllegalArgumentException();
- }
- }
- catch (IntrospectionException e)
- {
- throw new AssertionError(e);
- }
- }
-
- //
- return new ModelMBeanInfoSupport(typeMD.getType().getName(), mbeanDescription, attributeInfos.values().toArray(
- new ModelMBeanAttributeInfo[attributeInfos.size()]), new ModelMBeanConstructorInfo[0], operations
- .toArray(new ModelMBeanOperationInfo[operations.size()]), new ModelMBeanNotificationInfo[0]);
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ExoModelMBean.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ExoModelMBean.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ExoModelMBean.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,201 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.jmx;
-
-import org.exoplatform.container.ExoContainer;
-import org.exoplatform.container.component.RequestLifeCycle;
-import org.exoplatform.management.ManagementAware;
-import org.exoplatform.management.ManagementContext;
-import org.exoplatform.management.jmx.annotations.NamingContext;
-
-import java.util.Collections;
-import java.util.Map;
-
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanException;
-import javax.management.MBeanRegistration;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.management.ReflectionException;
-import javax.management.RuntimeOperationsException;
-import javax.management.modelmbean.InvalidTargetObjectTypeException;
-import javax.management.modelmbean.ModelMBeanInfo;
-import javax.management.modelmbean.RequiredModelMBean;
-
-/**
- * A convenient subclass of {@link RequiredModelMBean) that routes the invocation of the interface
- * {@link MBeanRegistration} to the managed resource when it implements the method.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ExoModelMBean extends RequiredModelMBean implements ManagementContext
-{
-
- /** . */
- private Object mr;
-
- /** . */
- private ManagementContextImpl parentContext;
-
- /** . */
- private ManagementContextImpl context;
-
- public ExoModelMBean(ManagementContextImpl parentContext, Object mr, ModelMBeanInfo mbi) throws MBeanException,
- RuntimeOperationsException, InstanceNotFoundException, InvalidTargetObjectTypeException
- {
- super(mbi);
-
- //
- this.parentContext = parentContext;
- this.mr = mr;
-
- //
- setManagedResource(mr, "ObjectReference");
- }
-
- @Override
- public Object invoke(String opName, Object[] opArgs, String[] sig) throws MBeanException, ReflectionException
- {
- final ExoContainer container = context.findContainer();
- if (container != null)
- {
- RequestLifeCycle.begin(container);
- try
- {
- return super.invoke(opName, opArgs, sig);
- }
- finally
- {
- RequestLifeCycle.end();
- }
- }
- else
- {
- return super.invoke(opName, opArgs, sig);
- }
- }
-
- @Override
- public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
- {
- name = super.preRegister(server, name);
-
- //
- if (mr instanceof MBeanRegistration)
- {
- ((MBeanRegistration)mr).preRegister(server, name);
- }
-
- //
- return name;
- }
-
- @Override
- public void postRegister(Boolean registrationDone)
- {
- super.postRegister(registrationDone);
-
- //
- PropertiesInfo info = PropertiesInfo.resolve(mr.getClass(), NamingContext.class);
-
- //
- Map<String, String> scopingProperties = info != null ? info.resolve(mr) : Collections.<String, String>emptyMap();
-
- //
- if (mr instanceof ManageableContainer)
- {
- context = ((ManageableContainer)mr).managementContext;
- }
- else
- {
- context = new ManagementContextImpl(parentContext);
- }
-
- //
- context.scopingProperties = scopingProperties;
-
- //
- if (mr instanceof ManagementAware)
- {
- ((ManagementAware)mr).setContext(this);
- }
-
- //
- if (mr instanceof MBeanRegistration)
- {
- ((MBeanRegistration)mr).postRegister(registrationDone);
- }
- }
-
- @Override
- public void preDeregister() throws Exception
- {
- if (mr instanceof MBeanRegistration)
- {
- ((MBeanRegistration)mr).preDeregister();
- }
-
- //
- if (mr instanceof ManagementAware)
- {
- ((ManagementAware)mr).setContext(null);
- }
-
- //
- super.preDeregister();
- }
-
- @Override
- public void postDeregister()
- {
- if (mr instanceof MBeanRegistration)
- {
- ((MBeanRegistration)mr).postDeregister();
- }
-
- //
- super.postDeregister();
- }
-
- //
-
-
- public ManagementContext getManagementContext()
- {
- return context;
- }
-
- public Object getManagedResource()
- {
- return mr;
- }
-
- //
-
- public void register(Object o) throws IllegalArgumentException, NullPointerException
- {
- context.register(o);
- }
-
- public void unregister(Object o) throws IllegalArgumentException, NullPointerException
- {
- context.unregister(o);
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/JMX.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/JMX.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/JMX.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.jmx;
-
-import java.util.Hashtable;
-import java.util.Map;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-/**
- * Various JMX utilities.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class JMX
-{
-
- private JMX()
- {
- }
-
- /**
- * This method create an object name from a generic map argument. The main reason is that
- * the method {@link javax.management.ObjectName#getInstance(String, java.util.Hashtable)} has
- * uses a non generic Hashtable with Java 5 and use a Hashtable<String, String> constructor in Java 6.
- *
- * The suitable solution is therefore to use a non generic Hashtable but that creates compilation warning therefore
- * we encapsulate there this code in order to use the warning supression in that single place.
- *
- * @see ObjectName#getInstance(String, java.util.Hashtable)
- *
- * @param domain The domain part of the object name.
- * @param table A hash table containing one or more key
- * properties. The key of each entry in the table is the key of a
- * key property in the object name. The associated value in the
- * table is the associated value in the object name.
- *
- * @return an ObjectName corresponding to the given domain and
- * key mappings.
- * @exception MalformedObjectNameException The <code>domain</code>
- * contains an illegal character, or one of the keys or values in
- * <code>table</code> contains an illegal character, or one of the
- * values in <code>table</code> does not follow the rules for
- * quoting.
- * @exception NullPointerException One of the parameters is null.
- */
- @SuppressWarnings("unchecked")
- public static ObjectName createObjectName(String domain, Map<String, String> table)
- throws MalformedObjectNameException, NullPointerException
- {
- Hashtable tmp = new Hashtable(table);
- return ObjectName.getInstance(domain, tmp);
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableComponentAdapter.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableComponentAdapter.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableComponentAdapter.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.jmx;
-
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-import org.picocontainer.ComponentAdapter;
-import org.picocontainer.PicoContainer;
-import org.picocontainer.PicoInitializationException;
-import org.picocontainer.PicoIntrospectionException;
-import org.picocontainer.PicoVisitor;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ManageableComponentAdapter implements ComponentAdapter
-{
-
- /** . */
- private Log log = ExoLogger.getLogger(ManageableComponentAdapter.class);
-
- /** . */
- private ComponentAdapter delegate;
-
- /** . */
- private final ManageableContainer container;
-
- /** . */
- private volatile boolean registered = false;
-
- public ManageableComponentAdapter(ManageableContainer container, ComponentAdapter delegate)
- {
- this.delegate = delegate;
- this.container = container;
- }
-
- public Object getComponentKey()
- {
- return delegate.getComponentKey();
- }
-
- public Class getComponentImplementation()
- {
- return delegate.getComponentImplementation();
- }
-
- public Object getComponentInstance(PicoContainer pico) throws PicoInitializationException,
- PicoIntrospectionException
- {
- Object instance = delegate.getComponentInstance(pico);
-
- //
- if (!registered)
- {
- registered = true;
-
- //
- if (container.managementContext != null)
- {
- log.debug("==> add " + instance + " to a mbean server");
- container.managementContext.register(instance);
- }
- }
- return instance;
- }
-
- public void verify(PicoContainer container) throws PicoIntrospectionException
- {
- delegate.verify(container);
- }
-
- public void accept(PicoVisitor visitor)
- {
- delegate.accept(visitor);
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableComponentAdapterFactory.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableComponentAdapterFactory.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableComponentAdapterFactory.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.jmx;
-
-import org.picocontainer.ComponentAdapter;
-import org.picocontainer.Parameter;
-import org.picocontainer.PicoIntrospectionException;
-import org.picocontainer.defaults.AssignabilityRegistrationException;
-import org.picocontainer.defaults.ComponentAdapterFactory;
-import org.picocontainer.defaults.NotConcreteRegistrationException;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ManageableComponentAdapterFactory implements ComponentAdapterFactory
-{
-
- /** . */
- private ComponentAdapterFactory delegate;
-
- /** . */
- ManageableContainer container;
-
- public ManageableComponentAdapterFactory(ComponentAdapterFactory delegate)
- {
- this.delegate = delegate;
- }
-
- public ComponentAdapter createComponentAdapter(Object componentKey, Class componentImplementation,
- Parameter[] parameters) throws PicoIntrospectionException, AssignabilityRegistrationException,
- NotConcreteRegistrationException
- {
- ComponentAdapter adapter = delegate.createComponentAdapter(componentKey, componentImplementation, parameters);
- return new ManageableComponentAdapter(container, adapter);
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableContainer.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableContainer.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManageableContainer.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,203 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.jmx;
-
-import org.exoplatform.container.CachingContainer;
-import org.exoplatform.management.ManagementContext;
-import org.exoplatform.management.annotations.Managed;
-import org.exoplatform.management.annotations.ManagedDescription;
-import org.exoplatform.management.annotations.ManagedName;
-import org.picocontainer.ComponentAdapter;
-import org.picocontainer.PicoContainer;
-import org.picocontainer.PicoException;
-import org.picocontainer.PicoRegistrationException;
-import org.picocontainer.defaults.ComponentAdapterFactory;
-import org.picocontainer.defaults.DuplicateComponentKeyRegistrationException;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanInfo;
-import javax.management.MBeanOperationInfo;
-import javax.management.MBeanParameterInfo;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ManageableContainer extends CachingContainer
-{
-
- /** . */
- private static final ThreadLocal<ManageableComponentAdapterFactory> hack =
- new ThreadLocal<ManageableComponentAdapterFactory>();
-
- /** . */
- protected ManagementContextImpl managementContext;
-
- public ManageableContainer(ManagementContextImpl managementContext)
- {
- super(getComponentAdapterFactory(new MX4JComponentAdapterFactory()));
- this.managementContext = managementContext;
- managementContext.container = this;
- init(null);
- }
-
- public ManageableContainer(PicoContainer parent)
- {
- super(getComponentAdapterFactory(new MX4JComponentAdapterFactory()), parent);
- init(parent);
- }
-
- public ManageableContainer(ComponentAdapterFactory componentAdapterFactory, PicoContainer parent)
- {
- super(getComponentAdapterFactory(componentAdapterFactory), parent);
- init(parent);
- }
-
- public ManageableContainer(ComponentAdapterFactory componentAdapterFactory)
- {
- super(getComponentAdapterFactory(componentAdapterFactory));
- init(null);
- }
-
- @Managed
- @ManagedName("RegisteredComponentNames")
- @ManagedDescription("Return the list of the registered component names")
- public Set<String> getRegisteredComponentNames() throws PicoException
- {
- Set<String> names = new HashSet<String>();
- Collection<ComponentAdapter> adapters = getComponentAdapters();
- for (ComponentAdapter adapter : adapters)
- {
- Object key = adapter.getComponentKey();
- String name = String.valueOf(key);
- names.add(name);
- }
- return names;
- }
-
- private static ManageableComponentAdapterFactory getComponentAdapterFactory(
- ComponentAdapterFactory componentAdapterFactory)
- {
- ManageableComponentAdapterFactory factory = new ManageableComponentAdapterFactory(componentAdapterFactory);
- hack.set(factory);
- return factory;
- }
-
- private void init(PicoContainer parent)
- {
- // Yeah this is not pretty but a necessary evil to make it work
- ManageableComponentAdapterFactory factory = hack.get();
- factory.container = this;
- hack.set(null);
-
- // Reference the same mbean server that the parent has
- if (parent instanceof ManageableContainer)
- {
- ManagementContextImpl parentManagementContext = ((ManageableContainer)parent).managementContext;
- if (parentManagementContext != null)
- {
- managementContext = new ManagementContextImpl(parentManagementContext);
- managementContext.container = this;
- }
- }
- }
-
- public ManagementContext getManagementContext()
- {
- return managementContext;
- }
-
- public final MBeanServer getMBeanServer()
- {
- return managementContext != null ? managementContext.server : null;
- }
-
- @Override
- public ComponentAdapter registerComponent(ComponentAdapter componentAdapter)
- throws DuplicateComponentKeyRegistrationException
- {
- return super.registerComponent(componentAdapter);
- }
-
- public ComponentAdapter registerComponentInstance(Object componentKey, Object componentInstance)
- throws PicoRegistrationException
- {
- ComponentAdapter adapter = super.registerComponentInstance(componentKey, componentInstance);
- if (managementContext != null)
- {
- managementContext.register(componentInstance);
- }
- return adapter;
- }
-
- //
-
- public void printMBeanServer()
- {
- MBeanServer server = getMBeanServer();
- final Set names = server.queryNames(null, null);
- for (final Iterator i = names.iterator(); i.hasNext();)
- {
- ObjectName name = (ObjectName)i.next();
- try
- {
- MBeanInfo info = server.getMBeanInfo(name);
- MBeanAttributeInfo[] attrs = info.getAttributes();
- if (attrs == null)
- continue;
- for (int j = 0; j < attrs.length; j++)
- {
- if (attrs[j].isReadable())
- {
- try
- {
- Object o = server.getAttribute(name, attrs[j].getName());
- }
- catch (Exception x)
- {
- x.printStackTrace();
- }
- }
- }
- MBeanOperationInfo[] methods = info.getOperations();
- for (int j = 0; j < methods.length; j++)
- {
- MBeanParameterInfo[] params = methods[j].getSignature();
- for (int k = 0; k < params.length; k++)
- {
- }
- }
- }
- catch (Exception x)
- {
- // x.printStackTrace(System. err);
- }
- }
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManagementContextImpl.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManagementContextImpl.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ManagementContextImpl.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,310 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.jmx;
-
-import org.exoplatform.container.ExoContainer;
-import org.exoplatform.management.ManagementContext;
-import org.exoplatform.management.annotations.ManagedBy;
-import org.exoplatform.management.jmx.annotations.NameTemplate;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Map;
-
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanRegistrationException;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.management.modelmbean.ModelMBeanInfo;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ManagementContextImpl implements ManagementContext
-{
-
- /** . */
- Map<String, String> scopingProperties;
-
- /** The registrations done by this mbean. */
- private final Map<Object, ObjectName> registrations;
-
- /** . */
- private final ManagementContextImpl parent;
-
- /** . */
- final MBeanServer server;
-
- /** An optional container setup when the management context is attached to a container. */
- ManageableContainer container;
-
- public ManagementContextImpl()
- {
- this(MBeanServerFactory.createMBeanServer());
- }
-
- public ManagementContextImpl(MBeanServer server)
- {
- if (server == null)
- {
- throw new NullPointerException();
- }
- this.registrations = new HashMap<Object, ObjectName>();
- this.parent = null;
-
- // This is the root container that never have scoping properties
- // Also without that we would have an NPE when the portal container are registered
- // as the scoping properties would not exist since the root container would not be yet
-
- this.scopingProperties = Collections.emptyMap();
- this.server = server;
- }
-
- public ManagementContextImpl(ManagementContextImpl parent)
- {
- if (parent == null)
- {
- throw new NullPointerException();
- }
- this.registrations = new HashMap<Object, ObjectName>();
- this.parent = parent;
- this.scopingProperties = null;
- this.server = parent.server;
- }
-
- public ManagementContext getParent()
- {
- return parent;
- }
-
- public void register(Object o)
- {
- ObjectName name = manageMBean(o);
- if (name != null)
- {
- registrations.put(o, name);
- }
- }
-
- public void unregister(Object o)
- {
- ObjectName name = registrations.remove(o);
- if (name != null)
- {
- unmanageMBean(name);
- }
- }
-
- private ExoModelMBean createExoMBean(Object bean)
- {
- Object view = null;
-
- // Apply managed by annotation
- ManagedBy managedBy = bean.getClass().getAnnotation(ManagedBy.class);
- if (managedBy != null)
- {
- try
- {
- Class managedByClass = managedBy.value();
- Constructor<?> blah = managedByClass.getConstructor(bean.getClass());
- view = blah.newInstance(bean);
- }
- catch (NoSuchMethodException e)
- {
- e.printStackTrace();
- }
- catch (InstantiationException e)
- {
- e.printStackTrace();
- }
- catch (IllegalAccessException e)
- {
- e.printStackTrace();
- }
- catch (InvocationTargetException e)
- {
- e.printStackTrace();
- }
- }
- else
- {
- view = bean;
- }
-
- //
- if (view != null)
- {
- ExoMBeanInfoBuilder infoBuilder = new ExoMBeanInfoBuilder(view.getClass());
- if (infoBuilder.isBuildable())
- {
- try
- {
- ModelMBeanInfo info = infoBuilder.build();
- return new ExoModelMBean(this, view, info);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- }
-
- //
- return null;
- }
-
- public ObjectName manageMBean(Object bean)
- {
-
- //
- ExoModelMBean mbean = createExoMBean(bean);
-
- //
- if (mbean != null)
- {
- Object mr = mbean.getManagedResource();
- ObjectName on = null;
- PropertiesInfo oni = PropertiesInfo.resolve(mr.getClass(), NameTemplate.class);
- if (oni != null)
- {
- try
- {
- Map<String, String> foo = oni.resolve(mr);
- on = JMX.createObjectName("exo", foo);
- }
- catch (MalformedObjectNameException e)
- {
- e.printStackTrace();
- }
- }
-
- //
- if (on != null)
- {
- // Merge with the container hierarchy context
- try
- {
- Map<String, String> props = new Hashtable<String, String>();
-
- // Julien : I know it's does not look great but it's necessary
- // for compiling under Java 5 and Java 6 properly. The methods
- // ObjectName#getKeyPropertyList() returns an Hashtable with Java 5
- // and a Hashtable<String, String> with Java 6.
- for (Object o : on.getKeyPropertyList().entrySet())
- {
- Map.Entry entry = (Map.Entry)o;
- String key = (String)entry.getKey();
- String value = (String)entry.getValue();
- props.put(key, value);
- }
- for (ManagementContextImpl current = this; current != null; current = current.parent)
- {
- if (current.scopingProperties != null)
- {
- props.putAll(current.scopingProperties);
- }
- }
- on = JMX.createObjectName(on.getDomain(), props);
- attemptToRegister(on, mbean);
- return on;
- }
- catch (MalformedObjectNameException e)
- {
- e.printStackTrace();
- }
- }
- }
-
- //
- return null;
- }
-
- public void unmanageMBean(ObjectName name)
- {
- try
- {
- server.unregisterMBean(name);
- }
- catch (InstanceNotFoundException e)
- {
- e.printStackTrace();
- }
- catch (MBeanRegistrationException e)
- {
- e.printStackTrace();
- }
- }
-
- synchronized void attemptToRegister(ObjectName name, Object mbean)
- {
- synchronized (server)
- {
- try
- {
- server.registerMBean(mbean, name);
- }
- catch (InstanceAlreadyExistsException e)
- {
- try
- {
-
- server.unregisterMBean(name);
- server.registerMBean(mbean, name);
-
- }
- catch (Exception e1)
- {
- throw new RuntimeException("Failed to register MBean '" + name + " due to " + e.getMessage(), e);
- }
- }
- catch (Exception e)
- {
- throw new RuntimeException("Failed to register MBean '" + name + " due to " + e.getMessage(), e);
- }
- }
- }
-
- public ExoContainer findContainer()
- {
- for (ManagementContextImpl current = this;true;current = current.parent)
- {
- if (current.container instanceof ExoContainer)
- {
- return (ExoContainer)current.container;
- }
- else if (current.parent == null)
- {
- return null;
- }
- }
- }
-
- @Override
- public String toString()
- {
- return "ManagementContextImpl[container=" + container + "]";
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ObjectNameBuilder.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ObjectNameBuilder.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/ObjectNameBuilder.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.jmx;
-
-import org.exoplatform.management.jmx.annotations.NameTemplate;
-
-import java.util.Map;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-/**
- * A builder for object name templates.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ObjectNameBuilder<T>
-{
-
- /** . */
- private String domain;
-
- /** . */
- private Class<? extends T> clazz;
-
- /**
- * Create a new builder.
- *
- * @param clazz the class
- * @throws IllegalArgumentException if the object is null
- */
- public ObjectNameBuilder(String domain, Class<? extends T> clazz) throws IllegalArgumentException
- {
- if (clazz == null)
- {
- throw new IllegalArgumentException("Clazz cannot be null");
- }
- this.domain = domain;
- this.clazz = clazz;
- }
-
- /**
- * Build the object name or return null if the class is not annotated by
- * {@link NameTemplate}.
- *
- * @param object the object
- * @return the built name
- * @throws IllegalStateException raised by a build time issue
- */
- public ObjectName build(T object) throws IllegalStateException
- {
- PropertiesInfo info = PropertiesInfo.resolve(clazz, NameTemplate.class);
-
- //
- if (info != null)
- {
-
- try
- {
- Map<String, String> props = info.resolve(object);
- return JMX.createObjectName(domain, props);
- }
- catch (MalformedObjectNameException e)
- {
- throw new IllegalArgumentException("ObjectName template is malformed", e);
- }
- }
-
- //
- return null;
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/PropertiesInfo.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/PropertiesInfo.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/PropertiesInfo.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.jmx;
-
-import org.exoplatform.commons.reflect.AnnotationIntrospector;
-import org.exoplatform.management.jmx.annotations.NameTemplate;
-import org.exoplatform.management.jmx.annotations.NamingContext;
-import org.exoplatform.management.jmx.annotations.Property;
-
-import java.lang.annotation.Annotation;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class PropertiesInfo
-{
-
- /** . */
- private Map<String, PropertyInfo> properties;
-
- public PropertiesInfo(Map<String, PropertyInfo> properties)
- {
- this.properties = properties;
- }
-
- public static PropertiesInfo resolve(Class clazz, Class<? extends Annotation> annotationClass)
- {
- Annotation tpl2 = AnnotationIntrospector.resolveClassAnnotations(clazz, annotationClass);
- Property[] blah = null;
- if (tpl2 instanceof NamingContext)
- {
- blah = ((NamingContext)tpl2).value();
- }
- else if (tpl2 instanceof NameTemplate)
- {
- blah = ((NameTemplate)tpl2).value();
- }
- if (blah != null)
- {
- Map<String, PropertyInfo> properties = new HashMap<String, PropertyInfo>();
- for (Property property : blah)
- {
- PropertyInfo propertyInfo = new PropertyInfo(clazz, property);
- properties.put(propertyInfo.getKey(), propertyInfo);
- }
- return new PropertiesInfo(properties);
- }
- else
- {
- return null;
- }
- }
-
- public Collection<PropertyInfo> getProperties()
- {
- return properties.values();
- }
-
- public Map<String, String> resolve(Object instance)
- {
- Map<String, String> props = new HashMap<String, String>();
- for (PropertyInfo propertyInfo : properties.values())
- {
- String key = propertyInfo.getKey();
- String value = propertyInfo.resolveValue(instance);
- props.put(key, value);
- }
- return props;
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/PropertyInfo.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/PropertyInfo.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/PropertyInfo.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,161 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.jmx;
-
-import org.exoplatform.management.jmx.annotations.Property;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-
-import javax.management.ObjectName;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class PropertyInfo
-{
-
- /** . */
- private final String key;
-
- /** . */
- private final Value value;
-
- public PropertyInfo(Class clazz, Property def)
- {
- String tmp = def.value();
- Value value;
- int length = tmp.length();
- if (length > 2 && tmp.charAt(0) == '{' && tmp.charAt(length - 1) == '}')
- {
- String s = tmp.substring(1, length - 1);
- String getterName = "get" + s;
- Method getter;
- try
- {
- getter = clazz.getMethod(getterName);
- }
- catch (NoSuchMethodException e)
- {
- throw new IllegalArgumentException("Getter parameter for property " + s + " on class " + clazz.getName()
- + " does not exist", e);
- }
-
- //
- if (getter.getReturnType() == void.class)
- {
- throw new IllegalArgumentException("Getter return type for property " + s + " on class " + clazz.getName()
- + " cannot be void");
- }
- if (getter.getParameterTypes().length > 0)
- {
- throw new IllegalArgumentException("Getter parameter type for property " + s + " on class "
- + clazz.getName() + " is not empty");
- }
- if (Modifier.isStatic(getter.getModifiers()))
- {
- throw new IllegalArgumentException("Getter for property " + s + " on class " + clazz.getName()
- + " is static");
- }
-
- //
- value = new DynamicValue(getter);
- }
- else
- {
- value = new LitteralValue(tmp);
- }
-
- //
- this.key = def.key();
- this.value = value;
- }
-
- public String resolveValue(Object instance)
- {
- return value.resolve(instance);
- }
-
- public String getKey()
- {
- return key;
- }
-
- private abstract static class Value
- {
- abstract String resolve(Object instance);
- }
-
- private class DynamicValue extends Value
- {
-
- /** . */
- private final Method getter;
-
- private DynamicValue(Method getter)
- {
- this.getter = getter;
- }
-
- String resolve(Object instance)
- {
- Object value;
- try
- {
- value = getter.invoke(instance);
- }
- catch (IllegalAccessException e)
- {
- throw new IllegalArgumentException("Getter for property " + key + " on class "
- + getter.getClass().getName() + " cannot be invoked", e);
- }
- catch (InvocationTargetException e)
- {
- throw new IllegalArgumentException("Getter for property " + key + " on class "
- + getter.getClass().getName() + " threw an exception during invocation", e);
- }
- if (value == null)
- {
- throw new IllegalArgumentException("Getter for property " + key + " on class "
- + getter.getClass().getName() + " returned a null value");
- }
- return ObjectName.quote(value.toString());
- }
- }
-
- private static class LitteralValue extends Value
- {
-
- /** . */
- private final String litteral;
-
- private LitteralValue(String litteral)
- {
- this.litteral = litteral;
- }
-
- String resolve(Object instance)
- {
- return litteral;
- }
- }
-
-}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableComponentAdapter.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableComponentAdapter.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableComponentAdapter.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.container.management;
+
+import org.exoplatform.management.spi.ManagementProvider;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+import org.picocontainer.ComponentAdapter;
+import org.picocontainer.PicoContainer;
+import org.picocontainer.PicoInitializationException;
+import org.picocontainer.PicoIntrospectionException;
+import org.picocontainer.PicoVisitor;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ManageableComponentAdapter implements ComponentAdapter
+{
+
+ /** . */
+ private Log log = ExoLogger.getLogger(ManageableComponentAdapter.class);
+
+ /** . */
+ private ComponentAdapter delegate;
+
+ /** . */
+ private final ManageableContainer container;
+
+ /** . */
+ private volatile boolean registered = false;
+
+ public ManageableComponentAdapter(ManageableContainer container, ComponentAdapter delegate)
+ {
+ this.delegate = delegate;
+ this.container = container;
+ }
+
+ public Object getComponentKey()
+ {
+ return delegate.getComponentKey();
+ }
+
+ public Class getComponentImplementation()
+ {
+ return delegate.getComponentImplementation();
+ }
+
+ public Object getComponentInstance(PicoContainer pico) throws PicoInitializationException,
+ PicoIntrospectionException
+ {
+ Object instance = delegate.getComponentInstance(pico);
+
+ //
+ if (!registered)
+ {
+ registered = true;
+
+ //
+ if (container.managementContext != null)
+ {
+ // Registry the instance against the management context
+ log.debug("==> add " + instance + " to a mbean server");
+ container.managementContext.register(instance);
+
+ // Register if it is a management provider
+ if (instance instanceof ManagementProvider)
+ {
+ ManagementProvider provider = (ManagementProvider)instance;
+ container.addProvider(provider);
+ }
+ }
+ }
+ return instance;
+ }
+
+ public void verify(PicoContainer container) throws PicoIntrospectionException
+ {
+ delegate.verify(container);
+ }
+
+ public void accept(PicoVisitor visitor)
+ {
+ delegate.accept(visitor);
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableComponentAdapterFactory.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableComponentAdapterFactory.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableComponentAdapterFactory.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.container.management;
+
+import org.picocontainer.ComponentAdapter;
+import org.picocontainer.Parameter;
+import org.picocontainer.PicoIntrospectionException;
+import org.picocontainer.defaults.AssignabilityRegistrationException;
+import org.picocontainer.defaults.ComponentAdapterFactory;
+import org.picocontainer.defaults.NotConcreteRegistrationException;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ManageableComponentAdapterFactory implements ComponentAdapterFactory
+{
+
+ /** . */
+ private ComponentAdapterFactory delegate;
+
+ /** . */
+ ManageableContainer container;
+
+ public ManageableComponentAdapterFactory(ComponentAdapterFactory delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public ComponentAdapter createComponentAdapter(Object componentKey, Class componentImplementation,
+ Parameter[] parameters) throws PicoIntrospectionException, AssignabilityRegistrationException,
+ NotConcreteRegistrationException
+ {
+ ComponentAdapter adapter = delegate.createComponentAdapter(componentKey, componentImplementation, parameters);
+ return new ManageableComponentAdapter(container, adapter);
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,230 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.container.management;
+
+import org.exoplatform.container.CachingContainer;
+import org.exoplatform.container.jmx.MX4JComponentAdapterFactory;
+import org.exoplatform.container.monitor.jvm.J2EEServerInfo;
+import org.exoplatform.management.ManagementContext;
+import org.exoplatform.management.annotations.Managed;
+import org.exoplatform.management.annotations.ManagedDescription;
+import org.exoplatform.management.annotations.ManagedName;
+import org.exoplatform.management.jmx.impl.JMXManagementProvider;
+import org.exoplatform.management.spi.ManagementProvider;
+import org.picocontainer.ComponentAdapter;
+import org.picocontainer.PicoContainer;
+import org.picocontainer.PicoException;
+import org.picocontainer.PicoRegistrationException;
+import org.picocontainer.defaults.ComponentAdapterFactory;
+import org.picocontainer.defaults.DuplicateComponentKeyRegistrationException;
+
+import java.lang.management.ManagementFactory;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.management.MBeanServer;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ManageableContainer extends CachingContainer
+{
+
+ private static MBeanServer findMBeanServer()
+ {
+ J2EEServerInfo serverenv_ = new J2EEServerInfo();
+ MBeanServer server = serverenv_.getMBeanServer();
+ if (server == null)
+ {
+ server = ManagementFactory.getPlatformMBeanServer();
+ }
+ return server;
+ }
+
+ /** . */
+ private static final ThreadLocal<ManageableComponentAdapterFactory> hack = new ThreadLocal<ManageableComponentAdapterFactory>();
+
+ /** . */
+ final ManagementContextImpl managementContext;
+
+ /** . */
+ private MBeanServer server;
+
+ /** . */
+ private final Set<ManagementProvider> providers;
+
+ /** . */
+ private final ManageableContainer parent;
+
+ public ManageableContainer()
+ {
+ this((PicoContainer)null);
+ }
+
+ public ManageableContainer(PicoContainer parent)
+ {
+ this(new MX4JComponentAdapterFactory(), parent);
+ }
+
+ public ManageableContainer(ComponentAdapterFactory componentAdapterFactory, PicoContainer parent)
+ {
+ super(getComponentAdapterFactory(componentAdapterFactory), parent);
+
+ // Yeah this is not pretty but a necessary evil to make it work
+ ManageableComponentAdapterFactory factory = hack.get();
+ factory.container = this;
+ hack.set(null);
+
+ // The synchronized wrapper, here will not impact runtime performances
+ // so it's fine
+ this.providers = Collections.synchronizedSet(new HashSet<ManagementProvider>());
+
+ //
+ ManagementContextImpl parentCtx = null;
+ if (parent instanceof ManageableContainer)
+ {
+ ManageableContainer manageableParent = (ManageableContainer)parent;
+ parentCtx = manageableParent.managementContext;
+ }
+
+ //
+ this.parent = parent instanceof ManageableContainer ? (ManageableContainer)parent : null;
+
+ //
+ if (parentCtx != null)
+ {
+ server = parentCtx.container.server;
+ managementContext = new ManagementContextImpl(parentCtx, this);
+ }
+ else
+ {
+ server = findMBeanServer();
+ managementContext = new ManagementContextImpl(this);
+ addProvider(new JMXManagementProvider(server));
+ }
+ }
+
+ public ManageableContainer(ComponentAdapterFactory componentAdapterFactory)
+ {
+ this(componentAdapterFactory, null);
+ }
+
+ @Managed
+ @ManagedName("RegisteredComponentNames")
+ @ManagedDescription("Return the list of the registered component names")
+ public Set<String> getRegisteredComponentNames() throws PicoException
+ {
+ Set<String> names = new HashSet<String>();
+ Collection<ComponentAdapter> adapters = getComponentAdapters();
+ for (ComponentAdapter adapter : adapters)
+ {
+ Object key = adapter.getComponentKey();
+ String name = String.valueOf(key);
+ names.add(name);
+ }
+ return names;
+ }
+
+ private static ManageableComponentAdapterFactory getComponentAdapterFactory(
+ ComponentAdapterFactory componentAdapterFactory)
+ {
+ ManageableComponentAdapterFactory factory = new ManageableComponentAdapterFactory(componentAdapterFactory);
+ hack.set(factory);
+ return factory;
+ }
+
+ public ManagementContext getManagementContext()
+ {
+ return managementContext;
+ }
+
+ public final MBeanServer getMBeanServer()
+ {
+ return server;
+ }
+
+ @Override
+ public ComponentAdapter registerComponent(ComponentAdapter componentAdapter)
+ throws DuplicateComponentKeyRegistrationException
+ {
+ return super.registerComponent(componentAdapter);
+ }
+
+ public ComponentAdapter registerComponentInstance(Object componentKey, Object componentInstance)
+ throws PicoRegistrationException
+ {
+ ComponentAdapter adapter = super.registerComponentInstance(componentKey, componentInstance);
+ if (managementContext != null)
+ {
+ managementContext.register(componentInstance);
+
+ // Register if it is a management provider
+ if (componentInstance instanceof ManagementProvider)
+ {
+ ManagementProvider provider = (ManagementProvider)componentInstance;
+ addProvider(provider);
+ }
+ }
+ return adapter;
+ }
+
+ /**
+ * Returns the list of the providers which are relevant for this container.
+ *
+ * @return the providers
+ */
+ Collection<ManagementProvider> getProviders()
+ {
+ HashSet<ManagementProvider> allProviders = new HashSet<ManagementProvider>();
+ computeAllProviders(allProviders);
+ return allProviders;
+ }
+
+ private void computeAllProviders(Set<ManagementProvider> allProviders)
+ {
+ if (parent != null)
+ {
+ parent.computeAllProviders(allProviders);
+ }
+
+ //
+ allProviders.addAll(providers);
+ }
+
+ boolean addProvider(ManagementProvider provider)
+ {
+ // Prevent double registration just in case...
+ if (providers.contains(provider))
+ {
+ return false;
+ }
+
+ //
+ providers.add(provider);
+
+ // Perform registration of already registered managed components
+ managementContext.install(provider);
+
+ //
+ return true;
+ }
+}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedMetaData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedMetaData.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedMetaData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.management;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ManagedMetaData
-{
-
- /** . */
- private String description;
-
- public String getDescription()
- {
- return description;
- }
-
- public void setDescription(String description)
- {
- this.description = description;
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedMethodMetaData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedMethodMetaData.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedMethodMetaData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.management;
-
-import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ManagedMethodMetaData extends ManagedMetaData
-{
-
- /** . */
- private final Method method;
-
- /** . */
- private final Map<Integer, ManagedMethodParameterMetaData> parameters;
-
- /**
- * Build a new instance.
- *
- * @param method the method
- * @throws NullPointerException if the method is null
- */
- public ManagedMethodMetaData(Method method) throws NullPointerException
- {
- if (method == null)
- {
- throw new NullPointerException();
- }
-
- //
- this.method = method;
- this.parameters = new HashMap<Integer, ManagedMethodParameterMetaData>();
- }
-
- public Method getMethod()
- {
- return method;
- }
-
- public void addParameter(ManagedMethodParameterMetaData parameter)
- {
- if (parameter == null)
- {
- throw new NullPointerException("No null parameter accepted");
- }
- parameters.put(parameter.getIndex(), parameter);
- }
-
- public Collection<ManagedMethodParameterMetaData> getParameters()
- {
- return Collections.unmodifiableCollection(parameters.values());
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedMethodParameterMetaData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedMethodParameterMetaData.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedMethodParameterMetaData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.management;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ManagedMethodParameterMetaData extends ManagedParameterMetaData
-{
-
- /** . */
- private final int index;
-
- /**
- * Build a managed method parameter meta data.
- *
- * @param index the parameter index
- * @throws IllegalArgumentException if the index is negative
- */
- public ManagedMethodParameterMetaData(int index) throws IllegalArgumentException
- {
- if (index < 0)
- {
- throw new IllegalArgumentException("Non negative index value accepted " + index);
- }
- this.index = index;
- }
-
- public int getIndex()
- {
- return index;
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedParameterMetaData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedParameterMetaData.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedParameterMetaData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.management;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ManagedParameterMetaData extends ManagedMetaData
-{
-
- /** . */
- private String name;
-
- public ManagedParameterMetaData()
- {
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedPropertyMetaData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedPropertyMetaData.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedPropertyMetaData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,116 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.management;
-
-import java.lang.reflect.Method;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ManagedPropertyMetaData extends ManagedMetaData
-{
-
- /** . */
- private final String name;
-
- /** . */
- private final Method getter;
-
- /** . */
- private final String getterDescription;
-
- /** . */
- private final Method setter;
-
- /** . */
- private final String setterDescription;
-
- /** . */
- private final ManagedParameterMetaData setterParameter;
-
- public ManagedPropertyMetaData(String name, Method getter, String getterDescription, Method setter,
- String setterDescription, ManagedParameterMetaData setterParameter) throws NullPointerException,
- IllegalArgumentException
- {
- if (name == null)
- {
- throw new NullPointerException("No null name accepted");
- }
- if (setter != null)
- {
- if (setterParameter == null)
- {
- throw new IllegalArgumentException("No setter parameter provided");
- }
- }
- else
- {
- if (setterParameter != null)
- {
- throw new IllegalArgumentException("No setter provided but a setter parameter was provided");
- }
- }
-
- //
- this.name = name;
- this.getter = getter;
- this.getterDescription = getterDescription;
- this.setter = setter;
- this.setterDescription = setterDescription;
- this.setterParameter = setterParameter;
- }
-
- public String getName()
- {
- return name;
- }
-
- public Method getGetter()
- {
- return getter;
- }
-
- public Method getSetter()
- {
- return setter;
- }
-
- public String getGetterDescription()
- {
- return getterDescription;
- }
-
- public String getSetterDescription()
- {
- return setterDescription;
- }
-
- public ManagedParameterMetaData getSetterParameter()
- {
- return setterParameter;
- }
-
- @Override
- public String toString()
- {
- return "ManagedPropertyMetaData[" + "name=" + name + "getter=" + getter.getName() + "setter=" + setter.getName()
- + "]";
- }
-}
Deleted: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedTypeMetaData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedTypeMetaData.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagedTypeMetaData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,126 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.container.management;
-
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ManagedTypeMetaData extends ManagedMetaData
-{
-
- /** . */
- private final Class type;
-
- /** . */
- private final Map<String, ManagedPropertyMetaData> properties;
-
- /** . */
- private final Map<MethodKey, ManagedMethodMetaData> methods;
-
- public ManagedTypeMetaData(Class type) throws NullPointerException
- {
- if (type == null)
- {
- throw new NullPointerException();
- }
-
- //
- this.type = type;
- this.properties = new HashMap<String, ManagedPropertyMetaData>();
- this.methods = new HashMap<MethodKey, ManagedMethodMetaData>();
- }
-
- public Class getType()
- {
- return type;
- }
-
- public ManagedPropertyMetaData getProperty(String propertyName)
- {
- return properties.get(propertyName);
- }
-
- public void addProperty(ManagedPropertyMetaData property)
- {
- properties.put(property.getName(), property);
- }
-
- public void addMethod(ManagedMethodMetaData method)
- {
- methods.put(new MethodKey(method.getMethod()), method);
- }
-
- public Collection<ManagedMethodMetaData> getMethods()
- {
- return methods.values();
- }
-
- public Collection<ManagedPropertyMetaData> getProperties()
- {
- return properties.values();
- }
-
- private static class MethodKey
- {
-
- private final String name;
-
- private final List<Class<?>> types;
-
- private MethodKey(Method method)
- {
- this.name = method.getName();
- this.types = Arrays.asList(method.getParameterTypes());
- }
-
- @Override
- public int hashCode()
- {
- int hashCode = name.hashCode();
- for (Class<?> type : types)
- {
- hashCode = hashCode * 41 + type.hashCode();
- }
- return hashCode;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
- if (obj instanceof MethodKey)
- {
- MethodKey that = (MethodKey)obj;
- return this.name.equals(that.name) && this.types.equals(that.types);
- }
- return false;
- }
- }
-}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagementContextImpl.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagementContextImpl.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagementContextImpl.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,322 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.container.management;
+
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.component.RequestLifeCycle;
+import org.exoplatform.management.ManagementAware;
+import org.exoplatform.management.spi.ManagedResource;
+import org.exoplatform.management.spi.ManagedTypeMetaData;
+import org.exoplatform.management.spi.ManagementProvider;
+import org.exoplatform.management.ManagementContext;
+import org.exoplatform.management.annotations.ManagedBy;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ManagementContextImpl implements ManagementContext, ManagedResource
+{
+
+ /** . */
+ private final Map<Class<?>, Object> scopingDataList;
+
+ /** The registrations done by this mbean. */
+ private final Map<Object, ManagementContextImpl> registrations;
+
+ /** . */
+ final Map<ManagementProvider, Object> managedSet;
+
+ /** . */
+ private final ManagementContextImpl parent;
+
+ /** . */
+ private final Object resource;
+
+ /** . */
+ private final ManagedTypeMetaData typeMD;
+
+ /** An optional container setup when the management context is attached to a container. */
+ final ManageableContainer container;
+
+ public ManagementContextImpl(ManageableContainer container)
+ {
+ if (container == null)
+ {
+ throw new NullPointerException();
+ }
+
+ //
+ Object resource = null;
+ ManagedTypeMetaData typeMD = null;
+ MetaDataBuilder builder = new MetaDataBuilder(container.getClass());
+ if (builder.isBuildable())
+ {
+ resource = container;
+ typeMD = builder.build();
+ }
+
+ //
+ this.managedSet = new HashMap<ManagementProvider, Object>();
+ this.registrations = new HashMap<Object, ManagementContextImpl>();
+ this.parent = null;
+ this.scopingDataList = new HashMap<Class<?>, Object>();
+ this.resource = resource;
+ this.typeMD = typeMD;
+ this.container = container;
+ }
+
+ public ManagementContextImpl(ManagementContextImpl parent, ManageableContainer container)
+ {
+ if (parent == null)
+ {
+ throw new NullPointerException();
+ }
+ if (container == null)
+ {
+ throw new NullPointerException();
+ }
+
+ //
+ Object resource = null;
+ ManagedTypeMetaData typeMD = null;
+ MetaDataBuilder builder = new MetaDataBuilder(container.getClass());
+ if (builder.isBuildable())
+ {
+ resource = container;
+ typeMD = builder.build();
+ }
+
+ //
+ this.managedSet = new HashMap<ManagementProvider, Object>();
+ this.registrations = new HashMap<Object, ManagementContextImpl>();
+ this.parent = parent;
+ this.scopingDataList = new HashMap<Class<?>, Object>();
+ this.resource = resource;
+ this.typeMD = typeMD;
+ this.container = container;
+ }
+
+ public ManagementContextImpl(ManagementContextImpl parent, Object resource, ManagedTypeMetaData typeMD)
+ {
+ if (parent == null)
+ {
+ throw new NullPointerException();
+ }
+ if ((resource != null && typeMD == null) && (resource == null && typeMD != null))
+ {
+ throw new IllegalArgumentException("Can't have resource null and meta data not null or the converse");
+ }
+
+ //
+ this.managedSet = new HashMap<ManagementProvider, Object>();
+ this.registrations = new HashMap<Object, ManagementContextImpl>();
+ this.parent = parent;
+ this.scopingDataList = new HashMap<Class<?>, Object>();
+ this.resource = resource;
+ this.typeMD = typeMD;
+ this.container = null;
+ }
+
+ public ManagementContext getParent()
+ {
+ return parent;
+ }
+
+ public <S> void setScopingData(Class<S> scopeType, S scopingData)
+ {
+ this.scopingDataList.put(scopeType, scopingData);
+ }
+
+ public void register(Object o)
+ {
+ Object resource = null;
+
+ // Apply managed by annotation
+ ManagedBy managedBy = o.getClass().getAnnotation(ManagedBy.class);
+ if (managedBy != null)
+ {
+ try
+ {
+ Class managedByClass = managedBy.value();
+ Constructor<?> blah = managedByClass.getConstructor(o.getClass());
+ resource = blah.newInstance(o);
+ }
+ catch (NoSuchMethodException e)
+ {
+ e.printStackTrace();
+ }
+ catch (InstantiationException e)
+ {
+ e.printStackTrace();
+ }
+ catch (IllegalAccessException e)
+ {
+ e.printStackTrace();
+ }
+ catch (InvocationTargetException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ else
+ {
+ resource = o;
+ }
+
+ //
+ if (resource != null) {
+
+ MetaDataBuilder builder = new MetaDataBuilder(resource.getClass());
+ if (builder.isBuildable()) {
+ ManagedTypeMetaData metaData = builder.build();
+
+ //
+ ManagementContextImpl managementContext;
+ if (resource instanceof ManageableContainer)
+ {
+ managementContext = ((ManageableContainer)resource).managementContext;
+ }
+ else
+ {
+ managementContext = new ManagementContextImpl(this, resource, metaData);
+ }
+
+ //
+ registrations.put(resource, managementContext);
+
+ //
+ ManageableContainer container = findContainer();
+
+ // Install for all the providers related
+ for (ManagementProvider provider : container.getProviders())
+ {
+ Object name = provider.manage(managementContext);
+ if (name != null)
+ {
+ managementContext.managedSet.put(provider, name);
+ }
+ }
+
+ // Allow for more resource management
+ if (resource instanceof ManagementAware)
+ {
+ ((ManagementAware)resource).setContext(managementContext);
+ }
+ }
+ }
+ }
+
+ public void unregister(Object o)
+ {
+ ManagementContextImpl context = registrations.remove(o);
+ if (context != null)
+ {
+ for (Map.Entry<ManagementProvider, Object> entry : context.managedSet.entrySet()) {
+ entry.getKey().unmanage(entry.getValue());
+ }
+ }
+ }
+
+ public <S> List<S> getScopingData(Class<S> scopeType)
+ {
+ ArrayList<S> list = new ArrayList<S>();
+ for (ManagementContextImpl current = this; current != null; current = current.parent)
+ {
+ Object scopedData = current.scopingDataList.get(scopeType);
+ if (scopedData != null)
+ {
+ // It must be that type since we put it
+ list.add((S)scopedData);
+ }
+ }
+ return list;
+ }
+
+ public ExoContainer findContainer()
+ {
+ for (ManagementContextImpl current = this;true;current = current.parent)
+ {
+ if (current.container instanceof ExoContainer)
+ {
+ return (ExoContainer)current.container;
+ }
+ else if (current.parent == null)
+ {
+ return null;
+ }
+ }
+ }
+
+ public void beforeInvoke(Object managedResource)
+ {
+ ExoContainer container = findContainer();
+ if (container != null)
+ {
+ RequestLifeCycle.begin(container);
+ }
+ }
+
+ public void afterInvoke(Object managedResource)
+ {
+ RequestLifeCycle.end();
+ }
+
+ @Override
+ public String toString()
+ {
+ return "ManagementContextImpl[container=" + container + "]";
+ }
+
+ public Object getResource()
+ {
+ return resource;
+ }
+
+ public ManagedTypeMetaData getMetaData()
+ {
+ return typeMD;
+ }
+
+ void install(ManagementProvider provider) {
+
+ // Install the current resource if necessary
+ if (resource != null&& typeMD != null)
+ {
+ Object name = provider.manage(this);
+ if (name != null)
+ {
+ managedSet.put(provider, name);
+ }
+ }
+
+ // Install thie children except the container ones
+ for (ManagementContextImpl registration : registrations.values())
+ {
+ registration.install(provider);
+ }
+ }
+}
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/MetaDataBuilder.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/MetaDataBuilder.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/management/MetaDataBuilder.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -19,9 +19,16 @@
package org.exoplatform.container.management;
import org.exoplatform.commons.reflect.AnnotationIntrospector;
+import org.exoplatform.management.annotations.Impact;
+import org.exoplatform.management.annotations.ImpactType;
import org.exoplatform.management.annotations.Managed;
import org.exoplatform.management.annotations.ManagedDescription;
import org.exoplatform.management.annotations.ManagedName;
+import org.exoplatform.management.spi.ManagedMethodMetaData;
+import org.exoplatform.management.spi.ManagedMethodParameterMetaData;
+import org.exoplatform.management.spi.ManagedParameterMetaData;
+import org.exoplatform.management.spi.ManagedPropertyMetaData;
+import org.exoplatform.management.spi.ManagedTypeMetaData;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
@@ -126,8 +133,12 @@
ManagedDescription methodDescriptionAnn = methodDescriptions.get(method);
String methodDescription = methodDescriptionAnn != null ? methodDescriptionAnn.value() : null;
+ //
+ Impact impactAnn = method.getAnnotation(Impact.class);
+ ImpactType impactType = impactAnn != null ? impactAnn.value() : ImpactType.WRITE;
+
// Build the default mbean info
- ManagedMethodMetaData managedMethod = new ManagedMethodMetaData(method);
+ ManagedMethodMetaData managedMethod = new ManagedMethodMetaData(method, impactType);
managedMethod.setDescription(methodDescription);
// Overload with annotations meta data
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractFilter.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractFilter.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractFilter.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.web;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractHttpServlet.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractHttpServlet.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractHttpServlet.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.web;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractHttpSessionListener.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractHttpSessionListener.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/AbstractHttpSessionListener.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.web;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/PortalContainerConfigOwner.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/PortalContainerConfigOwner.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/PortalContainerConfigOwner.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.web;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/PortalContainerCreator.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/PortalContainerCreator.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/web/PortalContainerCreator.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.web;
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/annotations/Impact.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/annotations/Impact.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/annotations/Impact.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.management.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * The impact annotates a managed method to describe how it affects the state of the managed resource.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target({ElementType.TYPE, ElementType.METHOD})
+public @interface Impact
+{
+
+ ImpactType value() default ImpactType.WRITE;
+
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/annotations/ImpactType.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/annotations/ImpactType.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/annotations/ImpactType.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.management.annotations;
+
+/**
+ * The type of the impact of a managed method.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public enum ImpactType
+{
+
+ /**
+ * Read operation, does not affect state of the managed resource.
+ * Equivalent of {@link javax.management.MBeanOperationInfo#INFO} for JMX and GET method for Rest.
+ */
+ READ,
+
+ /**
+ * Write operation, changes the state of the managed resource.
+ * Equivalent of {@link javax.management.MBeanOperationInfo#INFO} for JMX and POST method for Rest.
+ */
+ WRITE,
+
+ /**
+ * Write operation, changes the state of the managed resource in an idempotent manner.
+ * Equivalent of {@link javax.management.MBeanOperationInfo#INFO} for JMX and PUT method for Rest.
+ */
+ IDEMPOTENT_WRITE
+
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/annotations/package-info.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/annotations/package-info.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/annotations/package-info.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,8 @@
+/**
+ * <p>This package defines the annotations the defines the management interface of a service. The annotations are
+ * agnostic of any management layer implementation to avoid the coupling to a specific management layer.</p>
+ *
+ * <p>It is possible for a management layer to define additional annotations that are used by that layer to
+ * provide more information to manage the resource.</p>
+ */
+package org.exoplatform.management.annotations;
\ No newline at end of file
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/annotations/package-info.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/annotations/package-info.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/annotations/package-info.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,4 @@
+/**
+ * This package defines additional meta data for the JMX management layer.
+ */
+package org.exoplatform.management.jmx.annotations;
\ No newline at end of file
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/ExoMBeanInfoBuilder.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/ExoMBeanInfoBuilder.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/ExoMBeanInfoBuilder.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,245 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.jmx.impl;
+
+import org.exoplatform.management.annotations.ImpactType;
+import org.exoplatform.management.spi.ManagedMethodMetaData;
+import org.exoplatform.management.spi.ManagedMethodParameterMetaData;
+import org.exoplatform.management.spi.ManagedPropertyMetaData;
+import org.exoplatform.management.spi.ManagedTypeMetaData;
+import org.exoplatform.container.management.MetaDataBuilder;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.Descriptor;
+import javax.management.IntrospectionException;
+import javax.management.MBeanOperationInfo;
+import javax.management.MBeanParameterInfo;
+import javax.management.modelmbean.ModelMBeanAttributeInfo;
+import javax.management.modelmbean.ModelMBeanConstructorInfo;
+import javax.management.modelmbean.ModelMBeanInfo;
+import javax.management.modelmbean.ModelMBeanInfoSupport;
+import javax.management.modelmbean.ModelMBeanNotificationInfo;
+import javax.management.modelmbean.ModelMBeanOperationInfo;
+
+/**
+ * <p>A class that build mbean meta data</p>
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ExoMBeanInfoBuilder
+{
+
+ private static enum Role {
+ SET("setter"), IS("getter"), GET("getter"), OP("operation");
+
+ private final String name;
+
+ private Role(String role)
+ {
+ this.name = role;
+ }
+ }
+
+ private ManagedTypeMetaData typeMD;
+
+ /**
+ * Create a new builder.
+ *
+ * @param clazz the clazz
+ * @throws IllegalArgumentException if the class is null or does not contain meta data
+ */
+ public ExoMBeanInfoBuilder(Class clazz) throws IllegalArgumentException
+ {
+ this.typeMD = new MetaDataBuilder(clazz).build();
+ }
+
+ public ExoMBeanInfoBuilder(ManagedTypeMetaData typeMD) throws IllegalArgumentException
+ {
+ this.typeMD = typeMD;
+ }
+
+ private ModelMBeanOperationInfo buildOperationInfo(Method method, String description, Role role,
+ Collection<ManagedMethodParameterMetaData> parametersMD, ImpactType impactType)
+ {
+ ModelMBeanOperationInfo operationInfo = new ModelMBeanOperationInfo(description, method);
+
+ //
+ if (description == null)
+ {
+ description = "Management operation";
+ }
+
+ //
+ MBeanParameterInfo[] parameterInfos = operationInfo.getSignature();
+ for (ManagedMethodParameterMetaData parameterMD : parametersMD)
+ {
+ int i = parameterMD.getIndex();
+ MBeanParameterInfo parameterInfo = parameterInfos[i];
+ String parameterName = parameterInfo.getName();
+ String parameterDescription = operationInfo.getSignature()[i].getDescription();
+ if (parameterMD.getName() != null)
+ {
+ parameterName = parameterMD.getName();
+ }
+ else if (parameterMD.getDescription() != null)
+ {
+ parameterDescription = parameterMD.getDescription();
+ }
+ parameterInfos[i] = new MBeanParameterInfo(parameterName, parameterInfo.getType(), parameterDescription);
+ }
+
+ //
+ int jmxImpact;
+ switch (impactType)
+ {
+ case READ:
+ jmxImpact = MBeanOperationInfo.INFO;
+ break;
+ case IDEMPOTENT_WRITE:
+ case WRITE:
+ jmxImpact = MBeanOperationInfo.ACTION;
+ break;
+ default:
+ throw new AssertionError();
+ }
+
+ //
+ Descriptor operationDescriptor = operationInfo.getDescriptor();
+ operationDescriptor.setField("role", role.name);
+
+ //
+ return new ModelMBeanOperationInfo(operationInfo.getName(), description, parameterInfos, operationInfo
+ .getReturnType(), jmxImpact, operationDescriptor);
+ }
+
+ /**
+ * Build the info.
+ *
+ * @return returns the info
+ * @throws IllegalStateException raised by any build time issue
+ */
+ public ModelMBeanInfo build() throws IllegalStateException
+ {
+ String mbeanDescription = "Exo model mbean";
+ if (typeMD.getDescription() != null)
+ {
+ mbeanDescription = typeMD.getDescription();
+ }
+
+ //
+ ArrayList<ModelMBeanOperationInfo> operations = new ArrayList<ModelMBeanOperationInfo>();
+ for (ManagedMethodMetaData methodMD : typeMD.getMethods())
+ {
+ ModelMBeanOperationInfo operationInfo =
+ buildOperationInfo(methodMD.getMethod(), methodMD.getDescription(), Role.OP, methodMD.getParameters(), methodMD.getImpact());
+ operations.add(operationInfo);
+ }
+
+ //
+ Map<String, ModelMBeanAttributeInfo> attributeInfos = new HashMap<String, ModelMBeanAttributeInfo>();
+ for (ManagedPropertyMetaData propertyMD : typeMD.getProperties())
+ {
+
+ Method getter = propertyMD.getGetter();
+ if (getter != null)
+ {
+ Role role;
+ String getterName = getter.getName();
+ if (getterName.startsWith("get") && getterName.length() > 3)
+ {
+ role = Role.GET;
+ }
+ else if (getterName.startsWith("is") && getterName.length() > 2)
+ {
+ role = Role.IS;
+ }
+ else
+ {
+ throw new AssertionError();
+ }
+ Collection<ManagedMethodParameterMetaData> blah = Collections.emptyList();
+ ModelMBeanOperationInfo operationInfo =
+ buildOperationInfo(getter, propertyMD.getGetterDescription(), role, blah, ImpactType.READ);
+ operations.add(operationInfo);
+ }
+
+ //
+ Method setter = propertyMD.getSetter();
+ if (setter != null)
+ {
+ ManagedMethodParameterMetaData s = new ManagedMethodParameterMetaData(0);
+ s.setDescription(propertyMD.getSetterParameter().getDescription());
+ s.setName(propertyMD.getSetterParameter().getName());
+ Collection<ManagedMethodParameterMetaData> blah = Collections.singletonList(s);
+ ModelMBeanOperationInfo operationInfo =
+ buildOperationInfo(setter, propertyMD.getSetterDescription(), Role.SET, blah, ImpactType.IDEMPOTENT_WRITE);
+ operations.add(operationInfo);
+ }
+
+ //
+ try
+ {
+ String attributeDescription =
+ propertyMD.getDescription() != null ? propertyMD.getDescription() : ("Managed attribute " + propertyMD
+ .getName());
+
+ //
+ ModelMBeanAttributeInfo attributeInfo =
+ new ModelMBeanAttributeInfo(propertyMD.getName(), attributeDescription, getter, setter);
+
+ //
+ Descriptor attributeDescriptor = attributeInfo.getDescriptor();
+ if (getter != null)
+ {
+ attributeDescriptor.setField("getMethod", getter.getName());
+ }
+ if (setter != null)
+ {
+ attributeDescriptor.setField("setMethod", setter.getName());
+ }
+ attributeDescriptor.setField("currencyTimeLimit", "-1");
+ attributeDescriptor.setField("persistPolicy", "Never");
+ attributeInfo.setDescriptor(attributeDescriptor);
+
+ //
+ ModelMBeanAttributeInfo previous = attributeInfos.put(propertyMD.getName(), attributeInfo);
+ if (previous != null)
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+ catch (IntrospectionException e)
+ {
+ throw new AssertionError(e);
+ }
+ }
+
+ //
+ return new ModelMBeanInfoSupport(typeMD.getType().getName(), mbeanDescription, attributeInfos.values().toArray(
+ new ModelMBeanAttributeInfo[attributeInfos.size()]), new ModelMBeanConstructorInfo[0], operations
+ .toArray(new ModelMBeanOperationInfo[operations.size()]), new ModelMBeanNotificationInfo[0]);
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/ExoModelMBean.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/ExoModelMBean.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/ExoModelMBean.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.jmx.impl;
+
+import org.exoplatform.management.spi.ManagedResource;
+import org.exoplatform.management.ManagementAware;
+import org.exoplatform.management.jmx.annotations.NamingContext;
+
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanException;
+import javax.management.MBeanRegistration;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.management.ReflectionException;
+import javax.management.RuntimeOperationsException;
+import javax.management.modelmbean.InvalidTargetObjectTypeException;
+import javax.management.modelmbean.ModelMBeanInfo;
+import javax.management.modelmbean.RequiredModelMBean;
+
+/**
+ * A convenient subclass of {@link RequiredModelMBean) that routes the invocation of the interface
+ * {@link MBeanRegistration} to the managed resource when it implements the method.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ExoModelMBean extends RequiredModelMBean
+{
+
+ /** . */
+ private Object mr;
+
+ /** . */
+ private final ManagedResource context;
+
+ public ExoModelMBean(ManagedResource context, Object mr, ModelMBeanInfo mbi) throws MBeanException,
+ RuntimeOperationsException, InstanceNotFoundException, InvalidTargetObjectTypeException
+ {
+ super(mbi);
+
+ //
+ this.context = context;
+ this.mr = mr;
+
+ //
+ setManagedResource(mr, "ObjectReference");
+ }
+
+ @Override
+ public Object invoke(String opName, Object[] opArgs, String[] sig) throws MBeanException, ReflectionException
+ {
+ context.beforeInvoke(mr);
+ try
+ {
+ return super.invoke(opName, opArgs, sig);
+ }
+ finally
+ {
+ context.afterInvoke(mr);
+ }
+ }
+
+ @Override
+ public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
+ {
+ name = super.preRegister(server, name);
+
+ //
+ if (mr instanceof MBeanRegistration)
+ {
+ ((MBeanRegistration)mr).preRegister(server, name);
+ }
+
+ //
+ return name;
+ }
+
+ @Override
+ public void postRegister(Boolean registrationDone)
+ {
+ super.postRegister(registrationDone);
+
+ //
+ PropertiesInfo info = PropertiesInfo.resolve(mr.getClass(), NamingContext.class);
+
+ //
+ MBeanScopingData scopingData = info != null ? info.resolve(mr) : new MBeanScopingData();
+
+ //
+ context.setScopingData(MBeanScopingData.class, scopingData);
+
+ //
+ if (mr instanceof MBeanRegistration)
+ {
+ ((MBeanRegistration)mr).postRegister(registrationDone);
+ }
+ }
+
+ @Override
+ public void preDeregister() throws Exception
+ {
+ if (mr instanceof MBeanRegistration)
+ {
+ ((MBeanRegistration)mr).preDeregister();
+ }
+
+ //
+ if (mr instanceof ManagementAware)
+ {
+ ((ManagementAware)mr).setContext(null);
+ }
+
+ //
+ super.preDeregister();
+ }
+
+ @Override
+ public void postDeregister()
+ {
+ if (mr instanceof MBeanRegistration)
+ {
+ ((MBeanRegistration)mr).postDeregister();
+ }
+
+ //
+ super.postDeregister();
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/JMX.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/JMX.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/JMX.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.jmx.impl;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+/**
+ * Various JMX utilities.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class JMX
+{
+
+ private JMX()
+ {
+ }
+
+ /**
+ * This method create an object name from a generic map argument. The main reason is that
+ * the method {@link javax.management.ObjectName#getInstance(String, java.util.Hashtable)} has
+ * uses a non generic Hashtable with Java 5 and use a Hashtable<String, String> constructor in Java 6.
+ *
+ * The suitable solution is therefore to use a non generic Hashtable but that creates compilation warning therefore
+ * we encapsulate there this code in order to use the warning supression in that single place.
+ *
+ * @see ObjectName#getInstance(String, java.util.Hashtable)
+ *
+ * @param domain The domain part of the object name.
+ * @param table A hash table containing one or more key
+ * properties. The key of each entry in the table is the key of a
+ * key property in the object name. The associated value in the
+ * table is the associated value in the object name.
+ *
+ * @return an ObjectName corresponding to the given domain and
+ * key mappings.
+ * @exception MalformedObjectNameException The <code>domain</code>
+ * contains an illegal character, or one of the keys or values in
+ * <code>table</code> contains an illegal character, or one of the
+ * values in <code>table</code> does not follow the rules for
+ * quoting.
+ * @exception NullPointerException One of the parameters is null.
+ */
+ @SuppressWarnings("unchecked")
+ public static ObjectName createObjectName(String domain, Map<String, String> table)
+ throws MalformedObjectNameException, NullPointerException
+ {
+ Hashtable tmp = new Hashtable(table);
+ return ObjectName.getInstance(domain, tmp);
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/JMXManagementProvider.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/JMXManagementProvider.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/JMXManagementProvider.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,180 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.jmx.impl;
+
+import org.exoplatform.management.spi.ManagedResource;
+import org.exoplatform.management.spi.ManagementProvider;
+import org.exoplatform.management.jmx.annotations.NameTemplate;
+
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanRegistrationException;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.modelmbean.ModelMBeanInfo;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class JMXManagementProvider implements ManagementProvider
+{
+
+ /** . */
+ private final MBeanServer server;
+
+ public JMXManagementProvider()
+ {
+ this(MBeanServerFactory.createMBeanServer());
+ }
+
+ public JMXManagementProvider(MBeanServer server)
+ {
+ this.server = server;
+ }
+
+ public Object manage(ManagedResource context)
+ {
+ ExoModelMBean mbean = null;
+ try
+ {
+ ExoMBeanInfoBuilder infoBuilder = new ExoMBeanInfoBuilder(context.getMetaData());
+ ModelMBeanInfo info = infoBuilder.build();
+ mbean = new ExoModelMBean(context, context.getResource(), info);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ //
+ if (mbean != null)
+ {
+ ObjectName on = null;
+ PropertiesInfo oni = PropertiesInfo.resolve(context.getResource().getClass(), NameTemplate.class);
+ if (oni != null)
+ {
+ try
+ {
+ Map<String, String> foo = oni.resolve(context.getResource());
+ on = JMX.createObjectName("exo", foo);
+ }
+ catch (MalformedObjectNameException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ if (on != null)
+ {
+ // Merge with the container hierarchy context
+ try
+ {
+ Map<String, String> props = new Hashtable<String, String>();
+
+ // Merge scoping properties
+ List<MBeanScopingData> list = context.getScopingData(MBeanScopingData.class);
+ for (MBeanScopingData scopingData : list)
+ {
+ props.putAll(scopingData);
+ }
+
+ // Julien : I know it's does not look great but it's necessary
+ // for compiling under Java 5 and Java 6 properly. The methods
+ // ObjectName#getKeyPropertyList() returns an Hashtable with Java 5
+ // and a Hashtable<String, String> with Java 6.
+ for (Object o : on.getKeyPropertyList().entrySet())
+ {
+ Map.Entry entry = (Map.Entry)o;
+ String key = (String)entry.getKey();
+ String value = (String)entry.getValue();
+ props.put(key, value);
+ }
+
+ //
+ on = JMX.createObjectName(on.getDomain(), props);
+
+ //
+ attemptToRegister(on, mbean);
+
+ //
+ return on;
+ }
+ catch (MalformedObjectNameException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ //
+ return null;
+ }
+
+ private void attemptToRegister(ObjectName name, Object mbean)
+ {
+ synchronized (server)
+ {
+ try
+ {
+ server.registerMBean(mbean, name);
+ }
+ catch (InstanceAlreadyExistsException e)
+ {
+ try
+ {
+
+ server.unregisterMBean(name);
+ server.registerMBean(mbean, name);
+
+ }
+ catch (Exception e1)
+ {
+ throw new RuntimeException("Failed to register MBean '" + name + " due to " + e.getMessage(), e);
+ }
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Failed to register MBean '" + name + " due to " + e.getMessage(), e);
+ }
+ }
+ }
+
+ public void unmanage(Object key)
+ {
+ ObjectName name = (ObjectName)key;
+ try
+ {
+ server.unregisterMBean(name);
+ }
+ catch (InstanceNotFoundException e)
+ {
+ e.printStackTrace();
+ }
+ catch (MBeanRegistrationException e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/MBeanScopingData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/MBeanScopingData.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/MBeanScopingData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.jmx.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class MBeanScopingData extends HashMap<String, String>
+{
+ public MBeanScopingData(int initialCapacity, float loadFactor)
+ {
+ super(initialCapacity, loadFactor);
+ }
+
+ public MBeanScopingData(int initialCapacity)
+ {
+ super(initialCapacity);
+ }
+
+ public MBeanScopingData()
+ {
+ }
+
+ public MBeanScopingData(Map<? extends String, ? extends String> m)
+ {
+ super(m);
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/ObjectNameBuilder.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/ObjectNameBuilder.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/ObjectNameBuilder.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.jmx.impl;
+
+import org.exoplatform.management.jmx.annotations.NameTemplate;
+
+import java.util.Map;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+/**
+ * A builder for object name templates.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ObjectNameBuilder<T>
+{
+
+ /** . */
+ private String domain;
+
+ /** . */
+ private Class<? extends T> clazz;
+
+ /**
+ * Create a new builder.
+ *
+ * @param clazz the class
+ * @throws IllegalArgumentException if the object is null
+ */
+ public ObjectNameBuilder(String domain, Class<? extends T> clazz) throws IllegalArgumentException
+ {
+ if (clazz == null)
+ {
+ throw new IllegalArgumentException("Clazz cannot be null");
+ }
+ this.domain = domain;
+ this.clazz = clazz;
+ }
+
+ /**
+ * Build the object name or return null if the class is not annotated by
+ * {@link NameTemplate}.
+ *
+ * @param object the object
+ * @return the built name
+ * @throws IllegalStateException raised by a build time issue
+ */
+ public ObjectName build(T object) throws IllegalStateException
+ {
+ PropertiesInfo info = PropertiesInfo.resolve(clazz, NameTemplate.class);
+
+ //
+ if (info != null)
+ {
+
+ try
+ {
+ Map<String, String> props = info.resolve(object);
+ return JMX.createObjectName(domain, props);
+ }
+ catch (MalformedObjectNameException e)
+ {
+ throw new IllegalArgumentException("ObjectName template is malformed", e);
+ }
+ }
+
+ //
+ return null;
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/PropertiesInfo.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/PropertiesInfo.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/PropertiesInfo.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.jmx.impl;
+
+import org.exoplatform.commons.reflect.AnnotationIntrospector;
+import org.exoplatform.management.jmx.annotations.NameTemplate;
+import org.exoplatform.management.jmx.annotations.NamingContext;
+import org.exoplatform.management.jmx.annotations.Property;
+
+import java.lang.annotation.Annotation;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PropertiesInfo
+{
+
+ /** . */
+ private Map<String, PropertyInfo> properties;
+
+ public PropertiesInfo(Map<String, PropertyInfo> properties)
+ {
+ this.properties = properties;
+ }
+
+ public static PropertiesInfo resolve(Class clazz, Class<? extends Annotation> annotationClass)
+ {
+ Annotation tpl2 = AnnotationIntrospector.resolveClassAnnotations(clazz, annotationClass);
+ Property[] blah = null;
+ if (tpl2 instanceof NamingContext)
+ {
+ blah = ((NamingContext)tpl2).value();
+ }
+ else if (tpl2 instanceof NameTemplate)
+ {
+ blah = ((NameTemplate)tpl2).value();
+ }
+ if (blah != null)
+ {
+ Map<String, PropertyInfo> properties = new HashMap<String, PropertyInfo>();
+ for (Property property : blah)
+ {
+ PropertyInfo propertyInfo = new PropertyInfo(clazz, property);
+ properties.put(propertyInfo.getKey(), propertyInfo);
+ }
+ return new PropertiesInfo(properties);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public Collection<PropertyInfo> getProperties()
+ {
+ return properties.values();
+ }
+
+ public MBeanScopingData resolve(Object instance)
+ {
+ MBeanScopingData props = new MBeanScopingData();
+ for (PropertyInfo propertyInfo : properties.values())
+ {
+ String key = propertyInfo.getKey();
+ String value = propertyInfo.resolveValue(instance);
+ props.put(key, value);
+ }
+ return props;
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/PropertyInfo.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/PropertyInfo.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/PropertyInfo.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,161 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.jmx.impl;
+
+import org.exoplatform.management.jmx.annotations.Property;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+import javax.management.ObjectName;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PropertyInfo
+{
+
+ /** . */
+ private final String key;
+
+ /** . */
+ private final Value value;
+
+ public PropertyInfo(Class clazz, Property def)
+ {
+ String tmp = def.value();
+ Value value;
+ int length = tmp.length();
+ if (length > 2 && tmp.charAt(0) == '{' && tmp.charAt(length - 1) == '}')
+ {
+ String s = tmp.substring(1, length - 1);
+ String getterName = "get" + s;
+ Method getter;
+ try
+ {
+ getter = clazz.getMethod(getterName);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new IllegalArgumentException("Getter parameter for property " + s + " on class " + clazz.getName()
+ + " does not exist", e);
+ }
+
+ //
+ if (getter.getReturnType() == void.class)
+ {
+ throw new IllegalArgumentException("Getter return type for property " + s + " on class " + clazz.getName()
+ + " cannot be void");
+ }
+ if (getter.getParameterTypes().length > 0)
+ {
+ throw new IllegalArgumentException("Getter parameter type for property " + s + " on class "
+ + clazz.getName() + " is not empty");
+ }
+ if (Modifier.isStatic(getter.getModifiers()))
+ {
+ throw new IllegalArgumentException("Getter for property " + s + " on class " + clazz.getName()
+ + " is static");
+ }
+
+ //
+ value = new DynamicValue(getter);
+ }
+ else
+ {
+ value = new LitteralValue(tmp);
+ }
+
+ //
+ this.key = def.key();
+ this.value = value;
+ }
+
+ public String resolveValue(Object instance)
+ {
+ return value.resolve(instance);
+ }
+
+ public String getKey()
+ {
+ return key;
+ }
+
+ private abstract static class Value
+ {
+ abstract String resolve(Object instance);
+ }
+
+ private class DynamicValue extends Value
+ {
+
+ /** . */
+ private final Method getter;
+
+ private DynamicValue(Method getter)
+ {
+ this.getter = getter;
+ }
+
+ String resolve(Object instance)
+ {
+ Object value;
+ try
+ {
+ value = getter.invoke(instance);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new IllegalArgumentException("Getter for property " + key + " on class "
+ + getter.getClass().getName() + " cannot be invoked", e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new IllegalArgumentException("Getter for property " + key + " on class "
+ + getter.getClass().getName() + " threw an exception during invocation", e);
+ }
+ if (value == null)
+ {
+ throw new IllegalArgumentException("Getter for property " + key + " on class "
+ + getter.getClass().getName() + " returned a null value");
+ }
+ return ObjectName.quote(value.toString());
+ }
+ }
+
+ private static class LitteralValue extends Value
+ {
+
+ /** . */
+ private final String litteral;
+
+ private LitteralValue(String litteral)
+ {
+ this.litteral = litteral;
+ }
+
+ String resolve(Object instance)
+ {
+ return litteral;
+ }
+ }
+
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/package-info.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/package-info.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/package-info.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,4 @@
+/**
+ * The implementation of the management SPI (@link org.exoplatform.management.spi} for the JMX management system.
+ */
+package org.exoplatform.management.jmx.impl;
\ No newline at end of file
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMetaData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMetaData.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMetaData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.spi;
+
+/**
+ * Generic base meta data class.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ManagedMetaData
+{
+
+ /** . */
+ private String description;
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMethodMetaData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMethodMetaData.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMethodMetaData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.spi;
+
+import org.exoplatform.management.annotations.ImpactType;
+
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Meta data that describes a managed method.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ManagedMethodMetaData extends ManagedMetaData
+{
+
+ /** . */
+ private final Method method;
+
+ /** . */
+ private final Map<Integer, ManagedMethodParameterMetaData> parameters;
+
+ /** . */
+ private final ImpactType impact;
+
+ /**
+ * Build a new instance.
+ *
+ * @param method the method
+ * @param impactType the access mode
+ * @throws NullPointerException if the method is null or the impact is null
+ */
+ public ManagedMethodMetaData(Method method, ImpactType impactType) throws NullPointerException
+ {
+ if (method == null)
+ {
+ throw new NullPointerException();
+ }
+ if (impactType == null)
+ {
+ throw new NullPointerException();
+ }
+
+ //
+ this.method = method;
+ this.impact = impactType;
+ this.parameters = new HashMap<Integer, ManagedMethodParameterMetaData>();
+ }
+
+ public String getName()
+ {
+ return method.getName();
+ }
+
+ public ImpactType getImpact()
+ {
+ return impact;
+ }
+
+ public Method getMethod()
+ {
+ return method;
+ }
+
+ public void addParameter(ManagedMethodParameterMetaData parameter)
+ {
+ if (parameter == null)
+ {
+ throw new NullPointerException("No null parameter accepted");
+ }
+ parameters.put(parameter.getIndex(), parameter);
+ }
+
+ public Collection<ManagedMethodParameterMetaData> getParameters()
+ {
+ return Collections.unmodifiableCollection(parameters.values());
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMethodParameterMetaData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMethodParameterMetaData.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedMethodParameterMetaData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.spi;
+
+/**
+ * Meta data that describes the parameter of a managed method.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ManagedMethodParameterMetaData extends ManagedParameterMetaData
+{
+
+ /** . */
+ private final int index;
+
+ /**
+ * Build a managed method parameter meta data.
+ *
+ * @param index the parameter index
+ * @throws IllegalArgumentException if the index is negative
+ */
+ public ManagedMethodParameterMetaData(int index) throws IllegalArgumentException
+ {
+ if (index < 0)
+ {
+ throw new IllegalArgumentException("Non negative index value accepted " + index);
+ }
+ this.index = index;
+ }
+
+ public int getIndex()
+ {
+ return index;
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedParameterMetaData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedParameterMetaData.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedParameterMetaData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.spi;
+
+/**
+ * Meta data that describes a managed parameter.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ManagedParameterMetaData extends ManagedMetaData
+{
+
+ /** . */
+ private String name;
+
+ public ManagedParameterMetaData()
+ {
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedPropertyMetaData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedPropertyMetaData.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedPropertyMetaData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.spi;
+
+import java.lang.reflect.Method;
+
+/**
+ * Meta data that describes a managed property.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ManagedPropertyMetaData extends ManagedMetaData
+{
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final Method getter;
+
+ /** . */
+ private final String getterDescription;
+
+ /** . */
+ private final Method setter;
+
+ /** . */
+ private final String setterDescription;
+
+ /** . */
+ private final ManagedParameterMetaData setterParameter;
+
+ public ManagedPropertyMetaData(String name, Method getter, String getterDescription, Method setter,
+ String setterDescription, ManagedParameterMetaData setterParameter) throws NullPointerException,
+ IllegalArgumentException
+ {
+ if (name == null)
+ {
+ throw new NullPointerException("No null name accepted");
+ }
+ if (setter != null)
+ {
+ if (setterParameter == null)
+ {
+ throw new IllegalArgumentException("No setter parameter provided");
+ }
+ }
+ else
+ {
+ if (setterParameter != null)
+ {
+ throw new IllegalArgumentException("No setter provided but a setter parameter was provided");
+ }
+ }
+
+ //
+ this.name = name;
+ this.getter = getter;
+ this.getterDescription = getterDescription;
+ this.setter = setter;
+ this.setterDescription = setterDescription;
+ this.setterParameter = setterParameter;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Method getGetter()
+ {
+ return getter;
+ }
+
+ public Method getSetter()
+ {
+ return setter;
+ }
+
+ public String getGetterDescription()
+ {
+ return getterDescription;
+ }
+
+ public String getSetterDescription()
+ {
+ return setterDescription;
+ }
+
+ public ManagedParameterMetaData getSetterParameter()
+ {
+ return setterParameter;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "ManagedPropertyMetaData[" + "name=" + name + "getter=" + getter.getName() + "setter=" + setter.getName()
+ + "]";
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedResource.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedResource.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedResource.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.spi;
+
+import org.exoplatform.management.ManagementContext;
+
+import java.util.List;
+
+/**
+ * The managed resource provided by the kernel to a management provider. It gives access
+ * to the resource itself, the meta data of the managed resource, the attached scoped data
+ * and the before/after invoke contract when a resource is invoked from the management layer.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public interface ManagedResource extends ManagementContext
+{
+
+ /**
+ * The resource implementation.
+ *
+ * @return the resource
+ */
+ Object getResource();
+
+ /**
+ * Returns the resource meta data.
+ *
+ * @return the meta data
+ */
+ ManagedTypeMetaData getMetaData();
+
+ /**
+ * Returns the scoping data of the context. The list contains the scoping properties
+ * registered by the provider if a call has been made to the {@link #setScopingData(Class, Object)}
+ * method plus the scoping properties of the parent context.
+ *
+ * @param scopeType the scope type
+ * @param <S> the generic type of the scope type
+ * @return the scoping properties
+ */
+ <S> List<S> getScopingData(Class<S> scopeType);
+
+ /**
+ * Callback made by the provider to the resource to signal that scoping data that is used for the managed resource.
+ *
+ * @param scopeType the scope type
+ * @param <S> the generic type of the scope type
+ * @param scopingData the scoping data
+ */
+ <S> void setScopingData(Class<S> scopeType, S scopingData);
+
+ /**
+ * Before a managed resource is invoked by the management layer.
+ *
+ * @param managedResource the managed resource
+ */
+ void beforeInvoke(Object managedResource);
+
+ /**
+ * After a managed resource is invoked by the management layer.
+ *
+ * @param managedResource the managed resource
+ */
+ void afterInvoke(Object managedResource);
+
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedTypeMetaData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedTypeMetaData.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagedTypeMetaData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.spi;
+
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Meta data that describes a managed type.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ManagedTypeMetaData extends ManagedMetaData
+{
+
+ /** . */
+ private final Class type;
+
+ /** . */
+ private final Map<String, ManagedPropertyMetaData> properties;
+
+ /** . */
+ private final Map<MethodKey, ManagedMethodMetaData> methods;
+
+ public ManagedTypeMetaData(Class type) throws NullPointerException
+ {
+ if (type == null)
+ {
+ throw new NullPointerException();
+ }
+
+ //
+ this.type = type;
+ this.properties = new HashMap<String, ManagedPropertyMetaData>();
+ this.methods = new HashMap<MethodKey, ManagedMethodMetaData>();
+ }
+
+ public Class getType()
+ {
+ return type;
+ }
+
+ public ManagedPropertyMetaData getProperty(String propertyName)
+ {
+ return properties.get(propertyName);
+ }
+
+ public void addProperty(ManagedPropertyMetaData property)
+ {
+ properties.put(property.getName(), property);
+ }
+
+ public void addMethod(ManagedMethodMetaData method)
+ {
+ methods.put(new MethodKey(method.getMethod()), method);
+ }
+
+ public Collection<ManagedMethodMetaData> getMethods()
+ {
+ return methods.values();
+ }
+
+ public Collection<ManagedPropertyMetaData> getProperties()
+ {
+ return properties.values();
+ }
+
+ private static class MethodKey
+ {
+
+ private final String name;
+
+ private final List<Class<?>> types;
+
+ private MethodKey(Method method)
+ {
+ this.name = method.getName();
+ this.types = Arrays.asList(method.getParameterTypes());
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int hashCode = name.hashCode();
+ for (Class<?> type : types)
+ {
+ hashCode = hashCode * 41 + type.hashCode();
+ }
+ return hashCode;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof MethodKey)
+ {
+ MethodKey that = (MethodKey)obj;
+ return this.name.equals(that.name) && this.types.equals(that.types);
+ }
+ return false;
+ }
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagementProvider.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagementProvider.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/ManagementProvider.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.management.spi;
+
+/**
+ * This interface is implemented by a management provider such a JMX.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public interface ManagementProvider
+{
+
+ /**
+ * Instruct the management provider to manage the provided managed resource. If any registration is done
+ * the provider should return an unique key that will be used later for unregistration purpose in the
+ * {@link #unmanage(Object)} method. If no registration is performed then null should be returned.
+ *
+ * @param managedResource the managed resource
+ * @return the key under which the resource is registered
+ */
+ Object manage(ManagedResource managedResource);
+
+ /**
+ * Instruct the management provider to remove the specifed resource from management.
+ *
+ * @param key the key under which the resource is registered
+ */
+ void unmanage(Object key);
+
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/package-info.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/package-info.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/management/spi/package-info.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,11 @@
+/**
+ * <p>The Service Provider Interface for the eXo management framework. The entry point for plugged management system
+ * is the implementation of the interface {@link org.exoplatform.management.spi.ManagementProvider}.</p>
+ *
+ * <p>A part of the package defines the meta data that is given to the provider to build the management interface
+ * of the managed resource.</p>
+ *
+ * <p>The {@link org.exoplatform.management.spi.ManagedResource} interface wraps a resource and is provided by the
+ * kernel to the provider.</p>
+ */
+package org.exoplatform.management.spi;
\ No newline at end of file
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/resources/org/exoplatform/container/configuration/kernel-configuration_1_0.xsd
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/resources/org/exoplatform/container/configuration/kernel-configuration_1_0.xsd 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/resources/org/exoplatform/container/configuration/kernel-configuration_1_0.xsd 2010-01-10 18:27:37 UTC (rev 1331)
@@ -9,7 +9,7 @@
<xsd:element name="configuration" type="configurationType"/>
- <xsd:complexType abstract="true" name="baseObjectType">
+ <xsd:complexType name="baseObjectType">
<xsd:choice>
<xsd:element name="string" type="xsd:string"/>
<xsd:element name="int" type="xsd:int"/>
@@ -39,16 +39,16 @@
<xsd:complexType name="mapType">
<xsd:sequence>
- <xsd:element name="type" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="entry" type="entryType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
+ <xsd:attribute name="type" type="xsd:string" use="required"/>
</xsd:complexType>
<xsd:complexType name="collectionType">
<xsd:sequence>
<xsd:element name="value" type="valueType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
- <xsd:attribute name="type" type="xsd:string"/>
+ <xsd:attribute name="type" type="xsd:string" use="required"/>
<xsd:attribute name="item-type" type="xsd:string"/>
</xsd:complexType>
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/resources/org/exoplatform/container/configuration/kernel-configuration_1_1.xsd
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/resources/org/exoplatform/container/configuration/kernel-configuration_1_1.xsd 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/resources/org/exoplatform/container/configuration/kernel-configuration_1_1.xsd 2010-01-10 18:27:37 UTC (rev 1331)
@@ -13,7 +13,7 @@
<xsd:attribute name="profiles" type="xsd:string"/>
</xsd:complexType>
- <xsd:complexType abstract="true" name="baseObjectType">
+ <xsd:complexType name="baseObjectType">
<xsd:choice>
<xsd:element name="string" type="xsd:string"/>
<xsd:element name="int" type="xsd:int"/>
@@ -37,9 +37,9 @@
<xsd:complexType name="mapType">
<xsd:sequence>
- <xsd:element name="type" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="entry" type="entryType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
+ <xsd:attribute name="type" type="xsd:string" use="required"/>
</xsd:complexType>
<xsd:complexType name="collectionType">
@@ -54,7 +54,7 @@
</xsd:complexType>
</xsd:element>
</xsd:sequence>
- <xsd:attribute name="type" type="xsd:string"/>
+ <xsd:attribute name="type" type="xsd:string" use="required"/>
<xsd:attribute name="item-type" type="xsd:string"/>
</xsd:complexType>
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/ComponentWithRequestLifeCycle.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/ComponentWithRequestLifeCycle.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/ComponentWithRequestLifeCycle.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/LifeCycle.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/LifeCycle.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/LifeCycle.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainerInitTaskContextComparator.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainerInitTaskContextComparator.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainerInitTaskContextComparator.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestPropertyManagerConfigurator.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestPropertyManagerConfigurator.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestPropertyManagerConfigurator.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestRequestLifeCycle.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestRequestLifeCycle.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestRequestLifeCycle.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestUnifiedClassLoader.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestUnifiedClassLoader.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestUnifiedClassLoader.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestWebAppInitContextComparator.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestWebAppInitContextComparator.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/TestWebAppInitContextComparator.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2009 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/AbstractProfileTest.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/AbstractProfileTest.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/AbstractProfileTest.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.configuration;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/InitParamsHolder.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/InitParamsHolder.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/InitParamsHolder.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.configuration;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestCollectionValue.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestCollectionValue.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestCollectionValue.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.configuration;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestComponentPluginProfile.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestComponentPluginProfile.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestComponentPluginProfile.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.configuration;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestComponentProfile.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestComponentProfile.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestComponentProfile.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.configuration;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestField.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestField.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestField.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.configuration;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestImportProfile.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestImportProfile.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestImportProfile.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.configuration;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestInitParamProfile.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestInitParamProfile.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestInitParamProfile.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.configuration;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestXSD_1_0.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestXSD_1_0.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestXSD_1_0.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -58,6 +58,6 @@
fail("Was not expecting such exception " + e.getMessage());
}
}
- assertEquals(16, count);
+ assertEquals(17, count);
}
}
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestXSD_1_1.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestXSD_1_1.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/configuration/TestXSD_1_1.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -58,6 +58,6 @@
fail("Was not expecting such exception " + e.getMessage());
}
}
- assertEquals(17, count);
+ assertEquals(18, count);
}
}
\ No newline at end of file
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/AbstractTestExoMBean.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/AbstractTestExoMBean.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/AbstractTestExoMBean.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -19,6 +19,7 @@
package org.exoplatform.container.jmx;
import junit.framework.TestCase;
+import org.exoplatform.management.jmx.impl.ExoMBeanInfoBuilder;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestExoMBeanOperation.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestExoMBeanOperation.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestExoMBeanOperation.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -18,6 +18,8 @@
*/
package org.exoplatform.container.jmx;
+import org.exoplatform.management.annotations.Impact;
+import org.exoplatform.management.annotations.ImpactType;
import org.exoplatform.management.annotations.Managed;
import org.exoplatform.management.annotations.ManagedDescription;
import org.exoplatform.management.annotations.ManagedName;
@@ -188,4 +190,51 @@
return Integer.toString(arg);
}
}
+
+ public void test6() throws Exception
+ {
+ Bean bean = register("domain:name=mbean", MBean6.class);
+ MBeanOperationInfo[] operationInfos = bean.info.getOperations();
+ assertNotNull(operationInfos);
+ assertEquals(4, operationInfos.length);
+ MBeanOperationInfo readInfo = bean.info.getOperation("read");
+ assertNotNull(readInfo);
+ assertEquals(MBeanOperationInfo.INFO, readInfo.getImpact());
+ MBeanOperationInfo writeInfo = bean.info.getOperation("write");
+ assertNotNull(writeInfo);
+ assertEquals(MBeanOperationInfo.ACTION, writeInfo.getImpact());
+ MBeanOperationInfo idempotentWriteInfo = bean.info.getOperation("idempotentWrite");
+ assertNotNull(idempotentWriteInfo);
+ assertEquals(MBeanOperationInfo.ACTION, idempotentWriteInfo.getImpact());
+ MBeanOperationInfo defaultImpactInfo = bean.info.getOperation("defaultImpact");
+ assertNotNull(defaultImpactInfo);
+ assertEquals(MBeanOperationInfo.ACTION, defaultImpactInfo.getImpact());
+ }
+
+ @Managed
+ public static class MBean6
+ {
+ @Managed
+ @Impact(ImpactType.READ)
+ public void read()
+ {
+ }
+
+ @Managed
+ @Impact(ImpactType.WRITE)
+ public void write()
+ {
+ }
+
+ @Managed
+ @Impact(ImpactType.IDEMPOTENT_WRITE)
+ public void idempotentWrite()
+ {
+ }
+
+ @Managed
+ public void defaultImpact()
+ {
+ }
+ }
}
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestNameTemplate.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestNameTemplate.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestNameTemplate.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -22,6 +22,7 @@
import org.exoplatform.management.jmx.annotations.NameTemplate;
import org.exoplatform.management.jmx.annotations.Property;
+import org.exoplatform.management.jmx.impl.ObjectNameBuilder;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestPortalContainerManagedIntegration.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestPortalContainerManagedIntegration.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/TestPortalContainerManagedIntegration.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,24 +1,27 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.jmx;
import org.exoplatform.container.PortalContainer;
import org.exoplatform.container.RootContainer;
import org.exoplatform.container.jmx.support.SimpleManagementAware;
+import org.exoplatform.container.management.ManagementContextImpl;
import org.exoplatform.container.support.ContainerBuilder;
import java.net.URL;
@@ -47,12 +50,12 @@
//
SimpleManagementAware rootManagementAware = (SimpleManagementAware)root.getComponentInstance("RootManagementAware");
- ManagementContextImpl rootManagementAwareContext = (ManagementContextImpl)((ExoModelMBean)rootManagementAware.context).getManagementContext();
+ ManagementContextImpl rootManagementAwareContext = (ManagementContextImpl)rootManagementAware.context;
assertSame(rootManagementContext, rootManagementAwareContext.getParent());
//
SimpleManagementAware portalManagementAware = (SimpleManagementAware)portal.getComponentInstance("PortalManagementAware");
- ManagementContextImpl portalManagementAwareContext = (ManagementContextImpl)((ExoModelMBean)portalManagementAware.context).getManagementContext();
+ ManagementContextImpl portalManagementAwareContext = (ManagementContextImpl)portalManagementAware.context;
assertSame(portalManagementContext, portalManagementAwareContext.getParent());
}
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/support/ManagedComponentRequestLifeCycle.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/support/ManagedComponentRequestLifeCycle.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/support/ManagedComponentRequestLifeCycle.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.jmx.support;
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/support/SimpleManagementAware.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/support/SimpleManagementAware.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/jmx/support/SimpleManagementAware.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.jmx.support;
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/Bar.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/Bar.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/Bar.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.container.management;
+
+import org.exoplatform.management.annotations.Managed;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+@Managed
+public class Bar
+{
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/Foo.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/Foo.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/Foo.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.container.management;
+
+import org.exoplatform.management.ManagementAware;
+import org.exoplatform.management.ManagementContext;
+import org.exoplatform.management.annotations.Managed;
+
+/**
+ * @author <a href="mailto:julien.viet@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/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagedResource.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagedResource.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagedResource.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.container.management;
+
+import org.exoplatform.management.spi.ManagedTypeMetaData;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ManagedResource
+{
+
+ final ResourceKey key;
+
+ /** . */
+ final Object resource;
+
+ /** . */
+ final org.exoplatform.management.spi.ManagedResource context;
+
+ /** . */
+ final ManagedTypeMetaData metaData;
+
+ /** . */
+ final ScopedData data;
+
+ public ManagedResource(Object resource, org.exoplatform.management.spi.ManagedResource context, ManagedTypeMetaData metaData)
+ {
+ this.key = new ResourceKey();
+ this.resource = resource;
+ this.context = context;
+ this.metaData = metaData;
+ this.data = new ScopedData();
+ }
+
+ public void register()
+ {
+ context.setScopingData(ScopedData.class, data);
+ }
+
+ @Override
+ public String toString()
+ {
+ return "ManagedResource[key=" + key + ",resource=" + resource + "]";
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagementProviderImpl.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagementProviderImpl.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagementProviderImpl.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.container.management;
+
+import org.exoplatform.management.spi.*;
+import org.exoplatform.management.spi.ManagedResource;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ManagementProviderImpl implements ManagementProvider
+{
+
+ /** . */
+ final List<org.exoplatform.container.management.ManagedResource> managedResources = new ArrayList<org.exoplatform.container.management.ManagedResource>();
+
+ /** . */
+ final List<Object> resources = new ArrayList<Object>();
+
+ public Object manage(ManagedResource context)
+ {
+ org.exoplatform.container.management.ManagedResource mr = new org.exoplatform.container.management.ManagedResource(context.getResource(), context, context.getMetaData());
+ managedResources.add(mr);
+ resources.add(mr.resource);
+ return mr.key;
+ }
+
+ public void unmanage(Object key)
+ {
+ for (Iterator<org.exoplatform.container.management.ManagedResource> i = managedResources.iterator();i.hasNext();)
+ {
+ org.exoplatform.container.management.ManagedResource mr = i.next();
+ if (mr.key == key)
+ {
+ i.remove();
+ break;
+ }
+ }
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ResourceKey.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ResourceKey.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ResourceKey.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.container.management;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ResourceKey
+{
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ScopedData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ScopedData.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/ScopedData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.container.management;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ScopedData
+{
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/TestManagementProvider.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/TestManagementProvider.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/TestManagementProvider.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.container.management;
+
+import junit.framework.TestCase;
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.RootContainer;
+import org.exoplatform.container.support.ContainerBuilder;
+
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class TestManagementProvider extends TestCase
+{
+
+ public void testProviderRegistration()
+ {
+ URL url = getClass().getResource("configuration1.xml");
+ RootContainer container = new ContainerBuilder().withRoot(url).build();
+ ManagementProviderImpl provider = (ManagementProviderImpl)container.getComponentInstanceOfType(ManagementProviderImpl.class);
+ assertNotNull(provider);
+ }
+
+ public void testManagedRegistrationAfterProviderRegistration()
+ {
+ URL url = getClass().getResource("configuration1.xml");
+ RootContainer container = new ContainerBuilder().withRoot(url).build();
+ ManagementProviderImpl provider = (ManagementProviderImpl)container.getComponentInstanceOfType(ManagementProviderImpl.class);
+ assertEquals(1, provider.managedResources.size());
+ Object foo = container.getComponentInstance("Foo");
+ assertNotNull(foo);
+ assertEquals(2, provider.managedResources.size());
+ ManagedResource fooMR = provider.managedResources.get(1);
+ assertSame(foo, fooMR.resource);
+ assertEquals(Collections.<ScopedData>emptyList(), fooMR.context.getScopingData(ScopedData.class));
+ fooMR.register();
+ assertEquals(Collections.singletonList(fooMR.data), fooMR.context.getScopingData(ScopedData.class));
+ }
+
+ public void testManagedRegistrationBeforeProviderRegistration()
+ {
+ URL url = getClass().getResource("configuration2.xml");
+ RootContainer container = new ContainerBuilder().withRoot(url).build();
+ ManagementProviderImpl provider = (ManagementProviderImpl)container.getComponentInstanceOfType(ManagementProviderImpl.class);
+ assertNull(provider);
+ Object foo = container.getComponentInstance("Foo");
+ assertNotNull(foo);
+ provider = new ManagementProviderImpl();
+ container.registerComponentInstance(provider);
+ assertEquals(2, provider.managedResources.size());
+ ManagedResource fooMR = provider.managedResources.get(1);
+ assertSame(foo, fooMR.resource);
+ assertEquals(Collections.<ScopedData>emptyList(), fooMR.context.getScopingData(ScopedData.class));
+ fooMR.register();
+ assertEquals(Collections.singletonList(fooMR.data), fooMR.context.getScopingData(ScopedData.class));
+ }
+
+ public void testManagementAware()
+ {
+ URL url = getClass().getResource("configuration1.xml");
+ RootContainer container = new ContainerBuilder().withRoot(url).build();
+ ManagementProviderImpl provider = (ManagementProviderImpl)container.getComponentInstanceOfType(ManagementProviderImpl.class);
+ Foo foo = (Foo)container.getComponentInstance("Foo");
+ assertEquals(2, provider.managedResources.size());
+ ManagedResource fooMR = provider.managedResources.get(1);
+ fooMR.register();
+ assertTrue(foo.isAware());
+
+ //
+ foo.deploy();
+ assertEquals(3, provider.managedResources.size());
+ ManagedResource barMR = provider.managedResources.get(2);
+ assertSame(foo.bar, barMR.resource);
+ barMR.register();
+ assertEquals(Arrays.asList(barMR.data, fooMR.data), barMR.context.getScopingData(ScopedData.class));
+
+ //
+ foo.undeploy();
+ assertEquals(2, provider.managedResources.size());
+ assertEquals(fooMR, provider.managedResources.get(1));
+ }
+
+ public void testContainerScopedRegistration()
+ {
+ URL rootURL = getClass().getResource("root-configuration.xml");
+ URL portal1URL = getClass().getResource("portal-configuration1.xml");
+ URL portal2URL = getClass().getResource("portal-configuration2.xml");
+ RootContainer root = new ContainerBuilder().withRoot(rootURL).withPortal("portal1", portal1URL).withPortal("portal2", portal2URL).build();
+ Foo fooRoot = (Foo)root.getComponentInstanceOfType(Foo.class);
+ ManagementProviderImpl provider = (ManagementProviderImpl)root.getComponentInstanceOfType(ManagementProviderImpl.class);
+ PortalContainer portal1 = root.getPortalContainer("portal1");
+ Foo fooPortal1 = (Foo)portal1.getComponentInstanceOfType(Foo.class);
+ ManagementProviderImpl provider1 = (ManagementProviderImpl)portal1.getComponentInstanceOfType(ManagementProviderImpl.class);
+ PortalContainer portal2 = root.getPortalContainer("portal2");
+ Foo fooPortal2 = (Foo)portal2.getComponentInstanceOfType(Foo.class);
+ ManagementProviderImpl provider2 = (ManagementProviderImpl)portal2.getComponentInstanceOfType(ManagementProviderImpl.class);
+
+ //
+ assertEquals(6, provider.managedResources.size());
+ assertTrue(provider.resources.contains(root));
+ assertTrue(provider.resources.contains(root));
+ assertTrue(provider.resources.contains(portal1));
+ assertTrue(provider.resources.contains(portal2));
+ assertTrue(provider.resources.contains(fooRoot));
+ assertTrue(provider.resources.contains(fooPortal1));
+ assertTrue(provider.resources.contains(fooPortal2));
+ assertEquals(2, provider1.managedResources.size());
+ assertEquals(portal1, provider1.managedResources.get(0).resource);
+ assertEquals(fooPortal1, provider1.managedResources.get(1).resource);
+ assertEquals(2, provider2.managedResources.size());
+ assertEquals(portal2, provider2.managedResources.get(0).resource);
+ assertEquals(fooPortal2, provider2.managedResources.get(1).resource);
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/metadata/Bar.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/metadata/Bar.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/metadata/Bar.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.container.management.metadata;
+
+import org.exoplatform.management.annotations.Managed;
+import org.exoplatform.management.annotations.ManagedName;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+@Managed
+public class Bar
+{
+
+ @Managed
+ @ManagedName("b")
+ public void a()
+ {
+ }
+}
\ No newline at end of file
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/metadata/Foo.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/metadata/Foo.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/metadata/Foo.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.container.management.metadata;
+
+import org.exoplatform.management.annotations.Impact;
+import org.exoplatform.management.annotations.ImpactType;
+import org.exoplatform.management.annotations.Managed;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+@Managed
+public class Foo
+{
+
+ @Managed
+ @Impact(ImpactType.READ)
+ public void read()
+ {
+ }
+
+ @Managed
+ @Impact(ImpactType.WRITE)
+ public void write()
+ {
+ }
+
+ @Managed
+ @Impact(ImpactType.IDEMPOTENT_WRITE)
+ public void idempotentWrite()
+ {
+ }
+}
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/metadata/TestMetaData.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/metadata/TestMetaData.java (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/management/metadata/TestMetaData.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.container.management.metadata;
+
+import junit.framework.TestCase;
+import org.exoplatform.container.management.MetaDataBuilder;
+import org.exoplatform.management.annotations.ImpactType;
+import org.exoplatform.management.spi.ManagedMethodMetaData;
+import org.exoplatform.management.spi.ManagedTypeMetaData;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class TestMetaData extends TestCase
+{
+
+ private Map<String, ManagedMethodMetaData> getMethodMap(ManagedTypeMetaData type)
+ {
+ Map<String, ManagedMethodMetaData> methodMap = new HashMap<String, ManagedMethodMetaData>();
+ for (ManagedMethodMetaData method : type.getMethods())
+ {
+ methodMap.put(method.getName(), method);
+ }
+ return methodMap;
+ }
+
+ public void testImpact()
+ {
+ MetaDataBuilder builder = new MetaDataBuilder(Foo.class);
+ ManagedTypeMetaData type = builder.build();
+ Map<String, ManagedMethodMetaData> methodMap = getMethodMap(type);
+ ManagedMethodMetaData read = methodMap.get("read");
+ assertEquals(ImpactType.READ, read.getImpact());
+ ManagedMethodMetaData write = methodMap.get("write");
+ assertEquals(ImpactType.WRITE, write.getImpact());
+ ManagedMethodMetaData idempotentWrite = methodMap.get("idempotentWrite");
+ assertEquals(ImpactType.IDEMPOTENT_WRITE, idempotentWrite.getImpact());
+ }
+
+ public void testMethodNameOverride()
+ {
+ MetaDataBuilder builder = new MetaDataBuilder(Bar.class);
+ try
+ {
+ builder.build();
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ }
+}
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/support/ContainerBuilder.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/support/ContainerBuilder.java 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/java/org/exoplatform/container/support/ContainerBuilder.java 2010-01-10 18:27:37 UTC (rev 1331)
@@ -1,18 +1,20 @@
/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
+ * Copyright (C) 2009 eXo Platform SAS.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.container.support;
@@ -28,20 +30,28 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
+import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
import java.util.Set;
/**
- * An helper for building a root container and a portal container. I have done several attempt to make easily
- * and safe root/portal container boot for unit test. This one is my best attempt so far.
+ * <p>An helper for building a root container and a portal container. I have done several attempt to make easily
+ * and safe root/portal container boot for unit test. This one is my best attempt so far.</p>
*
+ * <p>Note that the portal container are booted in the order they are declared first.</p>
+ *
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
*/
public class ContainerBuilder
{
+ /** A hack used during the boot of a portal container. */
+ private final ThreadLocal<String> bootedPortalName = new ThreadLocal<String>();
+
/** . */
private ClassLoader loader;
@@ -49,7 +59,7 @@
private List<URL> configURLs;
/** . */
- private List<URL> portalConfigURLs;
+ private LinkedHashMap<String, List<URL>> portalConfigURLs;
/** . */
private Set<String> profiles;
@@ -58,7 +68,7 @@
{
this.loader = Thread.currentThread().getContextClassLoader();
this.configURLs = new ArrayList<URL>();
- this.portalConfigURLs = new ArrayList<URL>();
+ this.portalConfigURLs = new LinkedHashMap<String, List<URL>>();
}
public ContainerBuilder withRoot(String configPath)
@@ -75,28 +85,33 @@
public ContainerBuilder withPortal(String configPath)
{
- portalConfigURLs.addAll(urls(configPath));
+ return withPortal("portal", configPath);
+ }
+
+ public ContainerBuilder withPortal(String portalName, String configPath)
+ {
+ for (URL configURL : urls(configPath))
+ {
+ withPortal(portalName, configURL);
+ }
return this;
}
public ContainerBuilder withPortal(URL configURL)
{
- portalConfigURLs.add(configURL);
- return this;
+ return withPortal("portal", configURL);
}
- private List<URL> urls(String path)
+ public ContainerBuilder withPortal(String portalName, URL configURL)
{
- try
+ List<URL> urls = portalConfigURLs.get(portalName);
+ if (urls == null)
{
- return Collections.list(loader.getResources(path));
+ urls = new ArrayList<URL>();
+ portalConfigURLs.put(portalName, urls);
}
- catch (IOException e)
- {
- AssertionFailedError err = new AssertionFailedError();
- err.initCause(e);
- throw err;
- }
+ urls.add(configURL);
+ return this;
}
public ContainerBuilder withLoader(ClassLoader loader)
@@ -111,6 +126,20 @@
return this;
}
+ private List<URL> urls(String path)
+ {
+ try
+ {
+ return Collections.list(loader.getResources(path));
+ }
+ catch (IOException e)
+ {
+ AssertionFailedError err = new AssertionFailedError();
+ err.initCause(e);
+ throw err;
+ }
+ }
+
public RootContainer build()
{
try
@@ -176,7 +205,8 @@
}
else if ("conf/portal/configuration.xml".equals(name))
{
- return Collections.enumeration(portalConfigURLs);
+ String portalName = bootedPortalName.get();
+ return Collections.enumeration(portalConfigURLs.get(portalName));
}
else if ("conf/portal/test-configuration.xml".equals(name))
{
@@ -202,9 +232,17 @@
root = RootContainer.getInstance();
//
- if (portalConfigURLs.size() > 0)
+ for (String portalName : portalConfigURLs.keySet())
{
- root.getPortalContainer("portal");
+ try
+ {
+ bootedPortalName.set(portalName);
+ root.getPortalContainer(portalName);
+ }
+ finally
+ {
+ bootedPortalName.set(null);
+ }
}
}
finally
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/configuration1.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/configuration1.xml (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/configuration1.xml 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+
+ <component>
+ <key>Foo</key>
+ <type>org.exoplatform.container.management.Foo</type>
+ </component>
+
+ <component>
+ <key>org.exoplatform.container.management.ManagementProviderImpl</key>
+ <type>org.exoplatform.container.management.ManagementProviderImpl</type>
+ </component>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/configuration2.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/configuration2.xml (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/configuration2.xml 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+
+ <component>
+ <key>Foo</key>
+ <type>org.exoplatform.container.management.Foo</type>
+ </component>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/portal-configuration1.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/portal-configuration1.xml (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/portal-configuration1.xml 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+
+ <component>
+ <key>org.exoplatform.container.management.ManagementProviderImpl</key>
+ <type>org.exoplatform.container.management.ManagementProviderImpl</type>
+ </component>
+
+ <component>
+ <key>FooPortal1</key>
+ <type>org.exoplatform.container.management.Foo</type>
+ </component>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/portal-configuration2.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/portal-configuration2.xml (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/portal-configuration2.xml 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+
+ <component>
+ <key>org.exoplatform.container.management.ManagementProviderImpl</key>
+ <type>org.exoplatform.container.management.ManagementProviderImpl</type>
+ </component>
+
+ <component>
+ <key>FooPortal2</key>
+ <type>org.exoplatform.container.management.Foo</type>
+ </component>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/root-configuration.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/root-configuration.xml (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/org/exoplatform/container/management/root-configuration.xml 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+
+ <component>
+ <type>org.exoplatform.container.definition.PortalContainerConfig</type>
+ </component>
+
+ <component>
+ <key>org.exoplatform.container.management.ManagementProviderImpl</key>
+ <type>org.exoplatform.container.management.ManagementProviderImpl</type>
+ </component>
+
+ <component>
+ <key>FooRoot</key>
+ <type>org.exoplatform.container.management.Foo</type>
+ </component>
+
+</configuration>
\ No newline at end of file
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/xsd_1_0/sample-configuration-17.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/xsd_1_0/sample-configuration-17.xml (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/xsd_1_0/sample-configuration-17.xml 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+
+ <component>
+ <key>org.exoplatform.services.naming.InitialContextInitializer</key>
+ <type>org.exoplatform.services.naming.InitialContextInitializer</type>
+ <init-params>
+ <object-param>
+ <name>configuration</name>
+ <object type="org.exoplatform.services.organization.idm.Config">
+ <field name="typeMappings">
+ <map type="java">
+ <entry>
+ <key><string>/</string></key>
+ <value><string>root</string></value>
+ </entry>
+ </map>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+
+ <component>
+ <key>org.exoplatform.services.naming.InitialContextInitializer</key>
+ <type>org.exoplatform.services.naming.InitialContextInitializer</type>
+ <init-params>
+ <object-param>
+ <name>configuration</name>
+ <object type="package.name">
+ <field name="string"><string>This is a string</string></field>
+ <field name="int"><int>1234</int></field>
+ <field name="long"><long>123456</long></field>
+ <field name="double"><double>1.1234</double></field>
+ <field name="boolean"><boolean>true</boolean></field>
+ <field name="name">
+ <object type="package.name">
+ <field name="nested 1"><string>value</string></field>
+ <field name="nested 2"><int>1234</int></field>
+ </object>
+ </field>
+ <field name="map">
+ <map type="java.util.HashMap">
+ <entry>
+ <key><string>akey</string></key>
+ <value><string>a value</string></value>
+ </entry>
+ <entry>
+ <key><int>1234</int></key>
+ <value><string>a value</string></value>
+ </entry>
+ </map>
+ </field>
+ <field name="list">
+ <collection type="java.util.ArrayList">
+ <value><string>a value</string></value>
+ </collection>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+</component>
+
+</configuration>
\ No newline at end of file
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/xsd_1_1/sample-configuration-17.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/xsd_1_1/sample-configuration-17.xml 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/xsd_1_1/sample-configuration-17.xml 2010-01-10 18:27:37 UTC (rev 1331)
@@ -25,71 +25,63 @@
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
<component>
- <key>org.exoplatform.services.naming.InitialContextInitializer</key>
- <type>org.exoplatform.services.naming.InitialContextInitializer</type>
- </component>
+ <key>org.exoplatform.services.naming.InitialContextInitializer</key>
+ <type>org.exoplatform.services.naming.InitialContextInitializer</type>
+ <init-params>
+ <object-param>
+ <name>configuration</name>
+ <object type="org.exoplatform.services.organization.idm.Config">
+ <field name="typeMappings">
+ <map type="java">
+ <entry>
+ <key><string>/</string></key>
+ <value><string>root</string></value>
+ </entry>
+ </map>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+</component>
- <component profiles="a">
- <key>org.exoplatform.services.naming.InitialContextInitializer</key>
- <type>org.exoplatform.services.naming.InitialContextInitializer</type>
- </component>
+<component>
+<key>org.exoplatform.services.naming.InitialContextInitializer</key>
+<type>org.exoplatform.services.naming.InitialContextInitializer</type>
+<init-params>
+ <object-param>
+ <name>configuration</name>
+ <object type="package.name">
+ <field name="string"><string>This is a string</string></field>
+ <field name="int"><int>1234</int></field>
+ <field name="long"><long>123456</long></field>
+ <field name="double"><double>1.1234</double></field>
+ <field name="boolean"><boolean>true</boolean></field>
+ <field name="name">
+ <object type="package.name">
+ <field name="nested 1"><string>value</string></field>
+ <field name="nested 2"><int>1234</int></field>
+ </object>
+ </field>
+ <field name="map">
+ <map type="java.util.HashMap">
+ <entry>
+ <key><string>akey</string></key>
+ <value><string>a value</string></value>
+ </entry>
+ <entry>
+ <key><int>1234</int></key>
+ <value><string>a value</string></value>
+ </entry>
+ </map>
+ </field>
+ <field name="list">
+ <collection type="java.util.ArrayList">
+ <value><string>a value</string></value>
+ </collection>
+ </field>
+ </object>
+ </object-param>
+</init-params>
+</component>
- <component profiles="a,b">
- <key>org.exoplatform.services.naming.InitialContextInitializer</key>
- <type>org.exoplatform.services.naming.InitialContextInitializer</type>
- </component>
-
- <component>
- <key>org.exoplatform.services.naming.InitialContextInitializer</key>
- <type>org.exoplatform.services.naming.InitialContextInitializer</type>
- <init-params>
- <object-param>
- <name>object</name>
- <object type="object"></object>
- </object-param>
- <object-param profiles="a">
- <name>object</name>
- <object type="object"></object>
- </object-param>
- <object-param profiles="a,b">
- <name>object</name>
- <object type="object"></object>
- </object-param>
- <properties-param>
- <name>properties</name>
- </properties-param>
- <properties-param profiles="a">
- <name>properties</name>
- </properties-param>
- <properties-param profiles="a,b">
- <name>properties</name>
- </properties-param>
- <value-param>
- <name>value</name>
- <value>value</value>
- </value-param>
- <value-param profiles="a">
- <name>value</name>
- <value>value</value>
- </value-param>
- <value-param profiles="a,b">
- <name>value</name>
- <value>value</value>
- </value-param>
- <values-param>
- <name>values</name>
- </values-param>
- <values-param profiles="a">
- <name>values</name>
- </values-param>
- <values-param profiles="a,b">
- <name>values</name>
- </values-param>
- </init-params>
- </component>
-
- <import>import_1</import>
- <import profiles="a">import_1</import>
- <import profiles="a,b">import_1</import>
-
</configuration>
\ No newline at end of file
Added: kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/xsd_1_1/sample-configuration-18.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/xsd_1_1/sample-configuration-18.xml (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/test/resources/xsd_1_1/sample-configuration-18.xml 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+
+ <component>
+ <key>org.exoplatform.services.naming.InitialContextInitializer</key>
+ <type>org.exoplatform.services.naming.InitialContextInitializer</type>
+ </component>
+
+ <component profiles="a">
+ <key>org.exoplatform.services.naming.InitialContextInitializer</key>
+ <type>org.exoplatform.services.naming.InitialContextInitializer</type>
+ </component>
+
+ <component profiles="a,b">
+ <key>org.exoplatform.services.naming.InitialContextInitializer</key>
+ <type>org.exoplatform.services.naming.InitialContextInitializer</type>
+ </component>
+
+ <component>
+ <key>org.exoplatform.services.naming.InitialContextInitializer</key>
+ <type>org.exoplatform.services.naming.InitialContextInitializer</type>
+ <init-params>
+ <object-param>
+ <name>object</name>
+ <object type="object"></object>
+ </object-param>
+ <object-param profiles="a">
+ <name>object</name>
+ <object type="object"></object>
+ </object-param>
+ <object-param profiles="a,b">
+ <name>object</name>
+ <object type="object"></object>
+ </object-param>
+ <properties-param>
+ <name>properties</name>
+ </properties-param>
+ <properties-param profiles="a">
+ <name>properties</name>
+ </properties-param>
+ <properties-param profiles="a,b">
+ <name>properties</name>
+ </properties-param>
+ <value-param>
+ <name>value</name>
+ <value>value</value>
+ </value-param>
+ <value-param profiles="a">
+ <name>value</name>
+ <value>value</value>
+ </value-param>
+ <value-param profiles="a,b">
+ <name>value</name>
+ <value>value</value>
+ </value-param>
+ <values-param>
+ <name>values</name>
+ </values-param>
+ <values-param profiles="a">
+ <name>values</name>
+ </values-param>
+ <values-param profiles="a,b">
+ <name>values</name>
+ </values-param>
+ </init-params>
+ </component>
+
+ <import>import_1</import>
+ <import profiles="a">import_1</import>
+ <import profiles="a,b">import_1</import>
+
+</configuration>
\ No newline at end of file
Modified: kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/pom.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/pom.xml 2010-01-09 19:43:44 UTC (rev 1330)
+++ kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/pom.xml 2010-01-10 18:27:37 UTC (rev 1331)
@@ -28,6 +28,11 @@
<groupId>org.exoplatform.kernel</groupId>
<artifactId>exo.kernel.mc-int-demo</artifactId>
</dependency>
+ <dependency> <!-- TODO: remove this -->
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <version>1.0</version>
+ </dependency>
</dependencies>
<build>
@@ -94,5 +99,259 @@
</plugins>
</build>
</profile>
+
+ <profile>
+ <id>tests-with-jboss</id>
+ <build>
+ <finalName>eXo-kernel-integration-tests-${project.version}</finalName>
+ <defaultGoal>integration-test</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>jbossas-check-environment-ready</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <requireProperty>
+ <property>jboss.home</property>
+ <message>"You must define the property jboss.home to give the path to the package/pkg built GateIn JBoss instance"</message>
+ </requireProperty>
+ <requireFilesExist>
+ <files>
+ <file>${jboss.home}</file>
+ </files>
+ <message>"JBossAS directory doesn't exist : ${jboss.home}"</message>
+ </requireFilesExist>
+ <requireFilesExist>
+ <files>
+ <file>${jboss.home}/server/${jboss.conf}/deploy/gatein.ear</file>
+ </files>
+ <message>"JBossAS directory has no gatein.ear deployed: ${jboss.home}/server/${jboss.conf}/deploy/gatein.ear"</message>
+ </requireFilesExist>
+ </rules>
+ <fail>true</fail>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <version>1.0</version>
+ <configuration>
+ <wait>false</wait>
+ <container>
+ <containerId>jboss5x</containerId>
+ <type>installed</type>
+ <home>${jboss.home}</home>
+ <timeout>300000</timeout>
+ <output>${jboss.home}/server/${jboss.conf}/log/output.log</output>
+ </container>
+ <configuration>
+ <type>existing</type>
+ <home>${jboss.home}/server/${jboss.conf}</home>
+ <properties>
+ <cargo.jboss.configuration>${jboss.conf}</cargo.jboss.configuration>
+ <cargo.servlet.port>${jboss.port}</cargo.servlet.port>
+ <cargo.rmi.port>1099</cargo.rmi.port>
+ <cargo.jvmargs>-Xmx768m -XX:MaxPermSize=128m</cargo.jvmargs>
+ </properties>
+ <!--
+ This module's artifact (.war) gets deployed automatically by cargo,
+ but we don't use it for integration tests.
+ We use some previously installed build of the same artifact,
+ deployed under a different name as part of package/pkg build.
+ It is bound to a different context than the one deployed by cargo.
+ We only use cargo to start and stop jboss.
+ -->
+ <!--deployables>
+ <deployable>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>${project.artifactId}</artifactId>
+ <type>${project.packaging}</type>
+ </deployable>
+ </deployables-->
+ </configuration>
+ </configuration>
+
+ <executions>
+ <execution>
+ <id>start-container</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop-container</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>**/it/Test*.java</exclude>
+ </excludes>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-tests</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ <excludes>
+ <exclude>none</exclude>
+ </excludes>
+ <includes>
+ <include>**/it/Test*.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <properties>
+ <jboss.conf>default</jboss.conf>
+ <jboss.port>8080</jboss.port>
+ </properties>
+ </profile>
+
+ <profile>
+ <id>tests-with-tomcat</id>
+ <build>
+ <finalName>eXo-kernel-integration-tests-${project.version}</finalName>
+ <defaultGoal>integration-test</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>tomcat-check-environment-ready</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <requireProperty>
+ <property>tomcat.home</property>
+ <message>"You must define the property tomcat.home to give the path to the package/pkg built GateIn Tomcat instance"</message>
+ </requireProperty>
+ <requireFilesExist>
+ <files>
+ <file>${tomcat.home}</file>
+ </files>
+ <message>"Tomcat directory doesn't exist : ${tomcat.home}"</message>
+ </requireFilesExist>
+ <requireFilesExist>
+ <files>
+ <file>${tomcat.home}/webapps/portal.war</file>
+ </files>
+ <message>"Tomcat directory has no portal.war deployed: ${tomcat.home}/webapps/portal.war"</message>
+ </requireFilesExist>
+ </rules>
+ <fail>true</fail>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <version>1.0</version>
+ <configuration>
+ <wait>false</wait>
+ <container>
+ <containerId>tomcat6x</containerId>
+ <type>installed</type>
+ <home>${tomcat.home}</home>
+ <timeout>300000</timeout>
+ <output>${tomcat.home}/logs/output.log</output>
+ </container>
+ <configuration>
+ <type>existing</type>
+ <home>${tomcat.home}</home>
+ <properties>
+ <cargo.servlet.port>${tomcat.port}</cargo.servlet.port>
+ <cargo.jvmargs>-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xmx512m -XX:MaxPermSize=128m</cargo.jvmargs>
+ <cargo.logging>low</cargo.logging>
+ </properties>
+ <!--
+ This module's artifact (.war) gets deployed automatically by cargo,
+ but we don't use it for integration tests.
+ We use some previously installed build of the same artifact,
+ deployed under a different name as part of package/pkg build.
+ It is bound to a different context than the one deployed by cargo.
+ We only use cargo to start and stop tomcat.
+ -->
+ </configuration>
+ </configuration>
+
+ <executions>
+ <execution>
+ <id>start-container</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop-container</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>**/it/Test*.java</exclude>
+ </excludes>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-tests</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ <excludes>
+ <exclude>none</exclude>
+ </excludes>
+ <includes>
+ <include>**/it/Test*.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <properties>
+ <tomcat.port>8080</tomcat.port>
+ </properties>
+ </profile>
</profiles>
</project>
Added: kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/src/test/resources/jboss-log4j.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/src/test/resources/jboss-log4j.xml (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.mc-integration/exo.kernel.mc-int-tests/src/test/resources/jboss-log4j.xml 2010-01-10 18:27:37 UTC (rev 1331)
@@ -0,0 +1,328 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: jboss-log4j.xml 62403 2007-04-18 15:26:43Z dimitris(a)jboss.org $ -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <!-- A time/date based rolling appender -->
+ <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="File" value="${jboss.server.log.dir}/server.log"/>
+ <param name="Append" value="false"/>
+
+ <!-- Rollover at midnight each day -->
+ <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+
+ <!-- Rollover at the top of each hour
+ <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
+ -->
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+
+ <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
+ <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+ -->
+ </layout>
+ </appender>
+
+ <!-- A size based file rolling appender
+ <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="File" value="${jboss.server.log.dir}/server.log"/>
+ <param name="Append" value="false"/>
+ <param name="MaxFileSize" value="500KB"/>
+ <param name="MaxBackupIndex" value="1"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+ </layout>
+ </appender>
+ -->
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="INFO"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ====================== -->
+ <!-- More Appender examples -->
+ <!-- ====================== -->
+
+ <!-- Buffer events and log them asynchronously
+ <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <appender-ref ref="FILE"/>
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="SMTP"/>
+ </appender>
+ -->
+
+ <!-- EMail events to an administrator
+ <appender name="SMTP" class="org.apache.log4j.net.SMTPAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="Threshold" value="ERROR"/>
+ <param name="To" value="admin(a)myhost.domain.com"/>
+ <param name="From" value="nobody(a)myhost.domain.com"/>
+ <param name="Subject" value="JBoss Sever Errors"/>
+ <param name="SMTPHost" value="localhost"/>
+ <param name="BufferSize" value="10"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="[%d{ABSOLUTE},%c{1}] %m%n"/>
+ </layout>
+ </appender>
+ -->
+
+ <!-- Syslog events
+ <appender name="SYSLOG" class="org.apache.log4j.net.SyslogAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="Facility" value="LOCAL7"/>
+ <param name="FacilityPrinting" value="true"/>
+ <param name="SyslogHost" value="localhost"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="[%d{ABSOLUTE},%c{1}] %m%n"/>
+ </layout>
+ </appender>
+ -->
+
+ <!-- Log events to JMS (requires a topic to be created)
+ <appender name="JMS" class="org.apache.log4j.net.JMSAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="Threshold" value="ERROR"/>
+ <param name="TopicConnectionFactoryBindingName" value="java:/ConnectionFactory"/>
+ <param name="TopicBindingName" value="topic/MyErrorsTopic"/>
+ </appender>
+ -->
+
+ <!-- Log events through SNMP
+ <appender name="TRAP_LOG" class="org.apache.log4j.ext.SNMPTrapAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="ImplementationClassName" value="org.apache.log4j.ext.JoeSNMPTrapSender"/>
+ <param name="ManagementHost" value="127.0.0.1"/>
+ <param name="ManagementHostTrapListenPort" value="162"/>
+ <param name="EnterpriseOID" value="1.3.6.1.4.1.24.0"/>
+ <param name="LocalIPAddress" value="127.0.0.1"/>
+ <param name="LocalTrapSendPort" value="161"/>
+ <param name="GenericTrapType" value="6"/>
+ <param name="SpecificTrapType" value="12345678"/>
+ <param name="CommunityString" value="public"/>
+ <param name="ForwardStackTraceWithTrap" value="true"/>
+ <param name="Threshold" value="DEBUG"/>
+ <param name="ApplicationTrapOID" value="1.3.6.1.4.1.24.12.10.22.64"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d,%p,[%t],[%c],%m%n"/>
+ </layout>
+ </appender>
+ -->
+
+ <!-- Emit events as JMX notifications
+ <appender name="JMX" class="org.jboss.monitor.services.JMXNotificationAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+
+ <param name="Threshold" value="WARN"/>
+ <param name="ObjectName" value="jboss.system:service=Logging,type=JMXNotificationAppender"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d %-5p [%c] %m"/>
+ </layout>
+ </appender>
+ -->
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <!-- Limit the org.apache category to INFO as its DEBUG is verbose -->
+ <category name="org.apache">
+ <priority value="INFO"/>
+ </category>
+
+ <!-- Limit the org.jboss.serial (jboss-serialization) to INFO as its DEBUG is verbose -->
+ <category name="org.jboss.serial">
+ <priority value="INFO"/>
+ </category>
+
+ <!-- Limit the org.jgroups category to WARN as its INFO is verbose -->
+ <category name="org.jgroups">
+ <priority value="WARN"/>
+ </category>
+
+ <!-- Limit the jacorb category to WARN as its INFO is verbose -->
+ <category name="jacorb">
+ <priority value="WARN"/>
+ </category>
+
+ <!-- Limit JBoss categories
+ <category name="org.jboss">
+ <priority value="INFO"/>
+ </category>
+ -->
+
+ <!-- Limit the JSR77 categories -->
+ <category name="org.jboss.management">
+ <priority value="INFO"/>
+ </category>
+
+ <!-- Limit the JSR77 categories -->
+ <category name="jcr">
+ <priority value="INFO"/>
+ </category>
+
+ <!-- Limit the JSR-168 and JSR-286 categories -->
+ <category name="org.exoplatform.services">
+ <priority value="INFO"/>
+ </category>
+
+ <!-- Enable JBossWS message tracing
+ <category name="jbossws.SOAPMessage">
+ <priority value="TRACE"/>
+ </category>
+ -->
+
+ <!-- Decrease the priority threshold for the org.jboss.varia category
+ <category name="org.jboss.varia">
+ <priority value="DEBUG"/>
+ </category>
+ -->
+
+ <!-- Show the evolution of the DataSource pool in the logs [inUse/Available/Max]
+ <category name="org.jboss.resource.connectionmanager.JBossManagedConnectionPool">
+ <priority value="TRACE"/>
+ </category>
+ -->
+
+ <!--
+ | An example of enabling the custom TRACE level priority that is used
+ | by the JBoss internals to diagnose low level details. This example
+ | turns on TRACE level msgs for the org.jboss.ejb.plugins package and its
+ | subpackages. This will produce A LOT of logging output.
+ |
+ | Note: since jboss AS 4.2.x, the trace level is supported natively by
+ | log4j, so although the custom org.jboss.logging.XLevel priority will
+ | still work, there is no need to use it. The two examples that follow
+ | will both enable trace logging.
+ <category name="org.jboss.system">
+ <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+ </category>
+ <category name="org.jboss.ejb.plugins">
+ <priority value="TRACE"/>
+ </category>
+ -->
+
+ <!--
+ | Logs these events to SNMP:
+ - server starts/stops
+ - cluster evolution (node death/startup)
+ - When an EJB archive is deployed (and associated verified messages)
+ - When an EAR archive is deployed
+
+ <category name="org.jboss.system.server.Server">
+ <priority value="INFO" />
+ <appender-ref ref="TRAP_LOG"/>
+ </category>
+
+ <category name="org.jboss.ha.framework.interfaces.HAPartition.lifecycle">
+ <priority value="INFO" />
+ <appender-ref ref="TRAP_LOG"/>
+ </category>
+
+ <category name="org.jboss.deployment.MainDeployer">
+ <priority value="ERROR" />
+ <appender-ref ref="TRAP_LOG"/>
+ </category>
+
+ <category name="org.jboss.ejb.EJBDeployer">
+ <priority value="INFO" />
+ <appender-ref ref="TRAP_LOG"/>
+ </category>
+
+ <category name="org.jboss.deployment.EARDeployer">
+ <priority value="INFO" />
+ <appender-ref ref="TRAP_LOG"/>
+ </category>
+
+ -->
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE"/>
+ </root>
+
+ <!-- Clustering logging -->
+ <!-- Uncomment the following to redirect the org.jgroups and
+ org.jboss.ha categories to a cluster.log file.
+
+ <appender name="CLUSTER" class="org.jboss.logging.appender.RollingFileAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="File" value="${jboss.server.log.dir}/cluster.log"/>
+ <param name="Append" value="false"/>
+ <param name="MaxFileSize" value="500KB"/>
+ <param name="MaxBackupIndex" value="1"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+ </layout>
+ </appender>
+ <category name="org.jgroups">
+ <priority value="DEBUG" />
+ <appender-ref ref="CLUSTER"/>
+ </category>
+ <category name="org.jboss.ha">
+ <priority value="DEBUG" />
+ <appender-ref ref="CLUSTER"/>
+ </category>
+ -->
+
+</log4j:configuration>
16 years, 3 months
exo-jcr SVN: r1330 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2010-01-09 14:43:44 -0500 (Sat, 09 Jan 2010)
New Revision: 1330
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-configuration.xml
Log:
EXOJCR-361: removed unused ds
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-configuration.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-configuration.xml 2010-01-08 16:58:25 UTC (rev 1329)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-configuration.xml 2010-01-09 19:43:44 UTC (rev 1330)
@@ -270,249 +270,7 @@
</properties-param>
</init-params>
</component-plugin>
- <component-plugin>
- <name>bind.datasource</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.naming.BindReferencePlugin</type>
- <init-params>
- <value-param>
- <name>bind-name</name>
- <value>jdbcjcr2</value>
- </value-param>
- <value-param>
- <name>class-name</name>
- <value>javax.sql.DataSource</value>
- </value-param>
- <value-param>
- <name>factory</name>
- <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
- </value-param>
- <properties-param>
- <name>ref-addresses</name>
- <description>ref-addresses</description>
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://localhost/cluster_jcr3"/>
- <property name="username" value="root"/>
- <property name="password" value="admin"/>
- <property name="maxActive" value="100" />
- <property name="maxIdle" value="5" />
- <property name="initialSize" value="5" />
-
- </properties-param>
- </init-params>
- </component-plugin>
- <component-plugin>
- <name>bind.datasource</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.naming.BindReferencePlugin</type>
- <init-params>
- <value-param>
- <name>bind-name</name>
- <value>jdbcjcr3</value>
- </value-param>
- <value-param>
- <name>class-name</name>
- <value>javax.sql.DataSource</value>
- </value-param>
- <value-param>
- <name>factory</name>
- <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
- </value-param>
- <properties-param>
- <name>ref-addresses</name>
- <description>ref-addresses</description>
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://localhost/cluster_jcr4"/>
- <property name="username" value="root"/>
- <property name="password" value="admin"/>
- <property name="maxActive" value="100" />
- <property name="maxIdle" value="5" />
- <property name="initialSize" value="5" />
-
- </properties-param>
- </init-params>
- </component-plugin>
- <component-plugin>
- <name>bind.datasource</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.naming.BindReferencePlugin</type>
- <init-params>
- <value-param>
- <name>bind-name</name>
- <value>jdbcjcrtest</value>
- </value-param>
- <value-param>
- <name>class-name</name>
- <value>javax.sql.DataSource</value>
- </value-param>
- <value-param>
- <name>factory</name>
- <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
- </value-param>
- <properties-param>
- <name>ref-addresses</name>
- <description>ref-addresses</description>
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://localhost/cluster_jcr5"/>
- <property name="username" value="root"/>
- <property name="password" value="admin"/>
- <property name="maxActive" value="100" />
- <property name="maxIdle" value="5" />
- <property name="initialSize" value="5" />
-
- </properties-param>
- </init-params>
- </component-plugin>
- <component-plugin>
- <name>bind.datasource</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.naming.BindReferencePlugin</type>
- <init-params>
- <value-param>
- <name>bind-name</name>
- <value>jdbcjcrtck</value>
- </value-param>
- <value-param>
- <name>class-name</name>
- <value>javax.sql.DataSource</value>
- </value-param>
- <value-param>
- <name>factory</name>
- <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
- </value-param>
- <properties-param>
- <name>ref-addresses</name>
- <description>ref-addresses</description>
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://localhost/cluster_jcr6"/>
- <property name="username" value="root"/>
- <property name="password" value="admin"/>
- <property name="maxActive" value="100" />
- <property name="maxIdle" value="5" />
- <property name="initialSize" value="5" />
- </properties-param>
- </init-params>
- </component-plugin>
- <component-plugin>
- <name>bind.datasource</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.naming.BindReferencePlugin</type>
- <init-params>
- <value-param>
- <name>bind-name</name>
- <value>jdbcjcr1tck</value>
- </value-param>
- <value-param>
- <name>class-name</name>
- <value>javax.sql.DataSource</value>
- </value-param>
- <value-param>
- <name>factory</name>
- <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
- </value-param>
- <properties-param>
- <name>ref-addresses</name>
- <description>ref-addresses</description>
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://localhost/cluster_jcr7"/>
- <property name="username" value="root"/>
- <property name="password" value="admin"/>
- <property name="maxActive" value="100" />
- <property name="maxIdle" value="5" />
- <property name="initialSize" value="5" />
- </properties-param>
- </init-params>
- </component-plugin>
- <component-plugin>
- <name>bind.datasource</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.naming.BindReferencePlugin</type>
- <init-params>
- <value-param>
- <name>bind-name</name>
- <value>jdbcjcr2tck</value>
- </value-param>
- <value-param>
- <name>class-name</name>
- <value>javax.sql.DataSource</value>
- </value-param>
- <value-param>
- <name>factory</name>
- <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
- </value-param>
- <properties-param>
- <name>ref-addresses</name>
- <description>ref-addresses</description>
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://localhost/cluster_jcr8"/>
- <property name="username" value="root"/>
- <property name="password" value="admin"/>
- <property name="maxActive" value="100" />
- <property name="maxIdle" value="5" />
- <property name="initialSize" value="5" />
- </properties-param>
- </init-params>
- </component-plugin>
- <component-plugin>
- <name>bind.datasource</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.naming.BindReferencePlugin</type>
- <init-params>
- <value-param>
- <name>bind-name</name>
- <value>jdbcjcr2export1</value>
- </value-param>
- <value-param>
- <name>class-name</name>
- <value>javax.sql.DataSource</value>
- </value-param>
- <value-param>
- <name>factory</name>
- <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
- </value-param>
- <properties-param>
- <name>ref-addresses</name>
- <description>ref-addresses</description>
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://localhost/cluster_jcr9"/>
- <property name="username" value="root"/>
- <property name="password" value="admin"/>
- <property name="maxActive" value="100" />
- <property name="maxIdle" value="5" />
- <property name="initialSize" value="5" />
- </properties-param>
- </init-params>
- </component-plugin>
- <component-plugin>
- <name>bind.datasource</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.naming.BindReferencePlugin</type>
- <init-params>
- <value-param>
- <name>bind-name</name>
- <value>jdbcjcr2export2</value>
- </value-param>
- <value-param>
- <name>class-name</name>
- <value>javax.sql.DataSource</value>
- </value-param>
- <value-param>
- <name>factory</name>
- <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
- </value-param>
- <properties-param>
- <name>ref-addresses</name>
- <description>ref-addresses</description>
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://localhost/cluster_jcr10"/>
- <property name="username" value="root"/>
- <property name="password" value="admin"/>
- <property name="maxActive" value="100" />
- <property name="maxIdle" value="5" />
- <property name="initialSize" value="5" />
- </properties-param>
- </init-params>
- </component-plugin>
+
<!-- Resource configuration for UserTransaction
use JOTM
-->
16 years, 4 months
exo-jcr SVN: r1329 - in jcr/branches/1.12.0-OPT/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/core and 2 other directories.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2010-01-08 11:58:25 -0500 (Fri, 08 Jan 2010)
New Revision: 1329
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/WorkspaceEntry.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/resources/binding.xml
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.xml
Log:
EXOJCR-338 lazy load for childs config
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/WorkspaceEntry.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/WorkspaceEntry.java 2010-01-08 16:35:29 UTC (rev 1328)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/WorkspaceEntry.java 2010-01-08 16:58:25 UTC (rev 1329)
@@ -30,7 +30,7 @@
protected String name;
- protected int lazyReadThreshold = 0;
+ protected long lazyReadThreshold;
@Deprecated
protected String autoInitializedRootNt;
@@ -195,12 +195,12 @@
this.initializer = initializer;
}
- public int getLazyReadThreshold()
+ public long getLazyReadThreshold()
{
return lazyReadThreshold;
}
- public void setLazyReadThreshold(int lazyReadThreshold)
+ public void setLazyReadThreshold(long lazyReadThreshold)
{
this.lazyReadThreshold = lazyReadThreshold;
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java 2010-01-08 16:35:29 UTC (rev 1328)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java 2010-01-08 16:58:25 UTC (rev 1329)
@@ -160,7 +160,7 @@
WorkspaceEntry wsConfig = (WorkspaceEntry)container.getComponentInstanceOfType(WorkspaceEntry.class);
this.lazyReadThreshold =
- wsConfig.getLazyReadThreshold() > 0 ? wsConfig.getLazyReadThreshold() : DEFAULT_LAZY_READ_THRESHOLD;
+ wsConfig.getLazyReadThreshold() > 0 ? (int) wsConfig.getLazyReadThreshold() : DEFAULT_LAZY_READ_THRESHOLD;
WorkspaceFileCleanerHolder cleanerHolder =
(WorkspaceFileCleanerHolder)container.getComponentInstanceOfType(WorkspaceFileCleanerHolder.class);
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/resources/binding.xml
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/resources/binding.xml 2010-01-08 16:35:29 UTC (rev 1328)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/resources/binding.xml 2010-01-08 16:58:25 UTC (rev 1329)
@@ -21,10 +21,10 @@
<mapping name="workspace" class="org.exoplatform.services.jcr.config.WorkspaceEntry">
<value name="name" field="name" style="attribute" />
+ <value name="lazy-read-threshold" field="lazyReadThreshold" style="attribute"
+ deserializer="org.exoplatform.services.jcr.util.ConfigurationFormat.parseLong" usage="optional" />
<value name="auto-init-root-nodetype" field="autoInitializedRootNt" style="attribute" usage="optional" />
<value name="auto-init-permissions" field="autoInitPermissions" style="attribute" usage="optional" />
- <value name="lazy-read-threshold" field="lazyReadThreshold" usage="optional" />
-
<structure name="container" field="container">
<value name="class" field="type" style="attribute" />
<collection name="properties" field="parameters" usage="optional"
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.xml
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.xml 2010-01-08 16:35:29 UTC (rev 1328)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.xml 2010-01-08 16:58:25 UTC (rev 1329)
@@ -28,7 +28,7 @@
<session-max-age>1h</session-max-age>
<authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
<workspaces>
- <workspace name="ws">
+ <workspace name="ws" lazy-read-threshold="2000">
<!-- for system storage -->
<container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
<properties>
16 years, 4 months
exo-jcr SVN: r1328 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2010-01-08 11:35:29 -0500 (Fri, 08 Jan 2010)
New Revision: 1328
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-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_ws1.xml
Log:
EXOJCR-361 : update ports
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 2010-01-08 16:00:00 UTC (rev 1327)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws.xml 2010-01-08 16:35:29 UTC (rev 1328)
@@ -37,7 +37,7 @@
<PING num_initial_members="3" timeout="2000" /
-->
- <TCP bind_addr="127.0.0.1" start_port="9800" loopback="true"
+ <TCP bind_addr="127.0.0.1" start_port="9600" loopback="true"
recv_buf_size="20000000" send_buf_size="640000"
discard_incompatible_packets="true" max_bundle_size="64000"
max_bundle_timeout="30" use_incoming_packet_handler="true"
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 2010-01-08 16:00:00 UTC (rev 1327)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws1.xml 2010-01-08 16:35:29 UTC (rev 1328)
@@ -37,7 +37,7 @@
<PING num_initial_members="3" timeout="2000" /
-->
- <TCP bind_addr="127.0.0.1" start_port="9810" loopback="true"
+ <TCP bind_addr="127.0.0.1" start_port="9650" loopback="true"
recv_buf_size="20000000" send_buf_size="640000"
discard_incompatible_packets="true" max_bundle_size="64000"
max_bundle_timeout="30" use_incoming_packet_handler="true"
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 2010-01-08 16:00:00 UTC (rev 1327)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws.xml 2010-01-08 16:35:29 UTC (rev 1328)
@@ -31,7 +31,7 @@
<PING num_initial_members="3" timeout="2000" /
-->
- <TCP bind_addr="127.0.0.1" start_port="9900" loopback="true"
+ <TCP bind_addr="127.0.0.1" start_port="9700" loopback="true"
recv_buf_size="20000000" send_buf_size="640000"
discard_incompatible_packets="true" max_bundle_size="64000"
max_bundle_timeout="30" use_incoming_packet_handler="true"
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws1.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws1.xml 2010-01-08 16:00:00 UTC (rev 1327)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws1.xml 2010-01-08 16:35:29 UTC (rev 1328)
@@ -31,7 +31,7 @@
<PING num_initial_members="3" timeout="2000" /
-->
- <TCP bind_addr="127.0.0.1" start_port="9910" loopback="true"
+ <TCP bind_addr="127.0.0.1" start_port="9750" loopback="true"
recv_buf_size="20000000" send_buf_size="640000"
discard_incompatible_packets="true" max_bundle_size="64000"
max_bundle_timeout="30" use_incoming_packet_handler="true"
@@ -46,7 +46,7 @@
oob_thread_pool.queue_enabled="false"
oob_thread_pool.queue_max_size="100"
oob_thread_pool.rejection_policy="run" />
- <MPING timeout="2000" num_initial_members="2" mcast_port="34530"
+ <MPING timeout="2000" num_initial_members="2" mcast_port="34532"
bind_addr="127.0.0.1" mcast_addr="224.0.0.1" />
16 years, 4 months
exo-jcr SVN: r1327 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2010-01-08 11:00:00 -0500 (Fri, 08 Jan 2010)
New Revision: 1327
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java
Log:
EXOJCR-371: added ordering by hystorica index, if FQNs are equals.
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java 2010-01-08 15:57:22 UTC (rev 1326)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java 2010-01-08 16:00:00 UTC (rev 1327)
@@ -25,7 +25,7 @@
@SuppressWarnings("unchecked")
public class BufferedJBossCache implements Cache<Serializable, Object>
{
-// private final Log log = ExoLogger.getLogger(BufferedJbossCache.class);
+ // private final Log log = ExoLogger.getLogger(BufferedJbossCache.class);
/**
* Parent cache.
@@ -352,7 +352,7 @@
{
throw new IllegalStateException("changesContainer should not be empty");
}
- changesContainer.add(new PutObjectContainer(fqn, data, parentCache));
+ changesContainer.add(new PutObjectContainer(fqn, data, parentCache, changesContainer.size()));
}
/* (non-Javadoc)
@@ -365,7 +365,7 @@
{
throw new IllegalStateException("changesContainer should not be empty");
}
- changesContainer.add(new PutKeyValueContainer(fqn, key, value, parentCache));
+ changesContainer.add(new PutKeyValueContainer(fqn, key, value, parentCache, changesContainer.size()));
return parentCache.get(fqn, key);
}
@@ -405,7 +405,7 @@
{
throw new IllegalStateException("changesContainer should not be empty");
}
- changesContainer.add(new RemoveKeyContainer(fqn, key, parentCache));
+ changesContainer.add(new RemoveKeyContainer(fqn, key, parentCache, changesContainer.size()));
return parentCache.get(fqn, key);
}
@@ -451,7 +451,7 @@
{
throw new IllegalStateException("changesContainer should not be empty");
}
- changesContainer.add(new RemoveNodeContainer(fqn, parentCache));
+ changesContainer.add(new RemoveNodeContainer(fqn, parentCache, changesContainer.size()));
return true;
}
@@ -508,8 +508,7 @@
return ((CacheSPI<Serializable, Object>)parentCache).getTransactionManager();
}
- private static enum ChangesType
- {
+ private static enum ChangesType {
REMOVED, ADDED;
}
@@ -526,12 +525,15 @@
protected final Cache<Serializable, Object> cache;
- public ChangesContainer(Fqn fqn, ChangesType changesType, Cache<Serializable, Object> cache)
+ protected final int historicalIndex;
+
+ public ChangesContainer(Fqn fqn, ChangesType changesType, Cache<Serializable, Object> cache, int historicalIndex)
{
super();
this.fqn = fqn;
this.changesType = changesType;
this.cache = cache;
+ this.historicalIndex = historicalIndex;
}
/**
@@ -543,6 +545,14 @@
}
/**
+ * @return the index of change in original sequence
+ */
+ public int getHistoricalIndex()
+ {
+ return historicalIndex;
+ }
+
+ /**
* @return the changesType
*/
public ChangesType getChangesType()
@@ -556,13 +566,13 @@
@Override
public String toString()
{
- return fqn + " type=" + changesType;
+ return fqn + " type=" + changesType + " historyIndex=" + historicalIndex;
}
public int compareTo(ChangesContainer o)
{
int result = fqn.compareTo(o.getFqn());
- return result == 0 ? -1 : result;
+ return result == 0 ? historicalIndex - o.getHistoricalIndex() : result;
}
public abstract void apply();
@@ -578,9 +588,9 @@
private final Map<? extends Serializable, ? extends Object> data;
public PutObjectContainer(Fqn fqn, Map<? extends Serializable, ? extends Object> data,
- Cache<Serializable, Object> cache)
+ Cache<Serializable, Object> cache, int historicalIndex)
{
- super(fqn, ChangesType.ADDED, cache);
+ super(fqn, ChangesType.ADDED, cache, historicalIndex);
this.data = data;
}
@@ -603,9 +613,10 @@
private final Object value;
- public PutKeyValueContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache)
+ public PutKeyValueContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
+ int historicalIndex)
{
- super(fqn, ChangesType.ADDED, cache);
+ super(fqn, ChangesType.ADDED, cache, historicalIndex);
this.key = key;
this.value = value;
}
@@ -626,9 +637,9 @@
{
private final Serializable key;
- public RemoveKeyContainer(Fqn fqn, Serializable key, Cache<Serializable, Object> cache)
+ public RemoveKeyContainer(Fqn fqn, Serializable key, Cache<Serializable, Object> cache, int historicalIndex)
{
- super(fqn, ChangesType.REMOVED, cache);
+ super(fqn, ChangesType.REMOVED, cache, historicalIndex);
this.key = key;
}
@@ -649,9 +660,9 @@
private static class RemoveNodeContainer extends ChangesContainer
{
- public RemoveNodeContainer(Fqn fqn, Cache<Serializable, Object> cache)
+ public RemoveNodeContainer(Fqn fqn, Cache<Serializable, Object> cache, int historicalIndex)
{
- super(fqn, ChangesType.REMOVED, cache);
+ super(fqn, ChangesType.REMOVED, cache, historicalIndex);
}
@Override
16 years, 4 months
exo-jcr SVN: r1326 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2010-01-08 10:57:22 -0500 (Fri, 08 Jan 2010)
New Revision: 1326
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws1.xml
Log:
EXOJCR-361 : update channel name
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws1.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws1.xml 2010-01-08 14:53:53 UTC (rev 1325)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws1.xml 2010-01-08 15:57:22 UTC (rev 1326)
@@ -7,7 +7,7 @@
<transaction
transactionManagerLookupClass="org.jboss.cache.transaction.JBossStandaloneJTAManagerLookup" />
- <clustering mode="replication" clusterName="JBoss-Cache-Indexer-Cluster_db1_ws">
+ <clustering mode="replication" clusterName="JBoss-Cache-Indexer-Cluster_db1_ws1">
<stateRetrieval timeout="20000" fetchInMemoryState="false" nonBlocking="true"/>
<jgroupsConfig>
<!--
16 years, 4 months
exo-jcr SVN: r1325 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2010-01-08 09:53:53 -0500 (Fri, 08 Jan 2010)
New Revision: 1325
Added:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws1.xml
Removed:
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
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-jcr-config.xml
Log:
EXOJCR-361 : remove 1 repository and 2 ws. cache update live time interval.
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 2010-01-08 12:58:59 UTC (rev 1324)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws.xml 2010-01-08 14:53:53 UTC (rev 1325)
@@ -86,12 +86,12 @@
<!-- Eviction configuration -->
<eviction wakeUpInterval="5000">
<default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm">
- <property name="maxNodes" value="5000" />
- <property name="timeToLiveSeconds" value="120" />
+ <property name="maxNodes" value="50000" />
+ <property name="timeToLiveSeconds" value="900" />
</default>
<region name="/" algorithmClass="org.jboss.cache.eviction.LRUAlgorithm" actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ChildListEvictionActionPolicy" eventQueueSize="1000000">
- <property name="maxNodes" value="5000" />
- <property name="timeToLiveSeconds" value="120" />
+ <property name="maxNodes" value="50000" />
+ <property name="timeToLiveSeconds" value="900" />
</region>
</eviction>
</jbosscache>
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 2010-01-08 12:58:59 UTC (rev 1324)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws1.xml 2010-01-08 14:53:53 UTC (rev 1325)
@@ -86,12 +86,12 @@
<!-- Eviction configuration -->
<eviction wakeUpInterval="5000">
<default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm">
- <property name="maxNodes" value="5000" />
- <property name="timeToLiveSeconds" value="120" />
+ <property name="maxNodes" value="50000" />
+ <property name="timeToLiveSeconds" value="900" />
</default>
<region name="/" algorithmClass="org.jboss.cache.eviction.LRUAlgorithm" actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ChildListEvictionActionPolicy" eventQueueSize="1000000">
- <property name="maxNodes" value="5000" />
- <property name="timeToLiveSeconds" value="120" />
+ <property name="maxNodes" value="50000" />
+ <property name="timeToLiveSeconds" value="900" />
</region>
</eviction>
</jbosscache>
Deleted: 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 2010-01-08 12:58:59 UTC (rev 1324)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws2.xml 2010-01-08 14:53:53 UTC (rev 1325)
@@ -1,97 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:jboss:jbosscache-core:config:3.1">
-
- <locking useLockStriping="false" concurrencyLevel="50000" lockParentForChildInsertRemove="false" lockAcquisitionTimeout="3600000" />
-
- <clustering mode="replication" clusterName="JBoss-Cache-Cluster_db1_ws2">
- <!--
- Fetch in memory state is enable, because second cluster-node
- currently doesn't work properly on clear cache
- -->
- <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
- during running
- -->
- <jgroupsConfig>
- <!--
- UDP discard_incompatible_packets="true" enable_bundling="false"
- enable_diagnostics="false" ip_ttl="2" loopback="false"
- max_bundle_size="64000" max_bundle_timeout="30"
- mcast_addr="228.10.10.10" mcast_port="45588"
- mcast_recv_buf_size="25000000" mcast_send_buf_size="640000"
- oob_thread_pool.enabled="true"
- oob_thread_pool.keep_alive_time="10000"
- oob_thread_pool.max_threads="4" oob_thread_pool.min_threads="1"
- oob_thread_pool.queue_enabled="true"
- oob_thread_pool.queue_max_size="10"
- oob_thread_pool.rejection_policy="Run" thread_naming_pattern="pl"
- thread_pool.enabled="true" thread_pool.keep_alive_time="30000"
- thread_pool.max_threads="25" thread_pool.min_threads="1"
- thread_pool.queue_enabled="true" thread_pool.queue_max_size="10"
- thread_pool.rejection_policy="Run" tos="8"
- ucast_recv_buf_size="20000000" ucast_send_buf_size="640000"
- use_concurrent_stack="true" use_incoming_packet_handler="true" />
- <PING num_initial_members="3" timeout="2000" /
- -->
-
- <TCP bind_addr="127.0.0.1" start_port="9820" loopback="true"
- recv_buf_size="20000000" send_buf_size="640000"
- discard_incompatible_packets="true" max_bundle_size="64000"
- max_bundle_timeout="30" use_incoming_packet_handler="true"
- enable_bundling="false" use_send_queues="false" sock_conn_timeout="300"
- skip_suspected_members="true" use_concurrent_stack="true"
- thread_pool.enabled="true" thread_pool.min_threads="1"
- thread_pool.max_threads="25" thread_pool.keep_alive_time="5000"
- thread_pool.queue_enabled="false" thread_pool.queue_max_size="100"
- thread_pool.rejection_policy="run" oob_thread_pool.enabled="true"
- oob_thread_pool.min_threads="1" oob_thread_pool.max_threads="8"
- oob_thread_pool.keep_alive_time="5000"
- oob_thread_pool.queue_enabled="false"
- oob_thread_pool.queue_max_size="100"
- oob_thread_pool.rejection_policy="run" />
- <MPING timeout="2000" num_initial_members="2" mcast_port="34523"
- bind_addr="127.0.0.1" mcast_addr="224.0.0.1" />
-
-
- <MERGE2 max_interval="30000" min_interval="10000" />
- <FD_SOCK />
- <FD max_tries="5" shun="true" timeout="10000" />
- <VERIFY_SUSPECT timeout="1500" />
- <pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0"
- retransmit_timeout="300,600,1200,2400,4800" use_mcast_xmit="false" />
- <UNICAST timeout="300,600,1200,2400,3600" />
- <pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000"
- stability_delay="1000" />
- <pbcast.GMS join_timeout="5000" print_local_addr="true"
- shun="false" view_ack_collection_timeout="5000" view_bundling="true" />
- <FRAG2 frag_size="60000" />
- <pbcast.STREAMING_STATE_TRANSFER />
- <pbcast.FLUSH timeout="0" />
-
- </jgroupsConfig>
-
- <sync />
-
- </clustering>
-
- <!-- Configure the TransactionManager -->
- <transaction
- transactionManagerLookupClass="org.jboss.cache.transaction.JBossStandaloneJTAManagerLookup" />
-
- <!-- Enable batching -->
- <invocationBatching enabled="true" />
- <!-- Eviction configuration -->
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm">
- <property name="maxNodes" value="5000" />
- <property name="timeToLiveSeconds" value="120" />
- </default>
- <region name="/" algorithmClass="org.jboss.cache.eviction.LRUAlgorithm" actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ChildListEvictionActionPolicy" eventQueueSize="1000000">
- <property name="maxNodes" value="5000" />
- <property name="timeToLiveSeconds" value="120" />
- </region>
- </eviction>
-</jbosscache>
Deleted: 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 2010-01-08 12:58:59 UTC (rev 1324)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws3.xml 2010-01-08 14:53:53 UTC (rev 1325)
@@ -1,97 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:jboss:jbosscache-core:config:3.1">
-
- <locking useLockStriping="false" concurrencyLevel="50000" lockParentForChildInsertRemove="false" lockAcquisitionTimeout="3600000" />
-
- <clustering mode="replication" clusterName="JBoss-Cache-Cluster_db1_ws3">
- <!--
- Fetch in memory state is enable, because second cluster-node
- currently doesn't work properly on clear cache
- -->
- <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
- during running
- -->
- <jgroupsConfig>
- <!--
- UDP discard_incompatible_packets="true" enable_bundling="false"
- enable_diagnostics="false" ip_ttl="2" loopback="false"
- max_bundle_size="64000" max_bundle_timeout="30"
- mcast_addr="228.10.10.10" mcast_port="45588"
- mcast_recv_buf_size="25000000" mcast_send_buf_size="640000"
- oob_thread_pool.enabled="true"
- oob_thread_pool.keep_alive_time="10000"
- oob_thread_pool.max_threads="4" oob_thread_pool.min_threads="1"
- oob_thread_pool.queue_enabled="true"
- oob_thread_pool.queue_max_size="10"
- oob_thread_pool.rejection_policy="Run" thread_naming_pattern="pl"
- thread_pool.enabled="true" thread_pool.keep_alive_time="30000"
- thread_pool.max_threads="25" thread_pool.min_threads="1"
- thread_pool.queue_enabled="true" thread_pool.queue_max_size="10"
- thread_pool.rejection_policy="Run" tos="8"
- ucast_recv_buf_size="20000000" ucast_send_buf_size="640000"
- use_concurrent_stack="true" use_incoming_packet_handler="true" />
- <PING num_initial_members="3" timeout="2000" /
- -->
-
- <TCP bind_addr="127.0.0.1" start_port="9830" loopback="true"
- recv_buf_size="20000000" send_buf_size="640000"
- discard_incompatible_packets="true" max_bundle_size="64000"
- max_bundle_timeout="30" use_incoming_packet_handler="true"
- enable_bundling="false" use_send_queues="false" sock_conn_timeout="300"
- skip_suspected_members="true" use_concurrent_stack="true"
- thread_pool.enabled="true" thread_pool.min_threads="1"
- thread_pool.max_threads="25" thread_pool.keep_alive_time="5000"
- thread_pool.queue_enabled="false" thread_pool.queue_max_size="100"
- thread_pool.rejection_policy="run" oob_thread_pool.enabled="true"
- oob_thread_pool.min_threads="1" oob_thread_pool.max_threads="8"
- oob_thread_pool.keep_alive_time="5000"
- oob_thread_pool.queue_enabled="false"
- oob_thread_pool.queue_max_size="100"
- oob_thread_pool.rejection_policy="run" />
- <MPING timeout="2000" num_initial_members="2" mcast_port="34524"
- bind_addr="127.0.0.1" mcast_addr="224.0.0.1" />
-
-
- <MERGE2 max_interval="30000" min_interval="10000" />
- <FD_SOCK />
- <FD max_tries="5" shun="true" timeout="10000" />
- <VERIFY_SUSPECT timeout="1500" />
- <pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0"
- retransmit_timeout="300,600,1200,2400,4800" use_mcast_xmit="false" />
- <UNICAST timeout="300,600,1200,2400,3600" />
- <pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000"
- stability_delay="1000" />
- <pbcast.GMS join_timeout="5000" print_local_addr="true"
- shun="false" view_ack_collection_timeout="5000" view_bundling="true" />
- <FRAG2 frag_size="60000" />
- <pbcast.STREAMING_STATE_TRANSFER />
- <pbcast.FLUSH timeout="0" />
-
- </jgroupsConfig>
-
- <sync />
-
- </clustering>
-
- <!-- Configure the TransactionManager -->
- <transaction
- transactionManagerLookupClass="org.jboss.cache.transaction.JBossStandaloneJTAManagerLookup" />
-
- <!-- Enable batching -->
- <invocationBatching enabled="true" />
- <!-- Eviction configuration -->
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm">
- <property name="maxNodes" value="5000" />
- <property name="timeToLiveSeconds" value="120" />
- </default>
- <region name="/" algorithmClass="org.jboss.cache.eviction.LRUAlgorithm" actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ChildListEvictionActionPolicy" eventQueueSize="1000000">
- <property name="maxNodes" value="5000" />
- <property name="timeToLiveSeconds" value="120" />
- </region>
- </eviction>
-</jbosscache>
Deleted: 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 2010-01-08 12:58:59 UTC (rev 1324)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck.xml 2010-01-08 14:53:53 UTC (rev 1325)
@@ -1,97 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:jboss:jbosscache-core:config:3.1">
-
- <locking useLockStriping="false" concurrencyLevel="50000" lockParentForChildInsertRemove="false" lockAcquisitionTimeout="3600000" />
-
- <clustering mode="replication" clusterName="JBoss-Cache-Cluster_db1tck_wstck">
- <!--
- Fetch in memory state is enable, because second cluster-node
- currently doesn't work properly on clear cache
- -->
- <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
- during running
- -->
- <jgroupsConfig>
- <!--
- UDP discard_incompatible_packets="true" enable_bundling="false"
- enable_diagnostics="false" ip_ttl="2" loopback="false"
- max_bundle_size="64000" max_bundle_timeout="30"
- mcast_addr="228.10.10.10" mcast_port="45588"
- mcast_recv_buf_size="25000000" mcast_send_buf_size="640000"
- oob_thread_pool.enabled="true"
- oob_thread_pool.keep_alive_time="10000"
- oob_thread_pool.max_threads="4" oob_thread_pool.min_threads="1"
- oob_thread_pool.queue_enabled="true"
- oob_thread_pool.queue_max_size="10"
- oob_thread_pool.rejection_policy="Run" thread_naming_pattern="pl"
- thread_pool.enabled="true" thread_pool.keep_alive_time="30000"
- thread_pool.max_threads="25" thread_pool.min_threads="1"
- thread_pool.queue_enabled="true" thread_pool.queue_max_size="10"
- thread_pool.rejection_policy="Run" tos="8"
- ucast_recv_buf_size="20000000" ucast_send_buf_size="640000"
- use_concurrent_stack="true" use_incoming_packet_handler="true" />
- <PING num_initial_members="3" timeout="2000" /
- -->
-
- <TCP bind_addr="127.0.0.1" start_port="9840" loopback="true"
- recv_buf_size="20000000" send_buf_size="640000"
- discard_incompatible_packets="true" max_bundle_size="64000"
- max_bundle_timeout="30" use_incoming_packet_handler="true"
- enable_bundling="false" use_send_queues="false" sock_conn_timeout="300"
- skip_suspected_members="true" use_concurrent_stack="true"
- thread_pool.enabled="true" thread_pool.min_threads="1"
- thread_pool.max_threads="25" thread_pool.keep_alive_time="5000"
- thread_pool.queue_enabled="false" thread_pool.queue_max_size="100"
- thread_pool.rejection_policy="run" oob_thread_pool.enabled="true"
- oob_thread_pool.min_threads="1" oob_thread_pool.max_threads="8"
- oob_thread_pool.keep_alive_time="5000"
- oob_thread_pool.queue_enabled="false"
- oob_thread_pool.queue_max_size="100"
- oob_thread_pool.rejection_policy="run" />
- <MPING timeout="2000" num_initial_members="2" mcast_port="34525"
- bind_addr="127.0.0.1" mcast_addr="224.0.0.1" />
-
-
- <MERGE2 max_interval="30000" min_interval="10000" />
- <FD_SOCK />
- <FD max_tries="5" shun="true" timeout="10000" />
- <VERIFY_SUSPECT timeout="1500" />
- <pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0"
- retransmit_timeout="300,600,1200,2400,4800" use_mcast_xmit="false" />
- <UNICAST timeout="300,600,1200,2400,3600" />
- <pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000"
- stability_delay="1000" />
- <pbcast.GMS join_timeout="5000" print_local_addr="true"
- shun="false" view_ack_collection_timeout="5000" view_bundling="true" />
- <FRAG2 frag_size="60000" />
- <pbcast.STREAMING_STATE_TRANSFER />
- <pbcast.FLUSH timeout="0" />
-
- </jgroupsConfig>
-
- <sync />
-
- </clustering>
-
- <!-- Configure the TransactionManager -->
- <transaction
- transactionManagerLookupClass="org.jboss.cache.transaction.JBossStandaloneJTAManagerLookup" />
-
- <!-- Enable batching -->
- <invocationBatching enabled="true" />
- <!-- Eviction configuration -->
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm">
- <property name="maxNodes" value="5000" />
- <property name="timeToLiveSeconds" value="120" />
- </default>
- <region name="/" algorithmClass="org.jboss.cache.eviction.LRUAlgorithm" actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ChildListEvictionActionPolicy" eventQueueSize="1000000">
- <property name="maxNodes" value="5000" />
- <property name="timeToLiveSeconds" value="120" />
- </region>
- </eviction>
-</jbosscache>
Deleted: 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 2010-01-08 12:58:59 UTC (rev 1324)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck1.xml 2010-01-08 14:53:53 UTC (rev 1325)
@@ -1,98 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:jboss:jbosscache-core:config:3.1">
-
- <locking useLockStriping="false" concurrencyLevel="50000" lockParentForChildInsertRemove="false" lockAcquisitionTimeout="3600000" />
-
- <clustering mode="replication" clusterName="JBoss-Cache-Cluster_db1tck_wstck1">
- <!--
- Fetch in memory state is enable, because second cluster-node
- currently doesn't work properly on clear cache
- -->
- <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
- during running
- -->
- <jgroupsConfig>
- <!--
- UDP discard_incompatible_packets="true" enable_bundling="false"
- enable_diagnostics="false" ip_ttl="2" loopback="false"
- max_bundle_size="64000" max_bundle_timeout="30"
- mcast_addr="228.10.10.10" mcast_port="45588"
- mcast_recv_buf_size="25000000" mcast_send_buf_size="640000"
- oob_thread_pool.enabled="true"
- oob_thread_pool.keep_alive_time="10000"
- oob_thread_pool.max_threads="4" oob_thread_pool.min_threads="1"
- oob_thread_pool.queue_enabled="true"
- oob_thread_pool.queue_max_size="10"
- oob_thread_pool.rejection_policy="Run" thread_naming_pattern="pl"
- thread_pool.enabled="true" thread_pool.keep_alive_time="30000"
- thread_pool.max_threads="25" thread_pool.min_threads="1"
- thread_pool.queue_enabled="true" thread_pool.queue_max_size="10"
- thread_pool.rejection_policy="Run" tos="8"
- ucast_recv_buf_size="20000000" ucast_send_buf_size="640000"
- use_concurrent_stack="true" use_incoming_packet_handler="true" />
- <PING num_initial_members="3" timeout="2000" /
- -->
-
- <TCP bind_addr="127.0.0.1" start_port="9850" loopback="true"
- recv_buf_size="20000000" send_buf_size="640000"
- discard_incompatible_packets="true" max_bundle_size="64000"
- max_bundle_timeout="30" use_incoming_packet_handler="true"
- enable_bundling="false" use_send_queues="false" sock_conn_timeout="300"
- skip_suspected_members="true" use_concurrent_stack="true"
- thread_pool.enabled="true" thread_pool.min_threads="1"
- thread_pool.max_threads="25" thread_pool.keep_alive_time="5000"
- thread_pool.queue_enabled="false" thread_pool.queue_max_size="100"
- thread_pool.rejection_policy="run" oob_thread_pool.enabled="true"
- oob_thread_pool.min_threads="1" oob_thread_pool.max_threads="8"
- oob_thread_pool.keep_alive_time="5000"
- oob_thread_pool.queue_enabled="false"
- oob_thread_pool.queue_max_size="100"
- oob_thread_pool.rejection_policy="run" />
- <MPING timeout="2000" num_initial_members="2" mcast_port="34526"
- bind_addr="127.0.0.1" mcast_addr="224.0.0.1" />
-
-
- <MERGE2 max_interval="30000" min_interval="10000" />
- <FD_SOCK />
- <FD max_tries="5" shun="true" timeout="10000" />
- <VERIFY_SUSPECT timeout="1500" />
- <pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0"
- retransmit_timeout="300,600,1200,2400,4800" use_mcast_xmit="false" />
- <UNICAST timeout="300,600,1200,2400,3600" />
- <pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000"
- stability_delay="1000" />
- <pbcast.GMS join_timeout="5000" print_local_addr="true"
- shun="false" view_ack_collection_timeout="5000" view_bundling="true" />
- <FRAG2 frag_size="60000" />
- <pbcast.STREAMING_STATE_TRANSFER />
- <pbcast.FLUSH timeout="0" />
-
- </jgroupsConfig>
-
- <sync />
-
- </clustering>
-
- <!-- Configure the TransactionManager -->
- <transaction
- transactionManagerLookupClass="org.jboss.cache.transaction.JBossStandaloneJTAManagerLookup" />
-
- <!-- Enable batching -->
- <invocationBatching enabled="true" />
- <!-- Eviction configuration -->
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm">
- <property name="maxNodes" value="5000" />
- <property name="timeToLiveSeconds" value="120" />
- </default>
- <region name="/" algorithmClass="org.jboss.cache.eviction.LRUAlgorithm" actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ChildListEvictionActionPolicy" eventQueueSize="1000000">
- <property name="maxNodes" value="5000" />
- <property name="timeToLiveSeconds" value="120" />
- </region>
- </eviction>
-
-</jbosscache>
Deleted: 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 2010-01-08 12:58:59 UTC (rev 1324)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck2.xml 2010-01-08 14:53:53 UTC (rev 1325)
@@ -1,97 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:jboss:jbosscache-core:config:3.1">
-
- <locking useLockStriping="false" concurrencyLevel="50000" lockParentForChildInsertRemove="false" lockAcquisitionTimeout="3600000" />
-
- <clustering mode="replication" clusterName="JBoss-Cache-Cluster_db1tck_wstck2">
- <!--
- Fetch in memory state is enable, because second cluster-node
- currently doesn't work properly on clear cache
- -->
- <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
- during running
- -->
- <jgroupsConfig>
- <!--
- UDP discard_incompatible_packets="true" enable_bundling="false"
- enable_diagnostics="false" ip_ttl="2" loopback="false"
- max_bundle_size="64000" max_bundle_timeout="30"
- mcast_addr="228.10.10.10" mcast_port="45588"
- mcast_recv_buf_size="25000000" mcast_send_buf_size="640000"
- oob_thread_pool.enabled="true"
- oob_thread_pool.keep_alive_time="10000"
- oob_thread_pool.max_threads="4" oob_thread_pool.min_threads="1"
- oob_thread_pool.queue_enabled="true"
- oob_thread_pool.queue_max_size="10"
- oob_thread_pool.rejection_policy="Run" thread_naming_pattern="pl"
- thread_pool.enabled="true" thread_pool.keep_alive_time="30000"
- thread_pool.max_threads="25" thread_pool.min_threads="1"
- thread_pool.queue_enabled="true" thread_pool.queue_max_size="10"
- thread_pool.rejection_policy="Run" tos="8"
- ucast_recv_buf_size="20000000" ucast_send_buf_size="640000"
- use_concurrent_stack="true" use_incoming_packet_handler="true" />
- <PING num_initial_members="3" timeout="2000" /
- -->
-
- <TCP bind_addr="127.0.0.1" start_port="9860" loopback="true"
- recv_buf_size="20000000" send_buf_size="640000"
- discard_incompatible_packets="true" max_bundle_size="64000"
- max_bundle_timeout="30" use_incoming_packet_handler="true"
- enable_bundling="false" use_send_queues="false" sock_conn_timeout="300"
- skip_suspected_members="true" use_concurrent_stack="true"
- thread_pool.enabled="true" thread_pool.min_threads="1"
- thread_pool.max_threads="25" thread_pool.keep_alive_time="5000"
- thread_pool.queue_enabled="false" thread_pool.queue_max_size="100"
- thread_pool.rejection_policy="run" oob_thread_pool.enabled="true"
- oob_thread_pool.min_threads="1" oob_thread_pool.max_threads="8"
- oob_thread_pool.keep_alive_time="5000"
- oob_thread_pool.queue_enabled="false"
- oob_thread_pool.queue_max_size="100"
- oob_thread_pool.rejection_policy="run" />
- <MPING timeout="2000" num_initial_members="2" mcast_port="34527"
- bind_addr="127.0.0.1" mcast_addr="224.0.0.1" />
-
-
- <MERGE2 max_interval="30000" min_interval="10000" />
- <FD_SOCK />
- <FD max_tries="5" shun="true" timeout="10000" />
- <VERIFY_SUSPECT timeout="1500" />
- <pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0"
- retransmit_timeout="300,600,1200,2400,4800" use_mcast_xmit="false" />
- <UNICAST timeout="300,600,1200,2400,3600" />
- <pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000"
- stability_delay="1000" />
- <pbcast.GMS join_timeout="5000" print_local_addr="true"
- shun="false" view_ack_collection_timeout="5000" view_bundling="true" />
- <FRAG2 frag_size="60000" />
- <pbcast.STREAMING_STATE_TRANSFER />
- <pbcast.FLUSH timeout="0" />
-
- </jgroupsConfig>
-
- <sync />
-
- </clustering>
-
- <!-- Configure the TransactionManager -->
- <transaction
- transactionManagerLookupClass="org.jboss.cache.transaction.JBossStandaloneJTAManagerLookup" />
-
- <!-- Enable batching -->
- <invocationBatching enabled="true" />
- <!-- Eviction configuration -->
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm">
- <property name="maxNodes" value="5000" />
- <property name="timeToLiveSeconds" value="120" />
- </default>
- <region name="/" algorithmClass="org.jboss.cache.eviction.LRUAlgorithm" actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ChildListEvictionActionPolicy" eventQueueSize="1000000">
- <property name="maxNodes" value="5000" />
- <property name="timeToLiveSeconds" value="120" />
- </region>
- </eviction>
-</jbosscache>
Added: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws1.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws1.xml (rev 0)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws1.xml 2010-01-08 14:53:53 UTC (rev 1325)
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="urn:jboss:jbosscache-core:config:3.1">
+
+ <locking useLockStriping="false" concurrencyLevel="50000" lockParentForChildInsertRemove="false" lockAcquisitionTimeout="3600000" />
+ <!-- Configure the TransactionManager -->
+ <transaction
+ transactionManagerLookupClass="org.jboss.cache.transaction.JBossStandaloneJTAManagerLookup" />
+
+ <clustering mode="replication" clusterName="JBoss-Cache-Indexer-Cluster_db1_ws">
+ <stateRetrieval timeout="20000" fetchInMemoryState="false" nonBlocking="true"/>
+ <jgroupsConfig>
+ <!--
+ UDP discard_incompatible_packets="true" enable_bundling="false"
+ enable_diagnostics="false" ip_ttl="2" loopback="false"
+ max_bundle_size="64000" max_bundle_timeout="30"
+ mcast_addr="228.10.10.10" mcast_port="45588"
+ mcast_recv_buf_size="25000000" mcast_send_buf_size="640000"
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.keep_alive_time="10000"
+ oob_thread_pool.max_threads="4" oob_thread_pool.min_threads="1"
+ oob_thread_pool.queue_enabled="true"
+ oob_thread_pool.queue_max_size="10"
+ oob_thread_pool.rejection_policy="Run" thread_naming_pattern="pl"
+ thread_pool.enabled="true" thread_pool.keep_alive_time="30000"
+ thread_pool.max_threads="25" thread_pool.min_threads="1"
+ thread_pool.queue_enabled="true" thread_pool.queue_max_size="10"
+ thread_pool.rejection_policy="Run" tos="8"
+ ucast_recv_buf_size="20000000" ucast_send_buf_size="640000"
+ use_concurrent_stack="true" use_incoming_packet_handler="true" />
+ <PING num_initial_members="3" timeout="2000" /
+ -->
+
+ <TCP bind_addr="127.0.0.1" start_port="9910" loopback="true"
+ recv_buf_size="20000000" send_buf_size="640000"
+ discard_incompatible_packets="true" max_bundle_size="64000"
+ max_bundle_timeout="30" use_incoming_packet_handler="true"
+ enable_bundling="false" use_send_queues="false" sock_conn_timeout="300"
+ skip_suspected_members="true" use_concurrent_stack="true"
+ thread_pool.enabled="true" thread_pool.min_threads="1"
+ thread_pool.max_threads="25" thread_pool.keep_alive_time="5000"
+ thread_pool.queue_enabled="false" thread_pool.queue_max_size="100"
+ thread_pool.rejection_policy="run" oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="1" oob_thread_pool.max_threads="8"
+ oob_thread_pool.keep_alive_time="5000"
+ oob_thread_pool.queue_enabled="false"
+ oob_thread_pool.queue_max_size="100"
+ oob_thread_pool.rejection_policy="run" />
+ <MPING timeout="2000" num_initial_members="2" mcast_port="34530"
+ bind_addr="127.0.0.1" mcast_addr="224.0.0.1" />
+
+
+ <MERGE2 max_interval="30000" min_interval="10000" />
+ <FD_SOCK />
+ <FD max_tries="5" shun="true" timeout="10000" />
+ <VERIFY_SUSPECT timeout="1500" />
+ <pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0"
+ retransmit_timeout="300,600,1200,2400,4800" use_mcast_xmit="false" />
+ <UNICAST timeout="300,600,1200,2400,3600" />
+ <pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000"
+ stability_delay="1000" />
+ <pbcast.GMS join_timeout="5000" print_local_addr="true"
+ shun="false" view_ack_collection_timeout="5000" view_bundling="true" />
+ <FRAG2 frag_size="60000" />
+ <pbcast.STREAMING_STATE_TRANSFER />
+ <pbcast.FLUSH timeout="0" />
+
+ </jgroupsConfig>
+
+ <sync />
+ </clustering>
+ <invocationBatching enabled="false" />
+
+</jbosscache>
Property changes on: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws1.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jcr-config.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jcr-config.xml 2010-01-08 12:58:59 UTC (rev 1324)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jcr-config.xml 2010-01-08 14:53:53 UTC (rev 1325)
@@ -73,7 +73,7 @@
</cache>
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
<properties>
- <property name="index-dir" value="target/temp/index/db1/ws" />
+ <property name="index-dir" value="${java.io.tmpdir}/cluster_nfs/db1/ws" />
<property name="changesfilter-class" value="org.exoplatform.services.jcr.impl.core.query.jbosscache.JbossCacheIndexChangesFilter" />
<property name="changesfilter-config-path" value="conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws.xml" />
</properties>
@@ -116,284 +116,13 @@
</cache>
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
<properties>
- <property name="index-dir" value="target/temp/index/db1/ws1" />
- <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ <property name="index-dir" value="${java.io.tmpdir}/cluster_nfs/db1/ws1" />
+ <property name="changesfilter-class" value="org.exoplatform.services.jcr.impl.core.query.jbosscache.JbossCacheIndexChangesFilter" />
+ <property name="changesfilter-config-path" value="conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws1.xml" />
</properties>
</query-handler>
</workspace>
-
- <workspace name="ws2">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr2" />
- <property name="dialect" value="mysql" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws2" />
- </properties>
- <value-storages>
- <value-storage id="ws2" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws2" />
- </properties>
- <filters>
- <filter property-type="Binary" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
- <properties>
- <property name="jbosscache-configuration" value="conf/cluster/test-jbosscache-config-ws2.xml" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1/ws2" />
- <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- </properties>
- </query-handler>
- </workspace>
-
- <workspace name="ws3">
- <!-- for system storage -->
- <container
- class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr3" />
- <property name="dialect" value="mysql" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws3" />
- </properties>
- <value-storages>
- <!--
- This storage is used to check whether properties are removed
- correctly from each value-storage
- (TestRemoveFromValueStorage.java)
- -->
- <value-storage id="ws3_big"
- class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws3_big" />
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="1024K" />
- </filters>
- </value-storage>
- <value-storage id="ws3"
- class="org.exoplatform.services.jcr.impl.storage.value.fs.CASableTreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws3" />
- <property name="digest-algo" value="MD5" />
- <property name="vcas-type"
- value="org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImpl" />
- <property name="jdbc-source-name" value="jdbcjcr" />
- <property name="jdbc-dialect" value="mysql" />
- </properties>
- <filters>
- <filter property-type="Binary" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer
- class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured" />
- </properties>
- </initializer>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
- <properties>
- <property name="jbosscache-configuration" value="conf/cluster/test-jbosscache-config-ws3.xml" />
- </properties>
- </cache>
- <query-handler
- class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1/ws3" />
- <property name="synonymprovider-class"
- value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class"
- value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="spellchecker-class"
- value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- </properties>
- </query-handler>
- </workspace>
</workspaces>
</repository>
-
- <repository name="db1tck" system-workspace="ws" default-workspace="ws">
- <security-domain>exo-domain</security-domain>
- <!-- access-control>optional</access-control -->
- <!-- access-control>disable</access-control -->
- <session-max-age>1h</session-max-age>
- <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
- <workspaces>
- <workspace name="ws">
- <!-- for system storage -->
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcrtck" />
- <property name="dialect" value="mysql" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/wstck" />
- </properties>
- <value-storages>
- <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/wstck" />
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="100K" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured" />
- <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
- </properties>
- </initializer>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
- <properties>
- <property name="jbosscache-configuration" value="conf/cluster/test-jbosscache-config-wstck.xml" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1tck/ws" />
- <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="excerptprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.WeightedHTMLExcerpt" />
- <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- </properties>
- </query-handler>
- <lock-manager>
- <time-out>15m</time-out>
- <persister class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
- <properties>
- <property name="path" value="target/temp/locktck" />
- </properties>
- </persister>
- </lock-manager>
- </workspace>
-
- <workspace name="ws1">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr1tck" />
- <property name="dialect" value="mysql" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws1tck" />
- </properties>
- <value-storages>
- <value-storage id="ws1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws1tck" />
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="100K" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured" />
- <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
- </properties>
- </initializer>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
- <properties>
- <property name="jbosscache-configuration" value="conf/cluster/test-jbosscache-config-wstck1.xml" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1tck/ws1" />
- <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- </properties>
- </query-handler>
- </workspace>
-
- <workspace name="ws2">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr2tck" />
- <property name="dialect" value="mysql" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws2tck" />
- </properties>
- <value-storages>
- <value-storage id="ws2" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws2tck" />
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="100K" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured" />
- <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
- </properties>
- </initializer>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
- <properties>
- <property name="jbosscache-configuration" value="conf/cluster/test-jbosscache-config-wstck2.xml" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1tck/ws2" />
- <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- <property name="excerptprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.WeightedHTMLExcerpt"/>
- <property name="extractorPoolSize" value="2"/>
- <property name="extractorTimeout" value="10"/>
- </properties>
- </query-handler>
- </workspace>
- </workspaces>
- </repository>
</repositories>
</repository-service>
16 years, 4 months