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:04:40 UTC

svn commit: r919882 - in /openwebbeans/trunk/webbeans-ee-common: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/webbeans/ src/main/java/org/apache/webbeans/ee/ src/main/java/org/apache/webbeans/ee...

Author: gerdogdu
Date: Sun Mar  7 00:04:39 2010
New Revision: 919882

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

Added:
    openwebbeans/trunk/webbeans-ee-common/   (with props)
    openwebbeans/trunk/webbeans-ee-common/pom.xml   (with props)
    openwebbeans/trunk/webbeans-ee-common/src/
    openwebbeans/trunk/webbeans-ee-common/src/main/
    openwebbeans/trunk/webbeans-ee-common/src/main/java/
    openwebbeans/trunk/webbeans-ee-common/src/main/java/org/
    openwebbeans/trunk/webbeans-ee-common/src/main/java/org/apache/
    openwebbeans/trunk/webbeans-ee-common/src/main/java/org/apache/webbeans/
    openwebbeans/trunk/webbeans-ee-common/src/main/java/org/apache/webbeans/ee/
    openwebbeans/trunk/webbeans-ee-common/src/main/java/org/apache/webbeans/ee/common/
    openwebbeans/trunk/webbeans-ee-common/src/main/java/org/apache/webbeans/ee/common/beans/
    openwebbeans/trunk/webbeans-ee-common/src/main/java/org/apache/webbeans/ee/common/beans/PrinicipalBean.java   (with props)
    openwebbeans/trunk/webbeans-ee-common/src/main/java/org/apache/webbeans/ee/common/services/
    openwebbeans/trunk/webbeans-ee-common/src/main/java/org/apache/webbeans/ee/common/services/JNDIServiceEnterpriseImpl.java   (with props)
    openwebbeans/trunk/webbeans-ee-common/src/main/resources/
    openwebbeans/trunk/webbeans-ee-common/src/main/resources/META-INF/
    openwebbeans/trunk/webbeans-ee-common/src/main/resources/META-INF/openwebbeans/
    openwebbeans/trunk/webbeans-ee-common/src/main/resources/META-INF/openwebbeans/openwebbeans.properties   (with props)
    openwebbeans/trunk/webbeans-ee-common/src/test/

Propchange: openwebbeans/trunk/webbeans-ee-common/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Mar  7 00:04:39 2010
@@ -0,0 +1,4 @@
+.settings
+target
+.classpath
+.project

Added: openwebbeans/trunk/webbeans-ee-common/pom.xml
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ee-common/pom.xml?rev=919882&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-ee-common/pom.xml (added)
+++ openwebbeans/trunk/webbeans-ee-common/pom.xml Sun Mar  7 00:04:39 2010
@@ -0,0 +1,44 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<!--
+
+    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.
+-->
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.openwebbeans</groupId>
+        <artifactId>openwebbeans</artifactId>
+        <version>1.0.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>openwebbeans-ee-common</artifactId>
+    <name>Apache OpenWebBeans :: Java EE Common</name>
+    <packaging>jar</packaging>
+    <description>OpenWebBeans Java EE Common</description>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+        	<groupId>org.apache.openwebbeans</groupId>
+        	<artifactId>openwebbeans-impl</artifactId>
+        </dependency>
+      
+    </dependencies>
+</project>

