You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by ge...@apache.org on 2010/03/07 01:10:28 UTC

svn commit: r919888 - in /openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi: ContainerLifecycle.java ContextsService.java TransactionService.java util/

Author: gerdogdu
Date: Sun Mar  7 00:10:28 2010
New Revision: 919888

URL: http://svn.apache.org/viewvc?rev=919888&view=rev
Log:
[OWB-320] Remove Java EE Dependencies from WebBeans Core

Added:
    openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/ContextsService.java   (with props)
Removed:
    openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/util/
Modified:
    openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/ContainerLifecycle.java
    openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/TransactionService.java

Modified: openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/ContainerLifecycle.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/ContainerLifecycle.java?rev=919888&r1=919887&r2=919888&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/ContainerLifecycle.java (original)
+++ openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/ContainerLifecycle.java Sun Mar  7 00:10:28 2010
@@ -38,7 +38,7 @@
      * </p>
      * @param properties any properties
      */
-    public void init(Properties properties);
+    public void initApplication(Properties properties);
     
     /**
      * Starts container. It discovers all beans
@@ -65,14 +65,14 @@
      * @param startupObject any startup object.
      * @throws Exception exception thrown by startup
      */
-    public void start(Object startupObject) throws Exception;
-    
+    public void startApplication(Object startupObject) throws Exception;
+        
     /**
      * Stops means that container removes all bean instances
      * it store, remove contexts and does necessary final actions.
      * @param endObject any onject provided by implementors
      */
-    public void stop(Object endObject);
+    public void stopApplication(Object endObject);
     
     /**
      * Gets deployment bean manager instance. There is 1-1 correspondence
@@ -80,5 +80,10 @@
      * @return deployment {@link BeanManager} instance
      */
     public BeanManager getBeanManager();
-
+    
+    /**
+     * Gets container's context service implementation.
+     * @return container contexts service
+     */
+    public ContextsService getContextService();
 }

Added: openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/ContextsService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/ContextsService.java?rev=919888&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/ContextsService.java (added)
+++ openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/ContextsService.java Sun Mar  7 00:10:28 2010
@@ -0,0 +1,93 @@
+/*
+ * 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.webbeans.spi;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.context.ContextException;
+import javax.enterprise.context.spi.Context;
+
+/**
+ * Contexts services provides demarcation
+ * methods for each context that is defined
+ * in the specification. SPI providers implement
+ * related method that it supports.
+ * 
+ * <p>
+ * For example, web container supports request, session
+ * conversation, application, singleton and dependent
+ * contexts.
+ * </p>
+ * @version $Rev$ $Date$
+ *
+ */
+public interface ContextsService
+{
+    /**
+     * Initialize container contexts service.
+     * @param initializeObject any initialize object
+     */
+    public void init(Object initializeObject);
+    
+    /**
+     * Destroys container contexts service.
+     * @param destroyObject any destroy parameter
+     */
+    public void destroy(Object destroyObject);
+    
+    /**
+     * Gets current context with given scope type with
+     * respect to the current thread of execution.
+     * <p>
+     * If there is not current context, it returns null. 
+     * </p>
+     * @param scopeType context scope type
+     * @return current context with given scope type
+     */
+    public Context getCurrentContext(Class<? extends Annotation> scopeType);
+    
+    /**
+     * If container supports the given scope type it returns
+     * true, otherwise it return false.
+     * @param scopeType scope type
+     * @return true if container supports given scope type false otherwise
+     */
+    public boolean supportsContext(Class<? extends Annotation> scopeType);
+    
+    /**
+     * Starts the context with the given scope type. If 
+     * given scope type is not supported, there is no action.
+     * @param scopeType scope type
+     * @param startParameter any parameter
+     * @throws ContextException if any exception thrown by starting context,
+     *         it is wrapped inside {@link ContextException} and thrown.
+     */
+    public void startContext(Class<? extends Annotation> scopeType, Object startParameter) throws ContextException;
+    
+    /**
+     * Ends the context with the given scope type. If 
+     * given scope type is not supported, there is no action.
+     * Any exception thrown by the operation is catched and 
+     * logged by the container.
+     * @param scopeType scope type
+     * @param endParameters any end parameter
+     */
+    public void endContext(Class<? extends Annotation> scopeType, Object endParameters);
+    
+}

Propchange: openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/ContextsService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/TransactionService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/TransactionService.java?rev=919888&r1=919887&r2=919888&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/TransactionService.java (original)
+++ openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/TransactionService.java Sun Mar  7 00:10:28 2010
@@ -13,6 +13,8 @@
  */
 package org.apache.webbeans.spi;
 
+import javax.enterprise.event.TransactionPhase;
+import javax.enterprise.inject.spi.ObserverMethod;
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
 import javax.transaction.UserTransaction;
@@ -40,4 +42,12 @@
      * @return user transaction object
      */
     public UserTransaction getUserTransaction();
+    
+    /**
+     * Register transaction synch.
+     * @param phase transaction phase
+     * @param observer observer 
+     * @param event event
+     */
+    public void registerTransactionSynchronization(TransactionPhase phase, ObserverMethod<? super Object> observer, Object event) throws Exception;
 }
\ No newline at end of file