openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r919880 - in /openwebbeans/trunk/webbeans-ee: ./ 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/beans/...
Date Sun, 07 Mar 2010 00:03:02 GMT
Author: gerdogdu
Date: Sun Mar  7 00:03:02 2010
New Revision: 919880

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

Added:
    openwebbeans/trunk/webbeans-ee/   (with props)
    openwebbeans/trunk/webbeans-ee/src/
    openwebbeans/trunk/webbeans-ee/src/main/
    openwebbeans/trunk/webbeans-ee/src/main/java/
    openwebbeans/trunk/webbeans-ee/src/main/java/org/
    openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/
    openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/
    openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/
    openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/
    openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/UserTransactionBean.java
  (with props)
    openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/ValidatorBean.java
  (with props)
    openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/ValidatorFactoryBean.java
  (with props)
    openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/event/
    openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/event/TransactionalEventNotifier.java
  (with props)
    openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/services/
    openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/services/EnterpriseSecurityService.java
  (with props)
    openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/services/EnterpriseTransactionService.java
  (with props)
    openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/services/EnterpriseValidatorService.java
  (with props)
    openwebbeans/trunk/webbeans-ee/src/main/resources/
    openwebbeans/trunk/webbeans-ee/src/main/resources/META-INF/
    openwebbeans/trunk/webbeans-ee/src/main/resources/META-INF/openwebbeans/
    openwebbeans/trunk/webbeans-ee/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
  (with props)
    openwebbeans/trunk/webbeans-ee/src/test/

Propchange: openwebbeans/trunk/webbeans-ee/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Mar  7 00:03:02 2010
@@ -0,0 +1,5 @@
+.settings
+target
+.classpath
+.project
+pom.xml

