You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2006/10/30 17:36:06 UTC
svn commit: r469182 [1/6] - in /incubator/felix/trunk: ipojo.metadata/
ipojo.metadata/src/main/java/org/apache/felix/ipojo/metadata/ ipojo.plugin/
ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/
ipojo.plugin/src/main/java/org/apache/fel...
Author: rickhall
Date: Mon Oct 30 08:36:04 2006
New Revision: 469182
URL: http://svn.apache.org/viewvc?view=rev&rev=469182
Log:
Applied major patch to iPOJO (FELIX-166).
Added:
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/ComponentInfo.java (with props)
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/ComponentManagerImpl.java (with props)
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/Factory.java (with props)
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/PropertyInfo.java (with props)
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/architecture/DependencyHandlerDescription.java (with props)
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/architecture/HandlerDescription.java (with props)
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/architecture/ProvidedServiceHandlerDescription.java (with props)
Removed:
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/DummyActivator.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/architecture/State.java
Modified:
incubator/felix/trunk/ipojo.metadata/pom.xml
incubator/felix/trunk/ipojo.metadata/src/main/java/org/apache/felix/ipojo/metadata/Attribute.java
incubator/felix/trunk/ipojo.metadata/src/main/java/org/apache/felix/ipojo/metadata/Element.java
incubator/felix/trunk/ipojo.plugin/pom.xml
incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java
incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/ConstructorCodeAdapter.java
incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/ManipulationProperty.java
incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/PreprocessClassAdapter.java
incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/PreprocessCodeAdapter.java
incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java
incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/parser/ParseException.java
incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/parser/XMLMetadataParser.java
incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/Clazz.java
incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/IPojoPluginConfiguration.java
incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/Jar.java
incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/OsgiJarMojo.java
incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/OsgiManifest.java
incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/QuotedTokenizer.java
incubator/felix/trunk/ipojo.plugin/src/main/resources/META-INF/plexus/components.xml
incubator/felix/trunk/ipojo/pom.xml
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/Activator.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/Callback.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/ComponentManager.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/ComponentManagerFactory.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/ComponentMetadata.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/Handler.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/IPojoConfiguration.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/Nullable.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/architecture/Architecture.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/architecture/ComponentDescription.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/architecture/DependencyDescription.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/architecture/ProvidedServiceDescription.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/architecture/ArchitectureHandler.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurableProperty.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyCallback.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyMetadata.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/NullableClassloader.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/nullable/MethodSignature.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/nullable/MethodSignatureVisitor.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/nullable/NullableObjectWriter.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/callback/LifecycleCallback.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/callback/LifecycleCallbackHandler.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/callback/LifecycleCallbackMetadata.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/providedservice/Property.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/providedservice/PropertyMetadata.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceMetadata.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java
incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/parser/ParseException.java
Modified: incubator/felix/trunk/ipojo.metadata/pom.xml
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo.metadata/pom.xml?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo.metadata/pom.xml (original)
+++ incubator/felix/trunk/ipojo.metadata/pom.xml Mon Oct 30 08:36:04 2006
@@ -7,6 +7,6 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
<packaging>jar</packaging>
- <version>0.6.0-SNAPSHOT</version>
+ <version>0.7.0-incubator-SNAPSHOT</version>
<name>Apache Felix iPOJO Metadata</name>
</project>
Modified: incubator/felix/trunk/ipojo.metadata/src/main/java/org/apache/felix/ipojo/metadata/Attribute.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo.metadata/src/main/java/org/apache/felix/ipojo/metadata/Attribute.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo.metadata/src/main/java/org/apache/felix/ipojo/metadata/Attribute.java (original)
+++ incubator/felix/trunk/ipojo.metadata/src/main/java/org/apache/felix/ipojo/metadata/Attribute.java Mon Oct 30 08:36:04 2006
@@ -1,18 +1,20 @@
-/*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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
*
- * Licensed 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.
+ * 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.ipojo.metadata;
Modified: incubator/felix/trunk/ipojo.metadata/src/main/java/org/apache/felix/ipojo/metadata/Element.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo.metadata/src/main/java/org/apache/felix/ipojo/metadata/Element.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo.metadata/src/main/java/org/apache/felix/ipojo/metadata/Element.java (original)
+++ incubator/felix/trunk/ipojo.metadata/src/main/java/org/apache/felix/ipojo/metadata/Element.java Mon Oct 30 08:36:04 2006
@@ -1,18 +1,20 @@
-/*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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
*
- * Licensed 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.
+ * 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.ipojo.metadata;
Modified: incubator/felix/trunk/ipojo.plugin/pom.xml
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo.plugin/pom.xml?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo.plugin/pom.xml (original)
+++ incubator/felix/trunk/ipojo.plugin/pom.xml Mon Oct 30 08:36:04 2006
@@ -6,7 +6,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.apache.felix.ipojo.plugin</artifactId>
- <version>0.6.0-SNAPSHOT</version>
+ <version>0.7.0-incubator-SNAPSHOT</version>
<name>Apache Felix iPOJO Maven Plugin</name>
<packaging>maven-plugin</packaging>
<dependencies>
Modified: incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java (original)
+++ incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java Mon Oct 30 08:36:04 2006
@@ -1,3 +1,21 @@
+/*
+ * 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.ipojo.manipulation;
import java.util.HashMap;
@@ -32,7 +50,7 @@
*/
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
- if (access == ACC_PRIVATE && name.equals("_cm") && desc.equals("Lorg/apache/felix/ipojo/ComponentManager;")) {
+ if (access == ACC_PRIVATE && name.equals("_cm") && desc.equals("Lorg/apache/felix/ipojo/ComponentManagerImpl;")) {
isAlreadyManipulated = true;
}
@@ -45,11 +63,9 @@
}
else {
String nameType = type.getClassName().substring(0, type.getClassName().length() - 2);
- m_fields.put(name, nameType);
+ m_fields.put(name, nameType + "[]");
}
- } else {
- m_fields.put(name, type.getClassName());
- }
+ } else { m_fields.put(name, type.getClassName()); }
return null;
}
Modified: incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/ConstructorCodeAdapter.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/ConstructorCodeAdapter.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/ConstructorCodeAdapter.java (original)
+++ incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/ConstructorCodeAdapter.java Mon Oct 30 08:36:04 2006
@@ -1,18 +1,20 @@
-/*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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
*
- * Licensed 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.
+ * 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.ipojo.manipulation;
@@ -46,7 +48,6 @@
public ConstructorCodeAdapter(final MethodVisitor mv, final String owner) {
super(mv);
m_owner = owner;
- System.out.println("Create a constructor adapter");
m_superDetected = false;
}
@@ -95,7 +96,7 @@
//mv.visitVarInsn(ALOAD, Type.getArgumentTypes(m_constructorDesc).length);
mv.visitVarInsn(ALOAD, 1); // CM is always the first argument
// 3) Initialize the field
- mv.visitMethodInsn(INVOKESPECIAL, m_owner, "_setComponentManager", "(Lorg/apache/felix/ipojo/ComponentManager;)V");
+ mv.visitMethodInsn(INVOKESPECIAL, m_owner, "_setComponentManager", "(Lorg/apache/felix/ipojo/ComponentManagerImpl;)V");
// insertion finished
}
else { mv.visitMethodInsn(opcode, owner, name, desc); }
@@ -117,9 +118,9 @@
public void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index) {
if(index == 0) {
mv.visitLocalVariable(name, desc, signature, start, end, index);
- mv.visitLocalVariable("_manager", "Lorg/apache/felix/ipojo/ComponentManager;", null, start, end, 1);
+ mv.visitLocalVariable("_manager", "Lorg/apache/felix/ipojo/ComponentManagerImpl;", null, start, end, 1);
IPojoPluginConfiguration.getLogger().log(Level.INFO, "Local Variable : " + name + " index = " + index + " desc = " + desc);
- IPojoPluginConfiguration.getLogger().log(Level.INFO, "Local Variable : " + "_manager" + " index = " + 1 + " desc = " + "Lorg/apache/felix/ipojo/ComponentManager;");
+ IPojoPluginConfiguration.getLogger().log(Level.INFO, "Local Variable : " + "_manager" + " index = " + 1 + " desc = " + "Lorg/apache/felix/ipojo/ComponentManagerImpl;");
}
mv.visitLocalVariable(name, desc, signature, start, end, index+1);
IPojoPluginConfiguration.getLogger().log(Level.INFO, "Local Variable : " + name + " index = " + index + " desc = " + desc);
Modified: incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/ManipulationProperty.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/ManipulationProperty.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/ManipulationProperty.java (original)
+++ incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/ManipulationProperty.java Mon Oct 30 08:36:04 2006
@@ -1,18 +1,20 @@
-/*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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
*
- * Licensed 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.
+ * 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.ipojo.manipulation;
Modified: incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java (original)
+++ incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java Mon Oct 30 08:36:04 2006
@@ -1,18 +1,20 @@
-/*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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
*
- * Licensed 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.
+ * 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.ipojo.manipulation;
@@ -66,14 +68,16 @@
* @param bundle The component's m_bundle
* @param name The name of the class
* @param cm The component manager attached to this manipulation
- * @return A byte array.
* @throws Exception : throwed if the manipulation failed.
*/
- public void preProcess(String name, File outputDirectory) throws Exception {
+ public boolean preProcess(String name, File outputDirectory) throws Exception {
// gets an input stream to read the bytecode of the class
String path = outputDirectory+"/"+name.replace('.', '/') + ".class";
File clazz = new File(path);
+
+ if(!clazz.exists()) { return false; }
+
URL url = clazz.toURI().toURL();
//if (url == null) { throw new ClassNotFoundException(name); }
@@ -118,8 +122,9 @@
fos.close();
IPojoPluginConfiguration.getLogger().log(Level.INFO, "Put the file " + file.getAbsolutePath() + " in the jar file");
} catch (Exception e) { System.err.println("Problem to write the adapted class on the file system " + " [ "+ file.getAbsolutePath() +" ] " + e.getMessage()); }
-
}
+ // The file is in the bundle
+ return true;
}
Modified: incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/PreprocessClassAdapter.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/PreprocessClassAdapter.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/PreprocessClassAdapter.java (original)
+++ incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/PreprocessClassAdapter.java Mon Oct 30 08:36:04 2006
@@ -1,22 +1,23 @@
-/*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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
*
- * Licensed 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.
+ * 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.ipojo.manipulation;
-import java.util.HashMap;
import java.util.logging.Level;
import org.apache.felix.ipojo.plugin.IPojoPluginConfiguration;
@@ -78,7 +79,7 @@
m_owner = name;
// Insert _cm field
- FieldVisitor fv = super.visitField(ACC_PRIVATE, "_cm", "Lorg/apache/felix/ipojo/ComponentManager;", null, null);
+ FieldVisitor fv = super.visitField(ACC_PRIVATE, "_cm", "Lorg/apache/felix/ipojo/ComponentManagerImpl;", null, null);
fv.visitEnd();
// Create the _cmSetter(ComponentManager cm) method
@@ -107,7 +108,7 @@
if(name.equals("<init>")) {
// 1) change the constructor descriptor (add a component manager arg as first argument)
String new_desc = desc.substring(1);
- new_desc = "(Lorg/apache/felix/ipojo/ComponentManager;"+new_desc;
+ new_desc = "(Lorg/apache/felix/ipojo/ComponentManagerImpl;"+new_desc;
// Insert the new constructor
MethodVisitor mv = super.visitMethod(ACC_PUBLIC, "<init>", new_desc, null, null);
@@ -128,11 +129,11 @@
* Create the setter method for the _cm field.
*/
private void createComponentManagerSetter() {
- MethodVisitor mv = cv.visitMethod(ACC_PRIVATE, "_setComponentManager", "(Lorg/apache/felix/ipojo/ComponentManager;)V", null, null);
+ MethodVisitor mv = cv.visitMethod(ACC_PRIVATE, "_setComponentManager", "(Lorg/apache/felix/ipojo/ComponentManagerImpl;)V", null, null);
mv.visitVarInsn(ALOAD, 0);
mv.visitVarInsn(ALOAD, 1);
- mv.visitFieldInsn(PUTFIELD, m_owner, "_cm", "Lorg/apache/felix/ipojo/ComponentManager;");
+ mv.visitFieldInsn(PUTFIELD, m_owner, "_cm", "Lorg/apache/felix/ipojo/ComponentManagerImpl;");
mv.visitInsn(RETURN);
@@ -200,10 +201,10 @@
mv.visitFieldInsn(PUTFIELD, m_owner, name, internalType);
mv.visitVarInsn(ALOAD, 0);
- mv.visitFieldInsn(GETFIELD, m_owner, "_cm", "Lorg/apache/felix/ipojo/ComponentManager;");
+ mv.visitFieldInsn(GETFIELD, m_owner, "_cm", "Lorg/apache/felix/ipojo/ComponentManagerImpl;");
mv.visitLdcInsn(name);
mv.visitVarInsn(ALOAD, 1);
- mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/ComponentManager", "setterCallback", "(Ljava/lang/String;Ljava/lang/Object;)V");
+ mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/ComponentManagerImpl", "setterCallback", "(Ljava/lang/String;Ljava/lang/Object;)V");
mv.visitInsn(RETURN);
@@ -234,10 +235,10 @@
mv.visitVarInsn(ASTORE, 1);
mv.visitVarInsn(ALOAD, 0);
- mv.visitFieldInsn(GETFIELD, m_owner, "_cm", "Lorg/apache/felix/ipojo/ComponentManager;");
+ mv.visitFieldInsn(GETFIELD, m_owner, "_cm", "Lorg/apache/felix/ipojo/ComponentManagerImpl;");
mv.visitLdcInsn(name);
mv.visitVarInsn(ALOAD, 1);
- mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/ComponentManager", "getterCallback", "(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;");
+ mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/ComponentManagerImpl", "getterCallback", "(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;");
mv.visitVarInsn(ASTORE, 2);
mv.visitVarInsn(ALOAD, 2);
@@ -308,10 +309,10 @@
mv.visitVarInsn(ASTORE, 2);
mv.visitVarInsn(ALOAD, 0);
- mv.visitFieldInsn(GETFIELD, m_owner, "_cm", "Lorg/apache/felix/ipojo/ComponentManager;");
+ mv.visitFieldInsn(GETFIELD, m_owner, "_cm", "Lorg/apache/felix/ipojo/ComponentManagerImpl;");
mv.visitLdcInsn(name);
mv.visitVarInsn(ALOAD, 2);
- mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/ComponentManager", "getterCallback", "(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;");
+ mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/ComponentManagerImpl", "getterCallback", "(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;");
mv.visitVarInsn(ASTORE, 3);
mv.visitVarInsn(ALOAD, 3);
@@ -348,10 +349,10 @@
mv.visitVarInsn(ASTORE, 1);
mv.visitVarInsn(ALOAD, 0);
- mv.visitFieldInsn(GETFIELD, m_owner, "_cm", "Lorg/apache/felix/ipojo/ComponentManager;");
+ mv.visitFieldInsn(GETFIELD, m_owner, "_cm", "Lorg/apache/felix/ipojo/ComponentManagerImpl;");
mv.visitLdcInsn(name);
mv.visitVarInsn(ALOAD, 1);
- mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/ComponentManager", "getterCallback", "(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;");
+ mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/ComponentManagerImpl", "getterCallback", "(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;");
mv.visitVarInsn(ASTORE, 2);
mv.visitVarInsn(ALOAD, 2);
@@ -429,10 +430,10 @@
Label l2 = new Label();
mv.visitLabel(l2);
mv.visitVarInsn(ALOAD, 0);
- mv.visitFieldInsn(GETFIELD, m_owner, "_cm", "Lorg/apache/felix/ipojo/ComponentManager;");
+ mv.visitFieldInsn(GETFIELD, m_owner, "_cm", "Lorg/apache/felix/ipojo/ComponentManagerImpl;");
mv.visitLdcInsn(name);
mv.visitVarInsn(ALOAD, 2);
- mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/ComponentManager", "setterCallback", "(Ljava/lang/String;Ljava/lang/Object;)V");
+ mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/ComponentManagerImpl", "setterCallback", "(Ljava/lang/String;Ljava/lang/Object;)V");
Label l3 = new Label();
mv.visitLabel(l3);
@@ -445,10 +446,10 @@
mv.visitFieldInsn(PUTFIELD, m_owner, name, "L" + type.getInternalName() + ";");
mv.visitVarInsn(ALOAD, 0);
- mv.visitFieldInsn(GETFIELD, m_owner, "_cm", "Lorg/apache/felix/ipojo/ComponentManager;");
+ mv.visitFieldInsn(GETFIELD, m_owner, "_cm", "Lorg/apache/felix/ipojo/ComponentManagerImpl;");
mv.visitLdcInsn(name);
mv.visitVarInsn(ALOAD, 1);
- mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/ComponentManager", "setterCallback", "(Ljava/lang/String;Ljava/lang/Object;)V");
+ mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/ComponentManagerImpl", "setterCallback", "(Ljava/lang/String;Ljava/lang/Object;)V");
mv.visitInsn(RETURN);
break;
Modified: incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/PreprocessCodeAdapter.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/PreprocessCodeAdapter.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/PreprocessCodeAdapter.java (original)
+++ incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/PreprocessCodeAdapter.java Mon Oct 30 08:36:04 2006
@@ -1,18 +1,20 @@
-/*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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
*
- * Licensed 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.
+ * 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.ipojo.manipulation;
Modified: incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java (original)
+++ incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java Mon Oct 30 08:36:04 2006
@@ -1,18 +1,20 @@
-/*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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
*
- * Licensed 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.
+ * 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.ipojo.parser;
@@ -89,7 +91,6 @@
public void parse(Dictionary dict) throws ParseException {
m_headers = dict;
String componentClassesStr = (String)m_headers.get("iPOJO-Components");
- System.out.println("Parse : " + componentClassesStr);
parseElements(componentClassesStr.trim());
}
@@ -110,7 +111,6 @@
for (int i = 0; i < string.length; i++) {
char c = string[i];
- System.out.println("Analyse : " + c);
switch(c) {
case '$' :
Modified: incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/parser/ParseException.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/parser/ParseException.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/parser/ParseException.java (original)
+++ incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/parser/ParseException.java Mon Oct 30 08:36:04 2006
@@ -1,18 +1,20 @@
-/*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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
*
- * Licensed 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.
+ * 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.ipojo.parser;
Modified: incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/parser/XMLMetadataParser.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/parser/XMLMetadataParser.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/parser/XMLMetadataParser.java (original)
+++ incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/parser/XMLMetadataParser.java Mon Oct 30 08:36:04 2006
@@ -1,18 +1,20 @@
-/*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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
*
- * Licensed 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.
+ * 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.ipojo.parser;
@@ -40,6 +42,16 @@
*/
public Element[] getComponentsMetadata() throws ParseException {
return m_elements[0].getElements("Component");
+ }
+
+ public Element[] getMetadata() throws ParseException {
+ Element[] comp = m_elements[0].getElements("Component");
+ Element[] conf = m_elements[0].getElements("Instance");
+ Element[] metadata = new Element[comp.length + conf.length];
+ int l = 0;
+ for(int i = 0; i < comp.length; i++) { metadata[l] = comp[i]; l++;}
+ for(int i = 0; i < conf.length; i++) { metadata[l] = conf[i]; l++;}
+ return metadata;
}
Modified: incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/Clazz.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/Clazz.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/Clazz.java (original)
+++ incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/Clazz.java Mon Oct 30 08:36:04 2006
@@ -1,18 +1,20 @@
-/*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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
*
- * Licensed 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.
+ * 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.ipojo.plugin;
Modified: incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/IPojoPluginConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/IPojoPluginConfiguration.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/IPojoPluginConfiguration.java (original)
+++ incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/IPojoPluginConfiguration.java Mon Oct 30 08:36:04 2006
@@ -1,18 +1,20 @@
-/*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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
*
- * Licensed 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.
+ * 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.ipojo.plugin;
Modified: incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/Jar.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/Jar.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/Jar.java (original)
+++ incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/Jar.java Mon Oct 30 08:36:04 2006
@@ -1,18 +1,20 @@
-/*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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
*
- * Licensed 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.
+ * 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.ipojo.plugin;
Modified: incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/OsgiJarMojo.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/OsgiJarMojo.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/OsgiJarMojo.java (original)
+++ incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/OsgiJarMojo.java Mon Oct 30 08:36:04 2006
@@ -1,20 +1,21 @@
-/*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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
*
- * Licensed 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.
+ * 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.ipojo.plugin;
import java.io.*;
@@ -505,7 +506,8 @@
* Calculate the bundle class path based on the list of JARs in our bundle.
* This list includes outselves. We also calculate the Bundle-Classpath
* header (a bit clumsy) This is a bit cheap, so maybe this needs to be
- * changed TODO
+ * changed
+
*
* @param mainJar
* @return
@@ -848,7 +850,7 @@
private Element[] parseXMLMetadata(String path) throws MojoExecutionException {
File metadata = new File(outputDirectory+path);
URL url;
- Element[] components = null;
+ Element[] meta = null;
try {
url = metadata.toURI().toURL();
if (url == null) {
@@ -863,7 +865,7 @@
InputSource is = new InputSource(stream);
parser.parse(is);
- components = handler.getComponentsMetadata();
+ meta = handler.getMetadata();
} catch (MalformedURLException e) {
getLog().error("Malformed URL for " + outputDirectory+path+ "("+e.getMessage()+")");
@@ -876,12 +878,12 @@
throw new MojoExecutionException("[iPOJO] Parsing Error when parsing the XML file " + outputDirectory+path);
}
- if(components == null || components.length == 0) {
- getLog().error("No component in " + outputDirectory+path);
+ if(meta == null || meta.length == 0) {
+ getLog().error("No component in " + outputDirectory+path); //TODO : change the message
throw new MojoExecutionException("[iPOJO] No component in " + outputDirectory+path);
}
- return components;
+ return meta;
}
private Element[] parseManifestMetadata(String metadata) throws MojoExecutionException {
@@ -908,18 +910,18 @@
//Try to read the content of a file of the ouptut directory
getLog().info("iPOJO Manipulation ...");
- Element[] components = null;
+ Element[] original_meta = null;
// Get the metadata.xml location
String path = (String) osgiManifest.getEntries().get("iPOJO-Metadata");
if(path != null) {
if(!path.startsWith("/")) { path = "/" + path; }
- components = parseXMLMetadata(path);
+ original_meta = parseXMLMetadata(path);
} else {
String meta_ = (String) osgiManifest.getEntries().get("iPOJO-Components");
if(meta_ != null) {
- components = parseManifestMetadata(meta_);
+ original_meta = parseManifestMetadata(meta_);
} else {
getLog().error("Neither iPOJO-Metadata nor iPOJO-Components are in the manifest, please in the osgi-bundle packaging instead og ipojo-bundle");
throw new MojoExecutionException("[iPOJO] Neither iPOJO-Metadata nor iPOJO-Components are in the manifest");
@@ -927,45 +929,49 @@
}
Manipulator manipulator = new Manipulator();
- String[] metadata = new String[components.length];
+ String[] metadata = new String[original_meta.length];
String meta = "";
- if(namespaces == null) { namespaces = new String[components.length][]; }
- for(int i = 0; i < components.length; i++) {
- getLog().info("Component Class Name : " + components[i].getAttribute("className"));
- namespaces[i] = components[i].getNamespaces();
- try {
- manipulator.preProcess(components[i].getAttribute("className"), outputDirectory);
- } catch (Exception e) {
- getLog().error("Manipulation error in the class : " + components[i].getAttribute("className") + "("+e.getMessage()+")");
- throw new MojoExecutionException("[iPOJO] Manipulation error in the class : " + components[i].getAttribute("className"));
- }
+
+ if(namespaces == null) { namespaces = new String[original_meta.length][]; } //NO
+ for(int i = 0; i < original_meta.length; i++) {
+ if(original_meta[i].getName().equalsIgnoreCase("component")) {
+ getLog().info("Component Class Name : " + original_meta[i].getAttribute("className"));
+ namespaces[i] = original_meta[i].getNamespaces();
+ try {
+ manipulator.preProcess(original_meta[i].getAttribute("className"), outputDirectory);
+ } catch (Exception e) {
+ getLog().error("Manipulation error in the class : " + original_meta[i].getAttribute("className") + "("+e.getMessage()+")");
+ throw new MojoExecutionException("[iPOJO] Manipulation error in the class : " + original_meta[i].getAttribute("className"));
+ }
- getLog().info("Add manipulation metadata for : " + components[i].getAttribute("className"));
- // Insert information to metadata
- Element elem = new Element("Manipulation", "");
- for(int j = 0; j < manipulator.getInterfaces().length; j++) {
- // Create an interface element for each implemented interface
- Element itf = new Element("Interface", "");
- Attribute att =new Attribute("name", manipulator.getInterfaces()[j]);
- itf.addAttribute(att);
- elem.addElement(itf);
- }
-
- for(Iterator it = manipulator.getFields().keySet().iterator(); it.hasNext(); ) {
- Element field = new Element("Field", "");
- String name = (String) it.next();
- String type = (String) manipulator.getFields().get(name);
- Attribute attName =new Attribute("name", name);
- Attribute attType =new Attribute("type", type);
- field.addAttribute(attName);
- field.addAttribute(attType);
- elem.addElement(field);
- }
+ getLog().info("Add manipulation metadata for : " + original_meta[i].getAttribute("className"));
+ // Insert information to metadata
+ Element elem = new Element("Manipulation", "");
+ for(int j = 0; j < manipulator.getInterfaces().length; j++) {
+ // Create an interface element for each implemented interface
+ Element itf = new Element("Interface", "");
+ Attribute att =new Attribute("name", manipulator.getInterfaces()[j]);
+ itf.addAttribute(att);
+ elem.addElement(itf);
+ }
+
+ for(Iterator it = manipulator.getFields().keySet().iterator(); it.hasNext(); ) {
+ Element field = new Element("Field", "");
+ String name = (String) it.next();
+ String type = (String) manipulator.getFields().get(name);
+ Attribute attName =new Attribute("name", name);
+ Attribute attType =new Attribute("type", type);
+ field.addAttribute(attName);
+ field.addAttribute(attType);
+ elem.addElement(field);
+ }
+
+ original_meta[i].addElement(elem);
+ } else { namespaces[i] = new String[0]; }
- components[i].addElement(elem);
// Transform the metadate to manifest metadata
- metadata[i] = buildManifestMetadata(components[i], "");
+ metadata[i] = buildManifestMetadata(original_meta[i], "");
meta = meta + metadata[i];
}
Modified: incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/OsgiManifest.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/OsgiManifest.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/OsgiManifest.java (original)
+++ incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/OsgiManifest.java Mon Oct 30 08:36:04 2006
@@ -1,18 +1,20 @@
-/*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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
*
- * Licensed 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.
+ * 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.ipojo.plugin;
Modified: incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/QuotedTokenizer.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/QuotedTokenizer.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/QuotedTokenizer.java (original)
+++ incubator/felix/trunk/ipojo.plugin/src/main/java/org/apache/felix/ipojo/plugin/QuotedTokenizer.java Mon Oct 30 08:36:04 2006
@@ -1,18 +1,20 @@
-/*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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
*
- * Licensed 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.
+ * 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.ipojo.plugin;
Modified: incubator/felix/trunk/ipojo.plugin/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo.plugin/src/main/resources/META-INF/plexus/components.xml?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo.plugin/src/main/resources/META-INF/plexus/components.xml (original)
+++ incubator/felix/trunk/ipojo.plugin/src/main/resources/META-INF/plexus/components.xml Mon Oct 30 08:36:04 2006
@@ -26,13 +26,13 @@
</component>
<component>
<role>org.apache.maven.artifact.handler.ArtifactHandler</role>
- <role-hint>ipojo-bundle</role-hint>
+ <role-hint>ipojo-bundle</role-hint>;
<implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
<configuration>
+ <extension>jar</extension>
<type>ipojo-bundle</type>
<includesDependencies>true</includesDependencies>
<language>java</language>
- <extension>jar</extension>
<addedToClasspath>true</addedToClasspath>
</configuration>
</component>
Modified: incubator/felix/trunk/ipojo/pom.xml
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo/pom.xml?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo/pom.xml (original)
+++ incubator/felix/trunk/ipojo/pom.xml Mon Oct 30 08:36:04 2006
@@ -8,7 +8,7 @@
<packaging>osgi-bundle</packaging>
<name>Apache Felix iPOJO</name>
<artifactId>org.apache.felix.ipojo</artifactId>
- <version>0.6.0-SNAPSHOT</version>
+ <version>0.7.0-incubator-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>${pom.groupId}</groupId>
@@ -24,7 +24,7 @@
<dependency>
<groupId>${pom.groupId}</groupId>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>${pom.version}</version>
+ <version>0.7.0-incubator-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
@@ -40,10 +40,15 @@
<bundleVendor>Clement ESCOFFIER</bundleVendor>
<bundleDescription> iPOJO </bundleDescription>
<importPackage>
- org.osgi.framework, org.osgi.service.cm
+ org.osgi.framework; specification-version="1.3",
+ org.osgi.service.cm; specification-version="1.2"
</importPackage>
<exportPackage>
- org.apache.felix.ipojo, org.apache.felix.ipojo.metadata, org.apache.felix.ipojo.architecture, org.apache.felix.ipojo.parser, org.osgi.service.cm
+ org.apache.felix.ipojo,
+ org.apache.felix.ipojo.metadata,
+ org.apache.felix.ipojo.architecture,
+ org.apache.felix.ipojo.parser,
+ org.osgi.service.cm; specification-version="1.2"
</exportPackage>
</osgiManifest>
</configuration>
Modified: incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/Activator.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/Activator.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/Activator.java (original)
+++ incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/Activator.java Mon Oct 30 08:36:04 2006
@@ -1,23 +1,23 @@
-/*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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
*
- * Licensed 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.
+ * 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.ipojo;
-
-
import java.io.IOException;
import java.util.Dictionary;
import java.util.logging.Level;
@@ -36,19 +36,16 @@
*/
public class Activator implements BundleActivator {
+ // STATIC
+ /**
+ * The iPOJO static logger. This logger is used by each iPOJO instance.
+ */
+ private static Logger m_logger = Logger.getLogger("org.apache.felix.ipojo");
- // STATIC
- /**
- * The iPOJO static logger. This logger is used by each iPOJO instance.
- */
- private static Logger m_logger = Logger.getLogger("org.apache.felix.ipojo");
-
- /**
+ /**
* @return Returns the static ipojo logger : org.apache.felix.ipojo
*/
- public static Logger getLogger() {
- return Activator.m_logger;
- }
+ public static Logger getLogger() { return Activator.m_logger; }
// END STATIC
// NON STATIC PART
@@ -65,6 +62,12 @@
*/
private ComponentManagerFactory[] m_factories;
+ /**
+ * The configuration to create.
+ * m_configuration : Array of Dictionary
+ */
+ private Dictionary[] m_configurations;
+
// Field accessors :
/**
@@ -79,10 +82,10 @@
* @param cm : the new component metadata.
*/
public void addComponentFactory(Element cm) {
- // Create the factory :
- ComponentManagerFactory factory = new ComponentManagerFactory(m_bundleContext, cm);
+ // Create the factory :
+ ComponentManagerFactory factory = new ComponentManagerFactory(m_bundleContext, cm);
- // If the factory array is not empty add the new factory at the end
+ // If the factory array is not empty add the new factory at the end
if (m_factories.length != 0) {
ComponentManagerFactory[] newFactory = new ComponentManagerFactory[m_factories.length + 1];
System.arraycopy(m_factories, 0, newFactory, 0, m_factories.length);
@@ -110,7 +113,7 @@
if (idx >= 0) {
// If this is the factory, then point to empty list.
if ((m_factories.length - 1) == 0) {
- m_factories = new ComponentManagerFactory[0];
+ m_factories = new ComponentManagerFactory[0];
}
// Otherwise, we need to do some array copying.
else {
@@ -147,33 +150,18 @@
* @throws Exception : when a problem occurs
*/
public void start(final BundleContext bc) throws Exception {
- m_bundleContext = bc;
+ m_bundleContext = bc;
+ Activator.getLogger().setLevel(IPojoConfiguration.LOG_LEVEL);
- // Set the trace level
- String level = System.getProperty("ipojo.loglevel");
- if (level != null) {
- if (level.equals("ALL")) {
- Activator.getLogger().setLevel(Level.ALL);
- }
- if (level.equals("FINEST")) {
- Activator.getLogger().setLevel(Level.FINEST);
- }
- if (level.equals("WARNING")) {
- Activator.getLogger().setLevel(Level.WARNING);
- }
- }
- else { Activator.getLogger().setLevel(IPojoConfiguration.LOG_LEVEL); }
-
- try {
- parse();
- } catch (Exception e) {
- Activator.getLogger().log(Level.SEVERE, "Parse error for the bundle " + m_bundleContext.getBundle().getBundleId() + " : " + e.getMessage());
- return;
- }
- Activator.getLogger().log(Level.INFO, "[Bundle" + m_bundleContext.getBundle().getBundleId() + "] Called start after the parsing");
+ try {
+ parse();
+ } catch (Exception e) {
+ Activator.getLogger().log(Level.SEVERE, "Parse error for the bundle " + m_bundleContext.getBundle().getBundleId() + " : " + e.getMessage());
+ return;
+ }
+ Activator.getLogger().log(Level.INFO, "[Bundle" + m_bundleContext.getBundle().getBundleId() + "] Called start after the parsing");
- // Call the internal start method
- start();
+ start(); // Call the internal start method
}
@@ -185,8 +173,8 @@
*/
public void stop(BundleContext arg0) throws Exception {
for (int i = 0; i < m_factories.length; i++) {
- ComponentManagerFactory factory = m_factories[i];
- factory.stop();
+ ComponentManagerFactory factory = m_factories[i];
+ factory.stop();
}
}
@@ -197,29 +185,36 @@
/**
* Parse the file who is at the Metadata-Location place, manipulate the bytecode of the component implementation class
* and set the manager.
- * @throws IOException
- * @throws ParseException
+ * @throws IOException : the manisfest could not be found
+ * @throws ParseException : the parsing process failed
*/
private void parse() throws IOException, ParseException {
- String componentClasses = (String)m_bundleContext.getBundle().getHeaders().get("iPOJO-Components");
+ String componentClasses = (String) m_bundleContext.getBundle().getHeaders().get("iPOJO-Components");
if (componentClasses != null) {
- parseManifest(m_bundleContext.getBundle().getHeaders());
+ parseManifest(m_bundleContext.getBundle().getHeaders());
} else {
- Activator.getLogger().log(Level.SEVERE, "[Bundle" + m_bundleContext.getBundle().getBundleId() + "] Components-Metadata are not in the manifest");
- throw new ParseException("[Bundle" + m_bundleContext.getBundle().getBundleId() + "] Component-Metadata are not in the manifest");
+ Activator.getLogger().log(Level.SEVERE, "[Bundle" + m_bundleContext.getBundle().getBundleId() + "] Components-Metadata are not in the manifest");
+ throw new ParseException("[Bundle" + m_bundleContext.getBundle().getBundleId() + "] Component-Metadata are not in the manifest");
}
}
+ /**
+ * Parse the manifest.
+ * @param dict : Manifest Entries
+ * @throws ParseException : throwed when the parsing failed
+ */
private void parseManifest(Dictionary dict) throws ParseException {
- ManifestMetadataParser parser = new ManifestMetadataParser();
- parser.parse(dict);
- // Create the components Factory according to the declared component
+ ManifestMetadataParser parser = new ManifestMetadataParser();
+ parser.parse(dict);
+ // Create the components Factory according to the declared component
Element[] componentsMetadata = parser.getComponentsMetadata();
+ m_configurations = parser.getInstances();
for (int i = 0; i < componentsMetadata.length; i++) {
- Activator.getLogger().log(Level.INFO, "[Bundle" + m_bundleContext.getBundle().getBundleId() + "] Create a component factory for " + componentsMetadata[i].getAttribute("classname"));
- addComponentFactory(componentsMetadata[i]);
+ Activator.getLogger().log(Level.INFO, "[Bundle" + m_bundleContext.getBundle().getBundleId() + "] Create a component factory for " + componentsMetadata[i].getAttribute("classname"));
+ addComponentFactory(componentsMetadata[i]);
}
+
}
/**
@@ -228,7 +223,14 @@
private void start() {
for (int i = 0; i < m_factories.length; i++) {
ComponentManagerFactory factory = m_factories[i];
- factory.start(); // Start the management
+ String componentClass = factory.getComponentClassName();
+ for (int j = 0; j < m_configurations.length; j++) {
+ Dictionary conf = m_configurations[j];
+ if (conf.get("component") != null && conf.get("component").equals(componentClass)) {
+ factory.createComponent(m_configurations[j]); // create a component
+ }
+ }
+ factory.start(); // Start the factory exposition
}
}
Modified: incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/Callback.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/Callback.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/Callback.java (original)
+++ incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/Callback.java Mon Oct 30 08:36:04 2006
@@ -1,18 +1,20 @@
-/*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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
*
- * Licensed 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.
+ * 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.ipojo;
@@ -23,33 +25,33 @@
/**
- * A callback allows calling a method on the component.
+ * A callback allows calling a method on the component instances.
* @author <a href="mailto:felix-dev@incubator.apache.org">Felix Project Team</a>
*/
public class Callback {
- /**
- * Name of the method to call.
- */
- private String m_method;
-
- /**
- * Is the method a static method ?
- */
- private boolean m_isStatic;
-
- /**
- * Reference on the component manager.
- */
- private ComponentManager m_manager;
+ /**
+ * Name of the method to call.
+ */
+ private String m_method;
+
+ /**
+ * Is the method a static method ?
+ */
+ private boolean m_isStatic;
- /**
+ /**
+ * Reference on the component manager.
+ */
+ private ComponentManagerImpl m_manager;
+
+ /**
* LifecycleCallback constructor.
* @param method : the name of the method to call
* @param isStatic : is the method a static method
* @param cm : the component manager of the component containing the method
*/
- public Callback(String method, boolean isStatic, ComponentManager cm) {
+ public Callback(String method, boolean isStatic, ComponentManagerImpl cm) {
m_method = method;
m_isStatic = isStatic;
m_manager = cm;
@@ -62,28 +64,42 @@
* @throws IllegalAccessException : The method can not be invoked
*/
public void call() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
- Activator.getLogger().log(Level.INFO, "[" + m_manager.getComponentMetatada().getClassName() + "] Call an callback method : " + m_method);
+ Activator.getLogger().log(Level.INFO, "[" + m_manager.getComponentMetatada().getClassName() + "] Call an callback method : " + m_method);
Method method = m_manager.getClazz().getMethod(m_method, new Class[] {});
method.setAccessible(true);
if (m_isStatic) { method.invoke(null, new Object[]{}); }
else {
- // Two cases :
- // - if instances already exists : call on each instances
- // - if no instance exists : create an instance
- if (m_manager.getInstances().length == 0) {
- Activator.getLogger().log(Level.INFO, "[" + m_manager.getComponentMetatada().getClassName() + "] Create the first instance " + m_manager.getInstance());
- method.invoke(m_manager.getInstance(), new Object[]{});
- } else {
- for (int i = 0; i < m_manager.getInstances().length; i++) {
- Activator.getLogger().log(Level.INFO, "[" + m_manager.getComponentMetatada().getClassName() + "] Call the callback on the instance " + m_manager.getInstances()[i]);
- method.invoke(m_manager.getInstances()[i], new Object[]{});
- }
- }
+ // Two cases :
+ // - if instances already exists : call on each instances
+ // - if no instance exists : create an instance
+ if (m_manager.getInstances().length == 0) {
+ Activator.getLogger().log(Level.INFO, "[" + m_manager.getComponentMetatada().getClassName() + "] Create the first instance " + m_manager.getInstance());
+ method.invoke(m_manager.getInstance(), new Object[]{});
+ } else {
+ for (int i = 0; i < m_manager.getInstances().length; i++) {
+ Activator.getLogger().log(Level.INFO, "[" + m_manager.getComponentMetatada().getClassName() + "] Call the callback on the instance " + m_manager.getInstances()[i]);
+ method.invoke(m_manager.getInstances()[i], new Object[]{});
+ }
+ }
}
}
/**
+ * Call the current callback method on the instance given in parameter.
+ * @param instance : instance on which call the callbakc
+ * @throws NoSuchMethodException : the method was not found
+ * @throws IllegalAccessException : the method cannont be called
+ * @throws InvocationTargetException : an error happens in the method
+ */
+ public void call(Object instance) throws NoSuchMethodException,
+ IllegalAccessException, InvocationTargetException {
+ Method method = m_manager.getClazz().getMethod(m_method, new Class[] {});
+ method.setAccessible(true);
+ method.invoke(instance, new Object[] {});
+ }
+
+ /**
* Call the callback on the method with the argument given in parameter.
* @param arg : the parameters
* @throws NoSuchMethodException : the callback method is not found
@@ -91,29 +107,49 @@
* @throws InvocationTargetException : an error occurs inside the called method
*/
public void call(Object[] arg) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
- Activator.getLogger().log(Level.INFO, "[" + m_manager.getComponentMetatada().getClassName() + "] Call an callback method : " + m_method);
+ Activator.getLogger().log(Level.INFO, "[" + m_manager.getComponentMetatada().getClassName() + "] Call an callback method : " + m_method);
- // Build an array of call for arg :
- Class[] classes = new Class[arg.length];
- for (int i = 0; i < arg.length; i++) {
- classes[i] = arg[i].getClass();
- }
+ // Build an array of call for arg :
+ Class[] classes = new Class[arg.length];
+ for (int i = 0; i < arg.length; i++) {
+ classes[i] = arg[i].getClass();
+ }
Method method = m_manager.getClazz().getMethod(m_method, classes);
method.setAccessible(true);
if (m_isStatic) { method.invoke(null, arg); }
else {
- // Two cases :
- // - if instances already exists : call on each instances
- // - if no instance exists : create an instance
- if (m_manager.getInstances().length == 0) {
- Activator.getLogger().log(Level.INFO, "[" + m_manager.getComponentMetatada().getClassName() + "] Create the first instance " + m_manager.getInstance());
- method.invoke(m_manager.getInstance(), new Object[]{});
- } else {
- for (int i = 0; i < m_manager.getInstances().length; i++) {
- method.invoke(m_manager.getInstances()[i], arg);
- }
- }
+ // Two cases :
+ // - if instances already exists : call on each instances
+ // - if no instance exists : create an instance
+ if (m_manager.getInstances().length == 0) {
+ Activator.getLogger().log(Level.INFO, "[" + m_manager.getComponentMetatada().getClassName() + "] Create the first instance " + m_manager.getInstance());
+ method.invoke(m_manager.getInstance(), new Object[]{});
+ } else {
+ for (int i = 0; i < m_manager.getInstances().length; i++) {
+ method.invoke(m_manager.getInstances()[i], arg);
+ }
+ }
+ }
+ }
+
+ /**
+ * Call the callback on the method with the argument given in parameter and with the arguments given in parameter too.
+ * @param instance : instance on which call the callback
+ * @param arg : the argument array
+ * @throws NoSuchMethodException : the callback method is not found
+ * @throws IllegalAccessException : the callbback method cannot be called
+ * @throws InvocationTargetException : an error occurs inside the called method
+ */
+ public void call(Object instance, Object[] arg) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+ // Build an array of call for arg :
+ Class[] classes = new Class[arg.length];
+ for (int i = 0; i < arg.length; i++) {
+ classes[i] = arg[i].getClass();
}
+
+ Method method = m_manager.getClazz().getMethod(m_method, classes);
+ method.setAccessible(true);
+ method.invoke(instance, arg);
}
}
Added: incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/ComponentInfo.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/ComponentInfo.java?view=auto&rev=469182
==============================================================================
--- incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/ComponentInfo.java (added)
+++ incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/ComponentInfo.java Mon Oct 30 08:36:04 2006
@@ -0,0 +1,95 @@
+/*
+ * 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.ipojo;
+
+import java.util.ArrayList;
+import java.util.List;
+/**
+ * Component Type information.
+ * @author <a href="mailto:felix-dev@incubator.apache.org">Felix Project Team</a>
+ */
+public class ComponentInfo {
+
+ /**
+ * Provided service by the component type.
+ */
+ private ArrayList m_providedServiceSpecification = new ArrayList();
+
+ /**
+ * Component Type implementation class.
+ */
+ private String m_className;
+
+ /**
+ * Configuration Properties accepted by the component type.
+ */
+ private ArrayList m_properties = new ArrayList();
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ String res = "";
+ res += "Component : " + m_className + "\n";
+ for (int i = 0; i < m_providedServiceSpecification.size(); i++) {
+ res += "\tProvides : " + (String) m_providedServiceSpecification.get(i) + "\n";
+ }
+ for (int i = 0; i < m_properties.size(); i++) {
+ res += "\tProperty : " + (PropertyInfo) m_properties.get(i) + "\n";
+ }
+ return res;
+ }
+
+ /**
+ * @return the component type implementation class name.
+ */
+ public String getClassName() { return m_className; }
+
+ /**
+ * Set the component type implementation class name.
+ * @param name : the name of the implementation class
+ */
+ protected void setClassName(String name) { m_className = name; }
+
+ /**
+ * @return the list of configuration properties accepted by the component type.
+ */
+ public List getProperties() { return m_properties; }
+
+ /**
+ * Add a configuration properties to the component type.
+ * @param pi : the property to add
+ */
+ public void addProperty(PropertyInfo pi) { this.m_properties.add(pi); }
+
+ /**
+ * @return the list of the provided service.
+ */
+ public List getprovidedServiceSpecification() { return m_providedServiceSpecification; }
+
+ /**
+ * add a provided service to the component type.
+ * @param serviceSpecification : the provided service to add (interface name)
+ */
+ public void addProvidedServiceSpecification(String serviceSpecification) { m_providedServiceSpecification.add(serviceSpecification); }
+
+
+
+
+}
Propchange: incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/ComponentInfo.java
------------------------------------------------------------------------------
svn:eol-style = native