Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff McAffer2007-08-29 22:53:04 -0400
committerJeff McAffer2007-08-29 22:53:04 -0400
commit6d2ace02d1a3ec53498aaa4269aae0d9a11a7355 (patch)
treee0459538f086d1e7964c563ccac970d9e07719a0
parent4df356a90682672d04d2bd05ffb09b4cc1fade53 (diff)
downloadrt.equinox.p2-6d2ace02d1a3ec53498aaa4269aae0d9a11a7355.tar.gz
rt.equinox.p2-6d2ace02d1a3ec53498aaa4269aae0d9a11a7355.tar.xz
rt.equinox.p2-6d2ace02d1a3ec53498aaa4269aae0d9a11a7355.zip
initial commit
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/.classpath7
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/.project28
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/.settings/org.eclipse.jdt.core.prefs331
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/.settings/org.eclipse.jdt.ui.prefs54
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF18
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/build.properties4
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/p2/directorywatcher/Activator.java109
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/p2/directorywatcher/ConfigFileListener.java121
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/p2/directorywatcher/JARFileListener.java131
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/p2/directorywatcher/ProvisioningListener.java145
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/p2/directorywatcher/DirectoryWatcher.java197
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/p2/directorywatcher/IDirectoryChangeListener.java20
13 files changed, 1169 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/.classpath b/bundles/org.eclipse.equinox.p2.directorywatcher/.classpath
new file mode 100644
index 000000000..ce0c7a5d4
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.0%Foundation-1.0"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/.project b/bundles/org.eclipse.equinox.p2.directorywatcher/.project
new file mode 100644
index 000000000..b26a90d31
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.p2.directorywatcher</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.directorywatcher/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..78523cd05
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,331 @@
+#Thu Aug 16 11:00:59 EDT 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+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.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=error
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.3
+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_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_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=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=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_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=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+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=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_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not 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=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not 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=do not 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_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=do not 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_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_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=do not 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_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=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=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_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_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_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.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=800
+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=false
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+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.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.directorywatcher/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..51c225ffe
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,54 @@
+#Wed Aug 29 12:30:32 EDT 2007
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_core
+formatter_settings_version=11
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates/>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.equinox.p2.directorywatcher/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 000000000..6904bd96c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+#Sat Aug 11 20:17:52 EDT 2007
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..60ada7662
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Directorywatcher Bundle
+Bundle-SymbolicName: org.eclipse.equinox.p2.directorywatcher
+Bundle-Version: 0.1.0.qualifier
+Bundle-Activator: org.eclipse.equinox.internal.p2.directorywatcher.Activator
+Import-Package: org.eclipse.equinox.prov.core.helpers,
+ org.eclipse.equinox.prov.metadata.generator,
+ org.eclipse.equinox.prov.metadata.repository,
+ org.osgi.framework;version="1.4.0",
+ org.osgi.service.cm;version="1.2.0";resolution:=optional,
+ org.osgi.service.packageadmin;version="1.2.0",
+ org.osgi.util.tracker;version="1.3.0"
+Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0,
+ J2SE-1.3
+Export-Package: org.eclipse.equinox.internal.p2.directorywatcher;x-internal:=true,
+ org.eclipse.equinox.p2.directorywatcher
+Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.3.0,4.0)"
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/build.properties b/bundles/org.eclipse.equinox.p2.directorywatcher/build.properties
new file mode 100644
index 000000000..34d2e4d2d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/p2/directorywatcher/Activator.java b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/p2/directorywatcher/Activator.java
new file mode 100644
index 000000000..98f243942
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/p2/directorywatcher/Activator.java
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * Copyright (c) 2007 aQute, IBM Corporation and others. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: aQute - initial implementation and ideas IBM Corporation -
+ * initial adaptation to Equinox provisioning use
+ ******************************************************************************/
+package org.eclipse.equinox.internal.p2.directorywatcher;
+
+import java.util.*;
+import org.eclipse.equinox.p2.directorywatcher.DirectoryWatcher;
+import org.osgi.framework.*;
+import org.osgi.service.cm.*;
+import org.osgi.service.packageadmin.PackageAdmin;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * This clever little bundle watches a directory and will install any jar file
+ * if finds in that directory
+ */
+
+public class Activator implements BundleActivator, ManagedServiceFactory {
+ static ServiceTracker packageAdminTracker;
+ static ServiceTracker configAdminTracker;
+
+ private static BundleContext context;
+ Map watchers = null;
+
+ public static BundleContext getContext() {
+ return context;
+ }
+
+ public void start(BundleContext context) throws Exception {
+ this.context = context;
+ watchers = new HashMap();
+ Hashtable props = new Hashtable();
+ props.put(Constants.SERVICE_PID, getName());
+ context.registerService(ManagedServiceFactory.class.getName(), this, props);
+
+ packageAdminTracker = new ServiceTracker(context, PackageAdmin.class.getName(), null);
+ packageAdminTracker.open();
+ configAdminTracker = new ServiceTracker(context, ConfigurationAdmin.class.getName(), null);
+ configAdminTracker.open();
+
+ // Created the initial configuration
+ Hashtable properties = new Hashtable();
+ set(properties, DirectoryWatcher.POLL);
+ set(properties, DirectoryWatcher.DIR);
+ set(properties, DirectoryWatcher.DEBUG);
+ updated("initial", properties);
+ }
+
+ private void set(Hashtable properties, String key) {
+ Object o = context.getProperty(key);
+ if (o == null)
+ return;
+ properties.put(key, o);
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ if (watchers == null)
+ return;
+ for (Iterator i = watchers.values().iterator(); i.hasNext();)
+ try {
+ DirectoryWatcher watcher = (DirectoryWatcher) i.next();
+ watcher.close();
+ } catch (Exception e) {
+ // Ignore
+ }
+ watchers = null;
+ configAdminTracker.close();
+ packageAdminTracker.close();
+ }
+
+ public void deleted(String pid) {
+ DirectoryWatcher watcher = (DirectoryWatcher) watchers.remove(pid);
+ if (watcher != null)
+ watcher.close();
+ }
+
+ public String getName() {
+ return "equinox.p2.directorywatcher";
+ }
+
+ public void updated(String pid, Dictionary properties) throws ConfigurationException {
+ deleted(pid);
+ DirectoryWatcher watcher = new DirectoryWatcher(properties, context);
+ watchers.put(pid, properties);
+ watcher.addListener(new JARFileListener());
+ watcher.start();
+ }
+
+ public static ConfigurationAdmin getConfigAdmin() {
+ return (ConfigurationAdmin) Activator.configAdminTracker.getService();
+ }
+
+ public static PackageAdmin getPackageAdmin(int timeout) {
+ if (timeout == 0)
+ return (PackageAdmin) packageAdminTracker.getService();
+ try {
+ return (PackageAdmin) packageAdminTracker.waitForService(timeout);
+ } catch (InterruptedException e) {
+ return null;
+ }
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/p2/directorywatcher/ConfigFileListener.java b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/p2/directorywatcher/ConfigFileListener.java
new file mode 100644
index 000000000..56f60ffca
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/p2/directorywatcher/ConfigFileListener.java
@@ -0,0 +1,121 @@
+package org.eclipse.equinox.internal.p2.directorywatcher;
+
+import java.io.*;
+import java.util.*;
+import org.eclipse.equinox.p2.directorywatcher.IDirectoryChangeListener;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+public class ConfigFileListener implements IDirectoryChangeListener {
+ public final static String ALIAS_KEY = ".alias_factory_pid";
+
+ private Map seenFiles = new HashMap();
+
+ public boolean added(File file) {
+ // load the input file into a hashtable of settings...
+ Properties temp = new Properties();
+ InputStream in = null;
+ try {
+ in = new FileInputStream(file);
+ try {
+ temp.load(in);
+ } finally {
+ in.close();
+ }
+ } catch (IOException e) {
+ // TODO proper logging etc here
+ e.printStackTrace();
+ }
+ Hashtable settings = new Hashtable();
+ settings.putAll(temp);
+
+ String pid[] = parsePid(file.getName());
+ if (pid[1] != null)
+ settings.put(ALIAS_KEY, pid[1]);
+ Configuration config = getConfiguration(pid[0], pid[1]);
+ if (config == null)
+ return false;
+ if (config.getBundleLocation() != null)
+ config.setBundleLocation(null);
+ try {
+ config.update(settings);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ seenFiles.put(file, new Long(file.lastModified()));
+ return true;
+ }
+
+ public boolean changed(File file) {
+ return added(file);
+ }
+
+ private Configuration getConfiguration(String pid, String factoryPid) {
+ ConfigurationAdmin cm = Activator.getConfigAdmin();
+ if (cm == null)
+ return null;
+
+ try {
+ if (factoryPid != null) {
+ Configuration configs[] = null;
+ try {
+ configs = cm.listConfigurations("(" + ALIAS_KEY + "=" + factoryPid + ")");
+ } catch (InvalidSyntaxException e) {
+ return null;
+ }
+ if (configs == null || configs.length == 0)
+ return cm.createFactoryConfiguration(pid, null);
+ else
+ return configs[0];
+ } else
+ return cm.getConfiguration(pid, null);
+ } catch (IOException e) {
+ return null;
+ }
+ }
+
+ public String[] getExtensions() {
+ return new String[] {".cfg"};
+ }
+
+ public Long getSeenFile(File file) {
+ return (Long) seenFiles.get(file);
+ }
+
+ private String[] parsePid(String path) {
+ String pid = path.substring(0, path.length() - 4);
+ int n = pid.indexOf('-');
+ if (n > 0) {
+ String factoryPid = pid.substring(n + 1);
+ pid = pid.substring(0, n);
+ return new String[] {pid, factoryPid};
+ } else
+ return new String[] {pid, null};
+ }
+
+ public boolean removed(File file) {
+ String pid[] = parsePid(file.getName());
+ Configuration config = getConfiguration(pid[0], pid[1]);
+ if (config == null)
+ return false;
+ try {
+ config.delete();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ seenFiles.remove(file);
+ return true;
+ }
+
+ public void startPoll() {
+ // TODO Auto-generated method stub
+ }
+
+ public void stopPoll() {
+ // TODO Auto-generated method stub
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/p2/directorywatcher/JARFileListener.java b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/p2/directorywatcher/JARFileListener.java
new file mode 100644
index 000000000..cf87b4f23
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/p2/directorywatcher/JARFileListener.java
@@ -0,0 +1,131 @@
+package org.eclipse.equinox.internal.p2.directorywatcher;
+
+import java.io.*;
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.equinox.p2.directorywatcher.IDirectoryChangeListener;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+public class JARFileListener implements IDirectoryChangeListener {
+ private boolean refresh = false;
+ private Map seenFiles = new HashMap();
+
+ public boolean added(File file) {
+ InputStream in;
+ try {
+ in = new FileInputStream(file);
+ } catch (FileNotFoundException e1) {
+ return false;
+ }
+ Bundle bundle;
+ try {
+ bundle = Activator.getContext().installBundle(file.getAbsolutePath(), in);
+ } catch (BundleException e1) {
+ return false;
+ } finally {
+ try {
+ in.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ refresh = true;
+ if (!isFragment(bundle))
+ try {
+ bundle.start();
+ } catch (BundleException e) {
+ // TODO ignore for now
+ }
+ seenFiles.put(file, new Long(file.lastModified()));
+ return true;
+ }
+
+ private Bundle findBundle(String location) {
+ Bundle bundles[] = Activator.getContext().getBundles();
+ for (int i = 0; i < bundles.length; i++) {
+ Bundle bundle = bundles[i];
+ if (bundle.getLocation().equals(location))
+ return bundle;
+ }
+ return null;
+ }
+
+ public boolean changed(File file) {
+ Bundle bundle = findBundle(file.getAbsolutePath());
+ if (bundle == null)
+ // This is actually a goofy condition since we think this file changed but there
+ // is no bundle for it. Perhaps we found it previously but somehow failed to install
+ // it previously or it was uninstalled or...
+ return false;
+ InputStream in;
+ try {
+ in = new FileInputStream(file);
+ } catch (FileNotFoundException e) {
+ return false;
+ }
+ try {
+ bundle.update(in);
+ } catch (BundleException e) {
+ return false;
+ }
+ refresh = true;
+ try {
+ in.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ seenFiles.put(file, new Long(file.lastModified()));
+ return true;
+ }
+
+ public String[] getExtensions() {
+ return new String[] {".jar"};
+ }
+
+ public boolean removed(File file) {
+ Bundle bundle = findBundle(file.getAbsolutePath());
+ if (bundle == null) {
+ // This is actually a goofy condition since we think this file changed but there
+ // is no bundle for it. Perhaps we found it previously but somehow failed to install
+ // it previously or it was uninstalled or...
+ // Anyway, the bundle is gone so say we were successful anyway...
+ seenFiles.remove(file);
+ return true;
+ }
+ try {
+ bundle.uninstall();
+ } catch (BundleException e) {
+ return false;
+ }
+ refresh = true;
+ seenFiles.remove(file);
+ return true;
+ }
+
+ private boolean isFragment(Bundle bundle) {
+ PackageAdmin packageAdmin = Activator.getPackageAdmin(10000);
+ if (packageAdmin != null)
+ return packageAdmin.getBundleType(bundle) == PackageAdmin.BUNDLE_TYPE_FRAGMENT;
+ return false;
+ }
+
+ public void startPoll() {
+ refresh = false;
+ }
+
+ public void stopPoll() {
+ if (refresh) {
+ PackageAdmin packageAdmin = Activator.getPackageAdmin(10000);
+ if (packageAdmin != null)
+ packageAdmin.refreshPackages(null);
+ refresh = false;
+ }
+ }
+
+ public Long getSeenFile(File file) {
+ return (Long) seenFiles.get(file);
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/p2/directorywatcher/ProvisioningListener.java b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/p2/directorywatcher/ProvisioningListener.java
new file mode 100644
index 000000000..209d43a42
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/p2/directorywatcher/ProvisioningListener.java
@@ -0,0 +1,145 @@
+package org.eclipse.equinox.internal.p2.directorywatcher;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.*;
+import org.eclipse.equinox.p2.directorywatcher.DirectoryWatcher;
+import org.eclipse.equinox.p2.directorywatcher.IDirectoryChangeListener;
+import org.eclipse.equinox.prov.core.helpers.ServiceHelper;
+import org.eclipse.equinox.prov.metadata.generator.*;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepositoryManager;
+
+public class ProvisioningListener implements IDirectoryChangeListener {
+
+ // The mapping rules for in-place generation need to construct paths that are flat,
+ // with no nesting structure.
+ static final private String[][] INPLACE_MAPPING_RULES = { {"(& (namespace=eclipse) (classifier=feature))", "${repoUrl}/features/${id}_${version}.jar"}, //$NON-NLS-1$//$NON-NLS-2$
+ {"(& (namespace=eclipse) (classifier=plugin))", "${repoUrl}/${id}_${version}.jar"}, //$NON-NLS-1$//$NON-NLS-2$
+ {"(& (namespace=eclipse) (classifier=native))", "${repoUrl}/${id}_${version}"}}; //$NON-NLS-1$//$NON-NLS-2$
+
+ private Set toUninstall;
+ private Set toUpdate;
+ private Set toInstall;
+ private Set toGenerate;
+ private DirectoryWatcher watcher;
+ private IMetadataRepository metadataRepository;
+ private Map seenFiles;
+
+ public ProvisioningListener(DirectoryWatcher watcher) {
+ this.watcher = watcher;
+ seenFiles = new HashMap();
+ }
+
+ public boolean added(File file) {
+ toInstall.add(file);
+ if (file.getName().endsWith(".iu")) {
+ // add the IU and artifact entries in to the repo associated with the watched dir
+ // keep track of the JARs added so we can remove them from the list of JARs
+ // to be run through the metadata generator
+ } else if (file.getName().endsWith(".jar")) {
+ // queue up this JAR to be run through the metadata generator if needed
+ toGenerate.add(file);
+ }
+ seenFiles.put(file, new Long(file.lastModified()));
+ return true;
+ }
+
+ public boolean changed(File file) {
+ toUpdate.add(file);
+ if (file.getName().endsWith(".iu")) {
+ // overwrite the IU and artifact entries in to the repo associated with the watched dir
+ // keep track of the JARs added so we can remove them from the list of JARs
+ // to be run through the metadata generator
+ } else if (file.getName().endsWith(".jar")) {
+ // queue up this JAR to be run through the metadata generator
+ toGenerate.add(file);
+ }
+ seenFiles.put(file, new Long(file.lastModified()));
+ return true;
+ }
+
+ public boolean removed(File file) {
+ toUninstall.add(file);
+ if (file.getName().endsWith(".iu")) {
+ // remove the IU and artifact entries in to the repo associated with the watched dir
+ // keep track of the JARs added so we can remove them from the list of JARs
+ // to be run through the metadata generator
+ } else if (file.getName().endsWith(".jar")) {
+ // figure out which IU corresponds to this JAR and remove it
+ }
+ seenFiles.remove(file);
+ return true;
+ }
+
+ public String[] getExtensions() {
+ return new String[] {".iu", ".jar"};
+ }
+
+ private void initialize() {
+ toUninstall = new HashSet(3);
+ toUpdate = new HashSet(3);
+ toInstall = new HashSet(3);
+ toGenerate = new HashSet(3);
+ }
+
+ public void startPoll() {
+ initialize();
+ }
+
+ public void stopPoll() {
+ processIUs();
+ generate();
+ // 1) add/remove/update all the IUs and artifacts in the repo as required
+ // 2) generate all the IUs we need to generate. Here we have to sort out which
+ // JARs are just JARs and which are artifacts that have associated IUs. Anything with
+ // an IU already does not need to be generated
+ // reconcile the lists to ensure that the JAR
+ // 3) construct the set of operations needed and call the engine
+ // 4) kick something if needed
+ initialize();
+ }
+
+ private IGeneratorInfo getProvider(File[] locations, File destination) {
+ EclipseInstallGeneratorInfoProvider provider = new EclipseInstallGeneratorInfoProvider();
+ provider.initialize(null, null, null, locations, null);
+ provider.setMetadataLocation(new File(destination, "content.xml")); //$NON-NLS-1$
+ provider.setArtifactLocation(new File(destination, "artifacts.xml")); //$NON-NLS-1$
+ provider.setPublishArtifactRepository(true);
+ provider.setPublishArtifacts(false);
+ provider.setMappingRules(INPLACE_MAPPING_RULES);
+ return provider;
+ }
+
+ private void processIUs() {
+ }
+
+ private void generate() {
+ IMetadataRepository repo = getMetadataRepository();
+ IGeneratorInfo info = getProvider(new File[] {watcher.getTargetDirectory()}, watcher.getTargetDirectory());
+ info.setMetadataLocation(new File(repo.getURL().toExternalForm().substring(5)));
+ new Generator(info).generate();
+ }
+
+ private IMetadataRepository getMetadataRepository() {
+ if (metadataRepository != null)
+ return metadataRepository;
+ IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName());
+ if (manager != null)
+ return null;
+ URL location = null;
+ try {
+ location = new URL(watcher.getTargetDirectory().toURL(), "content.xml");
+ } catch (MalformedURLException e) {
+ // should never happen...
+ return null;
+ }
+ metadataRepository = manager.getRepository(location);
+ return metadataRepository;
+ }
+
+ public Long getSeenFile(File file) {
+ return (Long) seenFiles.get(file);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/p2/directorywatcher/DirectoryWatcher.java b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/p2/directorywatcher/DirectoryWatcher.java
new file mode 100644
index 000000000..14a398949
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/p2/directorywatcher/DirectoryWatcher.java
@@ -0,0 +1,197 @@
+/*******************************************************************************
+ * Copyright (c) 2007 aQute, IBM Corporation and others. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * aQute - initial implementation and ideas
+ * IBM Corporation - initial adaptation to Equinox provisioning use
+ ******************************************************************************/
+package org.eclipse.equinox.p2.directorywatcher;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.*;
+import org.osgi.framework.BundleContext;
+
+public class DirectoryWatcher extends Thread {
+ public final static String POLL = "eclipse.p2.directory.watcher.poll";
+ public final static String DIR = "eclipse.p2.directory.watcher.dir";
+ public final static String DEBUG = "eclipse.p2.directory.watcher.debug";
+ private static long debug;
+
+ public static void log(String string, Throwable e) {
+ System.err.println(string + ": " + e);
+ if (debug > 0)
+ e.printStackTrace();
+ }
+
+ File targetDirectory;
+ boolean done = false;
+ long poll = 2000;
+ Map processedBundles = new HashMap();
+ Map processedConfigs = new HashMap();
+ private Set listeners = new HashSet();
+ private HashSet scannedFiles = new HashSet();
+ private HashSet removals;
+ private Set pendingDeletions;
+
+ public DirectoryWatcher(Dictionary properties, BundleContext context) {
+ super("Directory Watcher");
+ poll = getLong(context.getProperty(POLL), poll);
+ debug = getLong(context.getProperty(DEBUG), -1);
+
+ String dir = (String) properties.get(DIR);
+ if (dir == null)
+ dir = "./load";
+
+ try {
+ targetDirectory = new File(dir).getCanonicalFile();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ targetDirectory.mkdirs();
+ }
+
+ public void addListener(IDirectoryChangeListener listener) {
+ listeners.add(listener);
+ }
+
+ public void close() {
+ done = true;
+ interrupt();
+ try {
+ join(10000);
+ } catch (InterruptedException ie) {
+ // Ignore
+ }
+ }
+
+ private long getLong(String value, long defaultValue) {
+ if (value != null)
+ try {
+ return Long.parseLong(value);
+ } catch (Exception e) {
+ System.out.println(value + " is not a long");
+ }
+ return defaultValue;
+ }
+
+ public File getTargetDirectory() {
+ return targetDirectory;
+ }
+
+ private boolean isInterested(IDirectoryChangeListener listener, File file) {
+ String[] extensions = listener.getExtensions();
+ for (int i = 0; i < extensions.length; i++)
+ if (file.getPath().endsWith(extensions[i]))
+ return true;
+ return false;
+ }
+
+ /**
+ * Notify the listeners of the files that have been deleted or marked for deletion.
+ */
+ private void notifyRemovals() {
+ Set removed = removals;
+ for (Iterator i = listeners.iterator(); i.hasNext();) {
+ IDirectoryChangeListener listener = (IDirectoryChangeListener) i.next();
+ for (Iterator j = removed.iterator(); j.hasNext();) {
+ File file = (File) j.next();
+ if (isInterested(listener, file))
+ listener.removed(file);
+ }
+ }
+ }
+
+ private void processFile(File file, IDirectoryChangeListener listener) {
+ try {
+ Long oldTimestamp = listener.getSeenFile(file);
+ if (oldTimestamp == null) {
+ // The file is new
+ listener.added(file);
+ } else {
+ // The file is not new but may have changed
+ long lastModified = file.lastModified();
+ if (oldTimestamp.longValue() != lastModified)
+ listener.changed(file);
+ }
+ } catch (Exception e) {
+ log("Processing : " + listener, e);
+ }
+ }
+
+ /**
+ * Try to remove the files that have been marked for deletion.
+ */
+ private void processPendingDeletions() {
+ for (Iterator iterator = pendingDeletions.iterator(); iterator.hasNext();) {
+ File file = (File) iterator.next();
+ if (!file.exists() || file.delete())
+ iterator.remove();
+ new File(file.getPath() + ".del").delete();
+ }
+ }
+
+ public void run() {
+ if (debug > 0) {
+ System.out.println(POLL + "(ms) " + poll);
+ System.out.println(DIR + " " + targetDirectory.getAbsolutePath());
+ System.out.println(DEBUG + " " + debug);
+ }
+ while (!done)
+ try {
+ startPoll();
+ scanDirectory();
+ stopPoll();
+ Thread.sleep(poll);
+ } catch (InterruptedException e) {
+ // ignore
+ } catch (Throwable e) {
+ log("In main loop, we have serious trouble", e);
+ }
+ }
+
+ private void scanDirectory() {
+ File list[] = targetDirectory.listFiles();
+ if (list == null)
+ return;
+ for (int i = 0; i < list.length; i++) {
+ File file = list[i];
+ // if this is a deletion marker then add to the list of pending deletions.
+ if (list[i].getPath().endsWith(".del")) {
+ File target = new File(file.getPath().substring(0, file.getPath().length() - 4));
+ removals.add(target);
+ pendingDeletions.add(target);
+ } else {
+ // else remember that we saw the file and remove it from this list of files to be
+ // removed at the end. Then notify all the listeners as needed.
+ scannedFiles.add(file);
+ removals.remove(file);
+ for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
+ IDirectoryChangeListener listener = (IDirectoryChangeListener) iterator.next();
+ if (isInterested(listener, file))
+ processFile(file, listener);
+ }
+ }
+ }
+ }
+
+ private void startPoll() {
+ removals = scannedFiles;
+ scannedFiles = new HashSet();
+ pendingDeletions = new HashSet();
+ for (Iterator i = listeners.iterator(); i.hasNext();)
+ ((IDirectoryChangeListener) i.next()).startPoll();
+ }
+
+ private void stopPoll() {
+ notifyRemovals();
+ removals = scannedFiles;
+ for (Iterator i = listeners.iterator(); i.hasNext();)
+ ((IDirectoryChangeListener) i.next()).stopPoll();
+ processPendingDeletions();
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/p2/directorywatcher/IDirectoryChangeListener.java b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/p2/directorywatcher/IDirectoryChangeListener.java
new file mode 100644
index 000000000..dcf52f859
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/p2/directorywatcher/IDirectoryChangeListener.java
@@ -0,0 +1,20 @@
+package org.eclipse.equinox.p2.directorywatcher;
+
+import java.io.File;
+
+public interface IDirectoryChangeListener {
+
+ public void startPoll();
+
+ public void stopPoll();
+
+ public String[] getExtensions();
+
+ public boolean added(File file);
+
+ public boolean removed(File file);
+
+ public boolean changed(File file);
+
+ public Long getSeenFile(File file);
+}

Back to the top