Added: openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/UserTransactionBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/UserTransactionBean.java?rev=919880&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/UserTransactionBean.java
(added)
+++ openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/UserTransactionBean.java
Sun Mar  7 00:03:02 2010
@@ -0,0 +1,61 @@
+/*
+ * 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.beans;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.transaction.UserTransaction;
+
+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.ServiceLoader;
+import org.apache.webbeans.spi.TransactionService;
+
+public class UserTransactionBean extends AbstractOwbBean<UserTransaction>
+{
+
+    protected UserTransactionBean()
+    {
+        super(WebBeansType.USERTRANSACTION, UserTransaction.class);
+        addApiType(Object.class);
+        addApiType(UserTransaction.class);
+        addQualifier(new DefaultLiteral());
+        setImplScopeType(new DependentScopeLiteral());
+    }
+
+    @Override
+    protected UserTransaction createInstance(CreationalContext<UserTransaction> creationalContext)
+    {
+        TransactionService transactionService = ServiceLoader.getService(TransactionService.class);
+        if(transactionService != null)
+        {
+            return transactionService.getUserTransaction();
+        }
+        
+        return null;
+    }
+
+    @Override
+    public boolean isPassivationCapable()
+    {
+        return true;
+    }
+    
+}

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

Added: openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/ValidatorBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/ValidatorBean.java?rev=919880&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/ValidatorBean.java
(added)
+++ openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/ValidatorBean.java
Sun Mar  7 00:03:02 2010
@@ -0,0 +1,61 @@
+/*
+ * 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.beans;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.validation.Validator;
+
+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.ServiceLoader;
+import org.apache.webbeans.spi.ValidatorService;
+
+public class ValidatorBean extends AbstractOwbBean<Validator>
+{
+
+    public ValidatorBean()
+    {
+        super(WebBeansType.VALIDATION, Validator.class);
+        addApiType(Object.class);
+        addApiType(Validator.class);
+        addQualifier(new DefaultLiteral());
+        setImplScopeType(new DependentScopeLiteral());
+    }
+
+    @Override
+    protected Validator createInstance(CreationalContext<Validator> creationalContext)
+    {
+        ValidatorService validatorService = ServiceLoader.getService(ValidatorService.class);
+        if(validatorService != null)
+        {
+            return validatorService.getDefaultValidator();
+        }
+        
+        return null;
+    }
+
+    @Override
+    public boolean isPassivationCapable()
+    {
+        return true;
+    }
+    
+}

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

Added: openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/ValidatorFactoryBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/ValidatorFactoryBean.java?rev=919880&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/ValidatorFactoryBean.java
(added)
+++ openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/ValidatorFactoryBean.java
Sun Mar  7 00:03:02 2010
@@ -0,0 +1,61 @@
+/*
+ * 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.beans;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.validation.ValidatorFactory;
+
+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.ServiceLoader;
+import org.apache.webbeans.spi.ValidatorService;
+
+public class ValidatorFactoryBean extends AbstractOwbBean<ValidatorFactory>
+{
+
+    public ValidatorFactoryBean()
+    {
+        super(WebBeansType.VALIDATIONFACT, ValidatorFactory.class);
+        addApiType(Object.class);
+        addApiType(ValidatorFactory.class);
+        addQualifier(new DefaultLiteral());
+        setImplScopeType(new DependentScopeLiteral());
+    }
+
+    @Override
+    protected ValidatorFactory createInstance(CreationalContext<ValidatorFactory> creationalContext)
+    {
+        ValidatorService validatorService = ServiceLoader.getService(ValidatorService.class);
+        if(validatorService != null)
+        {
+            return validatorService.getDefaultValidatorFactory();
+        }
+        
+        return null;
+    }
+
+    @Override
+    public boolean isPassivationCapable()
+    {
+        return true;
+    }
+    
+}

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

Added: openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/event/TransactionalEventNotifier.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/event/TransactionalEventNotifier.java?rev=919880&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/event/TransactionalEventNotifier.java
(added)
+++ openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/event/TransactionalEventNotifier.java
Sun Mar  7 00:03:02 2010
@@ -0,0 +1,174 @@
+/*
+ * 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.event;
+
+import javax.enterprise.event.TransactionPhase;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.transaction.Status;
+import javax.transaction.Synchronization;
+import javax.transaction.Transaction;
+
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.logger.WebBeansLogger;
+import org.apache.webbeans.spi.ServiceLoader;
+import org.apache.webbeans.spi.TransactionService;
+
+@SuppressWarnings("unchecked")
+public class TransactionalEventNotifier
+{
+    private static final WebBeansLogger logger = WebBeansLogger.getLogger(TransactionalEventNotifier.class);
+
+    public TransactionalEventNotifier()
+    {
+        
+    }
+    
+    public static void registerTransactionSynchronization(TransactionPhase phase, ObserverMethod<?
super Object> observer, Object event) throws Exception
+    {
+        TransactionService transactionService = ServiceLoader.getService(TransactionService.class);
+        
+        Transaction transaction = null;
+        if(transactionService != null)
+        {
+            transaction = transactionService.getTransaction();
+        }
+        
+        if(transaction != null)
+        {
+            if (phase.equals(TransactionPhase.AFTER_COMPLETION))
+            {
+                transaction.registerSynchronization(new AfterCompletion(observer, event));
+            }
+            else if (phase.equals(TransactionPhase.AFTER_SUCCESS))
+            {
+                transaction.registerSynchronization(new AfterCompletionSuccess(observer,
event));
+            }
+            else if (phase.equals(TransactionPhase.AFTER_FAILURE))
+            {
+                transaction.registerSynchronization(new AfterCompletionFailure(observer,
event));
+            }
+            else if (phase.equals(TransactionPhase.BEFORE_COMPLETION))
+            {
+                transaction.registerSynchronization(new BeforeCompletion(observer, event));
+            }
+            else
+            {
+                throw new IllegalStateException(logger.getTokenString(OWBLogConst.EXCEPT_0007)
+ phase);
+            }            
+        }        
+    }
+    
+    private static class AbstractSynchronization<T> implements Synchronization
+    {
+
+        private final ObserverMethod<T> observer;
+        private final T event;
+
+        public AbstractSynchronization(ObserverMethod<T> observer, T event)
+        {
+            this.observer = observer;
+            this.event = event;
+        }
+
+        public void beforeCompletion()
+        {
+            // Do nothing
+        }
+
+        public void afterCompletion(int i)
+        {
+            //Do nothing
+        }
+
+        public void notifyObserver()
+        {
+            try
+            {
+                observer.notify(event);
+            }
+            catch (Exception e)
+            {
+                logger.error(OWBLogConst.ERROR_0003, e);
+            }
+        }
+    }
+
+    private static class BeforeCompletion extends AbstractSynchronization
+    {
+        private BeforeCompletion(ObserverMethod observer, Object event)
+        {
+            super(observer, event);
+        }
+
+        @Override
+        public void beforeCompletion()
+        {
+            notifyObserver();
+        }
+    }
+
+    private static class AfterCompletion extends AbstractSynchronization
+    {
+        private AfterCompletion(ObserverMethod observer, Object event)
+        {
+            super(observer, event);
+        }
+
+        @Override
+        public void afterCompletion(int i)
+        {
+            notifyObserver();
+        }
+    }
+
+    private static class AfterCompletionSuccess extends AbstractSynchronization
+    {
+        private AfterCompletionSuccess(ObserverMethod observer, Object event)
+        {
+            super(observer, event);
+        }
+
+        @Override
+        public void afterCompletion(int i)
+        {
+            if (i == Status.STATUS_COMMITTED)
+            {
+                notifyObserver();
+            }
+        }
+    }
+
+    private static class AfterCompletionFailure extends AbstractSynchronization
+    {
+        private AfterCompletionFailure(ObserverMethod observer, Object event)
+        {
+            super(observer, event);
+        }
+
+        @Override
+        public void afterCompletion(int i)
+        {
+            if (i != Status.STATUS_COMMITTED)
+            {
+                notifyObserver();
+            }
+        }
+    }
+    
+}

Propchange: openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/event/TransactionalEventNotifier.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/services/EnterpriseSecurityService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/services/EnterpriseSecurityService.java?rev=919880&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/services/EnterpriseSecurityService.java
(added)
+++ openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/services/EnterpriseSecurityService.java
Sun Mar  7 00:03:02 2010
@@ -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.webbeans.ee.services;
+
+import java.security.Principal;
+
+import org.apache.webbeans.plugins.OpenWebBeansJavaEEPlugin;
+import org.apache.webbeans.plugins.PluginLoader;
+import org.apache.webbeans.spi.SecurityService;
+
+public class EnterpriseSecurityService implements SecurityService
+{
+
+    @Override
+    public Principal getCurrentPrincipal()
+    {
+        OpenWebBeansJavaEEPlugin provider = PluginLoader.getInstance().getJavaEEPlugin();
+        
+        if(provider != null)
+        {
+            SecurityService securityService = provider.getSecurityService();
+            if(securityService != null)
+            {
+                return securityService.getCurrentPrincipal();
+            }
+        }
+        
+        return null;
+    }
+
+}

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

Added: openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/services/EnterpriseTransactionService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/services/EnterpriseTransactionService.java?rev=919880&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/services/EnterpriseTransactionService.java
(added)
+++ openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/services/EnterpriseTransactionService.java
Sun Mar  7 00:03:02 2010
@@ -0,0 +1,86 @@
+/*
+ * 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.services;
+
+import javax.enterprise.event.TransactionPhase;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import javax.transaction.UserTransaction;
+
+import org.apache.webbeans.ee.event.TransactionalEventNotifier;
+import org.apache.webbeans.plugins.OpenWebBeansJavaEEPlugin;
+import org.apache.webbeans.plugins.PluginLoader;
+import org.apache.webbeans.spi.TransactionService;
+
+public final class EnterpriseTransactionService implements TransactionService
+{
+    private TransactionService service = null;
+    
+    public EnterpriseTransactionService()
+    {
+        OpenWebBeansJavaEEPlugin provider = PluginLoader.getInstance().getJavaEEPlugin();
+        if(provider != null)
+        {
+            service = provider.getTransactionService();
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public TransactionManager getTransactionManager()
+    {
+        if(service != null)
+        {
+            return service.getTransactionManager();
+        }
+        
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Transaction getTransaction()
+    {
+        if(service != null)
+        {
+            return service.getTransaction();
+        }
+        
+        return null;
+        
+    }
+
+
+    public UserTransaction getUserTransaction()
+    {
+        if(service != null)
+        {
+            return service.getUserTransaction();
+        }
+        
+        return null;
+        
+    }
+
+
+    @Override
+    public void registerTransactionSynchronization(TransactionPhase phase, ObserverMethod<?
super Object> observer, Object event) throws Exception
+    {
+        TransactionalEventNotifier.registerTransactionSynchronization(phase, observer, event);
+    }
+}

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

Added: openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/services/EnterpriseValidatorService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/services/EnterpriseValidatorService.java?rev=919880&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/services/EnterpriseValidatorService.java
(added)
+++ openwebbeans/trunk/webbeans-ee/src/main/java/org/apache/webbeans/ee/services/EnterpriseValidatorService.java
Sun Mar  7 00:03:02 2010
@@ -0,0 +1,64 @@
+/*
+ * 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.services;
+
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+
+import org.apache.webbeans.plugins.OpenWebBeansJavaEEPlugin;
+import org.apache.webbeans.plugins.PluginLoader;
+import org.apache.webbeans.spi.ValidatorService;
+
+public class EnterpriseValidatorService implements ValidatorService
+{
+    private ValidatorService service = null;
+    
+    public EnterpriseValidatorService()
+    {
+        OpenWebBeansJavaEEPlugin provider = PluginLoader.getInstance().getJavaEEPlugin();
+        if(provider != null)
+        {
+            service = provider.getValidatorService();
+        }
+        
+    }
+
+    @Override
+    public Validator getDefaultValidator()
+    {
+        if(service != null)
+        {
+            return service.getDefaultValidator();
+        }
+        
+        return null;
+    }
+
+    @Override
+    public ValidatorFactory getDefaultValidatorFactory()
+    {
+        if(service != null)
+        {
+            return service.getDefaultValidatorFactory();
+        }
+        
+        return null;        
+    }
+
+}

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

Added: openwebbeans/trunk/webbeans-ee/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ee/src/main/resources/META-INF/openwebbeans/openwebbeans.properties?rev=919880&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-ee/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
(added)
+++ openwebbeans/trunk/webbeans-ee/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
Sun Mar  7 00:03:02 2010
@@ -0,0 +1,42 @@
+#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 Security Service ###################################
+#Default implementation of org.apache.webbeans.spi.SecurityService.
+org.apache.webbeans.spi.SecurityService=org.apache.webbeans.ee.services.EnterpriseSecurityService
+################################################################################################
+
+################################### Default Validator Service ##################################
+#Default implementation of org.apache.webbeans.spi.ValidatorService.
+org.apache.webbeans.spi.ValidatorService=org.apache.webbeans.ee.services.EnterpriseValidatorService
+################################################################################################
+
+################################### Default Transaction Service ################################
+#Default implementation of org.apache.webbeans.spi.TransactionService.
+org.apache.webbeans.spi.TransactionService=org.apache.webbeans.ee.services.EnterpriseTransactionService
+################################################################################################
\ No newline at end of file

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



Mime
View raw message