Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/felix3680_2/Main.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/felix3680_2/Main.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/felix3680_2/Main.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/felix3680_2/Main.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,310 @@ +/* + * 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.integration.components.felix3680_2; + + +import java.lang.management.ManagementFactory; +import java.lang.management.ThreadInfo; +import java.lang.management.ThreadMXBean; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.Executor; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.osgi.framework.ServiceRegistration; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.runtime.ServiceComponentRuntime; +import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO; +import org.osgi.service.log.LogService; + + +public class Main implements Runnable +{ + public volatile boolean running = true; + public volatile static CountDownLatch STOPLATCH; + public static final int LATCH_TIMEOUT = 10000; + + private volatile ComponentContext m_ctx; + private volatile AtomicInteger m_counter = new AtomicInteger(); + private volatile CountDownLatch m_enabledLatch; + private volatile CountDownLatch m_disabledLatch; + private volatile LogService m_logService; + private ServiceComponentRuntime m_scr; + private volatile ExecutorService m_exec; + private volatile BundleContext m_bctx; + volatile ConcurrentHashMap<Class, ServiceRegistration> m_registrations = new ConcurrentHashMap<Class, ServiceRegistration>(); + volatile Exception _bindStackTrace; + + + + /** + * Helper used to randomly enable or disable a list of components. + */ + class RegistrationHelper + { + public void registerBCDEFGHIJK( Executor exec ) + { + enableOrDisable( true ); + } + + + public void unregisterBCDEFGHIJK( Executor exec ) + { + enableOrDisable( false ); + } + + + private void enableOrDisable( final boolean enable ) + { + if ( enable ) + { + register( B.class ); + register( C.class ); + register( D.class ); + register( E.class ); + register( F.class ); + register( G.class ); + register( H.class ); + register( I.class ); + register( J.class ); + register( K.class ); + } + else + { + unregister( B.class ); + unregister( C.class ); + unregister( D.class ); + unregister( E.class ); + unregister( F.class ); + unregister( G.class ); + unregister( H.class ); + unregister( I.class ); + unregister( J.class ); + unregister( K.class ); + } + } + + + private void register( final Class clazz ) + { + m_exec.execute( new Runnable() + { + public void run() + { + try + { + Object instance = clazz.newInstance(); + m_registrations.put( clazz, m_bctx.registerService( clazz.getName(), instance, null ) ); + m_enabledLatch.countDown(); + } + catch ( Throwable e ) + { + m_logService.log( LogService.LOG_ERROR, "error while enabling " + clazz, e ); + } + } + } ); + } + + + private void unregister( final Class clazz ) + { + m_exec.execute( new Runnable() + { + public void run() + { + try + { + ServiceRegistration sr = m_registrations.remove( clazz ); + sr.unregister(); + m_disabledLatch.countDown(); + } + catch ( Throwable e ) + { + m_logService.log( LogService.LOG_ERROR, "error while enabling " + clazz, e ); + } + } + } ); + } + } + + + void bindSCR( ServiceComponentRuntime scr ) + { + m_scr = scr; + } + + + void bindLogService( LogService logService ) + { + m_logService = logService; + } + + + void bindA( ServiceReference sr ) + { + Exception trace = new Exception( "bindA (" + Thread.currentThread() + ")" ); + if ( _bindStackTrace != null ) + { + m_logService.log( LogService.LOG_ERROR, "Already bound A from stacktrace:", _bindStackTrace ); + m_logService.log( LogService.LOG_ERROR, "Current stacktrace is:", trace ); + return; + } + + _bindStackTrace = trace; + + A a = ( A ) m_ctx.locateService( "a", sr ); + if ( a == null ) + { + throw new IllegalStateException( "bindA: bundleContext.getService returned null" ); + } + if ( m_counter.incrementAndGet() != 1 ) + { + throw new IllegalStateException( "bindA: invalid counter value: " + m_counter ); + } + m_enabledLatch.countDown(); + } + + + void unbindA( A a ) + { + if ( m_counter.decrementAndGet() != 0 ) + { + throw new IllegalStateException( "unbindA: invalid counter value: " + m_counter ); + } + _bindStackTrace = null; + m_disabledLatch.countDown(); + } + + + void start( ComponentContext ctx ) + { + STOPLATCH = new CountDownLatch(1); + m_exec = Executors.newFixedThreadPool( 12 ); + m_ctx = ctx; + m_bctx = ctx.getBundleContext(); + m_ctx.getBundleContext().registerService( Executor.class.getName(), m_exec, null ); + new Thread( this ).start(); + } + + void stop() throws InterruptedException + { + synchronized ( this ) + { + running = false; + } + STOPLATCH.await(LATCH_TIMEOUT, TimeUnit.MILLISECONDS); + m_exec.shutdown(); + } + + + public void run() + { + int loop = 0; + while ( iterate() ) + { + + + RegistrationHelper registry = new RegistrationHelper(); + registry.registerBCDEFGHIJK( m_exec ); + + try + { + if ( !m_enabledLatch.await( LATCH_TIMEOUT, TimeUnit.MILLISECONDS ) ) + { + System.out.println( "Did not get A injected timely ... see logs.txt" ); + m_logService.log( LogService.LOG_ERROR, "enableLatch TIMEOUT" ); + m_logService.log(LogService.LOG_ERROR, dumpThreads()); + dumpA(); + System.exit( 1 ); + } + } + catch ( InterruptedException e ) + { + } + + registry.unregisterBCDEFGHIJK( m_exec ); + try + { + if ( !m_disabledLatch.await( LATCH_TIMEOUT, TimeUnit.MILLISECONDS ) ) + { + System.out.println( "Could not disable components timely ... see logs.txt" ); + m_logService.log( LogService.LOG_ERROR, "disableLatch TIMEOUT" ); + m_logService.log(LogService.LOG_ERROR, dumpThreads()); + dumpA(); + System.exit( 1 ); + } + } + catch ( InterruptedException e ) + { + } + + ++loop; + if ( loop % 500 == 0 ) + { + m_logService.log( LogService.LOG_WARNING, "Felix3680_2Test: Performed " + loop + " tests." ); + } + } + + STOPLATCH.countDown(); + } + + + private synchronized boolean iterate() + { + if ( running ) + { + m_enabledLatch = new CountDownLatch( 11 ); // 10 for registrations of B,C,D,E,F,G,H,I,J,K + 1 for Main.bindA + m_disabledLatch = new CountDownLatch( 11 ); // 10 for unregistrations of B,C,D,E,F,G,H,I,J,K + 1 for Main.unbindA + } + return running; + } + + private String dumpThreads() + { + ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean(); + StringBuffer b = new StringBuffer( "Thread dump\n" ); + ThreadInfo[] infos = threadMXBean.dumpAllThreads( threadMXBean.isObjectMonitorUsageSupported(), threadMXBean.isSynchronizerUsageSupported() ); + for ( int i = 0; i < infos.length; i++ ) + { + ThreadInfo ti = infos[i]; + b.append( "\n\nThreadId: " ).append( ti.getThreadId() ).append( " : name: " ).append( ti.getThreadName() ).append( " State: " ).append( ti.getThreadState() ); + b.append( "\n LockInfo: " ).append( ti.getLockInfo() ).append( " LockOwnerId: " ).append( ti.getLockOwnerId() ).append( " LockOwnerName: ").append( ti.getLockOwnerName() ); + StackTraceElement[] stackTrace = ti.getStackTrace(); + for (int j = 0; j < stackTrace.length; j++ ) + { + b.append( "\n " ).append( stackTrace[j] ); + } + } + return b.toString(); + } + + private void dumpA() + { + ComponentDescriptionDTO c = m_scr + .getComponentDescriptionDTO(m_bctx.getBundle(), "org.apache.felix.scr.integration.components.felix3680_2.A" ); + m_logService.log( LogService.LOG_WARNING, "State of " + c.name + " enabled:" + m_scr.isComponentEnabled(c) + "\n" ); + } + + +}
Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/felix4188/Felix4188Component.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/felix4188/Felix4188Component.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/felix4188/Felix4188Component.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/felix4188/Felix4188Component.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,46 @@ +/* + * 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.integration.components.felix4188; + +import org.osgi.framework.Bundle; +import org.osgi.framework.FrameworkUtil; + +public class Felix4188Component { + + public Bundle bundle; + public Throwable throwable; + public int state; + + void start() + { + bundle = FrameworkUtil.getBundle(getClass()); + } + + void stop() + { + try { + Thread.sleep(2000); + state = bundle.getState(); + bundle.getBundleContext().getBundle(); + } catch (Throwable t) { + throwable = t; + } + } + +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/packageinfo URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/packageinfo?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/packageinfo (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/packageinfo Wed Jul 8 22:10:14 2015 @@ -0,0 +1 @@ +version 1.0.0 \ No newline at end of file Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/.classpath URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/.classpath?rev=1689973&view=auto ============================================================================== Binary file - no diff available. Propchange: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/.classpath ------------------------------------------------------------------------------ svn:mime-type = application/xml Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/.gitignore URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/.gitignore?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/.gitignore (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/.gitignore Wed Jul 8 22:10:14 2015 @@ -0,0 +1,3 @@ +/bin/ +/bin_test/ +/generated/ Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/.project URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/.project?rev=1689973&view=auto ============================================================================== Binary file - no diff available. Propchange: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/.project ------------------------------------------------------------------------------ svn:mime-type = application/xml Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/.settings/org.eclipse.jdt.core.prefs URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/.settings/org.eclipse.jdt.core.prefs?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/.settings/org.eclipse.jdt.core.prefs (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/.settings/org.eclipse.jdt.core.prefs Wed Jul 8 22:10:14 2015 @@ -0,0 +1,296 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=next_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=false +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=1 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=120 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/.settings/org.eclipse.jdt.ui.prefs URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/.settings/org.eclipse.jdt.ui.prefs?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/.settings/org.eclipse.jdt.ui.prefs (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/.settings/org.eclipse.jdt.ui.prefs Wed Jul 8 22:10:14 2015 @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +formatter_profile=_Apache Felix Eclipse Template +formatter_settings_version=12 Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/bnd.bnd URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/bnd.bnd?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/bnd.bnd (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/bnd.bnd Wed Jul 8 22:10:14 2015 @@ -0,0 +1,62 @@ +Bundle-Version: 1.0.0 +-buildpath: \ + org.osgi:org.osgi.core;version=6.0.0,\ + org.osgi:org.osgi.annotation;version=6.0.0,\ + org.osgi:org.osgi.enterprise;version=5.0.0,\ + org.apache.felix:org.apache.felix.utils;version=1.4.2;strategy=exact,\ + org.codehaus.mojo:animal-sniffer-annotations;version=1.9;strategy=exact,\ + net.sf.kxml:kxml2;version=2.2.2;strategy=exact,\ + org.apache.felix:org.apache.felix.gogo.runtime;version=0.6.1,\ + org.apache.felix:org.apache.felix.shell;version=1.0.0,\ + ${junit},\ + org.mockito.mockito-all;version=1.9,\ + org.easymock:easymock;version=3.1;strategy=exact +Bundle-Category: osgi +Bundle-DocURL: http://felix.apache.org/site/apache-felix-service-component-runtime.html +Bundle-Activator: org.apache.felix.scr.impl.Activator + +Provide-Capability: osgi.extender;\ + osgi.extender="osgi.component";\ + uses:="org.osgi.service.component";\ + version:Version="1.3",\ + osgi.service;\ + objectClass:List<String>="org.osgi.service.component.runtime.ServiceComponentRuntime";\ + uses:="org.osgi.service.component.runtime" + + +Export-Package: org.apache.felix.scr.component;version=1.1.0;provide:=true, \ + org.apache.felix.scr.info;version=1.0.0;provide:=true, \ + org.osgi.service.component;version=1.3;-split-package:=first;provide:=true, \ + org.osgi.service.component.runtime;version=1.3;provide:=true, \ + org.osgi.service.component.runtime.dto;version=1.3;provide:=true, \ + org.osgi.util.function;version=1.0, \ + org.osgi.util.promise;version=1.0 + +Private-Package: org.apache.felix.scr.impl.*, \ + org.apache.felix.utils.extender + +# Configuration Admin is optional and dynamic, but allow eager wiring by importing it +# LogService is optional but if present the R4.0 version 1.3 is sufficient. +# Metatype import is optional and dynamic, but allow eager wiring by importing it +# PackageAdmin is used to find reference types if the component's bundle does not import it. +# R4.0 version 1.2 is sufficient. +# optional import for Gogo annotations +# The Felix Shell support is optional +Import-Package: \ + org.osgi.service.cm;version="[1.2,2)";resolution:=optional, \ + org.osgi.service.log;version="[1.3,2)";resolution:=optional, \ + org.osgi.service.metatype;version="[1.1,2)";resolution:=optional, \ + org.osgi.service.packageadmin;version="[1.2,2)";resolution:=optional, \ + org.osgi.util.function;version="[1.0,2)", \ + org.apache.felix.service.command;resolution:=optional, \ + org.apache.felix.shell;provide:=true;resolution:=optional, \ + * + +DynamicImport-Package: \ + org.osgi.service.cm;version="[1.2,2)", \ + org.osgi.service.metatype;version="[1.1,2)" + +Include-Resource: \ + @kxml2-2.2.2.jar!/org/kxml2/io/KXmlParser.class|org/xmlpull/v1/XmlPull** + + Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/src/.gitignore URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/src/.gitignore?rev=1689973&view=auto ============================================================================== (empty) Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/src/org/apache/felix/scr/component/ExtComponentContext.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/src/org/apache/felix/scr/component/ExtComponentContext.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/src/org/apache/felix/scr/component/ExtComponentContext.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/src/org/apache/felix/scr/component/ExtComponentContext.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.felix.scr.component; + + +import java.util.Dictionary; + +import org.osgi.service.component.ComponentContext; + + +/** + * The <code>ExtComponentContext</code> is a custom extension of the + * standard ComponentContext allowing to update the service registration + * properties of a component registered as a service. + */ +public interface ExtComponentContext extends ComponentContext +{ + + /** + * Sets the service registration properties of the component + * registered as a service. If the component is not registered as + * a service, this method has no effect. + * <p> + * The <code>component.id</code> and <code>component.name</code> + * property are set by the Service Component Runtime and cannot be + * removed or replaced. + * + * @param properties properties to update the default component + * properties with. If this is <code>null</code> or empty the + * default set of properties as defined in Section 112.6, + * Component Properties, are used as the service registration + * properties. + * + * @throws IllegalStateException if this method is called for a + * Component Factory component + */ + void setServiceProperties( Dictionary<String, ?> properties ); + +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/src/org/apache/felix/scr/component/ExtFactoryComponentInstance.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/src/org/apache/felix/scr/component/ExtFactoryComponentInstance.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/src/org/apache/felix/scr/component/ExtFactoryComponentInstance.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/src/org/apache/felix/scr/component/ExtFactoryComponentInstance.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,30 @@ +/* + * 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.component; + +import java.util.Dictionary; + +import org.osgi.service.component.ComponentInstance; + +public interface ExtFactoryComponentInstance extends ComponentInstance +{ + + void modify( Dictionary<String, ?> properties ); + +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/src/org/apache/felix/scr/impl/Activator.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/src/org/apache/felix/scr/impl/Activator.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/src/org/apache/felix/scr/impl/Activator.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds/src/org/apache/felix/scr/impl/Activator.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,546 @@ +/* + * 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.impl; + + +import java.io.PrintStream; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import org.apache.felix.scr.impl.config.ScrConfiguration; +import org.apache.felix.scr.impl.runtime.ServiceComponentRuntimeImpl; +import org.apache.felix.utils.extender.AbstractExtender; +import org.apache.felix.utils.extender.Extension; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceRegistration; +import org.osgi.framework.wiring.BundleRevision; +import org.osgi.framework.wiring.BundleWire; +import org.osgi.framework.wiring.BundleWiring; +import org.osgi.namespace.extender.ExtenderNamespace; +import org.osgi.service.component.ComponentConstants; +import org.osgi.service.component.runtime.ServiceComponentRuntime; +import org.osgi.service.log.LogService; +import org.osgi.util.tracker.ServiceTracker; + + +/** + * This activator is used to cover requirement described in section 112.8.1 @@ -27,14 + * 37,202 @@ in active bundles. + * + */ +public class Activator extends AbstractExtender +{ + // name of the LogService class (this is a string to not create a reference to the class) + static final String LOGSERVICE_CLASS = "org.osgi.service.log.LogService"; + + // name of the PackageAdmin class (this is a string to not create a reference to the class) + static final String PACKAGEADMIN_CLASS = "org.osgi.service.packageadmin.PackageAdmin"; + + // Our configuration from bundle context properties and Config Admin + private static ScrConfiguration m_configuration; + + // this bundle's context + private static BundleContext m_context; + + // this bundle + private static Bundle m_bundle; + + // the log service to log messages to + private static volatile ServiceTracker<LogService, LogService> m_logService; + + // the package admin service (see BindMethod.getParameterClass) + private static volatile ServiceTracker<?, ?> m_packageAdmin; + + // map of BundleComponentActivator instances per Bundle indexed by Bundle id + private Map<Long, BundleComponentActivator> m_componentBundles; + + // registry of managed component + private ComponentRegistry m_componentRegistry; + + // thread acting upon configurations + private ComponentActorThread m_componentActor; + + private ServiceRegistration<?> m_runtime_reg; + + private ScrCommand m_scrCommand; + + public Activator() { + m_configuration = new ScrConfiguration( this ); + setSynchronous(true); + } + + /** + * Registers this instance as a (synchronous) bundle listener and loads the + * components of already registered bundles. + * + * @param context The <code>BundleContext</code> of the SCR implementation + * bundle. + */ + @Override + public void start( BundleContext context ) throws Exception + { + m_context = context; + m_bundle = context.getBundle(); + // require the log service + m_logService = new ServiceTracker<LogService, LogService>( m_context, LOGSERVICE_CLASS, null ); + m_logService.open(); + // get the configuration + m_configuration.start( m_context ); //this will call restart, which calls super.start. + } + + public void restart( boolean globalExtender ) + { + BundleContext context; + if ( globalExtender ) + { + context = m_context.getBundle( 0 ).getBundleContext(); + } + else + { + context = m_context; + } + if ( m_packageAdmin != null ) + { + log( LogService.LOG_INFO, m_bundle, "Stopping to restart with new globalExtender setting: " + globalExtender, null ); + //this really is a restart, not the initial start + try + { + super.stop(context); + } + catch ( Exception e ) + { + log( LogService.LOG_ERROR, m_bundle, "Exception stopping during restart", e ); + } + } + try + { + log( LogService.LOG_INFO, m_bundle, "Starting with globalExtender setting: " + globalExtender, null ); + super.start( context ); + } + catch ( Exception e ) + { + log( LogService.LOG_ERROR, m_bundle, "Exception starting during restart", e ); + } + + } + + @Override + protected void doStart() throws Exception { + + // prepare component registry + m_componentBundles = new HashMap<Long, BundleComponentActivator>(); + m_componentRegistry = new ComponentRegistry( m_context ); + + final ServiceComponentRuntime runtime = new ServiceComponentRuntimeImpl(m_context, m_componentRegistry); + m_runtime_reg = m_context.registerService(ServiceComponentRuntime.class, + runtime, null); + + // log SCR startup + log( LogService.LOG_INFO, m_bundle, " Version = {0}", + new Object[] {m_bundle.getHeaders().get( Constants.BUNDLE_VERSION )}, null ); + + // create and start the component actor + m_componentActor = new ComponentActorThread(); + Thread t = new Thread(m_componentActor, "SCR Component Actor"); + t.setDaemon( true ); + t.start(); + + super.doStart(); + + m_scrCommand = ScrCommand.register(m_context, runtime, m_configuration); + m_configuration.setScrCommand( m_scrCommand ); + } + + @Override + public void stop(BundleContext context) throws Exception + { + super.stop(context); + m_configuration.stop(); + m_configuration = null; + } + + + /** + * Unregisters this instance as a bundle listener and unloads all components + * which have been registered during the active life time of the SCR + * implementation bundle. + */ + @Override + public void doStop() throws Exception + { + // stop tracking + super.doStop(); + + if (m_scrCommand != null) + { + m_scrCommand.unregister(); + m_scrCommand = null; + } + if (m_runtime_reg != null) + { + m_runtime_reg.unregister(); + m_runtime_reg = null; + } + // dispose component registry + if ( m_componentRegistry != null ) + { + m_componentRegistry.dispose(); + m_componentRegistry = null; + } + + // terminate the actor thread + if ( m_componentActor != null ) + { + m_componentActor.terminate(); + m_componentActor = null; + } + + // close the LogService tracker now + if ( m_logService != null ) + { + m_logService.close(); + m_logService = null; + } + + // close the PackageAdmin tracker now + if ( m_packageAdmin != null ) + { + m_packageAdmin.close(); + m_packageAdmin = null; + } + + // remove the reference to the component context + m_context = null; + } + + + //---------- Component Management ----------------------------------------- + + + @Override + protected Extension doCreateExtension(final Bundle bundle) throws Exception + { + return new ScrExtension(bundle); + } + + protected class ScrExtension implements Extension { + + private final Bundle bundle; + private final CountDownLatch started; + + public ScrExtension(Bundle bundle) { + this.bundle = bundle; + this.started = new CountDownLatch(1); + } + + public void start() { + try { + loadComponents( ScrExtension.this.bundle ); + } finally { + started.countDown(); + } + } + + public void destroy() { + try { + this.started.await(m_configuration.stopTimeout(), TimeUnit.MILLISECONDS); + } catch (InterruptedException e) { + log( LogService.LOG_WARNING, m_bundle, "The wait for bundle {0}/{1} being started before destruction has been interrupted.", + new Object[] {bundle.getSymbolicName(), bundle.getBundleId()}, e ); + } + disposeComponents( this.bundle ); + } + } + + /** + * Loads the components of the given bundle. If the bundle has no + * <i>Service-Component</i> header, this method has no effect. The + * fragments of a bundle are not checked for the header (112.4.1). + * <p> + * This method calls the {@link Bundle#getBundleContext()} method to find + * the <code>BundleContext</code> of the bundle. If the context cannot be + * found, this method does not load components for the bundle. + */ + private void loadComponents( Bundle bundle ) + { + if ( bundle.getHeaders().get( ComponentConstants.SERVICE_COMPONENT ) == null ) + { + // no components in the bundle, abandon + return; + } + + // there should be components, load them with a bundle context + BundleContext context = bundle.getBundleContext(); + if ( context == null ) + { + log( LogService.LOG_ERROR, m_bundle, "Cannot get BundleContext of bundle {0}/{1}", + new Object[] {bundle.getSymbolicName(), bundle.getBundleId()}, null ); + return; + } + + //Examine bundle for extender requirement; if present check if bundle is wired to us. + BundleWiring wiring = bundle.adapt(BundleWiring.class); + List<BundleWire> extenderWires = wiring.getRequiredWires(ExtenderNamespace.EXTENDER_NAMESPACE); + try + { + for (BundleWire wire: extenderWires) + { + if (ComponentConstants.COMPONENT_CAPABILITY_NAME.equals(wire.getCapability().getAttributes().get(ExtenderNamespace.EXTENDER_NAMESPACE))) + { + if (!m_bundle.adapt(BundleRevision.class).equals(wire.getProvider())) + { + log( LogService.LOG_DEBUG, m_bundle, "Bundle {0}/{1} wired to a different extender: {2}", + new Object[] {bundle.getSymbolicName(), bundle.getBundleId(), wire.getProvider().getSymbolicName()}, null ); + return; + } + break; + } + } + } + catch (NoSuchMethodError e) + { + log( LogService.LOG_DEBUG, m_bundle, "Cannot determine bundle wiring on pre R6 framework", + null, null ); + } + + // FELIX-1666 method is called for the LAZY_ACTIVATION event and + // the started event. Both events cause this method to be called; + // so we have to make sure to not load components twice + // FELIX-2231 Mark bundle loaded early to prevent concurrent loading + // if LAZY_ACTIVATION and STARTED event are fired at the same time + final boolean loaded; + final Long bundleId = bundle.getBundleId(); + synchronized ( m_componentBundles ) + { + if ( m_componentBundles.containsKey( bundleId ) ) + { + loaded = true; + } + else + { + m_componentBundles.put( bundleId, null ); + loaded = false; + } + } + + // terminate if already loaded (or currently being loaded) + if ( loaded ) + { + log( LogService.LOG_DEBUG, m_bundle, "Components for bundle {0}/{1} already loaded. Nothing to do.", + new Object[] {bundle.getSymbolicName(), bundle.getBundleId()}, null ); + return; + } + + try + { + BundleComponentActivator ga = new BundleComponentActivator( m_componentRegistry, m_componentActor, context, + m_configuration ); + ga.initialEnable(); + + // replace bundle activator in the map + synchronized ( m_componentBundles ) + { + m_componentBundles.put( bundleId, ga ); + } + } + catch ( Exception e ) + { + // remove the bundle id from the bundles map to ensure it is + // not marked as being loaded + synchronized ( m_componentBundles ) + { + m_componentBundles.remove( bundleId ); + } + + if ( e instanceof IllegalStateException && bundle.getState() != Bundle.ACTIVE ) + { + log( + LogService.LOG_DEBUG, + m_bundle, + "Bundle {0}/{1} has been stopped while trying to activate its components. Trying again when the bundles gets started again.", + new Object[] {bundle.getSymbolicName(), bundle.getBundleId()}, + e ); + } + else + { + log( LogService.LOG_ERROR, m_bundle, "Error while loading components of bundle {0}/{1}", + new Object[] {bundle.getSymbolicName(), bundle.getBundleId()}, e ); + } + } + } + + + /** + * Unloads components of the given bundle. If no components have been loaded + * for the bundle, this method has no effect. + */ + private void disposeComponents( Bundle bundle ) + { + final Object ga; + synchronized ( m_componentBundles ) + { + ga = m_componentBundles.remove( bundle.getBundleId() ); + } + + if ( ga != null ) + { + try + { + int reason = isStopping() + ? ComponentConstants.DEACTIVATION_REASON_DISPOSED + : ComponentConstants.DEACTIVATION_REASON_BUNDLE_STOPPED; + ( ( BundleComponentActivator ) ga ).dispose( reason ); + } + catch ( Exception e ) + { + log( LogService.LOG_ERROR, m_bundle, "Error while disposing components of bundle {0}/{1}", + new Object[] {bundle.getSymbolicName(), bundle.getBundleId()}, e ); + } + } + } + + @Override + protected void debug(Bundle bundle, String msg) { + final String message = MessageFormat.format( msg + " bundle: {0}/{1}", bundle.getSymbolicName(), bundle.getBundleId() ); + log( LogService.LOG_DEBUG, bundle, message, null ); + } + + @Override + protected void warn(Bundle bundle, String msg, Throwable t) { + final String message = MessageFormat.format( msg + " bundle: {0}/{1}", bundle.getSymbolicName(), bundle.getBundleId() ); + log( LogService.LOG_WARNING, bundle, message, t ); + } + + @Override + protected void error(String msg, Throwable t) { + log( LogService.LOG_DEBUG, m_bundle, msg, t ); + } + + public static void log( int level, Bundle bundle, String pattern, Object[] arguments, Throwable ex ) + { + if ( isLogEnabled( level ) ) + { + final String message = MessageFormat.format( pattern, arguments ); + log( level, bundle, message, ex ); + } + } + + /** + * Returns <code>true</code> if logging for the given level is enabled. + */ + public static boolean isLogEnabled( int level ) + { + return m_configuration == null || m_configuration.getLogLevel() >= level; + } + + /** + * Method to actually emit the log message. If the LogService is available, + * the message will be logged through the LogService. Otherwise the message + * is logged to stdout (or stderr in case of LOG_ERROR level messages), + * + * @param level The log level to log the message at + * @param message The message to log + * @param ex An optional <code>Throwable</code> whose stack trace is written, + * or <code>null</code> to not log a stack trace. + */ + public static void log( int level, Bundle bundle, String message, Throwable ex ) + { + if ( isLogEnabled( level ) ) + { + ServiceTracker<LogService, LogService> t = m_logService; + LogService logger = ( t != null ) ? t.getService() : null; + if ( logger == null ) + { + // output depending on level + PrintStream out = ( level == LogService.LOG_ERROR ) ? System.err : System.out; + + // level as a string + StringBuffer buf = new StringBuffer(); + switch ( level ) + { + case ( LogService.LOG_DEBUG ): + buf.append( "DEBUG: " ); + break; + case ( LogService.LOG_INFO ): + buf.append( "INFO : " ); + break; + case ( LogService.LOG_WARNING ): + buf.append( "WARN : " ); + break; + case ( LogService.LOG_ERROR ): + buf.append( "ERROR: " ); + break; + default: + buf.append( "UNK : " ); + break; + } + + // bundle information + if ( bundle != null ) + { + buf.append( bundle.getSymbolicName() ); + buf.append( " (" ); + buf.append( bundle.getBundleId() ); + buf.append( "): " ); + } + + // the message + buf.append( message ); + + // keep the message and the stacktrace together + synchronized ( out) + { + out.println( buf ); + if ( ex != null ) + { + ex.printStackTrace( out ); + } + } + } + else + { + logger.log( level, message, ex ); + } + } + } + + + public static Object getPackageAdmin() + { + if ( m_packageAdmin == null ) + { + synchronized ( Activator.class ) + { + if ( m_packageAdmin == null ) + { + m_packageAdmin = new ServiceTracker( m_context, PACKAGEADMIN_CLASS, null ); + m_packageAdmin.open(); + } + } + } + + return m_packageAdmin.getService(); + } +} \ No newline at end of file
