You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gp...@apache.org on 2010/03/03 11:29:38 UTC
svn commit: r918385 - in /myfaces/extensions/cdi/branches/branch_for_jsf_1_2:
core/api/src/main/java/org/ core/api/src/main/java/org/apache/
core/api/src/main/java/org/apache/myfaces/
core/api/src/main/java/org/apache/myfaces/extensions/ core/api/src/m...
Author: gpetracek
Date: Wed Mar 3 10:29:36 2010
New Revision: 918385
URL: http://svn.apache.org/viewvc?rev=918385&view=rev
Log:
EXTCDI-9 (and EXTCDI-6) initial draft
Added:
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/common/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/common/qualifier/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/common/qualifier/Current.java
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/config/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/config/ConfigEntryResolver.java
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/config/ConfigManager.java
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/config/InitParameter.java
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/config/InitParameterNames.java
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/stage/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/stage/ProjectStage.java
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/stage/ProjectStageResolver.java
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/impl/src/main/config/beans.xml
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/impl/src/main/java/org/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/impl/src/main/java/org/apache/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/impl/src/main/java/org/apache/myfaces/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/impl/src/main/java/org/apache/myfaces/extensions/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/project/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/project/config/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/project/config/InitParameterConfigManager.java
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/project/stage/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/project/stage/ApplicationProjectStageResolver.java
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/config/beans.xml
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/WebXmlParameterNames.java
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/project/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/project/stage/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/project/stage/JsfProjectStage.java
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/qualifier/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/qualifier/Jsf.java
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/config/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/config/DefaultConfigEntryResolver.java
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/config/InternalKeyAwareConfigEntryResolver.java
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/config/JsfProjectStageConfigEntryResolver.java
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/config/WebXmlInitParameterConfigManager.java
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/stage/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/stage/JsfAwareProjectStageResolver.java
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/stage/JsfProjectStageBuilder.java
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/stage/JsfProjectStageEnum.java
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/util/
myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/util/JsfUtils.java
Added: myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/common/qualifier/Current.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/common/qualifier/Current.java?rev=918385&view=auto
==============================================================================
--- myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/common/qualifier/Current.java (added)
+++ myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/common/qualifier/Current.java Wed Mar 3 10:29:36 2010
@@ -0,0 +1,35 @@
+/*
+ * 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.myfaces.extensions.cdi.core.api.common.qualifier;
+
+import javax.inject.Qualifier;
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.*;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+@Qualifier
+
+@Target({TYPE, METHOD, FIELD, PARAMETER})
+@Retention(RUNTIME)
+@Documented
+public @interface Current
+{
+}
\ No newline at end of file
Added: myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/config/ConfigEntryResolver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/config/ConfigEntryResolver.java?rev=918385&view=auto
==============================================================================
--- myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/config/ConfigEntryResolver.java (added)
+++ myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/config/ConfigEntryResolver.java Wed Mar 3 10:29:36 2010
@@ -0,0 +1,24 @@
+/*
+ * 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.myfaces.extensions.cdi.core.api.project.config;
+
+public interface ConfigEntryResolver<K, V>
+{
+ V resolveEntry(K key);
+}
\ No newline at end of file
Added: myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/config/ConfigManager.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/config/ConfigManager.java?rev=918385&view=auto
==============================================================================
--- myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/config/ConfigManager.java (added)
+++ myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/config/ConfigManager.java Wed Mar 3 10:29:36 2010
@@ -0,0 +1,24 @@
+/*
+ * 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.myfaces.extensions.cdi.core.api.project.config;
+
+public interface ConfigManager<K, V>
+{
+ V getValue(K key);
+}
Added: myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/config/InitParameter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/config/InitParameter.java?rev=918385&view=auto
==============================================================================
--- myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/config/InitParameter.java (added)
+++ myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/config/InitParameter.java Wed Mar 3 10:29:36 2010
@@ -0,0 +1,38 @@
+/*
+ * 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.myfaces.extensions.cdi.core.api.project.config;
+
+import javax.inject.Qualifier;
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.*;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+@Qualifier
+
+@Target({TYPE, METHOD, FIELD, PARAMETER})
+@Retention(RUNTIME)
+@Documented
+public @interface InitParameter
+{
+ //TODO
+
+ Class value() default InitParameter.class;
+}
Added: myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/config/InitParameterNames.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/config/InitParameterNames.java?rev=918385&view=auto
==============================================================================
--- myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/config/InitParameterNames.java (added)
+++ myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/config/InitParameterNames.java Wed Mar 3 10:29:36 2010
@@ -0,0 +1,24 @@
+/*
+ * 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.myfaces.extensions.cdi.core.api.project.config;
+
+public interface InitParameterNames
+{
+ static final String APPLICATION_PROJECT_STAGE = "application.PROJECT_STAGE";
+}
\ No newline at end of file
Added: myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/stage/ProjectStage.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/stage/ProjectStage.java?rev=918385&view=auto
==============================================================================
--- myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/stage/ProjectStage.java (added)
+++ myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/stage/ProjectStage.java Wed Mar 3 10:29:36 2010
@@ -0,0 +1,55 @@
+/*
+ * 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.myfaces.extensions.cdi.core.api.project.stage;
+
+import org.apache.myfaces.extensions.cdi.core.api.common.qualifier.Current;
+
+import javax.enterprise.inject.Produces;
+import java.io.Serializable;
+
+public class ProjectStage implements Serializable
+{
+ private static final long serialVersionUID = 8372440985154139133L;
+
+ public static final String DEFAULT_STAGE = "Production";
+
+ private String value;
+
+ protected ProjectStage()
+ {
+ //required for proxy libs
+ }
+
+ private ProjectStage(String value)
+ {
+ this.value = value;
+ }
+
+ @Produces
+ @Current
+ public ProjectStage createProjectStage(ProjectStageResolver projectStageResolver)
+ {
+ return new ProjectStage(projectStageResolver.getCurrentProjectStageName());
+ }
+
+ public boolean is(String projectStage)
+ {
+ return this.value.equals(projectStage);
+ }
+}
Added: myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/stage/ProjectStageResolver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/stage/ProjectStageResolver.java?rev=918385&view=auto
==============================================================================
--- myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/stage/ProjectStageResolver.java (added)
+++ myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/project/stage/ProjectStageResolver.java Wed Mar 3 10:29:36 2010
@@ -0,0 +1,24 @@
+/*
+ * 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.myfaces.extensions.cdi.core.api.project.stage;
+
+public interface ProjectStageResolver
+{
+ String getCurrentProjectStageName();
+}
Added: myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/impl/src/main/config/beans.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/impl/src/main/config/beans.xml?rev=918385&view=auto
==============================================================================
(empty)
Added: myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/project/config/InitParameterConfigManager.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/project/config/InitParameterConfigManager.java?rev=918385&view=auto
==============================================================================
--- myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/project/config/InitParameterConfigManager.java (added)
+++ myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/project/config/InitParameterConfigManager.java Wed Mar 3 10:29:36 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.
+ */
+package org.apache.myfaces.extensions.cdi.core.impl.project.config;
+
+import org.apache.myfaces.extensions.cdi.core.api.project.config.ConfigManager;
+import org.apache.myfaces.extensions.cdi.core.api.project.config.InitParameter;
+import org.apache.myfaces.extensions.cdi.core.api.project.config.InitParameterNames;
+
+@InitParameter
+public class InitParameterConfigManager implements ConfigManager<String, String>
+{
+ public String getValue(String key)
+ {
+ return System.getProperty(InitParameterNames.APPLICATION_PROJECT_STAGE);
+ }
+}
Added: myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/project/stage/ApplicationProjectStageResolver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/project/stage/ApplicationProjectStageResolver.java?rev=918385&view=auto
==============================================================================
--- myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/project/stage/ApplicationProjectStageResolver.java (added)
+++ myfaces/extensions/cdi/branches/branch_for_jsf_1_2/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/project/stage/ApplicationProjectStageResolver.java Wed Mar 3 10:29:36 2010
@@ -0,0 +1,55 @@
+/*
+ * 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.myfaces.extensions.cdi.core.impl.project.stage;
+
+import org.apache.myfaces.extensions.cdi.core.api.project.config.ConfigManager;
+import org.apache.myfaces.extensions.cdi.core.api.project.config.InitParameter;
+import org.apache.myfaces.extensions.cdi.core.api.project.config.InitParameterNames;
+import org.apache.myfaces.extensions.cdi.core.api.project.stage.ProjectStageResolver;
+import org.apache.myfaces.extensions.cdi.core.api.project.stage.ProjectStage;
+
+import javax.inject.Inject;
+
+public class ApplicationProjectStageResolver implements ProjectStageResolver
+{
+ private ConfigManager<String, String> configManager;
+
+ protected ApplicationProjectStageResolver()
+ {
+ //required for proxy libs
+ }
+
+ @Inject
+ public ApplicationProjectStageResolver(@InitParameter ConfigManager<String, String> configManager)
+ {
+ this.configManager = configManager;
+ }
+
+ public String getCurrentProjectStageName()
+ {
+ String result = this.configManager.getValue(InitParameterNames.APPLICATION_PROJECT_STAGE);
+
+ if (result == null || "".equals(result))
+ {
+ return ProjectStage.DEFAULT_STAGE;
+ }
+
+ return result;
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/config/beans.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/config/beans.xml?rev=918385&view=auto
==============================================================================
--- myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/config/beans.xml (added)
+++ myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/config/beans.xml Wed Mar 3 10:29:36 2010
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+ <alternatives>
+ <class>org.apache.myfaces.extensions.cdi.javaee.jsf.impl.project.stage.JsfAwareProjectStageResolver</class>
+ </alternatives>
+</beans>
Added: myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/WebXmlParameterNames.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/WebXmlParameterNames.java?rev=918385&view=auto
==============================================================================
--- myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/WebXmlParameterNames.java (added)
+++ myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/WebXmlParameterNames.java Wed Mar 3 10:29:36 2010
@@ -0,0 +1,24 @@
+/*
+ * 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.myfaces.extensions.cdi.javaee.jsf.api;
+
+public interface WebXmlParameterNames
+{
+ public static final String PROJECT_STAGE_PARAMETER_NAME = "javax.faces.PROJECT_STAGE";
+}
Added: myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/project/stage/JsfProjectStage.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/project/stage/JsfProjectStage.java?rev=918385&view=auto
==============================================================================
--- myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/project/stage/JsfProjectStage.java (added)
+++ myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/project/stage/JsfProjectStage.java Wed Mar 3 10:29:36 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.
+ */
+package org.apache.myfaces.extensions.cdi.javaee.jsf.api.project.stage;
+
+import java.io.Serializable;
+
+public interface JsfProjectStage extends Serializable
+{
+ public boolean isDevelopment();
+
+ public boolean isUnitTest();
+
+ public boolean isSystemTest();
+
+ public boolean isProduction();
+}
Added: myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/qualifier/Jsf.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/qualifier/Jsf.java?rev=918385&view=auto
==============================================================================
--- myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/qualifier/Jsf.java (added)
+++ myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/qualifier/Jsf.java Wed Mar 3 10:29:36 2010
@@ -0,0 +1,36 @@
+/*
+ * 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.myfaces.extensions.cdi.javaee.jsf.api.qualifier;
+
+import javax.inject.Qualifier;
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.*;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+@Qualifier
+
+@Target({TYPE, METHOD, FIELD, PARAMETER, CONSTRUCTOR})
+@Retention(RUNTIME)
+@Documented
+//TODO
+public @interface Jsf
+{
+}
\ No newline at end of file
Added: myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/config/DefaultConfigEntryResolver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/config/DefaultConfigEntryResolver.java?rev=918385&view=auto
==============================================================================
--- myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/config/DefaultConfigEntryResolver.java (added)
+++ myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/config/DefaultConfigEntryResolver.java Wed Mar 3 10:29:36 2010
@@ -0,0 +1,69 @@
+/*
+ * 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.myfaces.extensions.cdi.javaee.jsf.impl.project.config;
+
+import org.apache.myfaces.extensions.cdi.core.api.project.config.ConfigEntryResolver;
+import org.apache.myfaces.extensions.cdi.javaee.jsf.api.qualifier.Jsf;
+
+import javax.enterprise.inject.Typed;
+import javax.enterprise.inject.Produces;
+import java.util.List;
+import java.util.ArrayList;
+
+@Typed()
+public class DefaultConfigEntryResolver implements ConfigEntryResolver<String, String>
+{
+ private List<InternalKeyAwareConfigEntryResolver<String, String>> configEntryResolvers;
+
+ protected DefaultConfigEntryResolver()
+ {
+ //required for proxy libs
+ }
+
+ private ConfigEntryResolver<String, String> init()
+ {
+ if(this.configEntryResolvers == null)
+ {
+ this.configEntryResolvers = new ArrayList<InternalKeyAwareConfigEntryResolver<String, String>>();
+
+ this.configEntryResolvers.add(new JsfProjectStageConfigEntryResolver());
+ }
+ return this;
+ }
+
+ @Produces
+ @Jsf
+ public ConfigEntryResolver<String, String> createDefaultConfigResolverManager()
+ {
+ return new DefaultConfigEntryResolver().init();
+ }
+
+ public String resolveEntry(String key)
+ {
+ for(InternalKeyAwareConfigEntryResolver<String, String> keyAwareConfigEntryResolver : this.configEntryResolvers)
+ {
+ if(keyAwareConfigEntryResolver.isResponsibleFor(key))
+ {
+ return keyAwareConfigEntryResolver.resolveValue();
+ }
+ }
+
+ return null;
+ }
+}
Added: myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/config/InternalKeyAwareConfigEntryResolver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/config/InternalKeyAwareConfigEntryResolver.java?rev=918385&view=auto
==============================================================================
--- myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/config/InternalKeyAwareConfigEntryResolver.java (added)
+++ myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/config/InternalKeyAwareConfigEntryResolver.java Wed Mar 3 10:29:36 2010
@@ -0,0 +1,26 @@
+/*
+ * 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.myfaces.extensions.cdi.javaee.jsf.impl.project.config;
+
+interface InternalKeyAwareConfigEntryResolver<K, V>
+{
+ V resolveValue();
+
+ boolean isResponsibleFor(K key);
+}
Added: myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/config/JsfProjectStageConfigEntryResolver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/config/JsfProjectStageConfigEntryResolver.java?rev=918385&view=auto
==============================================================================
--- myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/config/JsfProjectStageConfigEntryResolver.java (added)
+++ myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/config/JsfProjectStageConfigEntryResolver.java Wed Mar 3 10:29:36 2010
@@ -0,0 +1,35 @@
+/*
+ * 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.myfaces.extensions.cdi.javaee.jsf.impl.project.config;
+
+import org.apache.myfaces.extensions.cdi.core.api.project.config.InitParameterNames;
+import org.apache.myfaces.extensions.cdi.javaee.jsf.impl.util.JsfUtils;
+
+class JsfProjectStageConfigEntryResolver implements InternalKeyAwareConfigEntryResolver<String, String>
+{
+ public boolean isResponsibleFor(String key)
+ {
+ return InitParameterNames.APPLICATION_PROJECT_STAGE.equals(key);
+ }
+
+ public String resolveValue()
+ {
+ return JsfUtils.getProjectStageName();
+ }
+}
Added: myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/config/WebXmlInitParameterConfigManager.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/config/WebXmlInitParameterConfigManager.java?rev=918385&view=auto
==============================================================================
--- myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/config/WebXmlInitParameterConfigManager.java (added)
+++ myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/config/WebXmlInitParameterConfigManager.java Wed Mar 3 10:29:36 2010
@@ -0,0 +1,53 @@
+/*
+ * 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.myfaces.extensions.cdi.javaee.jsf.impl.project.config;
+
+import org.apache.myfaces.extensions.cdi.core.api.project.config.ConfigEntryResolver;
+import org.apache.myfaces.extensions.cdi.core.api.project.config.ConfigManager;
+import org.apache.myfaces.extensions.cdi.core.api.project.config.InitParameter;
+import org.apache.myfaces.extensions.cdi.javaee.jsf.api.qualifier.Jsf;
+
+import javax.inject.Inject;
+
+//TODO instead of if statements: inject 1-n lookup strategies - ~every strategy is responsible for a different key
+//TODO @Jsf @InitParameter doesn't work
+
+@InitParameter(Jsf.class)
+public class WebXmlInitParameterConfigManager implements ConfigManager<String, String>
+{
+ @Inject
+ @InitParameter
+ private ConfigManager<String, String> wrapped;
+
+ @Inject
+ @Jsf
+ private ConfigEntryResolver<String, String> configEntryResolver;
+
+ public String getValue(String key)
+ {
+ String result = this.wrapped.getValue(key);
+
+ if (result != null)
+ {
+ return result;
+ }
+
+ return configEntryResolver.resolveEntry(key);
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/stage/JsfAwareProjectStageResolver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/stage/JsfAwareProjectStageResolver.java?rev=918385&view=auto
==============================================================================
--- myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/stage/JsfAwareProjectStageResolver.java (added)
+++ myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/stage/JsfAwareProjectStageResolver.java Wed Mar 3 10:29:36 2010
@@ -0,0 +1,65 @@
+/*
+ * 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.myfaces.extensions.cdi.javaee.jsf.impl.project.stage;
+
+import org.apache.myfaces.extensions.cdi.core.api.project.config.ConfigManager;
+import org.apache.myfaces.extensions.cdi.core.api.project.config.InitParameter;
+import org.apache.myfaces.extensions.cdi.core.api.project.config.InitParameterNames;
+import org.apache.myfaces.extensions.cdi.core.api.project.stage.ProjectStage;
+import org.apache.myfaces.extensions.cdi.core.api.project.stage.ProjectStageResolver;
+import org.apache.myfaces.extensions.cdi.javaee.jsf.api.qualifier.Jsf;
+
+import javax.enterprise.inject.Alternative;
+import javax.inject.Inject;
+
+@Alternative
+public class JsfAwareProjectStageResolver implements ProjectStageResolver
+{
+ //TODO @Inject @Jsf @InitParameter doesn't work!?
+ private ConfigManager<String, String> configManager;
+
+ protected JsfAwareProjectStageResolver()
+ {
+ //required for proxy libs
+ }
+
+ @Inject
+ public JsfAwareProjectStageResolver(
+ @InitParameter(Jsf.class) /*TODO @Jsf*/ ConfigManager<String, String> configManager)
+ {
+ this.configManager = configManager;
+ }
+
+ public String getCurrentProjectStageName()
+ {
+ String projectStageName = this.configManager.getValue(InitParameterNames.APPLICATION_PROJECT_STAGE);
+
+ if (isProjectStageAvailable(projectStageName))
+ {
+ return projectStageName;
+ }
+
+ return ProjectStage.DEFAULT_STAGE;
+ }
+
+ private boolean isProjectStageAvailable(String independentProjectStageName)
+ {
+ return !(independentProjectStageName == null || "".equals(independentProjectStageName));
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/stage/JsfProjectStageBuilder.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/stage/JsfProjectStageBuilder.java?rev=918385&view=auto
==============================================================================
--- myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/stage/JsfProjectStageBuilder.java (added)
+++ myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/stage/JsfProjectStageBuilder.java Wed Mar 3 10:29:36 2010
@@ -0,0 +1,70 @@
+/*
+ * 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.myfaces.extensions.cdi.javaee.jsf.impl.project.stage;
+
+import org.apache.myfaces.extensions.cdi.core.api.common.qualifier.Current;
+import org.apache.myfaces.extensions.cdi.core.api.project.stage.ProjectStage;
+import org.apache.myfaces.extensions.cdi.javaee.jsf.api.project.stage.JsfProjectStage;
+
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.Typed;
+
+@Typed() // required workaround
+public class JsfProjectStageBuilder implements JsfProjectStage
+{
+ private static final long serialVersionUID = 2561553908344678363L;
+
+ private ProjectStage projectStage;
+
+ protected JsfProjectStageBuilder()
+ {
+ //required for proxy libs
+ }
+
+ private JsfProjectStageBuilder(ProjectStage projectStage)
+ {
+ this.projectStage = projectStage;
+ }
+
+ @Produces
+ public JsfProjectStage createJsfProjectStage(@Current ProjectStage projectStage)
+ {
+ return new JsfProjectStageBuilder(projectStage);
+ }
+
+ public boolean isDevelopment()
+ {
+ return this.projectStage.is(JsfProjectStageEnum.Development.getProjectStageName());
+ }
+
+ public boolean isUnitTest()
+ {
+ return this.projectStage.is(JsfProjectStageEnum.UnitTest.getProjectStageName());
+ }
+
+ public boolean isSystemTest()
+ {
+ return this.projectStage.is(JsfProjectStageEnum.SystemTest.getProjectStageName());
+ }
+
+ public boolean isProduction()
+ {
+ return this.projectStage.is(JsfProjectStageEnum.Production.getProjectStageName());
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/stage/JsfProjectStageEnum.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/stage/JsfProjectStageEnum.java?rev=918385&view=auto
==============================================================================
--- myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/stage/JsfProjectStageEnum.java (added)
+++ myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/project/stage/JsfProjectStageEnum.java Wed Mar 3 10:29:36 2010
@@ -0,0 +1,39 @@
+/*
+ * 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.myfaces.extensions.cdi.javaee.jsf.impl.project.stage;
+
+public enum JsfProjectStageEnum
+{
+ Development("Development"),
+ UnitTest("UnitTest"),
+ SystemTest("SystemTest"),
+ Production("Production");
+
+ private final String value;
+
+ JsfProjectStageEnum(String value)
+ {
+ this.value = value;
+ }
+
+ String getProjectStageName()
+ {
+ return this.value;
+ }
+}
Added: myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/util/JsfUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/util/JsfUtils.java?rev=918385&view=auto
==============================================================================
--- myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/util/JsfUtils.java (added)
+++ myfaces/extensions/cdi/branches/branch_for_jsf_1_2/jee-modules/jsf-module/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/util/JsfUtils.java Wed Mar 3 10:29:36 2010
@@ -0,0 +1,40 @@
+/*
+ * 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.myfaces.extensions.cdi.javaee.jsf.impl.util;
+
+import org.apache.myfaces.extensions.cdi.javaee.jsf.api.WebXmlParameterNames;
+
+import javax.faces.context.FacesContext;
+
+public class JsfUtils
+{
+ public static String getProjectStageName()
+ {
+ try
+ {
+ //TODO
+ return FacesContext.getCurrentInstance().getExternalContext()
+ .getInitParameter(WebXmlParameterNames.PROJECT_STAGE_PARAMETER_NAME);
+ }
+ catch (Throwable t)
+ {
+ return null;
+ }
+ }
+}