You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2009/06/12 18:05:24 UTC
svn commit: r784173 - in
/felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations:
Activate.java Component.java ConfigurationPolicy.java Deactivate.java
Reference.java ReferenceStrategy.java
Author: cziegeler
Date: Fri Jun 12 16:05:22 2009
New Revision: 784173
URL: http://svn.apache.org/viewvc?rev=784173&view=rev
Log:
FELIX-1229 : Add new annotations for activate and deactivate; add enumerations for policy and strategy
Added:
felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Activate.java (with props)
felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/ConfigurationPolicy.java (with props)
felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Deactivate.java (with props)
felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/ReferenceStrategy.java (with props)
Modified:
felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Component.java
felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Reference.java
Added: felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Activate.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Activate.java?rev=784173&view=auto
==============================================================================
--- felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Activate.java (added)
+++ felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Activate.java Fri Jun 12 16:05:22 2009
@@ -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.felix.scr.annotations;
+
+import java.lang.annotation.*;
+
+/**
+ * The <code>Activate</code> annotation defines the method which is used
+ * to activate the component.
+ * Please note that this annotation only marks the method name which is
+ * put into the configuration. The DS implementation will still use its
+ * search strategy to find the method.
+ */
+@Target( { ElementType.METHOD })
+@Retention(RetentionPolicy.SOURCE)
+@Documented
+public @interface Activate {
+
+}
Propchange: felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Activate.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Activate.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Activate.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Component.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Component.java?rev=784173&r1=784172&r2=784173&view=diff
==============================================================================
--- felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Component.java (original)
+++ felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Component.java Fri Jun 12 16:05:22 2009
@@ -107,4 +107,9 @@
*/
boolean createPid() default true;
+ /**
+ * The configuration policy
+ * @since 1.0
+ */
+ ConfigurationPolicy policy() default ConfigurationPolicy.OPTIONAL;
}
Added: felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/ConfigurationPolicy.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/ConfigurationPolicy.java?rev=784173&view=auto
==============================================================================
--- felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/ConfigurationPolicy.java (added)
+++ felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/ConfigurationPolicy.java Fri Jun 12 16:05:22 2009
@@ -0,0 +1,49 @@
+/*
+ * 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.felix.scr.annotations;
+
+/**
+ * Options for {@link Component#policy()} property.
+ */
+public enum ConfigurationPolicy {
+
+ /**
+ * If a configuration is available it will be used, if not the component
+ * will be activated anyway (this is the default).
+ */
+ OPTIONAL,
+
+ /**
+ * The configuration admin is not consulted for a configuration for this component.
+ */
+ IGNORE,
+
+ /**
+ * In order to activate this component a configuration is required.
+ */
+ REQUIRE;
+
+ /**
+ * @return String representation of policy
+ */
+ public String getPolicyString() {
+ return this.name().toLowerCase();
+ }
+
+}
Propchange: felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/ConfigurationPolicy.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/ConfigurationPolicy.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/ConfigurationPolicy.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Deactivate.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Deactivate.java?rev=784173&view=auto
==============================================================================
--- felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Deactivate.java (added)
+++ felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Deactivate.java Fri Jun 12 16:05:22 2009
@@ -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.felix.scr.annotations;
+
+import java.lang.annotation.*;
+
+/**
+ * The <code>Dectivate</code> annotation defines the method which is used
+ * to deactivate the component.
+ * Please note that this annotation only marks the method name which is
+ * put into the configuration. The DS implementation will still use its
+ * search strategy to find the method.
+ */
+@Target( { ElementType.METHOD })
+@Retention(RetentionPolicy.SOURCE)
+@Documented
+public @interface Deactivate {
+
+}
Propchange: felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Deactivate.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Deactivate.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Deactivate.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Reference.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Reference.java?rev=784173&r1=784172&r2=784173&view=diff
==============================================================================
--- felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Reference.java (original)
+++ felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Reference.java Fri Jun 12 16:05:22 2009
@@ -103,6 +103,6 @@
* TODO: parameter documentation missing
* @since 1.0.9
*/
- String strategy() default "";
+ ReferenceStrategy strategy() default ReferenceStrategy.EVENT;
}
Added: felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/ReferenceStrategy.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/ReferenceStrategy.java?rev=784173&view=auto
==============================================================================
--- felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/ReferenceStrategy.java (added)
+++ felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/ReferenceStrategy.java Fri Jun 12 16:05:22 2009
@@ -0,0 +1,37 @@
+/*
+ * 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.felix.scr.annotations;
+
+/**
+ * Options for {@link Reference#strategy()} property.
+ */
+public enum ReferenceStrategy {
+
+ EVENT,
+
+ LOOKUP;
+
+ /**
+ * @return String representation of the stragey
+ */
+ public String getStrategyString() {
+ return this.name().toLowerCase();
+ }
+
+}
Propchange: felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/ReferenceStrategy.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/ReferenceStrategy.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/ReferenceStrategy.java
------------------------------------------------------------------------------
svn:mime-type = text/plain