Propchange: openwebbeans/trunk/webbeans-ee-common/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/webbeans-ee-common/src/main/java/org/apache/webbeans/ee/common/beans/PrinicipalBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ee-common/src/main/java/org/apache/webbeans/ee/common/beans/PrinicipalBean.java?rev=919882&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-ee-common/src/main/java/org/apache/webbeans/ee/common/beans/PrinicipalBean.java (added)
+++ openwebbeans/trunk/webbeans-ee-common/src/main/java/org/apache/webbeans/ee/common/beans/PrinicipalBean.java Sun Mar  7 00:04:39 2010
@@ -0,0 +1,62 @@
+/*
+ * 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.ee.common.beans;
+
+import java.security.Principal;
+
+import javax.enterprise.context.spi.CreationalContext;
+
+import org.apache.webbeans.annotation.DefaultLiteral;
+import org.apache.webbeans.annotation.DependentScopeLiteral;
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.component.WebBeansType;
+import org.apache.webbeans.spi.SecurityService;
+import org.apache.webbeans.spi.ServiceLoader;
+
+public class PrinicipalBean extends AbstractOwbBean<Principal>
+{
+
+    public PrinicipalBean()
+    {
+        super(WebBeansType.PRINCIPAL, Principal.class);
+        addApiType(Object.class);
+        addApiType(Principal.class);
+        addQualifier(new DefaultLiteral());
+        setImplScopeType(new DependentScopeLiteral());
+    }
+
+    @Override
+    protected Principal createInstance(CreationalContext<Principal> creationalContext)
+    {
+        SecurityService securityService = ServiceLoader.getService(SecurityService.class);
+        if(securityService != null)
+        {
+            return securityService.getCurrentPrincipal();
+        }
+        
+        return null;
+    }
+
+    @Override
+    public boolean isPassivationCapable()
+    {
+        return true;
+    }
+    
+}

Propchange: openwebbeans/trunk/webbeans-ee-common/src/main/java/org/apache/webbeans/ee/common/beans/PrinicipalBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/webbeans-ee-common/src/main/java/org/apache/webbeans/ee/common/services/JNDIServiceEnterpriseImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ee-common/src/main/java/org/apache/webbeans/ee/common/services/JNDIServiceEnterpriseImpl.java?rev=919882&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-ee-common/src/main/java/org/apache/webbeans/ee/common/services/JNDIServiceEnterpriseImpl.java (added)
+++ openwebbeans/trunk/webbeans-ee-common/src/main/java/org/apache/webbeans/ee/common/services/JNDIServiceEnterpriseImpl.java Sun Mar  7 00:04:39 2010
@@ -0,0 +1,62 @@
+/*
+ * 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.ee.common.services;
+
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.spi.JNDIService;
+import org.apache.webbeans.util.JNDIUtil;
+
+/**
+ * SPI Implementation of the JNDIService.
+ * This version performs JNDI handling in J2EE environments where
+ * the java:comp and java:app context can be written
+ *
+ * @see org.apache.webbeans.spi.se.DefaultJndiService
+ */
+public final class JNDIServiceEnterpriseImpl implements JNDIService
+{
+    public JNDIServiceEnterpriseImpl()
+    {
+        
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void bind(String name, Object object) throws WebBeansException
+    {
+        JNDIUtil.bind(name, object);
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void unbind(String name) throws WebBeansException
+    {
+        JNDIUtil.unbind(name);
+    }
+    
+    /** 
+     * {@inheritDoc}
+     */
+    public <T> T getObject(String name, Class<? extends T> expectedClass) throws WebBeansException
+    {
+        return JNDIUtil.lookup(name, expectedClass);
+    }
+
+    public <T> T lookup(String name, Class<? extends T> expectedClass)
+    {
+        return getObject(name, expectedClass);
+    }
+}

Propchange: openwebbeans/trunk/webbeans-ee-common/src/main/java/org/apache/webbeans/ee/common/services/JNDIServiceEnterpriseImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/webbeans-ee-common/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ee-common/src/main/resources/META-INF/openwebbeans/openwebbeans.properties?rev=919882&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-ee-common/src/main/resources/META-INF/openwebbeans/openwebbeans.properties (added)
+++ openwebbeans/trunk/webbeans-ee-common/src/main/resources/META-INF/openwebbeans/openwebbeans.properties Sun Mar  7 00:04:39 2010
@@ -0,0 +1,32 @@
+#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.
+#---------------------------------------------------------------
+# The default configuration for OpenWebBeans
+#
+# The default configuration is intended for a JDK and a simple ServletContainer
+# like jetty, resin or tomcat.
+# 
+#---------------------------------------------------------------
+
+################################################################################################
+################################### DEFAULT SPI CONFIGURATION SECTION ##########################
+################################################################################################ 
+
+################################### Default JNDI Service #######################################
+#Default implementation of org.apache.webbeans.spi.JNDIService.
+org.apache.webbeans.spi.JNDIService=org.apache.webbeans.ee.common.JNDIServiceEnterpriseImpl
+################################################################################################

Propchange: openwebbeans/trunk/webbeans-ee-common/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
------------------------------------------------------------------------------
    svn:eol-style = native