Repository: tomee Updated Branches: refs/heads/develop 7d60b1603 -> 48de26094
TOMEE-1446 BeforeStartEjbs event Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/48de2609 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/48de2609 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/48de2609 Branch: refs/heads/develop Commit: 48de26094539c9a19931c8bf5591d7678e7083e0 Parents: 7d60b16 Author: Romain Manni-Bucau <[email protected]> Authored: Mon Nov 17 16:29:36 2014 +0100 Committer: Romain Manni-Bucau <[email protected]> Committed: Mon Nov 17 16:29:36 2014 +0100 ---------------------------------------------------------------------- .../openejb/assembler/classic/Assembler.java | 3 ++ .../classic/event/BeforeStartEjbs.java | 47 ++++++++++++++++++++ 2 files changed, 50 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/48de2609/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java index 9eda2b6..051fce3 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java @@ -44,6 +44,7 @@ import org.apache.openejb.assembler.classic.event.AssemblerAfterApplicationCreat import org.apache.openejb.assembler.classic.event.AssemblerBeforeApplicationDestroyed; import org.apache.openejb.assembler.classic.event.AssemblerCreated; import org.apache.openejb.assembler.classic.event.AssemblerDestroyed; +import org.apache.openejb.assembler.classic.event.BeforeStartEjbs; import org.apache.openejb.assembler.classic.event.ContainerSystemPostCreate; import org.apache.openejb.assembler.classic.event.ContainerSystemPreDestroy; import org.apache.openejb.assembler.monitoring.JMXContainer; @@ -1199,6 +1200,8 @@ public class Assembler extends AssemblerTool implements org.apache.openejb.spi.A public void startEjbs(final boolean start, final List<BeanContext> allDeployments) throws OpenEJBException { // now that everything is configured, deploy to the container if (start) { + SystemInstance.get().fireEvent(new BeforeStartEjbs(allDeployments)); + final Collection<BeanContext> toStart = new ArrayList<BeanContext>(); // deploy http://git-wip-us.apache.org/repos/asf/tomee/blob/48de2609/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/event/BeforeStartEjbs.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/event/BeforeStartEjbs.java b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/event/BeforeStartEjbs.java new file mode 100644 index 0000000..a73a115 --- /dev/null +++ b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/event/BeforeStartEjbs.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.assembler.classic.event; + +import org.apache.openejb.BeanContext; +import org.apache.openejb.observer.Event; + +import java.util.Collections; +import java.util.List; + +/** + * IMPORTANT NOTE: when using this event it should be compared to BeforeAppInfoBuilderEvent which is likely better. + * Main reason to use BeforeStartEjbs is the need of reflection (to do filtering for instance). All other cases shouldn't use it. + */ +@Event +public class BeforeStartEjbs { + private final List<BeanContext> ejbs; + + public BeforeStartEjbs(final List<BeanContext> allDeployments) { + this.ejbs = allDeployments; + } + + public List<BeanContext> getEjbs() { + return Collections.unmodifiableList(ejbs); + } + + @Override + public String toString() { + return "BeforeStartEjbs{" + + "#ejbs=" + ejbs.size() + + '}'; + } +}
