Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2013-01-18 01:27:23 -0500
committerslewis2013-01-18 01:27:23 -0500
commitcb4d73609ca031c5649f855b57dd03ed7cfc1b9d (patch)
treefd978c47712e959929584ace3e62984713bd213d /incubation
parent15d0cf001a6ca546eb08955b67a3fe7b9b51494e (diff)
parent6e0debee6465770c617adc3ca4c9c9e04e7c49b5 (diff)
downloadorg.eclipse.ecf-cb4d73609ca031c5649f855b57dd03ed7cfc1b9d.tar.gz
org.eclipse.ecf-cb4d73609ca031c5649f855b57dd03ed7cfc1b9d.tar.xz
org.eclipse.ecf-cb4d73609ca031c5649f855b57dd03ed7cfc1b9d.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'incubation')
-rw-r--r--incubation/bundles/org.eclipse.ecf.bulletinboard/.classpath14
-rw-r--r--incubation/bundles/org.eclipse.ecf.bulletinboard/.settings/org.eclipse.jdt.core.prefs126
-rw-r--r--incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/.classpath14
-rw-r--r--incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/.project56
-rw-r--r--incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/.settings/org.eclipse.jdt.core.prefs156
-rw-r--r--incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/.settings/org.eclipse.pde.core.prefs8
-rw-r--r--incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/.settings/org.eclipse.pde.prefs66
-rw-r--r--incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/build.properties10
-rw-r--r--incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/endpointdescription1.xml98
-rw-r--r--incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/plugin.properties20
-rw-r--r--incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/src/org/eclipse/ecf/provider/internal/endpointdescription/localdiscovery/Activator.java192
-rw-r--r--incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/src/org/eclipse/ecf/provider/internal/endpointdescription/localdiscovery/EndpointDescriptionDiscoveryContainerAdapter.java390
-rw-r--r--incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/src/org/eclipse/ecf/provider/internal/endpointdescription/localdiscovery/EndpointDescriptionParser.java1584
-rw-r--r--incubation/bundles/org.eclipse.ecf.remoteservice.apt.java6/.settings/org.eclipse.jdt.core.prefs154
-rw-r--r--incubation/bundles/org.eclipse.ecf.sync.resources.core/.classpath14
-rw-r--r--incubation/bundles/org.eclipse.ecf.sync.resources.core/.options32
-rw-r--r--incubation/bundles/org.eclipse.ecf.sync.resources.core/.settings/org.eclipse.jdt.core.prefs14
-rw-r--r--incubation/bundles/org.eclipse.ecf.sync.resources.core/.settings/org.eclipse.pde.core.prefs8
-rw-r--r--incubation/bundles/org.eclipse.ecf.sync.resources.core/META-INF/MANIFEST.MF46
-rw-r--r--incubation/bundles/org.eclipse.ecf.sync.resources.core/about.html54
-rw-r--r--incubation/bundles/org.eclipse.ecf.sync.resources.core/build.properties16
-rw-r--r--incubation/bundles/org.eclipse.ecf.sync.resources.core/plugin.properties24
-rw-r--r--incubation/bundles/org.eclipse.ecf.sync.resources.core/plugin.xml20
-rw-r--r--incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/FileChangeMessage.java254
-rw-r--r--incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/FolderChangeMessage.java162
-rw-r--r--incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/Message.java94
-rw-r--r--incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/ResourceChangeMessage.java244
-rw-r--r--incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/ResourcesShare.java514
-rw-r--r--incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/ResourcesSynchronizationStrategy.java148
-rw-r--r--incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/StartMessage.java90
-rw-r--r--incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/StopMessage.java58
-rw-r--r--incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/SyncResourcesCore.java656
-rw-r--r--incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/sync/resources/core/IResourceChange.java110
-rw-r--r--incubation/bundles/org.eclipse.ecf.sync.resources.ui/.classpath14
-rw-r--r--incubation/bundles/org.eclipse.ecf.sync.resources.ui/.settings/org.eclipse.jdt.core.prefs14
-rw-r--r--incubation/bundles/org.eclipse.ecf.sync.resources.ui/build.properties12
-rw-r--r--incubation/bundles/org.eclipse.ecf.sync.resources.ui/plugin.xml258
-rw-r--r--incubation/bundles/org.eclipse.ecf.sync.resources.ui/src/org/eclipse/ecf/internal/sync/ui/resources/SyncResourcesUI.java696
38 files changed, 3220 insertions, 3220 deletions
diff --git a/incubation/bundles/org.eclipse.ecf.bulletinboard/.classpath b/incubation/bundles/org.eclipse.ecf.bulletinboard/.classpath
index 6e14aced3..c4a3549d9 100644
--- a/incubation/bundles/org.eclipse.ecf.bulletinboard/.classpath
+++ b/incubation/bundles/org.eclipse.ecf.bulletinboard/.classpath
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/incubation/bundles/org.eclipse.ecf.bulletinboard/.settings/org.eclipse.jdt.core.prefs b/incubation/bundles/org.eclipse.ecf.bulletinboard/.settings/org.eclipse.jdt.core.prefs
index 2b9cfe3f9..b53cfe275 100644
--- a/incubation/bundles/org.eclipse.ecf.bulletinboard/.settings/org.eclipse.jdt.core.prefs
+++ b/incubation/bundles/org.eclipse.ecf.bulletinboard/.settings/org.eclipse.jdt.core.prefs
@@ -1,63 +1,63 @@
-#Fri Oct 15 16:56:28 PDT 2010
-eclipse.preferences.version=1
-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.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=disabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-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=ignore
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-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=ignore
-org.eclipse.jdt.core.compiler.problem.nullReference=ignore
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
-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=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
+#Fri Oct 15 16:56:28 PDT 2010
+eclipse.preferences.version=1
+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.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=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+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=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+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=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+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=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.3
diff --git a/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/.classpath b/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/.classpath
index 2d1a4302f..64c5e31b7 100644
--- a/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/.classpath
+++ b/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/.classpath
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/.project b/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/.project
index 9678ab6a8..7772136c2 100644
--- a/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/.project
+++ b/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/.project
@@ -1,28 +1,28 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.ecf.provider.endpointdescription.localdiscovery</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>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.ecf.provider.endpointdescription.localdiscovery</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/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/.settings/org.eclipse.jdt.core.prefs b/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/.settings/org.eclipse.jdt.core.prefs
index c851a1697..a124dea54 100644
--- a/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/.settings/org.eclipse.jdt.core.prefs
+++ b/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/.settings/org.eclipse.jdt.core.prefs
@@ -1,78 +1,78 @@
-#Tue Jan 11 19:56:36 PST 2011
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
-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.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
-org.eclipse.jdt.core.compiler.problem.deadCode=warning
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-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.includeNullInfoFromAsserts=disabled
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
-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.nullReference=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.5
+#Tue Jan 11 19:56:36 PST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+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.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+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.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+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.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/.settings/org.eclipse.pde.core.prefs b/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/.settings/org.eclipse.pde.core.prefs
index 610d2769c..9f3a72a9f 100644
--- a/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/.settings/org.eclipse.pde.core.prefs
+++ b/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/.settings/org.eclipse.pde.core.prefs
@@ -1,4 +1,4 @@
-#Thu Oct 14 13:55:37 PDT 2010
-eclipse.preferences.version=1
-pluginProject.extensions=true
-resolve.requirebundle=false
+#Thu Oct 14 13:55:37 PDT 2010
+eclipse.preferences.version=1
+pluginProject.extensions=true
+resolve.requirebundle=false
diff --git a/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/.settings/org.eclipse.pde.prefs b/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/.settings/org.eclipse.pde.prefs
index 5778019ff..8e9c9ee4c 100644
--- a/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/.settings/org.eclipse.pde.prefs
+++ b/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/.settings/org.eclipse.pde.prefs
@@ -1,33 +1,33 @@
-#Thu Oct 14 13:10:02 PDT 2010
-compilers.f.unresolved-features=1
-compilers.f.unresolved-plugins=1
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.build.bin.includes=1
-compilers.p.build.encodings=2
-compilers.p.build.java.compiler=2
-compilers.p.build.java.compliance=1
-compilers.p.build.missing.output=2
-compilers.p.build.output.library=1
-compilers.p.build.source.library=1
-compilers.p.build.src.includes=1
-compilers.p.deprecated=1
-compilers.p.discouraged-class=1
-compilers.p.internal=1
-compilers.p.missing-packages=2
-compilers.p.missing-version-export-package=2
-compilers.p.missing-version-import-package=2
-compilers.p.missing-version-require-bundle=2
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=2
-compilers.p.unknown-attribute=1
-compilers.p.unknown-class=1
-compilers.p.unknown-element=1
-compilers.p.unknown-identifier=1
-compilers.p.unknown-resource=1
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.s.create-docs=false
-compilers.s.doc-folder=doc
-compilers.s.open-tags=1
-eclipse.preferences.version=1
+#Thu Oct 14 13:10:02 PDT 2010
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=2
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=1
+compilers.p.discouraged-class=1
+compilers.p.internal=1
+compilers.p.missing-packages=2
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=2
+compilers.p.unknown-attribute=1
+compilers.p.unknown-class=1
+compilers.p.unknown-element=1
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=1
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+eclipse.preferences.version=1
diff --git a/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/build.properties b/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/build.properties
index f4ae97015..aa1a00826 100644
--- a/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/build.properties
+++ b/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/build.properties
@@ -1,5 +1,5 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.properties
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties
diff --git a/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/endpointdescription1.xml b/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/endpointdescription1.xml
index 6e661a7cf..417554f5b 100644
--- a/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/endpointdescription1.xml
+++ b/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/endpointdescription1.xml
@@ -1,49 +1,49 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<endpoint-descriptions xmlns="http://www.osgi.org/xmlns/rsa/v1.0.0">
- <endpoint-description>
- <!-- osgi required endpoint description properties -->
- <property name="objectClass" value="com.acme.Foo"/>
- <property name="endpoint.service.id" value="100"/>
- <property name="endpoint.framework.uuid" value="frameworkid.1000"/>
- <property name="endpoint.id" value="http://ws.acme.com:9000/hello"/>
- <property name="service.imported.configs" value="com.acme"/>
-
- <!-- ecf required endpoint description properties -->
- <property name="ecf.endpoint.containerid" value="ecftcp://localhost:3283/server" />
- <property name="ecf.endpoint.containerid.namespace" value="org.eclipse.ecf.core.identity.StringID" />
- <property name="ecf.endpoint.remoteserviceid" value="1000" />
-
- <!-- osgi optional endpoint description properties -->
- <property name="endpoint.package.version.com.acme" value="4.2"/>
- <property name="service.imported.configs" value="com.acme"/>
- <property name="service.intents">
- <list>
- <value>SOAP</value>
- <value>HTTP</value>
- </list>
- </property>
- <property name="integers" value-type="int">
- <array>
- <value> 1 </value>
- <value>2</value>
- <value> 3 </value>
- </array>
- </property>
- <property name="floats" value-type="Float">
- <set>
- <value> 1.45 </value>
- <value>2.0</value>
- <value> 3 </value>
- </set>
- </property>
-
- <property name="com.acme.ws.xml">
- <xml>
- <config xmlns:cfg="http://acme.com/defs" foo="bar">
- <cfg:port>1029</cfg:port>
- <host>www.acme.com</host>
- </config>
- </xml>
- </property>
- </endpoint-description>
-</endpoint-descriptions>
+<?xml version="1.0" encoding="UTF-8"?>
+<endpoint-descriptions xmlns="http://www.osgi.org/xmlns/rsa/v1.0.0">
+ <endpoint-description>
+ <!-- osgi required endpoint description properties -->
+ <property name="objectClass" value="com.acme.Foo"/>
+ <property name="endpoint.service.id" value="100"/>
+ <property name="endpoint.framework.uuid" value="frameworkid.1000"/>
+ <property name="endpoint.id" value="http://ws.acme.com:9000/hello"/>
+ <property name="service.imported.configs" value="com.acme"/>
+
+ <!-- ecf required endpoint description properties -->
+ <property name="ecf.endpoint.containerid" value="ecftcp://localhost:3283/server" />
+ <property name="ecf.endpoint.containerid.namespace" value="org.eclipse.ecf.core.identity.StringID" />
+ <property name="ecf.endpoint.remoteserviceid" value="1000" />
+
+ <!-- osgi optional endpoint description properties -->
+ <property name="endpoint.package.version.com.acme" value="4.2"/>
+ <property name="service.imported.configs" value="com.acme"/>
+ <property name="service.intents">
+ <list>
+ <value>SOAP</value>
+ <value>HTTP</value>
+ </list>
+ </property>
+ <property name="integers" value-type="int">
+ <array>
+ <value> 1 </value>
+ <value>2</value>
+ <value> 3 </value>
+ </array>
+ </property>
+ <property name="floats" value-type="Float">
+ <set>
+ <value> 1.45 </value>
+ <value>2.0</value>
+ <value> 3 </value>
+ </set>
+ </property>
+
+ <property name="com.acme.ws.xml">
+ <xml>
+ <config xmlns:cfg="http://acme.com/defs" foo="bar">
+ <cfg:port>1029</cfg:port>
+ <host>www.acme.com</host>
+ </config>
+ </xml>
+ </property>
+ </endpoint-description>
+</endpoint-descriptions>
diff --git a/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/plugin.properties b/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/plugin.properties
index 47bb5474b..e94b42352 100644
--- a/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/plugin.properties
+++ b/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/plugin.properties
@@ -1,10 +1,10 @@
-############################################################################
-# Copyright (c) 2010 Composent Inc. 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
-#
-############################################################################
-plugin.provider=Eclipse.org - ECF
-plugin.name=ECF EndpointDescription File Discovery Provider
+############################################################################
+# Copyright (c) 2010 Composent Inc. 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
+#
+############################################################################
+plugin.provider=Eclipse.org - ECF
+plugin.name=ECF EndpointDescription File Discovery Provider
diff --git a/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/src/org/eclipse/ecf/provider/internal/endpointdescription/localdiscovery/Activator.java b/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/src/org/eclipse/ecf/provider/internal/endpointdescription/localdiscovery/Activator.java
index b4d796537..13e5b5fe6 100644
--- a/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/src/org/eclipse/ecf/provider/internal/endpointdescription/localdiscovery/Activator.java
+++ b/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/src/org/eclipse/ecf/provider/internal/endpointdescription/localdiscovery/Activator.java
@@ -1,96 +1,96 @@
-/*******************************************************************************
- * Copyright (c) 2010 Composent, Inc. 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:
- * Composent, Inc. - initial API and implementation
- ******************************************************************************/
-package org.eclipse.ecf.provider.internal.endpointdescription.localdiscovery;
-
-import javax.xml.parsers.SAXParserFactory;
-
-import org.eclipse.ecf.osgi.services.remoteserviceadmin.IServiceInfoFactory;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.util.tracker.ServiceTracker;
-
-public class Activator implements BundleActivator {
-
- private static BundleContext context;
- private static Activator instance;
-
- private ServiceTracker parserTracker;
-
- private ServiceTracker serviceInfoFactoryTracker;
-
- static BundleContext getContext() {
- return context;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext
- * )
- */
- public void start(BundleContext bundleContext) throws Exception {
- Activator.context = bundleContext;
- instance = this;
- }
-
- public synchronized IServiceInfoFactory getServiceInfoFactory() {
- if (instance == null)
- return null;
- if (serviceInfoFactoryTracker == null) {
- serviceInfoFactoryTracker = new ServiceTracker(context,
- IServiceInfoFactory.class.getName(), null);
- serviceInfoFactoryTracker.open();
- }
- return (IServiceInfoFactory) serviceInfoFactoryTracker.getService();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext bundleContext) throws Exception {
- closeServiceInfoFactoryTracker();
- closeSAXParserTracker();
- Activator.context = null;
- instance = null;
- }
-
- public static Activator getDefault() {
- return instance;
- }
-
- public synchronized SAXParserFactory getSAXParserFactory() {
- if (instance == null)
- return null;
- if (parserTracker == null) {
- parserTracker = new ServiceTracker(context,
- SAXParserFactory.class.getName(), null);
- parserTracker.open();
- }
- return (SAXParserFactory) parserTracker.getService();
- }
-
- private synchronized void closeSAXParserTracker() {
- if (parserTracker != null) {
- parserTracker.close();
- parserTracker = null;
- }
- }
-
- private synchronized void closeServiceInfoFactoryTracker() {
- if (serviceInfoFactoryTracker != null) {
- serviceInfoFactoryTracker.close();
- serviceInfoFactoryTracker = null;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 Composent, Inc. 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:
+ * Composent, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ecf.provider.internal.endpointdescription.localdiscovery;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import org.eclipse.ecf.osgi.services.remoteserviceadmin.IServiceInfoFactory;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.util.tracker.ServiceTracker;
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+ private static Activator instance;
+
+ private ServiceTracker parserTracker;
+
+ private ServiceTracker serviceInfoFactoryTracker;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext
+ * )
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ instance = this;
+ }
+
+ public synchronized IServiceInfoFactory getServiceInfoFactory() {
+ if (instance == null)
+ return null;
+ if (serviceInfoFactoryTracker == null) {
+ serviceInfoFactoryTracker = new ServiceTracker(context,
+ IServiceInfoFactory.class.getName(), null);
+ serviceInfoFactoryTracker.open();
+ }
+ return (IServiceInfoFactory) serviceInfoFactoryTracker.getService();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+ closeServiceInfoFactoryTracker();
+ closeSAXParserTracker();
+ Activator.context = null;
+ instance = null;
+ }
+
+ public static Activator getDefault() {
+ return instance;
+ }
+
+ public synchronized SAXParserFactory getSAXParserFactory() {
+ if (instance == null)
+ return null;
+ if (parserTracker == null) {
+ parserTracker = new ServiceTracker(context,
+ SAXParserFactory.class.getName(), null);
+ parserTracker.open();
+ }
+ return (SAXParserFactory) parserTracker.getService();
+ }
+
+ private synchronized void closeSAXParserTracker() {
+ if (parserTracker != null) {
+ parserTracker.close();
+ parserTracker = null;
+ }
+ }
+
+ private synchronized void closeServiceInfoFactoryTracker() {
+ if (serviceInfoFactoryTracker != null) {
+ serviceInfoFactoryTracker.close();
+ serviceInfoFactoryTracker = null;
+ }
+ }
+}
diff --git a/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/src/org/eclipse/ecf/provider/internal/endpointdescription/localdiscovery/EndpointDescriptionDiscoveryContainerAdapter.java b/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/src/org/eclipse/ecf/provider/internal/endpointdescription/localdiscovery/EndpointDescriptionDiscoveryContainerAdapter.java
index 718b74feb..8be5a2643 100644
--- a/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/src/org/eclipse/ecf/provider/internal/endpointdescription/localdiscovery/EndpointDescriptionDiscoveryContainerAdapter.java
+++ b/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/src/org/eclipse/ecf/provider/internal/endpointdescription/localdiscovery/EndpointDescriptionDiscoveryContainerAdapter.java
@@ -1,195 +1,195 @@
-/*******************************************************************************
- * Copyright (c) 2010 Composent, Inc. 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:
- * Composent, Inc. - initial API and implementation
- ******************************************************************************/
-package org.eclipse.ecf.provider.internal.endpointdescription.localdiscovery;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.ecf.core.ContainerConnectException;
-import org.eclipse.ecf.core.identity.ID;
-import org.eclipse.ecf.core.security.IConnectContext;
-import org.eclipse.ecf.discovery.AbstractDiscoveryContainerAdapter;
-import org.eclipse.ecf.discovery.DiscoveryContainerConfig;
-import org.eclipse.ecf.discovery.IServiceEvent;
-import org.eclipse.ecf.discovery.IServiceInfo;
-import org.eclipse.ecf.discovery.IServiceTypeEvent;
-import org.eclipse.ecf.discovery.identity.IServiceID;
-import org.eclipse.ecf.discovery.identity.IServiceTypeID;
-
-public class EndpointDescriptionDiscoveryContainerAdapter extends
- AbstractDiscoveryContainerAdapter {
-
- private Map<IServiceID, IServiceInfo> remoteServiceInfos;
-
- public EndpointDescriptionDiscoveryContainerAdapter(String aNamespaceName,
- DiscoveryContainerConfig aConfig) {
- super(aNamespaceName, aConfig);
- remoteServiceInfos = new HashMap<IServiceID, IServiceInfo>();
- }
-
- public IServiceInfo getServiceInfo(IServiceID aServiceID) {
- if (aServiceID == null)
- return null;
- synchronized (remoteServiceInfos) {
- return remoteServiceInfos.get(aServiceID);
- }
- }
-
- public IServiceInfo[] getServices() {
- Collection<IServiceInfo> results = new ArrayList<IServiceInfo>();
- synchronized (remoteServiceInfos) {
- for (IServiceInfo i : remoteServiceInfos.values())
- results.add(i);
- }
- return (IServiceInfo[]) results.toArray(new IServiceInfo[] {});
- }
-
- public IServiceInfo[] getServices(IServiceTypeID aServiceTypeID) {
- Collection<IServiceInfo> results = new ArrayList<IServiceInfo>();
- if (aServiceTypeID == null)
- return (IServiceInfo[]) results.toArray(new IServiceInfo[] {});
- synchronized (remoteServiceInfos) {
- for (IServiceInfo i : remoteServiceInfos.values()) {
- if (i.getServiceID().getServiceTypeID().equals(aServiceTypeID))
- results.add(i);
- }
- }
- return (IServiceInfo[]) results.toArray(new IServiceInfo[] {});
- }
-
- private Collection<IServiceTypeID> getServiceTypesAsCollection() {
- Collection<IServiceTypeID> results = new ArrayList<IServiceTypeID>();
- synchronized (remoteServiceInfos) {
- for (IServiceInfo i : remoteServiceInfos.values())
- results.add(i.getServiceID().getServiceTypeID());
- }
- return results;
- }
-
- public IServiceTypeID[] getServiceTypes() {
- return (IServiceTypeID[]) getServiceTypesAsCollection().toArray(
- new IServiceTypeID[] {});
- }
-
- public void registerService(IServiceInfo serviceInfo) {
- if (serviceInfo == null)
- throw new NullPointerException("serviceInfo cannot be null"); //$NON-NLS-1$
- addServiceInfo(serviceInfo);
- }
-
- private void addServiceInfo(IServiceInfo serviceInfo) {
- IServiceID serviceID = serviceInfo.getServiceID();
- IServiceInfo addResult = null;
- IServiceTypeID serviceTypeAdded = null;
- synchronized (remoteServiceInfos) {
- // First add..
- addResult = remoteServiceInfos.put(serviceID, serviceInfo);
- if (addResult == null) {
- Collection<IServiceTypeID> serviceTypes = getServiceTypesAsCollection();
- IServiceTypeID stID = serviceID.getServiceTypeID();
- if (serviceTypes.contains(stID))
- serviceTypeAdded = stID;
- }
- }
- if (serviceTypeAdded != null)
- fireServiceTypeDiscovered(createDiscoveredServiceTypeEvent(serviceTypeAdded));
- if (addResult == null)
- fireServiceDiscovered(createDiscoveredServiceEvent(serviceInfo));
- }
-
- private IServiceTypeEvent createDiscoveredServiceTypeEvent(
- final IServiceTypeID serviceTypeID) {
- return new IServiceTypeEvent() {
-
- public ID getLocalContainerID() {
- return getID();
- }
-
- public IServiceTypeID getServiceTypeID() {
- return serviceTypeID;
- }
- };
- }
-
- private IServiceEvent createDiscoveredServiceEvent(
- final IServiceInfo serviceInfo) {
- return new IServiceEvent() {
-
- public ID getLocalContainerID() {
- return getID();
- }
-
- public IServiceInfo getServiceInfo() {
- return serviceInfo;
- }
- };
- }
-
- public void unregisterService(IServiceInfo serviceInfo) {
- if (serviceInfo == null)
- throw new NullPointerException("serviceInfo cannot be null"); //$NON-NLS-1$
- removeServiceInfo(serviceInfo);
- }
-
- private void removeServiceInfo(IServiceInfo serviceInfo) {
- IServiceID serviceID = serviceInfo.getServiceID();
- IServiceInfo addResult = null;
- synchronized (remoteServiceInfos) {
- addResult = remoteServiceInfos.remove(serviceID);
- }
- if (addResult == null)
- fireServiceUndiscovered(createUndiscoveredServiceEvent(serviceInfo));
- }
-
- private IServiceEvent createUndiscoveredServiceEvent(
- final IServiceInfo serviceInfo) {
- return new IServiceEvent() {
-
- public ID getLocalContainerID() {
- return getID();
- }
-
- public IServiceInfo getServiceInfo() {
- return serviceInfo;
- }
- };
- }
-
- public void connect(ID targetID, IConnectContext connectContext)
- throws ContainerConnectException {
- // Do nothing...no connection
- }
-
- public ID getConnectedID() {
- return getID();
- }
-
- public void disconnect() {
- // No disconnection
- }
-
- @SuppressWarnings("rawtypes")
- public Object getAdapter(Class adapter) {
- // No adapters supported
- return null;
- }
-
- @Override
- public String getContainerName() {
- return "ecf.discovery.local"; //$NON-NLS-1$
- }
-
- public void dispose() {
- remoteServiceInfos.clear();
- super.dispose();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 Composent, Inc. 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:
+ * Composent, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ecf.provider.internal.endpointdescription.localdiscovery;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.ecf.core.ContainerConnectException;
+import org.eclipse.ecf.core.identity.ID;
+import org.eclipse.ecf.core.security.IConnectContext;
+import org.eclipse.ecf.discovery.AbstractDiscoveryContainerAdapter;
+import org.eclipse.ecf.discovery.DiscoveryContainerConfig;
+import org.eclipse.ecf.discovery.IServiceEvent;
+import org.eclipse.ecf.discovery.IServiceInfo;
+import org.eclipse.ecf.discovery.IServiceTypeEvent;
+import org.eclipse.ecf.discovery.identity.IServiceID;
+import org.eclipse.ecf.discovery.identity.IServiceTypeID;
+
+public class EndpointDescriptionDiscoveryContainerAdapter extends
+ AbstractDiscoveryContainerAdapter {
+
+ private Map<IServiceID, IServiceInfo> remoteServiceInfos;
+
+ public EndpointDescriptionDiscoveryContainerAdapter(String aNamespaceName,
+ DiscoveryContainerConfig aConfig) {
+ super(aNamespaceName, aConfig);
+ remoteServiceInfos = new HashMap<IServiceID, IServiceInfo>();
+ }
+
+ public IServiceInfo getServiceInfo(IServiceID aServiceID) {
+ if (aServiceID == null)
+ return null;
+ synchronized (remoteServiceInfos) {
+ return remoteServiceInfos.get(aServiceID);
+ }
+ }
+
+ public IServiceInfo[] getServices() {
+ Collection<IServiceInfo> results = new ArrayList<IServiceInfo>();
+ synchronized (remoteServiceInfos) {
+ for (IServiceInfo i : remoteServiceInfos.values())
+ results.add(i);
+ }
+ return (IServiceInfo[]) results.toArray(new IServiceInfo[] {});
+ }
+
+ public IServiceInfo[] getServices(IServiceTypeID aServiceTypeID) {
+ Collection<IServiceInfo> results = new ArrayList<IServiceInfo>();
+ if (aServiceTypeID == null)
+ return (IServiceInfo[]) results.toArray(new IServiceInfo[] {});
+ synchronized (remoteServiceInfos) {
+ for (IServiceInfo i : remoteServiceInfos.values()) {
+ if (i.getServiceID().getServiceTypeID().equals(aServiceTypeID))
+ results.add(i);
+ }
+ }
+ return (IServiceInfo[]) results.toArray(new IServiceInfo[] {});
+ }
+
+ private Collection<IServiceTypeID> getServiceTypesAsCollection() {
+ Collection<IServiceTypeID> results = new ArrayList<IServiceTypeID>();
+ synchronized (remoteServiceInfos) {
+ for (IServiceInfo i : remoteServiceInfos.values())
+ results.add(i.getServiceID().getServiceTypeID());
+ }
+ return results;
+ }
+
+ public IServiceTypeID[] getServiceTypes() {
+ return (IServiceTypeID[]) getServiceTypesAsCollection().toArray(
+ new IServiceTypeID[] {});
+ }
+
+ public void registerService(IServiceInfo serviceInfo) {
+ if (serviceInfo == null)
+ throw new NullPointerException("serviceInfo cannot be null"); //$NON-NLS-1$
+ addServiceInfo(serviceInfo);
+ }
+
+ private void addServiceInfo(IServiceInfo serviceInfo) {
+ IServiceID serviceID = serviceInfo.getServiceID();
+ IServiceInfo addResult = null;
+ IServiceTypeID serviceTypeAdded = null;
+ synchronized (remoteServiceInfos) {
+ // First add..
+ addResult = remoteServiceInfos.put(serviceID, serviceInfo);
+ if (addResult == null) {
+ Collection<IServiceTypeID> serviceTypes = getServiceTypesAsCollection();
+ IServiceTypeID stID = serviceID.getServiceTypeID();
+ if (serviceTypes.contains(stID))
+ serviceTypeAdded = stID;
+ }
+ }
+ if (serviceTypeAdded != null)
+ fireServiceTypeDiscovered(createDiscoveredServiceTypeEvent(serviceTypeAdded));
+ if (addResult == null)
+ fireServiceDiscovered(createDiscoveredServiceEvent(serviceInfo));
+ }
+
+ private IServiceTypeEvent createDiscoveredServiceTypeEvent(
+ final IServiceTypeID serviceTypeID) {
+ return new IServiceTypeEvent() {
+
+ public ID getLocalContainerID() {
+ return getID();
+ }
+
+ public IServiceTypeID getServiceTypeID() {
+ return serviceTypeID;
+ }
+ };
+ }
+
+ private IServiceEvent createDiscoveredServiceEvent(
+ final IServiceInfo serviceInfo) {
+ return new IServiceEvent() {
+
+ public ID getLocalContainerID() {
+ return getID();
+ }
+
+ public IServiceInfo getServiceInfo() {
+ return serviceInfo;
+ }
+ };
+ }
+
+ public void unregisterService(IServiceInfo serviceInfo) {
+ if (serviceInfo == null)
+ throw new NullPointerException("serviceInfo cannot be null"); //$NON-NLS-1$
+ removeServiceInfo(serviceInfo);
+ }
+
+ private void removeServiceInfo(IServiceInfo serviceInfo) {
+ IServiceID serviceID = serviceInfo.getServiceID();
+ IServiceInfo addResult = null;
+ synchronized (remoteServiceInfos) {
+ addResult = remoteServiceInfos.remove(serviceID);
+ }
+ if (addResult == null)
+ fireServiceUndiscovered(createUndiscoveredServiceEvent(serviceInfo));
+ }
+
+ private IServiceEvent createUndiscoveredServiceEvent(
+ final IServiceInfo serviceInfo) {
+ return new IServiceEvent() {
+
+ public ID getLocalContainerID() {
+ return getID();
+ }
+
+ public IServiceInfo getServiceInfo() {
+ return serviceInfo;
+ }
+ };
+ }
+
+ public void connect(ID targetID, IConnectContext connectContext)
+ throws ContainerConnectException {
+ // Do nothing...no connection
+ }
+
+ public ID getConnectedID() {
+ return getID();
+ }
+
+ public void disconnect() {
+ // No disconnection
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Object getAdapter(Class adapter) {
+ // No adapters supported
+ return null;
+ }
+
+ @Override
+ public String getContainerName() {
+ return "ecf.discovery.local"; //$NON-NLS-1$
+ }
+
+ public void dispose() {
+ remoteServiceInfos.clear();
+ super.dispose();
+ }
+}
diff --git a/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/src/org/eclipse/ecf/provider/internal/endpointdescription/localdiscovery/EndpointDescriptionParser.java b/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/src/org/eclipse/ecf/provider/internal/endpointdescription/localdiscovery/EndpointDescriptionParser.java
index d42cd83f1..0094835f2 100644
--- a/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/src/org/eclipse/ecf/provider/internal/endpointdescription/localdiscovery/EndpointDescriptionParser.java
+++ b/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/src/org/eclipse/ecf/provider/internal/endpointdescription/localdiscovery/EndpointDescriptionParser.java
@@ -1,792 +1,792 @@
-/*******************************************************************************
- * Copyright (c) 2010 Composent, Inc. 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:
- * Composent, Inc. - initial API and implementation
- ******************************************************************************/
-package org.eclipse.ecf.provider.internal.endpointdescription.localdiscovery;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.DefaultHandler;
-
-public class EndpointDescriptionParser {
-
- private static List<String> multiValueTypes;
-
- static {
- multiValueTypes = Arrays.asList(new String[] { "String", "Long", //$NON-NLS-1$ //$NON-NLS-2$
- "long", "Double", "double", "float", "Float", "int", "Integer", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
- "byte", "Byte", "char", "Character", "boolean", "Boolean", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- "short", "Short" }); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- private static final String ENDPOINT_DESCRIPTIONS = "endpoint-descriptions"; //$NON-NLS-1$
- private static final String ENDPOINT_DESCRIPTION = "endpoint-description"; //$NON-NLS-1$
- private static final String ENDPOINT_PROPERTY = "property"; //$NON-NLS-1$
- private static final String ENDPOINT_PROPERTY_NAME = "name"; //$NON-NLS-1$
- private static final String ENDPOINT_PROPERTY_VALUE = "value"; //$NON-NLS-1$
- private static final String ENDPOINT_PROPERTY_VALUETYPE = "value-type"; //$NON-NLS-1$
- private static final String ENDPOINT_PROPERTY_ARRAY = "array"; //$NON-NLS-1$
- private static final String ENDPOINT_PROPERTY_LIST = "list"; //$NON-NLS-1$
- private static final String ENDPOINT_PROPERTY_SET = "set"; //$NON-NLS-1$
- private static final String ENDPOINT_PROPERTY_XML = "xml"; //$NON-NLS-1$
-
- public static String[] noAttributes = new String[0];
-
- private XMLReader xmlReader;
- protected Locator locator = null; // document locator, if supported by the
- // parser
-
- class IgnoringHandler extends AbstractHandler {
-
- public IgnoringHandler(AbstractHandler parent) {
- super(parent);
- this.elementHandled = "IgnoringAll"; //$NON-NLS-1$
- }
-
- public void startElement(String name, Attributes attributes) {
- noSubElements(name, attributes);
- }
-
- }
-
- /**
- * Abstract base class for content handlers
- */
- abstract class AbstractHandler extends DefaultHandler {
-
- protected ContentHandler parentHandler = null;
- protected String elementHandled = null;
-
- protected StringBuffer characters = null; // character data inside an
- // element
-
- public AbstractHandler() {
- // Empty constructor for a root handler
- }
-
- public AbstractHandler(ContentHandler parentHandler) {
- this.parentHandler = parentHandler;
- xmlReader.setContentHandler(this);
- }
-
- public AbstractHandler(ContentHandler parentHandler,
- String elementHandled) {
- this.parentHandler = parentHandler;
- xmlReader.setContentHandler(this);
- this.elementHandled = elementHandled;
- }
-
- /**
- * Set the document locator for the parser
- *
- * @see org.xml.sax.ContentHandler#setDocumentLocator
- */
- public void setDocumentLocator(Locator docLocator) {
- locator = docLocator;
- }
-
- public void startElement(String uri, String localName, String qName,
- Attributes attributes) throws SAXException {
- finishCharacters();
- String name = makeSimpleName(localName, qName);
- startElement(name, attributes);
- }
-
- public abstract void startElement(String name, Attributes attributes)
- throws SAXException;
-
- public void invalidElement(String name, Attributes attributes) {
- unexpectedElement(this, name, attributes);
- new IgnoringHandler(this);
- }
-
- public void endElement(String namespaceURI, String localName,
- String qName) {
- finishCharacters();
- finished();
- // Restore the parent content handler
- xmlReader.setContentHandler(parentHandler);
- }
-
- /**
- * An implementation for startElement when there are no sub-elements
- */
- protected void noSubElements(String name, Attributes attributes) {
- unexpectedElement(this, name, attributes);
- // Create a new handler to ignore subsequent nested elements
- new IgnoringHandler(this);
- }
-
- /*
- * Save up character data until endElement or nested startElement
- *
- * @see org.xml.sax.ContentHandler#characters
- */
- public void characters(char[] chars, int start, int length) {
- if (this.characters == null) {
- this.characters = new StringBuffer();
- }
- this.characters.append(chars, start, length);
- }
-
- // Consume the characters accumulated in this.characters.
- // Called before startElement or endElement
- private String finishCharacters() {
- // common case -- no characters or only whitespace
- if (this.characters == null || this.characters.length() == 0) {
- return null;
- }
- if (allWhiteSpace(this.characters)) {
- this.characters.setLength(0);
- return null;
- }
-
- // process the characters
- try {
- String trimmedChars = this.characters.toString().trim();
- if (trimmedChars.length() == 0) {
- // this shouldn't happen due to the test for allWhiteSpace
- // above
- System.err.println("Unexpected non-whitespace characters: " //$NON-NLS-1$
- + trimmedChars);
- return null;
- }
- processCharacters(trimmedChars);
- return trimmedChars;
- } finally {
- this.characters.setLength(0);
- }
- }
-
- // Method to override in the handler of an element with CDATA.
- protected void processCharacters(String data) {
- if (data.length() > 0) {
- unexpectedCharacterData(this, data);
- }
- }
-
- private boolean allWhiteSpace(StringBuffer sb) {
- int length = sb.length();
- for (int i = 0; i < length; i += 1) {
- if (!Character.isWhitespace(sb.charAt(i))) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Called when this element and all elements nested into it have been
- * handled.
- */
- protected void finished() {
- // Do nothing by default
- }
-
- /*
- * A name used to identify the handler.
- */
- public String getName() {
- return (elementHandled != null ? elementHandled : "NoName"); //$NON-NLS-1$
- }
-
- /**
- * Parse the attributes of an element with only required attributes.
- */
- protected String[] parseRequiredAttributes(Attributes attributes,
- String[] required) {
- return parseAttributes(attributes, required, noAttributes);
- }
-
- /**
- * Parse the attributes of an element with a single optional attribute.
- */
- protected String parseOptionalAttribute(Attributes attributes,
- String name) {
- return parseAttributes(attributes, noAttributes,
- new String[] { name })[0];
- }
-
- /**
- * Parse the attributes of an element, given the list of required and
- * optional ones. Return values in same order, null for those not
- * present. Log warnings for extra attributes or missing required
- * attributes.
- */
- protected String[] parseAttributes(Attributes attributes,
- String[] required, String[] optional) {
- String[] result = new String[required.length + optional.length];
- for (int i = 0; i < attributes.getLength(); i += 1) {
- String name = attributes.getLocalName(i);
- String value = attributes.getValue(i).trim();
- int j;
- if ((j = indexOf(required, name)) >= 0) {
- result[j] = value;
- } else if ((j = indexOf(optional, name)) >= 0) {
- result[required.length + j] = value;
- } else {
- unexpectedAttribute(elementHandled, name, value);
- }
- }
- for (int i = 0; i < required.length; i += 1) {
- checkRequiredAttribute(elementHandled, required[i], result[i]);
- }
- return result;
- }
-
- }
-
- SAXParser getParser() throws ParserConfigurationException,
- SAXException {
- Activator a = Activator.getDefault();
- if (a == null)
- return null;
-
- SAXParserFactory factory = a.getSAXParserFactory();
- if (factory == null) {
- throw new SAXException("Unable to acquire sax parser"); //$NON-NLS-1$
- }
- factory.setNamespaceAware(true);
- factory.setValidating(false);
- try {
- factory.setFeature(
- "http://xml.org/sax/features/string-interning", true); //$NON-NLS-1$
- } catch (SAXException se) {
- // some parsers may not support string interning
- }
- SAXParser theParser = factory.newSAXParser();
- if (theParser == null) {
- throw new SAXException("Unable to create sax parser"); //$NON-NLS-1$
- }
- xmlReader = theParser.getXMLReader();
- return theParser;
- }
-
- abstract class RootHandler extends AbstractHandler {
-
- public RootHandler() {
- super();
- }
-
- public void initialize(DocHandler document, String rootName,
- Attributes attributes) {
- this.parentHandler = document;
- this.elementHandled = rootName;
- handleRootAttributes(attributes);
- }
-
- protected abstract void handleRootAttributes(Attributes attributes);
-
- }
-
- class DocHandler extends AbstractHandler {
-
- RootHandler rootHandler;
-
- public DocHandler(String rootName, RootHandler rootHandler) {
- super(null, rootName);
- this.rootHandler = rootHandler;
- }
-
- public void startElement(String name, Attributes attributes) {
- if (name.equals(elementHandled)) {
- rootHandler.initialize(this, name, attributes);
- xmlReader.setContentHandler(rootHandler);
- } else {
- this.noSubElements(name, attributes);
- }
- }
-
- }
-
- class EndpointDescriptionDocHandler extends DocHandler {
-
- public EndpointDescriptionDocHandler(String rootName,
- RootHandler rootHandler) {
- super(rootName, rootHandler);
- }
-
- public void processingInstruction(String target, String data)
- throws SAXException {
- // do nothing
- }
- }
-
- class EndpointDescriptionsHandler extends RootHandler {
-
- private List<EndpointDescription> endpointDescriptions = new ArrayList<EndpointDescription>();
- private EndpointDescriptionHandler endpointDescriptionHandler;
-
- protected void handleRootAttributes(Attributes attributes) {
- }
-
- public void startElement(String name, Attributes attributes)
- throws SAXException {
- if (ENDPOINT_DESCRIPTION.equals(name)) {
- if (endpointDescriptionHandler == null) {
- endpointDescriptionHandler = new EndpointDescriptionHandler(
- this, attributes, endpointDescriptions);
- } else {
- duplicateElement(this, name, attributes);
- }
- } else {
- invalidElement(name, attributes);
- }
- }
-
- public void endElement(String namespaceURI, String localName,
- String qName) {
- if (elementHandled.equals(localName)) {
- endpointDescriptionHandler = null;
- super.endElement(namespaceURI, localName, qName);
- }
- }
-
- public List<EndpointDescription> getEndpointDescriptions() {
- return endpointDescriptions;
- }
- }
-
- class EndpointDescriptionHandler extends AbstractHandler {
-
- private Map<String,Object> properties;
- private List<EndpointDescription> descriptions;
-
- public EndpointDescriptionHandler(ContentHandler parentHandler,
- Attributes attributes, List<EndpointDescription> descriptions) {
- super(parentHandler, ENDPOINT_DESCRIPTION);
- this.properties = new HashMap<String, Object>();
- this.descriptions = descriptions;
- }
-
- public void startElement(String name, Attributes attributes)
- throws SAXException {
- if (ENDPOINT_PROPERTY.equals(name)) {
- new EndpointPropertyHandler(this, attributes, properties);
- }
- }
-
- public void endElement(String namespaceURI, String localName,
- String qName) {
- if (elementHandled.equals(localName)) {
- this.descriptions.add(new EndpointDescription(properties));
- super.endElement(namespaceURI, localName, qName);
- }
- }
-
- }
-
- abstract class MultiValueHandler extends AbstractHandler {
-
- protected String valueType;
-
- public MultiValueHandler(ContentHandler parentHandler,
- String elementHandled, String valueType) {
- super(parentHandler, elementHandled);
- this.valueType = valueType;
- }
-
- protected Object createValue(String value) {
- if (value == null)
- return null;
- if (valueType.equals("String")) { //$NON-NLS-1$
- return value;
- } else if (valueType.equals("long") || valueType.equals("Long")) { //$NON-NLS-1$ //$NON-NLS-2$
- return Long.valueOf(value);
- } else if (valueType.equals("double") || valueType.equals("Double")) { //$NON-NLS-1$ //$NON-NLS-2$
- return Double.valueOf(value);
- } else if (valueType.equals("float") || valueType.equals("Float")) { //$NON-NLS-1$ //$NON-NLS-2$
- return Float.valueOf(value);
- } else if (valueType.equals("int") || valueType.equals("Integer")) { //$NON-NLS-1$ //$NON-NLS-2$
- return Integer.valueOf(value);
- } else if (valueType.equals("byte") || valueType.equals("Byte")) { //$NON-NLS-1$ //$NON-NLS-2$
- return Byte.valueOf(value);
- } else if (valueType.equals("char") //$NON-NLS-1$
- || valueType.equals("Character")) { //$NON-NLS-1$
- char[] chars = new char[1];
- value.getChars(0, 1, chars, 0);
- return Character.valueOf(chars[0]);
- } else if (valueType.equals("boolean") //$NON-NLS-1$
- || valueType.equals("Boolean")) { //$NON-NLS-1$
- return Boolean.valueOf(value);
- } else if (valueType.equals("short") || valueType.equals("Short")) { //$NON-NLS-1$ //$NON-NLS-2$
- return Short.valueOf(value);
- }
- return null;
- }
-
- public void startElement(String name, Attributes attributes)
- throws SAXException {
- if (ENDPOINT_PROPERTY_VALUE.equals(name)) {
- characters = new StringBuffer();
- }
- }
-
- public void endElement(String namespaceURI, String localName,
- String qName) {
- if (ENDPOINT_PROPERTY_VALUE.equals(localName)) {
- Object value = createValue(processValue((characters == null) ? null
- : characters.toString()));
- if (value != null)
- addValue(value);
- characters = null;
- } else if (elementHandled.equals(localName)) {
- super.endElement(namespaceURI, localName, qName);
- }
- }
-
- private String processValue(String characters) {
- if (characters == null || characters.length() == 0)
- return null;
- if (valueType.equals("String")) //$NON-NLS-1$
- return characters;
- int startIndex = 0;
- while (Character.isWhitespace(characters.charAt(startIndex)))
- startIndex++;
- int endIndex = characters.length() - 1;
- while (Character.isWhitespace(characters.charAt(endIndex)))
- endIndex--;
- return characters.substring(startIndex, endIndex + 1);
- }
-
- protected abstract void addValue(Object value);
-
- public abstract Object getValues();
- }
-
- class ArrayMultiValueHandler extends MultiValueHandler {
-
- private List<Object> values = new ArrayList<Object>();
-
- public ArrayMultiValueHandler(ContentHandler parentHandler,
- String elementHandled, String valueType) {
- super(parentHandler, elementHandled, valueType);
- }
-
- protected Object[] createEmptyArrayOfType() {
- if (valueType.equals("String")) { //$NON-NLS-1$
- return new String[] {};
- } else if (valueType.equals("long") || valueType.equals("Long")) { //$NON-NLS-1$ //$NON-NLS-2$
- return new Long[] {};
- } else if (valueType.equals("double") || valueType.equals("Double")) { //$NON-NLS-1$ //$NON-NLS-2$
- return new Double[] {};
- } else if (valueType.equals("float") || valueType.equals("Float")) { //$NON-NLS-1$ //$NON-NLS-2$
- return new Double[] {};
- } else if (valueType.equals("int") || valueType.equals("Integer")) { //$NON-NLS-1$ //$NON-NLS-2$
- return new Integer[] {};
- } else if (valueType.equals("byte") || valueType.equals("Byte")) { //$NON-NLS-1$ //$NON-NLS-2$
- return new Byte[] {};
- } else if (valueType.equals("char") //$NON-NLS-1$
- || valueType.equals("Character")) { //$NON-NLS-1$
- return new Character[] {};
- } else if (valueType.equals("boolean") //$NON-NLS-1$
- || valueType.equals("Boolean")) { //$NON-NLS-1$
- return new Boolean[] {};
- } else if (valueType.equals("short") || valueType.equals("Short")) { //$NON-NLS-1$ //$NON-NLS-2$
- return new Short[] {};
- } else
- return null;
- }
-
- public Object getValues() {
- return values.toArray(createEmptyArrayOfType());
- }
-
- protected void addValue(Object value) {
- values.add(value);
- }
- }
-
- class ListMultiValueHandler extends MultiValueHandler {
-
- private List<Object> values = new ArrayList<Object>();
-
- public ListMultiValueHandler(ContentHandler parentHandler,
- String elementHandled, String valueType) {
- super(parentHandler, elementHandled, valueType);
- }
-
- public Object getValues() {
- return values;
- }
-
- protected void addValue(Object value) {
- values.add(value);
- }
- }
-
- class SetMultiValueHandler extends MultiValueHandler {
-
- private Set<Object> values = new HashSet<Object>();
-
- public SetMultiValueHandler(ContentHandler parentHandler,
- String elementHandled, String valueType) {
- super(parentHandler, elementHandled, valueType);
- }
-
- public Object getValues() {
- return values;
- }
-
- protected void addValue(Object value) {
- values.add(value);
- }
- }
-
- class XMLValueHandler extends AbstractHandler {
-
- private Map<String,String> nsPrefixMap = new HashMap<String,String>();
- private StringBuffer buf;
-
- public XMLValueHandler(ContentHandler parentHandler) {
- super(parentHandler, ENDPOINT_PROPERTY_XML);
- buf = new StringBuffer();
- }
-
- public void startPrefixMapping(String prefix, String uri)
- throws SAXException {
- nsPrefixMap.put(uri, prefix);
- }
-
- public void startElement(String uri, String localName, String qName,
- Attributes attributes) throws SAXException {
- buf.append("<").append(qName); //$NON-NLS-1$
- for(Iterator<String> i=nsPrefixMap.keySet().iterator(); i.hasNext(); ) {
- String nsURI = (String) i.next();
- String prefix = (String) nsPrefixMap.get(nsURI);
- i.remove();
- if (nsURI != null) {
- buf.append(" xmlns"); //$NON-NLS-1$
- if (prefix != null) buf.append(":").append(prefix); //$NON-NLS-1$
- buf.append("=\"").append(nsURI).append("\""); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- for (int i = 0; i < attributes.getLength(); i++) {
- buf.append(" "); //$NON-NLS-1$
- buf.append(attributes.getQName(i)).append("=\"").append(attributes.getValue(i)).append("\""); //$NON-NLS-1$ //$NON-NLS-2$
- }
- buf.append(">"); //$NON-NLS-1$
- characters = new StringBuffer();
- }
-
- public void startElement(String name, Attributes attributes)
- throws SAXException {
- // not used
- }
-
- public void endElement(String namespaceURI, String localName,
- String qName) {
- if (elementHandled.equals(localName)) {
- super.endElement(namespaceURI, localName, qName);
- } else {
- if (characters != null) buf.append(characters);
- buf.append("</").append(qName).append(">"); //$NON-NLS-1$ //$NON-NLS-2$
- characters = null;
- }
- }
-
- public String getXML() {
- return buf.toString();
- }
- }
-
- class EndpointPropertyHandler extends AbstractHandler {
-
- private Map<String,Object> properties;
- private String name;
- private String valueType = "String"; //$NON-NLS-1$
- private String value;
- private MultiValueHandler multiValueHandler;
- private XMLValueHandler xmlValueHandler;
-
- public EndpointPropertyHandler(ContentHandler parentHandler,
- Attributes attributes, Map<String,Object> properties) throws SAXException {
- super(parentHandler, ENDPOINT_PROPERTY);
- name = parseRequiredAttributes(attributes,
- new String[] { ENDPOINT_PROPERTY_NAME })[0];
- value = parseOptionalAttribute(attributes, ENDPOINT_PROPERTY_VALUE);
- String vt = parseOptionalAttribute(attributes,
- ENDPOINT_PROPERTY_VALUETYPE);
- if (vt != null) {
- if (!multiValueTypes.contains(vt))
- throw new SAXException("property element valueType=" + vt //$NON-NLS-1$
- + " not allowed"); //$NON-NLS-1$
- this.valueType = vt;
- }
- this.properties = properties;
- if (value != null) {
- String[] property = new String[] { name, value };
- if (isValidProperty(property)) {
- this.properties.put(property[0], property[1]);
- }
- }
- }
-
- public void startElement(String name, Attributes attributes)
- throws SAXException {
- // Should not happen if value is non-null
- if (value != null)
- throw new SAXException(
- "property element has both value attribute and sub-element"); //$NON-NLS-1$
- if (ENDPOINT_PROPERTY_ARRAY.equals(name)) {
- if (multiValueHandler == null) {
- multiValueHandler = new ArrayMultiValueHandler(this,
- ENDPOINT_PROPERTY_ARRAY, valueType);
- } else {
- duplicateElement(this, name, attributes);
- }
- } else if (ENDPOINT_PROPERTY_LIST.equals(name)) {
- if (multiValueHandler == null) {
- multiValueHandler = new ListMultiValueHandler(this,
- ENDPOINT_PROPERTY_LIST, valueType);
- } else {
- duplicateElement(this, name, attributes);
- }
- } else if (ENDPOINT_PROPERTY_SET.equals(name)) {
- if (multiValueHandler == null) {
- multiValueHandler = new SetMultiValueHandler(this,
- ENDPOINT_PROPERTY_SET, valueType);
- } else {
- duplicateElement(this, name, attributes);
- }
- } else if (ENDPOINT_PROPERTY_XML.equals(name)) {
- // xml
- if (xmlValueHandler == null) {
- xmlValueHandler = new XMLValueHandler(this);
- } else {
- duplicateElement(this, name, attributes);
- }
- } else {
- invalidElement(name, attributes);
- }
- }
-
- public void endElement(String namespaceURI, String localName,
- String qName) {
- if (elementHandled.equals(localName)) {
- if (multiValueHandler != null) {
- properties.put(name, multiValueHandler.getValues());
- multiValueHandler = null;
- } else if (xmlValueHandler != null) {
- properties.put(name, xmlValueHandler.getXML());
- xmlValueHandler = null;
- }
- super.endElement(namespaceURI, localName, qName);
- }
- }
-
- private boolean isValidProperty(String[] property) {
- return (property.length == 2 && property[0] != null && property[1] != null);
- }
- }
-
- public class EndpointDescription {
- private Map<String,Object> properties;
-
- public EndpointDescription(Map<String,Object> properties) {
- this.properties = properties;
- }
-
- public Map<String,Object> getProperties() {
- return properties;
- }
-
- public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("EndpointDescription [properties="); //$NON-NLS-1$
- builder.append(properties);
- builder.append("]"); //$NON-NLS-1$
- return builder.toString();
- }
-
- }
-
- public synchronized void parse(InputStream input) throws IOException {
- try {
- getParser();
- EndpointDescriptionsHandler endpointDescriptionsHandler = new EndpointDescriptionsHandler();
- xmlReader.setContentHandler(new EndpointDescriptionDocHandler(
- ENDPOINT_DESCRIPTIONS, endpointDescriptionsHandler));
- xmlReader.parse(new InputSource(input));
- endpointDescriptions = endpointDescriptionsHandler
- .getEndpointDescriptions();
- } catch (SAXException e) {
- throw new IOException(e.getMessage());
- } catch (ParserConfigurationException e) {
- throw new IOException(e.getMessage());
- } finally {
- input.close();
- }
-
- }
-
- public static String makeSimpleName(String localName, String qualifiedName) {
- if (localName != null && localName.length() > 0) {
- return localName;
- }
- int nameSpaceIndex = qualifiedName.indexOf(":"); //$NON-NLS-1$
- return (nameSpaceIndex == -1 ? qualifiedName : qualifiedName
- .substring(nameSpaceIndex + 1));
- }
-
- public void unexpectedElement(AbstractHandler handler, String element,
- Attributes attributes) {
- }
-
- public void unexpectedCharacterData(AbstractHandler handler, String cdata) {
- }
-
- public void unexpectedAttribute(String element, String attribute,
- String value) {
- }
-
- static int indexOf(String[] array, String value) {
- for (int i = 0; i < array.length; i += 1) {
- if (value == null ? array[i] == null : value.equals(array[i])) {
- return i;
- }
- }
- return -1;
- }
-
- public void checkRequiredAttribute(String element, String name, Object value) {
- }
-
- public void duplicateElement(AbstractHandler handler, String element,
- Attributes attributes) {
- // ignore the duplicate element entirely because we have already logged
- // it
- new IgnoringHandler(handler);
- }
-
- private List<EndpointDescription> endpointDescriptions;
-
- public List<EndpointDescription> getEndpointDescriptions() {
- return endpointDescriptions;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 Composent, Inc. 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:
+ * Composent, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ecf.provider.internal.endpointdescription.localdiscovery;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+public class EndpointDescriptionParser {
+
+ private static List<String> multiValueTypes;
+
+ static {
+ multiValueTypes = Arrays.asList(new String[] { "String", "Long", //$NON-NLS-1$ //$NON-NLS-2$
+ "long", "Double", "double", "float", "Float", "int", "Integer", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
+ "byte", "Byte", "char", "Character", "boolean", "Boolean", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ "short", "Short" }); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ private static final String ENDPOINT_DESCRIPTIONS = "endpoint-descriptions"; //$NON-NLS-1$
+ private static final String ENDPOINT_DESCRIPTION = "endpoint-description"; //$NON-NLS-1$
+ private static final String ENDPOINT_PROPERTY = "property"; //$NON-NLS-1$
+ private static final String ENDPOINT_PROPERTY_NAME = "name"; //$NON-NLS-1$
+ private static final String ENDPOINT_PROPERTY_VALUE = "value"; //$NON-NLS-1$
+ private static final String ENDPOINT_PROPERTY_VALUETYPE = "value-type"; //$NON-NLS-1$
+ private static final String ENDPOINT_PROPERTY_ARRAY = "array"; //$NON-NLS-1$
+ private static final String ENDPOINT_PROPERTY_LIST = "list"; //$NON-NLS-1$
+ private static final String ENDPOINT_PROPERTY_SET = "set"; //$NON-NLS-1$
+ private static final String ENDPOINT_PROPERTY_XML = "xml"; //$NON-NLS-1$
+
+ public static String[] noAttributes = new String[0];
+
+ private XMLReader xmlReader;
+ protected Locator locator = null; // document locator, if supported by the
+ // parser
+
+ class IgnoringHandler extends AbstractHandler {
+
+ public IgnoringHandler(AbstractHandler parent) {
+ super(parent);
+ this.elementHandled = "IgnoringAll"; //$NON-NLS-1$
+ }
+
+ public void startElement(String name, Attributes attributes) {
+ noSubElements(name, attributes);
+ }
+
+ }
+
+ /**
+ * Abstract base class for content handlers
+ */
+ abstract class AbstractHandler extends DefaultHandler {
+
+ protected ContentHandler parentHandler = null;
+ protected String elementHandled = null;
+
+ protected StringBuffer characters = null; // character data inside an
+ // element
+
+ public AbstractHandler() {
+ // Empty constructor for a root handler
+ }
+
+ public AbstractHandler(ContentHandler parentHandler) {
+ this.parentHandler = parentHandler;
+ xmlReader.setContentHandler(this);
+ }
+
+ public AbstractHandler(ContentHandler parentHandler,
+ String elementHandled) {
+ this.parentHandler = parentHandler;
+ xmlReader.setContentHandler(this);
+ this.elementHandled = elementHandled;
+ }
+
+ /**
+ * Set the document locator for the parser
+ *
+ * @see org.xml.sax.ContentHandler#setDocumentLocator
+ */
+ public void setDocumentLocator(Locator docLocator) {
+ locator = docLocator;
+ }
+
+ public void startElement(String uri, String localName, String qName,
+ Attributes attributes) throws SAXException {
+ finishCharacters();
+ String name = makeSimpleName(localName, qName);
+ startElement(name, attributes);
+ }
+
+ public abstract void startElement(String name, Attributes attributes)
+ throws SAXException;
+
+ public void invalidElement(String name, Attributes attributes) {
+ unexpectedElement(this, name, attributes);
+ new IgnoringHandler(this);
+ }
+
+ public void endElement(String namespaceURI, String localName,
+ String qName) {
+ finishCharacters();
+ finished();
+ // Restore the parent content handler
+ xmlReader.setContentHandler(parentHandler);
+ }
+
+ /**
+ * An implementation for startElement when there are no sub-elements
+ */
+ protected void noSubElements(String name, Attributes attributes) {
+ unexpectedElement(this, name, attributes);
+ // Create a new handler to ignore subsequent nested elements
+ new IgnoringHandler(this);
+ }
+
+ /*
+ * Save up character data until endElement or nested startElement
+ *
+ * @see org.xml.sax.ContentHandler#characters
+ */
+ public void characters(char[] chars, int start, int length) {
+ if (this.characters == null) {
+ this.characters = new StringBuffer();
+ }
+ this.characters.append(chars, start, length);
+ }
+
+ // Consume the characters accumulated in this.characters.
+ // Called before startElement or endElement
+ private String finishCharacters() {
+ // common case -- no characters or only whitespace
+ if (this.characters == null || this.characters.length() == 0) {
+ return null;
+ }
+ if (allWhiteSpace(this.characters)) {
+ this.characters.setLength(0);
+ return null;
+ }
+
+ // process the characters
+ try {
+ String trimmedChars = this.characters.toString().trim();
+ if (trimmedChars.length() == 0) {
+ // this shouldn't happen due to the test for allWhiteSpace
+ // above
+ System.err.println("Unexpected non-whitespace characters: " //$NON-NLS-1$
+ + trimmedChars);
+ return null;
+ }
+ processCharacters(trimmedChars);
+ return trimmedChars;
+ } finally {
+ this.characters.setLength(0);
+ }
+ }
+
+ // Method to override in the handler of an element with CDATA.
+ protected void processCharacters(String data) {
+ if (data.length() > 0) {
+ unexpectedCharacterData(this, data);
+ }
+ }
+
+ private boolean allWhiteSpace(StringBuffer sb) {
+ int length = sb.length();
+ for (int i = 0; i < length; i += 1) {
+ if (!Character.isWhitespace(sb.charAt(i))) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Called when this element and all elements nested into it have been
+ * handled.
+ */
+ protected void finished() {
+ // Do nothing by default
+ }
+
+ /*
+ * A name used to identify the handler.
+ */
+ public String getName() {
+ return (elementHandled != null ? elementHandled : "NoName"); //$NON-NLS-1$
+ }
+
+ /**
+ * Parse the attributes of an element with only required attributes.
+ */
+ protected String[] parseRequiredAttributes(Attributes attributes,
+ String[] required) {
+ return parseAttributes(attributes, required, noAttributes);
+ }
+
+ /**
+ * Parse the attributes of an element with a single optional attribute.
+ */
+ protected String parseOptionalAttribute(Attributes attributes,
+ String name) {
+ return parseAttributes(attributes, noAttributes,
+ new String[] { name })[0];
+ }
+
+ /**
+ * Parse the attributes of an element, given the list of required and
+ * optional ones. Return values in same order, null for those not
+ * present. Log warnings for extra attributes or missing required
+ * attributes.
+ */
+ protected String[] parseAttributes(Attributes attributes,
+ String[] required, String[] optional) {
+ String[] result = new String[required.length + optional.length];
+ for (int i = 0; i < attributes.getLength(); i += 1) {
+ String name = attributes.getLocalName(i);
+ String value = attributes.getValue(i).trim();
+ int j;
+ if ((j = indexOf(required, name)) >= 0) {
+ result[j] = value;
+ } else if ((j = indexOf(optional, name)) >= 0) {
+ result[required.length + j] = value;
+ } else {
+ unexpectedAttribute(elementHandled, name, value);
+ }
+ }
+ for (int i = 0; i < required.length; i += 1) {
+ checkRequiredAttribute(elementHandled, required[i], result[i]);
+ }
+ return result;
+ }
+
+ }
+
+ SAXParser getParser() throws ParserConfigurationException,
+ SAXException {
+ Activator a = Activator.getDefault();
+ if (a == null)
+ return null;
+
+ SAXParserFactory factory = a.getSAXParserFactory();
+ if (factory == null) {
+ throw new SAXException("Unable to acquire sax parser"); //$NON-NLS-1$
+ }
+ factory.setNamespaceAware(true);
+ factory.setValidating(false);
+ try {
+ factory.setFeature(
+ "http://xml.org/sax/features/string-interning", true); //$NON-NLS-1$
+ } catch (SAXException se) {
+ // some parsers may not support string interning
+ }
+ SAXParser theParser = factory.newSAXParser();
+ if (theParser == null) {
+ throw new SAXException("Unable to create sax parser"); //$NON-NLS-1$
+ }
+ xmlReader = theParser.getXMLReader();
+ return theParser;
+ }
+
+ abstract class RootHandler extends AbstractHandler {
+
+ public RootHandler() {
+ super();
+ }
+
+ public void initialize(DocHandler document, String rootName,
+ Attributes attributes) {
+ this.parentHandler = document;
+ this.elementHandled = rootName;
+ handleRootAttributes(attributes);
+ }
+
+ protected abstract void handleRootAttributes(Attributes attributes);
+
+ }
+
+ class DocHandler extends AbstractHandler {
+
+ RootHandler rootHandler;
+
+ public DocHandler(String rootName, RootHandler rootHandler) {
+ super(null, rootName);
+ this.rootHandler = rootHandler;
+ }
+
+ public void startElement(String name, Attributes attributes) {
+ if (name.equals(elementHandled)) {
+ rootHandler.initialize(this, name, attributes);
+ xmlReader.setContentHandler(rootHandler);
+ } else {
+ this.noSubElements(name, attributes);
+ }
+ }
+
+ }
+
+ class EndpointDescriptionDocHandler extends DocHandler {
+
+ public EndpointDescriptionDocHandler(String rootName,
+ RootHandler rootHandler) {
+ super(rootName, rootHandler);
+ }
+
+ public void processingInstruction(String target, String data)
+ throws SAXException {
+ // do nothing
+ }
+ }
+
+ class EndpointDescriptionsHandler extends RootHandler {
+
+ private List<EndpointDescription> endpointDescriptions = new ArrayList<EndpointDescription>();
+ private EndpointDescriptionHandler endpointDescriptionHandler;
+
+ protected void handleRootAttributes(Attributes attributes) {
+ }
+
+ public void startElement(String name, Attributes attributes)
+ throws SAXException {
+ if (ENDPOINT_DESCRIPTION.equals(name)) {
+ if (endpointDescriptionHandler == null) {
+ endpointDescriptionHandler = new EndpointDescriptionHandler(
+ this, attributes, endpointDescriptions);
+ } else {
+ duplicateElement(this, name, attributes);
+ }
+ } else {
+ invalidElement(name, attributes);
+ }
+ }
+
+ public void endElement(String namespaceURI, String localName,
+ String qName) {
+ if (elementHandled.equals(localName)) {
+ endpointDescriptionHandler = null;
+ super.endElement(namespaceURI, localName, qName);
+ }
+ }
+
+ public List<EndpointDescription> getEndpointDescriptions() {
+ return endpointDescriptions;
+ }
+ }
+
+ class EndpointDescriptionHandler extends AbstractHandler {
+
+ private Map<String,Object> properties;
+ private List<EndpointDescription> descriptions;
+
+ public EndpointDescriptionHandler(ContentHandler parentHandler,
+ Attributes attributes, List<EndpointDescription> descriptions) {
+ super(parentHandler, ENDPOINT_DESCRIPTION);
+ this.properties = new HashMap<String, Object>();
+ this.descriptions = descriptions;
+ }
+
+ public void startElement(String name, Attributes attributes)
+ throws SAXException {
+ if (ENDPOINT_PROPERTY.equals(name)) {
+ new EndpointPropertyHandler(this, attributes, properties);
+ }
+ }
+
+ public void endElement(String namespaceURI, String localName,
+ String qName) {
+ if (elementHandled.equals(localName)) {
+ this.descriptions.add(new EndpointDescription(properties));
+ super.endElement(namespaceURI, localName, qName);
+ }
+ }
+
+ }
+
+ abstract class MultiValueHandler extends AbstractHandler {
+
+ protected String valueType;
+
+ public MultiValueHandler(ContentHandler parentHandler,
+ String elementHandled, String valueType) {
+ super(parentHandler, elementHandled);
+ this.valueType = valueType;
+ }
+
+ protected Object createValue(String value) {
+ if (value == null)
+ return null;
+ if (valueType.equals("String")) { //$NON-NLS-1$
+ return value;
+ } else if (valueType.equals("long") || valueType.equals("Long")) { //$NON-NLS-1$ //$NON-NLS-2$
+ return Long.valueOf(value);
+ } else if (valueType.equals("double") || valueType.equals("Double")) { //$NON-NLS-1$ //$NON-NLS-2$
+ return Double.valueOf(value);
+ } else if (valueType.equals("float") || valueType.equals("Float")) { //$NON-NLS-1$ //$NON-NLS-2$
+ return Float.valueOf(value);
+ } else if (valueType.equals("int") || valueType.equals("Integer")) { //$NON-NLS-1$ //$NON-NLS-2$
+ return Integer.valueOf(value);
+ } else if (valueType.equals("byte") || valueType.equals("Byte")) { //$NON-NLS-1$ //$NON-NLS-2$
+ return Byte.valueOf(value);
+ } else if (valueType.equals("char") //$NON-NLS-1$
+ || valueType.equals("Character")) { //$NON-NLS-1$
+ char[] chars = new char[1];
+ value.getChars(0, 1, chars, 0);
+ return Character.valueOf(chars[0]);
+ } else if (valueType.equals("boolean") //$NON-NLS-1$
+ || valueType.equals("Boolean")) { //$NON-NLS-1$
+ return Boolean.valueOf(value);
+ } else if (valueType.equals("short") || valueType.equals("Short")) { //$NON-NLS-1$ //$NON-NLS-2$
+ return Short.valueOf(value);
+ }
+ return null;
+ }
+
+ public void startElement(String name, Attributes attributes)
+ throws SAXException {
+ if (ENDPOINT_PROPERTY_VALUE.equals(name)) {
+ characters = new StringBuffer();
+ }
+ }
+
+ public void endElement(String namespaceURI, String localName,
+ String qName) {
+ if (ENDPOINT_PROPERTY_VALUE.equals(localName)) {
+ Object value = createValue(processValue((characters == null) ? null
+ : characters.toString()));
+ if (value != null)
+ addValue(value);
+ characters = null;
+ } else if (elementHandled.equals(localName)) {
+ super.endElement(namespaceURI, localName, qName);
+ }
+ }
+
+ private String processValue(String characters) {
+ if (characters == null || characters.length() == 0)
+ return null;
+ if (valueType.equals("String")) //$NON-NLS-1$
+ return characters;
+ int startIndex = 0;
+ while (Character.isWhitespace(characters.charAt(startIndex)))
+ startIndex++;
+ int endIndex = characters.length() - 1;
+ while (Character.isWhitespace(characters.charAt(endIndex)))
+ endIndex--;
+ return characters.substring(startIndex, endIndex + 1);
+ }
+
+ protected abstract void addValue(Object value);
+
+ public abstract Object getValues();
+ }
+
+ class ArrayMultiValueHandler extends MultiValueHandler {
+
+ private List<Object> values = new ArrayList<Object>();
+
+ public ArrayMultiValueHandler(ContentHandler parentHandler,
+ String elementHandled, String valueType) {
+ super(parentHandler, elementHandled, valueType);
+ }
+
+ protected Object[] createEmptyArrayOfType() {
+ if (valueType.equals("String")) { //$NON-NLS-1$
+ return new String[] {};
+ } else if (valueType.equals("long") || valueType.equals("Long")) { //$NON-NLS-1$ //$NON-NLS-2$
+ return new Long[] {};
+ } else if (valueType.equals("double") || valueType.equals("Double")) { //$NON-NLS-1$ //$NON-NLS-2$
+ return new Double[] {};
+ } else if (valueType.equals("float") || valueType.equals("Float")) { //$NON-NLS-1$ //$NON-NLS-2$
+ return new Double[] {};
+ } else if (valueType.equals("int") || valueType.equals("Integer")) { //$NON-NLS-1$ //$NON-NLS-2$
+ return new Integer[] {};
+ } else if (valueType.equals("byte") || valueType.equals("Byte")) { //$NON-NLS-1$ //$NON-NLS-2$
+ return new Byte[] {};
+ } else if (valueType.equals("char") //$NON-NLS-1$
+ || valueType.equals("Character")) { //$NON-NLS-1$
+ return new Character[] {};
+ } else if (valueType.equals("boolean") //$NON-NLS-1$
+ || valueType.equals("Boolean")) { //$NON-NLS-1$
+ return new Boolean[] {};
+ } else if (valueType.equals("short") || valueType.equals("Short")) { //$NON-NLS-1$ //$NON-NLS-2$
+ return new Short[] {};
+ } else
+ return null;
+ }
+
+ public Object getValues() {
+ return values.toArray(createEmptyArrayOfType());
+ }
+
+ protected void addValue(Object value) {
+ values.add(value);
+ }
+ }
+
+ class ListMultiValueHandler extends MultiValueHandler {
+
+ private List<Object> values = new ArrayList<Object>();
+
+ public ListMultiValueHandler(ContentHandler parentHandler,
+ String elementHandled, String valueType) {
+ super(parentHandler, elementHandled, valueType);
+ }
+
+ public Object getValues() {
+ return values;
+ }
+
+ protected void addValue(Object value) {
+ values.add(value);
+ }
+ }
+
+ class SetMultiValueHandler extends MultiValueHandler {
+
+ private Set<Object> values = new HashSet<Object>();
+
+ public SetMultiValueHandler(ContentHandler parentHandler,
+ String elementHandled, String valueType) {
+ super(parentHandler, elementHandled, valueType);
+ }
+
+ public Object getValues() {
+ return values;
+ }
+
+ protected void addValue(Object value) {
+ values.add(value);
+ }
+ }
+
+ class XMLValueHandler extends AbstractHandler {
+
+ private Map<String,String> nsPrefixMap = new HashMap<String,String>();
+ private StringBuffer buf;
+
+ public XMLValueHandler(ContentHandler parentHandler) {
+ super(parentHandler, ENDPOINT_PROPERTY_XML);
+ buf = new StringBuffer();
+ }
+
+ public void startPrefixMapping(String prefix, String uri)
+ throws SAXException {
+ nsPrefixMap.put(uri, prefix);
+ }
+
+ public void startElement(String uri, String localName, String qName,
+ Attributes attributes) throws SAXException {
+ buf.append("<").append(qName); //$NON-NLS-1$
+ for(Iterator<String> i=nsPrefixMap.keySet().iterator(); i.hasNext(); ) {
+ String nsURI = (String) i.next();
+ String prefix = (String) nsPrefixMap.get(nsURI);
+ i.remove();
+ if (nsURI != null) {
+ buf.append(" xmlns"); //$NON-NLS-1$
+ if (prefix != null) buf.append(":").append(prefix); //$NON-NLS-1$
+ buf.append("=\"").append(nsURI).append("\""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ for (int i = 0; i < attributes.getLength(); i++) {
+ buf.append(" "); //$NON-NLS-1$
+ buf.append(attributes.getQName(i)).append("=\"").append(attributes.getValue(i)).append("\""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ buf.append(">"); //$NON-NLS-1$
+ characters = new StringBuffer();
+ }
+
+ public void startElement(String name, Attributes attributes)
+ throws SAXException {
+ // not used
+ }
+
+ public void endElement(String namespaceURI, String localName,
+ String qName) {
+ if (elementHandled.equals(localName)) {
+ super.endElement(namespaceURI, localName, qName);
+ } else {
+ if (characters != null) buf.append(characters);
+ buf.append("</").append(qName).append(">"); //$NON-NLS-1$ //$NON-NLS-2$
+ characters = null;
+ }
+ }
+
+ public String getXML() {
+ return buf.toString();
+ }
+ }
+
+ class EndpointPropertyHandler extends AbstractHandler {
+
+ private Map<String,Object> properties;
+ private String name;
+ private String valueType = "String"; //$NON-NLS-1$
+ private String value;
+ private MultiValueHandler multiValueHandler;
+ private XMLValueHandler xmlValueHandler;
+
+ public EndpointPropertyHandler(ContentHandler parentHandler,
+ Attributes attributes, Map<String,Object> properties) throws SAXException {
+ super(parentHandler, ENDPOINT_PROPERTY);
+ name = parseRequiredAttributes(attributes,
+ new String[] { ENDPOINT_PROPERTY_NAME })[0];
+ value = parseOptionalAttribute(attributes, ENDPOINT_PROPERTY_VALUE);
+ String vt = parseOptionalAttribute(attributes,
+ ENDPOINT_PROPERTY_VALUETYPE);
+ if (vt != null) {
+ if (!multiValueTypes.contains(vt))
+ throw new SAXException("property element valueType=" + vt //$NON-NLS-1$
+ + " not allowed"); //$NON-NLS-1$
+ this.valueType = vt;
+ }
+ this.properties = properties;
+ if (value != null) {
+ String[] property = new String[] { name, value };
+ if (isValidProperty(property)) {
+ this.properties.put(property[0], property[1]);
+ }
+ }
+ }
+
+ public void startElement(String name, Attributes attributes)
+ throws SAXException {
+ // Should not happen if value is non-null
+ if (value != null)
+ throw new SAXException(
+ "property element has both value attribute and sub-element"); //$NON-NLS-1$
+ if (ENDPOINT_PROPERTY_ARRAY.equals(name)) {
+ if (multiValueHandler == null) {
+ multiValueHandler = new ArrayMultiValueHandler(this,
+ ENDPOINT_PROPERTY_ARRAY, valueType);
+ } else {
+ duplicateElement(this, name, attributes);
+ }
+ } else if (ENDPOINT_PROPERTY_LIST.equals(name)) {
+ if (multiValueHandler == null) {
+ multiValueHandler = new ListMultiValueHandler(this,
+ ENDPOINT_PROPERTY_LIST, valueType);
+ } else {
+ duplicateElement(this, name, attributes);
+ }
+ } else if (ENDPOINT_PROPERTY_SET.equals(name)) {
+ if (multiValueHandler == null) {
+ multiValueHandler = new SetMultiValueHandler(this,
+ ENDPOINT_PROPERTY_SET, valueType);
+ } else {
+ duplicateElement(this, name, attributes);
+ }
+ } else if (ENDPOINT_PROPERTY_XML.equals(name)) {
+ // xml
+ if (xmlValueHandler == null) {
+ xmlValueHandler = new XMLValueHandler(this);
+ } else {
+ duplicateElement(this, name, attributes);
+ }
+ } else {
+ invalidElement(name, attributes);
+ }
+ }
+
+ public void endElement(String namespaceURI, String localName,
+ String qName) {
+ if (elementHandled.equals(localName)) {
+ if (multiValueHandler != null) {
+ properties.put(name, multiValueHandler.getValues());
+ multiValueHandler = null;
+ } else if (xmlValueHandler != null) {
+ properties.put(name, xmlValueHandler.getXML());
+ xmlValueHandler = null;
+ }
+ super.endElement(namespaceURI, localName, qName);
+ }
+ }
+
+ private boolean isValidProperty(String[] property) {
+ return (property.length == 2 && property[0] != null && property[1] != null);
+ }
+ }
+
+ public class EndpointDescription {
+ private Map<String,Object> properties;
+
+ public EndpointDescription(Map<String,Object> properties) {
+ this.properties = properties;
+ }
+
+ public Map<String,Object> getProperties() {
+ return properties;
+ }
+
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("EndpointDescription [properties="); //$NON-NLS-1$
+ builder.append(properties);
+ builder.append("]"); //$NON-NLS-1$
+ return builder.toString();
+ }
+
+ }
+
+ public synchronized void parse(InputStream input) throws IOException {
+ try {
+ getParser();
+ EndpointDescriptionsHandler endpointDescriptionsHandler = new EndpointDescriptionsHandler();
+ xmlReader.setContentHandler(new EndpointDescriptionDocHandler(
+ ENDPOINT_DESCRIPTIONS, endpointDescriptionsHandler));
+ xmlReader.parse(new InputSource(input));
+ endpointDescriptions = endpointDescriptionsHandler
+ .getEndpointDescriptions();
+ } catch (SAXException e) {
+ throw new IOException(e.getMessage());
+ } catch (ParserConfigurationException e) {
+ throw new IOException(e.getMessage());
+ } finally {
+ input.close();
+ }
+
+ }
+
+ public static String makeSimpleName(String localName, String qualifiedName) {
+ if (localName != null && localName.length() > 0) {
+ return localName;
+ }
+ int nameSpaceIndex = qualifiedName.indexOf(":"); //$NON-NLS-1$
+ return (nameSpaceIndex == -1 ? qualifiedName : qualifiedName
+ .substring(nameSpaceIndex + 1));
+ }
+
+ public void unexpectedElement(AbstractHandler handler, String element,
+ Attributes attributes) {
+ }
+
+ public void unexpectedCharacterData(AbstractHandler handler, String cdata) {
+ }
+
+ public void unexpectedAttribute(String element, String attribute,
+ String value) {
+ }
+
+ static int indexOf(String[] array, String value) {
+ for (int i = 0; i < array.length; i += 1) {
+ if (value == null ? array[i] == null : value.equals(array[i])) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ public void checkRequiredAttribute(String element, String name, Object value) {
+ }
+
+ public void duplicateElement(AbstractHandler handler, String element,
+ Attributes attributes) {
+ // ignore the duplicate element entirely because we have already logged
+ // it
+ new IgnoringHandler(handler);
+ }
+
+ private List<EndpointDescription> endpointDescriptions;
+
+ public List<EndpointDescription> getEndpointDescriptions() {
+ return endpointDescriptions;
+ }
+
+}
diff --git a/incubation/bundles/org.eclipse.ecf.remoteservice.apt.java6/.settings/org.eclipse.jdt.core.prefs b/incubation/bundles/org.eclipse.ecf.remoteservice.apt.java6/.settings/org.eclipse.jdt.core.prefs
index 0dd35fd56..2162b01af 100644
--- a/incubation/bundles/org.eclipse.ecf.remoteservice.apt.java6/.settings/org.eclipse.jdt.core.prefs
+++ b/incubation/bundles/org.eclipse.ecf.remoteservice.apt.java6/.settings/org.eclipse.jdt.core.prefs
@@ -1,77 +1,77 @@
-#Fri Oct 15 20:04:12 PDT 2010
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
-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.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
-org.eclipse.jdt.core.compiler.problem.deadCode=warning
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-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=ignore
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullReference=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.6
+#Fri Oct 15 20:04:12 PDT 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+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.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+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=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/incubation/bundles/org.eclipse.ecf.sync.resources.core/.classpath b/incubation/bundles/org.eclipse.ecf.sync.resources.core/.classpath
index 731ea5fad..2fbb7a23e 100644
--- a/incubation/bundles/org.eclipse.ecf.sync.resources.core/.classpath
+++ b/incubation/bundles/org.eclipse.ecf.sync.resources.core/.classpath
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/incubation/bundles/org.eclipse.ecf.sync.resources.core/.options b/incubation/bundles/org.eclipse.ecf.sync.resources.core/.options
index 699829556..2937ca723 100644
--- a/incubation/bundles/org.eclipse.ecf.sync.resources.core/.options
+++ b/incubation/bundles/org.eclipse.ecf.sync.resources.core/.options
@@ -1,16 +1,16 @@
-# Debugging options for the org.eclipse.ecf.sync plug-in
-
-# Turn on general debugging for the org.eclipse.ecf.internal.provisional.docshare plug-in
-org.eclipse.ecf.sync/debug=true
-org.eclipse.ecf.sync/debug/filter = *
-org.eclipse.ecf.sync/debug/flag = true
-
-# Trace when exceptions are caught
-org.eclipse.ecf.sync/debug/exceptions/catching=false
-# Trace when exceptions are thrown
-org.eclipse.ecf.sync/debug/exceptions/throwing=false
-
-# Trace when methods are entered
-org.eclipse.ecf.sync/debug/methods/entering=false
-# Trace when methods are exited
-org.eclipse.ecf.sync/debug/methods/exiting=false
+# Debugging options for the org.eclipse.ecf.sync plug-in
+
+# Turn on general debugging for the org.eclipse.ecf.internal.provisional.docshare plug-in
+org.eclipse.ecf.sync/debug=true
+org.eclipse.ecf.sync/debug/filter = *
+org.eclipse.ecf.sync/debug/flag = true
+
+# Trace when exceptions are caught
+org.eclipse.ecf.sync/debug/exceptions/catching=false
+# Trace when exceptions are thrown
+org.eclipse.ecf.sync/debug/exceptions/throwing=false
+
+# Trace when methods are entered
+org.eclipse.ecf.sync/debug/methods/entering=false
+# Trace when methods are exited
+org.eclipse.ecf.sync/debug/methods/exiting=false
diff --git a/incubation/bundles/org.eclipse.ecf.sync.resources.core/.settings/org.eclipse.jdt.core.prefs b/incubation/bundles/org.eclipse.ecf.sync.resources.core/.settings/org.eclipse.jdt.core.prefs
index 6a4bc0e78..4b7e2cfc4 100644
--- a/incubation/bundles/org.eclipse.ecf.sync.resources.core/.settings/org.eclipse.jdt.core.prefs
+++ b/incubation/bundles/org.eclipse.ecf.sync.resources.core/.settings/org.eclipse.jdt.core.prefs
@@ -1,7 +1,7 @@
-#Tue Sep 23 21:41:24 PDT 2008
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.compliance=1.4
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.source=1.3
+#Tue Sep 23 21:41:24 PDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.source=1.3
diff --git a/incubation/bundles/org.eclipse.ecf.sync.resources.core/.settings/org.eclipse.pde.core.prefs b/incubation/bundles/org.eclipse.ecf.sync.resources.core/.settings/org.eclipse.pde.core.prefs
index 8abb8ca6a..ae44e6131 100644
--- a/incubation/bundles/org.eclipse.ecf.sync.resources.core/.settings/org.eclipse.pde.core.prefs
+++ b/incubation/bundles/org.eclipse.ecf.sync.resources.core/.settings/org.eclipse.pde.core.prefs
@@ -1,4 +1,4 @@
-#Tue Sep 23 21:41:25 PDT 2008
-eclipse.preferences.version=1
-pluginProject.extensions=false
-resolve.requirebundle=false
+#Tue Sep 23 21:41:25 PDT 2008
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/incubation/bundles/org.eclipse.ecf.sync.resources.core/META-INF/MANIFEST.MF b/incubation/bundles/org.eclipse.ecf.sync.resources.core/META-INF/MANIFEST.MF
index 19edd35c4..f3d2bd8a3 100644
--- a/incubation/bundles/org.eclipse.ecf.sync.resources.core/META-INF/MANIFEST.MF
+++ b/incubation/bundles/org.eclipse.ecf.sync.resources.core/META-INF/MANIFEST.MF
@@ -1,23 +1,23 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %plugin.name
-Bundle-SymbolicName: org.eclipse.ecf.sync.resources.core;singleton:=true
-Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: org.eclipse.ecf.internal.sync.resources.core.SyncResourcesCore
-Bundle-Vendor: %plugin.provider
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
-Import-Package: org.eclipse.core.runtime,
- org.eclipse.ecf.core.identity,
- org.eclipse.ecf.core.util,
- org.eclipse.ecf.sync,
- org.osgi.framework
-Bundle-ActivationPolicy: lazy
-Bundle-Localization: plugin
-Export-Package: org.eclipse.ecf.internal.sync.resources.core;x-friends:="org.eclipse.ecf.sync.resources.ui",
- org.eclipse.ecf.sync.resources.core,
- org.eclipse.ecf.sync.resources.core.preferences
-Require-Bundle: org.eclipse.core.resources,
- org.eclipse.core.jobs,
- org.eclipse.ecf.datashare,
- org.eclipse.ecf,
- org.eclipse.core.runtime
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %plugin.name
+Bundle-SymbolicName: org.eclipse.ecf.sync.resources.core;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.ecf.internal.sync.resources.core.SyncResourcesCore
+Bundle-Vendor: %plugin.provider
+Bundle-RequiredExecutionEnvironment: J2SE-1.4
+Import-Package: org.eclipse.core.runtime,
+ org.eclipse.ecf.core.identity,
+ org.eclipse.ecf.core.util,
+ org.eclipse.ecf.sync,
+ org.osgi.framework
+Bundle-ActivationPolicy: lazy
+Bundle-Localization: plugin
+Export-Package: org.eclipse.ecf.internal.sync.resources.core;x-friends:="org.eclipse.ecf.sync.resources.ui",
+ org.eclipse.ecf.sync.resources.core,
+ org.eclipse.ecf.sync.resources.core.preferences
+Require-Bundle: org.eclipse.core.resources,
+ org.eclipse.core.jobs,
+ org.eclipse.ecf.datashare,
+ org.eclipse.ecf,
+ org.eclipse.core.runtime
diff --git a/incubation/bundles/org.eclipse.ecf.sync.resources.core/about.html b/incubation/bundles/org.eclipse.ecf.sync.resources.core/about.html
index 75743c5b1..6a60a262f 100644
--- a/incubation/bundles/org.eclipse.ecf.sync.resources.core/about.html
+++ b/incubation/bundles/org.eclipse.ecf.sync.resources.core/about.html
@@ -1,28 +1,28 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 29, 2007</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="/">http://www.eclipse.org</a>.</p>
-
-</body>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 29, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="/">http://www.eclipse.org</a>.</p>
+
+</body>
</html> \ No newline at end of file
diff --git a/incubation/bundles/org.eclipse.ecf.sync.resources.core/build.properties b/incubation/bundles/org.eclipse.ecf.sync.resources.core/build.properties
index baa36b183..f70828ba5 100644
--- a/incubation/bundles/org.eclipse.ecf.sync.resources.core/build.properties
+++ b/incubation/bundles/org.eclipse.ecf.sync.resources.core/build.properties
@@ -1,8 +1,8 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- about.html,\
- plugin.properties,\
- plugin.xml
-src.includes = about.html
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ plugin.properties,\
+ plugin.xml
+src.includes = about.html
diff --git a/incubation/bundles/org.eclipse.ecf.sync.resources.core/plugin.properties b/incubation/bundles/org.eclipse.ecf.sync.resources.core/plugin.properties
index bc4ebe92f..74b3aa8f4 100644
--- a/incubation/bundles/org.eclipse.ecf.sync.resources.core/plugin.properties
+++ b/incubation/bundles/org.eclipse.ecf.sync.resources.core/plugin.properties
@@ -1,12 +1,12 @@
-################################################################################
-# Copyright (c) 2009 Remy Chi Jian Suen 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:
-# Remy Chi Jian Suen <remy.suen@gmail.com> - initial API and implementation
-################################################################################
-plugin.provider = Eclipse.org - ECF
-plugin.name = ECF Resources Synchronization API
+################################################################################
+# Copyright (c) 2009 Remy Chi Jian Suen 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:
+# Remy Chi Jian Suen <remy.suen@gmail.com> - initial API and implementation
+################################################################################
+plugin.provider = Eclipse.org - ECF
+plugin.name = ECF Resources Synchronization API
diff --git a/incubation/bundles/org.eclipse.ecf.sync.resources.core/plugin.xml b/incubation/bundles/org.eclipse.ecf.sync.resources.core/plugin.xml
index 0fd56b452..a90704741 100644
--- a/incubation/bundles/org.eclipse.ecf.sync.resources.core/plugin.xml
+++ b/incubation/bundles/org.eclipse.ecf.sync.resources.core/plugin.xml
@@ -1,10 +1,10 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin>
- <extension
- point="org.eclipse.core.runtime.preferences">
- <initializer
- class="org.eclipse.ecf.sync.resources.core.preferences.PreferenceInitializer">
- </initializer>
- </extension>
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer
+ class="org.eclipse.ecf.sync.resources.core.preferences.PreferenceInitializer">
+ </initializer>
+ </extension>
+</plugin>
diff --git a/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/FileChangeMessage.java b/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/FileChangeMessage.java
index 92cb136ab..5f7dd30b1 100644
--- a/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/FileChangeMessage.java
+++ b/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/FileChangeMessage.java
@@ -1,127 +1,127 @@
-/*******************************************************************************
- * Copyright (c) 2009 Remy Chi Jian Suen 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:
- * Remy Chi Jian Suen <remy.suen@gmail.com> - initial API and implementation
- ******************************************************************************/
-package org.eclipse.ecf.internal.sync.resources.core;
-
-import java.io.ByteArrayInputStream;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.ecf.sync.ModelUpdateException;
-import org.eclipse.ecf.sync.resources.core.preferences.PreferenceConstants;
-
-public final class FileChangeMessage extends ResourceChangeMessage {
-
- private static final long serialVersionUID = 1482601202361201103L;
-
- FileChangeMessage(String path, int kind, byte[] contents) {
- super(path, IResource.FILE, kind, contents);
- }
-
- public void applyToModel(Object model) throws ModelUpdateException {
- try {
- apply();
- } catch (CoreException e) {
- throw new ModelUpdateException(e, this, model);
- }
- }
-
- private void apply() throws CoreException {
- IPath resourcePath = new Path(path);
- final IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(
- resourcePath);
-
- switch (kind) {
- case IResourceDelta.ADDED:
- switch (SyncResourcesCore
- .getInt(PreferenceConstants.REMOTE_RESOURCE_ADDITION)) {
- case PreferenceConstants.COMMIT_VALUE:
- if (file.exists()) {
- // file was added by a remote peer when it exists locally,
- // this is a conflict, flag it as such
- setConflicted(true);
- // change the contents
- file.setContents(new ByteArrayInputStream(contents), true,
- true, null);
- } else {
- // file doesn't exist, create it
- file.create(new ByteArrayInputStream(contents), true, null);
- }
- break;
- case PreferenceConstants.IGNORE_CONFLICTS_VALUE:
- if (file.exists()) {
- // the file exists, this is a conflict, flag it
- setConflicted(true);
- // the user has set the system to ignore conflicts, flag it
- setIgnored(true);
- } else {
- // file doesn't exist, create it
- file.create(new ByteArrayInputStream(contents), true,
- new NullProgressMonitor());
- }
- break;
- case PreferenceConstants.IGNORE_VALUE:
- setIgnored(true);
- break;
- }
- break;
- case IResourceDelta.CHANGED:
- switch (SyncResourcesCore
- .getInt(PreferenceConstants.REMOTE_RESOURCE_ADDITION)) {
- case PreferenceConstants.COMMIT_VALUE:
- if (file.exists()) {
- file.setContents(new ByteArrayInputStream(contents), true,
- true, null);
- } else {
- setConflicted(true);
- file.create(new ByteArrayInputStream(contents), true, null);
- }
- break;
- case PreferenceConstants.IGNORE_CONFLICTS_VALUE:
- if (file.exists()) {
- file.setContents(new ByteArrayInputStream(contents), true,
- true, null);
- } else {
- setConflicted(true);
- setIgnored(true);
- }
- break;
- case PreferenceConstants.IGNORE_VALUE:
- setIgnored(true);
- break;
- }
- break;
- case IResourceDelta.REMOVED:
- switch (SyncResourcesCore
- .getInt(PreferenceConstants.REMOTE_RESOURCE_DELETION)) {
- case PreferenceConstants.COMMIT_VALUE:
- if (file.exists()) {
- // the file exists, commit the change by deleting it
- file.delete(false, true, new NullProgressMonitor());
- } else {
- // if it doesn't exist, then there's nothing to delete, so
- // we flag this change as having been ignored
- setIgnored(true);
- }
- break;
- case PreferenceConstants.IGNORE_VALUE:
- setIgnored(true);
- break;
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 Remy Chi Jian Suen 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:
+ * Remy Chi Jian Suen <remy.suen@gmail.com> - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ecf.internal.sync.resources.core;
+
+import java.io.ByteArrayInputStream;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.ecf.sync.ModelUpdateException;
+import org.eclipse.ecf.sync.resources.core.preferences.PreferenceConstants;
+
+public final class FileChangeMessage extends ResourceChangeMessage {
+
+ private static final long serialVersionUID = 1482601202361201103L;
+
+ FileChangeMessage(String path, int kind, byte[] contents) {
+ super(path, IResource.FILE, kind, contents);
+ }
+
+ public void applyToModel(Object model) throws ModelUpdateException {
+ try {
+ apply();
+ } catch (CoreException e) {
+ throw new ModelUpdateException(e, this, model);
+ }
+ }
+
+ private void apply() throws CoreException {
+ IPath resourcePath = new Path(path);
+ final IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(
+ resourcePath);
+
+ switch (kind) {
+ case IResourceDelta.ADDED:
+ switch (SyncResourcesCore
+ .getInt(PreferenceConstants.REMOTE_RESOURCE_ADDITION)) {
+ case PreferenceConstants.COMMIT_VALUE:
+ if (file.exists()) {
+ // file was added by a remote peer when it exists locally,
+ // this is a conflict, flag it as such
+ setConflicted(true);
+ // change the contents
+ file.setContents(new ByteArrayInputStream(contents), true,
+ true, null);
+ } else {
+ // file doesn't exist, create it
+ file.create(new ByteArrayInputStream(contents), true, null);
+ }
+ break;
+ case PreferenceConstants.IGNORE_CONFLICTS_VALUE:
+ if (file.exists()) {
+ // the file exists, this is a conflict, flag it
+ setConflicted(true);
+ // the user has set the system to ignore conflicts, flag it
+ setIgnored(true);
+ } else {
+ // file doesn't exist, create it
+ file.create(new ByteArrayInputStream(contents), true,
+ new NullProgressMonitor());
+ }
+ break;
+ case PreferenceConstants.IGNORE_VALUE:
+ setIgnored(true);
+ break;
+ }
+ break;
+ case IResourceDelta.CHANGED:
+ switch (SyncResourcesCore
+ .getInt(PreferenceConstants.REMOTE_RESOURCE_ADDITION)) {
+ case PreferenceConstants.COMMIT_VALUE:
+ if (file.exists()) {
+ file.setContents(new ByteArrayInputStream(contents), true,
+ true, null);
+ } else {
+ setConflicted(true);
+ file.create(new ByteArrayInputStream(contents), true, null);
+ }
+ break;
+ case PreferenceConstants.IGNORE_CONFLICTS_VALUE:
+ if (file.exists()) {
+ file.setContents(new ByteArrayInputStream(contents), true,
+ true, null);
+ } else {
+ setConflicted(true);
+ setIgnored(true);
+ }
+ break;
+ case PreferenceConstants.IGNORE_VALUE:
+ setIgnored(true);
+ break;
+ }
+ break;
+ case IResourceDelta.REMOVED:
+ switch (SyncResourcesCore
+ .getInt(PreferenceConstants.REMOTE_RESOURCE_DELETION)) {
+ case PreferenceConstants.COMMIT_VALUE:
+ if (file.exists()) {
+ // the file exists, commit the change by deleting it
+ file.delete(false, true, new NullProgressMonitor());
+ } else {
+ // if it doesn't exist, then there's nothing to delete, so
+ // we flag this change as having been ignored
+ setIgnored(true);
+ }
+ break;
+ case PreferenceConstants.IGNORE_VALUE:
+ setIgnored(true);
+ break;
+ }
+ }
+ }
+
+}
diff --git a/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/FolderChangeMessage.java b/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/FolderChangeMessage.java
index 06e2d5665..0665e5d62 100644
--- a/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/FolderChangeMessage.java
+++ b/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/FolderChangeMessage.java
@@ -1,81 +1,81 @@
-/*******************************************************************************
- * Copyright (c) 2009 Remy Chi Jian Suen 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:
- * Remy Chi Jian Suen <remy.suen@gmail.com> - initial API and implementation
- ******************************************************************************/
-package org.eclipse.ecf.internal.sync.resources.core;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.ecf.sync.ModelUpdateException;
-import org.eclipse.ecf.sync.resources.core.preferences.PreferenceConstants;
-
-final class FolderChangeMessage extends ResourceChangeMessage {
-
- private static final long serialVersionUID = -9163249277826579621L;
-
- FolderChangeMessage(String path, int kind) {
- super(path, IResource.FOLDER, kind, null);
- }
-
- public void applyToModel(Object model) throws ModelUpdateException {
- try {
- apply();
- } catch (CoreException e) {
- throw new ModelUpdateException(e, this, model);
- }
- }
-
- private void apply() throws CoreException {
- IFolder folder = ResourcesPlugin.getWorkspace().getRoot().getFolder(
- new Path(path));
- switch (kind) {
- case IResourceDelta.ADDED:
- switch (SyncResourcesCore
- .getInt(PreferenceConstants.REMOTE_RESOURCE_ADDITION)) {
- case PreferenceConstants.COMMIT_VALUE:
- if (folder.exists()) {
- // the folder already exists, no need to create it, mark it
- // as conflicting and ignored
- setConflicted(true);
- setIgnored(true);
- } else {
- folder.create(false, true, new NullProgressMonitor());
- }
- break;
- case PreferenceConstants.IGNORE_VALUE:
- setIgnored(true);
- break;
- }
- break;
- case IResourceDelta.REMOVED:
- switch (SyncResourcesCore
- .getInt(PreferenceConstants.REMOTE_RESOURCE_DELETION)) {
- case PreferenceConstants.COMMIT_VALUE:
- if (folder.exists()) {
- folder.delete(false, true, new NullProgressMonitor());
- } else {
- // if it doesn't exist, then there's nothing to delete, so
- // we flag this change as having been ignored
- setIgnored(true);
- }
- break;
- case PreferenceConstants.IGNORE_VALUE:
- setIgnored(true);
- break;
- }
- break;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 Remy Chi Jian Suen 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:
+ * Remy Chi Jian Suen <remy.suen@gmail.com> - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ecf.internal.sync.resources.core;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.ecf.sync.ModelUpdateException;
+import org.eclipse.ecf.sync.resources.core.preferences.PreferenceConstants;
+
+final class FolderChangeMessage extends ResourceChangeMessage {
+
+ private static final long serialVersionUID = -9163249277826579621L;
+
+ FolderChangeMessage(String path, int kind) {
+ super(path, IResource.FOLDER, kind, null);
+ }
+
+ public void applyToModel(Object model) throws ModelUpdateException {
+ try {
+ apply();
+ } catch (CoreException e) {
+ throw new ModelUpdateException(e, this, model);
+ }
+ }
+
+ private void apply() throws CoreException {
+ IFolder folder = ResourcesPlugin.getWorkspace().getRoot().getFolder(
+ new Path(path));
+ switch (kind) {
+ case IResourceDelta.ADDED:
+ switch (SyncResourcesCore
+ .getInt(PreferenceConstants.REMOTE_RESOURCE_ADDITION)) {
+ case PreferenceConstants.COMMIT_VALUE:
+ if (folder.exists()) {
+ // the folder already exists, no need to create it, mark it
+ // as conflicting and ignored
+ setConflicted(true);
+ setIgnored(true);
+ } else {
+ folder.create(false, true, new NullProgressMonitor());
+ }
+ break;
+ case PreferenceConstants.IGNORE_VALUE:
+ setIgnored(true);
+ break;
+ }
+ break;
+ case IResourceDelta.REMOVED:
+ switch (SyncResourcesCore
+ .getInt(PreferenceConstants.REMOTE_RESOURCE_DELETION)) {
+ case PreferenceConstants.COMMIT_VALUE:
+ if (folder.exists()) {
+ folder.delete(false, true, new NullProgressMonitor());
+ } else {
+ // if it doesn't exist, then there's nothing to delete, so
+ // we flag this change as having been ignored
+ setIgnored(true);
+ }
+ break;
+ case PreferenceConstants.IGNORE_VALUE:
+ setIgnored(true);
+ break;
+ }
+ break;
+ }
+ }
+
+}
diff --git a/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/Message.java b/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/Message.java
index e1d68c231..d1b54f08b 100644
--- a/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/Message.java
+++ b/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/Message.java
@@ -1,47 +1,47 @@
-/****************************************************************************
- * Copyright (c) 2007, 2009 Composent, Inc. 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:
- * Composent, Inc. - initial API and implementation
- *****************************************************************************/
-
-package org.eclipse.ecf.internal.sync.resources.core;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-
-import org.eclipse.ecf.sync.SerializationException;
-
-public class Message implements Serializable {
-
- private static final long serialVersionUID = 4858801311305630711L;
-
- static byte[] serialize(Object object) throws SerializationException {
- try {
- final ByteArrayOutputStream bos = new ByteArrayOutputStream();
- final ObjectOutputStream oos = new ObjectOutputStream(bos);
- oos.writeObject(object);
- return bos.toByteArray();
- } catch (IOException e) {
- throw new SerializationException(e);
- }
- }
-
- byte[] serialize() throws SerializationException {
- return serialize(this);
- }
-
- static Object deserialize(byte[] bytes) throws Exception {
- final ByteArrayInputStream bins = new ByteArrayInputStream(bytes);
- final ObjectInputStream oins = new ObjectInputStream(bins);
- return oins.readObject();
- }
-}
+/****************************************************************************
+ * Copyright (c) 2007, 2009 Composent, Inc. 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:
+ * Composent, Inc. - initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.ecf.internal.sync.resources.core;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+
+import org.eclipse.ecf.sync.SerializationException;
+
+public class Message implements Serializable {
+
+ private static final long serialVersionUID = 4858801311305630711L;
+
+ static byte[] serialize(Object object) throws SerializationException {
+ try {
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final ObjectOutputStream oos = new ObjectOutputStream(bos);
+ oos.writeObject(object);
+ return bos.toByteArray();
+ } catch (IOException e) {
+ throw new SerializationException(e);
+ }
+ }
+
+ byte[] serialize() throws SerializationException {
+ return serialize(this);
+ }
+
+ static Object deserialize(byte[] bytes) throws Exception {
+ final ByteArrayInputStream bins = new ByteArrayInputStream(bytes);
+ final ObjectInputStream oins = new ObjectInputStream(bins);
+ return oins.readObject();
+ }
+}
diff --git a/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/ResourceChangeMessage.java b/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/ResourceChangeMessage.java
index d07837e80..2596bac7e 100644
--- a/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/ResourceChangeMessage.java
+++ b/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/ResourceChangeMessage.java
@@ -1,122 +1,122 @@
-/*******************************************************************************
- * Copyright (c) 2009 Remy Chi Jian Suen 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:
- * Remy Chi Jian Suen <remy.suen@gmail.com> - initial API and implementation
- ******************************************************************************/
-package org.eclipse.ecf.internal.sync.resources.core;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.ecf.sync.IModelChange;
-import org.eclipse.ecf.sync.IModelChangeMessage;
-import org.eclipse.ecf.sync.resources.core.IResourceChange;
-
-public abstract class ResourceChangeMessage implements IResourceChange,
- IModelChangeMessage, Serializable {
-
- private static final long serialVersionUID = 1460461590232423466L;
-
- static IModelChange createResourceChange(IResource resource, int kind) {
- switch (resource.getType()) {
- case IResource.FILE:
- IFile file = (IFile) resource;
- try {
- if (file.exists()) {
- InputStream contents = file.getContents();
- byte[] bytes = new byte[contents.available()];
- contents.read(bytes);
- return new FileChangeMessage(resource.getFullPath()
- .toString(), kind, bytes);
- }
- return new FileChangeMessage(resource.getFullPath().toString(),
- kind, null);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- case IResource.FOLDER:
- // we're not interested in folder changes
- if (kind != IResourceDelta.CHANGED) {
- return new FolderChangeMessage(resource.getFullPath()
- .toString(), kind);
- }
- default:
- return null;
- }
- }
-
- final byte[] contents;
- final int kind;
- final String path;
- private final int type;
-
- private boolean conflicted = false;
- private boolean ignored = false;
-
- ResourceChangeMessage(String path, int type, int kind, byte[] contents) {
- this.contents = contents;
- this.kind = kind;
- this.type = type;
- this.path = path;
- }
-
- public final String getPath() {
- return path;
- }
-
- public final int getType() {
- return type;
- }
-
- public final int getKind() {
- return kind;
- }
-
- public final byte[] getContents() {
- return contents;
- }
-
- void setConflicted(boolean conflicted) {
- this.conflicted = conflicted;
- }
-
- public boolean isConflicted() {
- return conflicted;
- }
-
- void setIgnored(boolean ignored) {
- this.ignored = ignored;
- }
-
- public boolean isIgnored() {
- return ignored;
- }
-
- public final byte[] serialize() {
- try {
- final ByteArrayOutputStream bos = new ByteArrayOutputStream();
- final ObjectOutputStream oos = new ObjectOutputStream(bos);
- oos.writeObject(this);
- return bos.toByteArray();
- } catch (IOException e) {
- return new byte[0];
- }
- }
-
- public Object getAdapter(Class adapter) {
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 Remy Chi Jian Suen 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:
+ * Remy Chi Jian Suen <remy.suen@gmail.com> - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ecf.internal.sync.resources.core;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.ecf.sync.IModelChange;
+import org.eclipse.ecf.sync.IModelChangeMessage;
+import org.eclipse.ecf.sync.resources.core.IResourceChange;
+
+public abstract class ResourceChangeMessage implements IResourceChange,
+ IModelChangeMessage, Serializable {
+
+ private static final long serialVersionUID = 1460461590232423466L;
+
+ static IModelChange createResourceChange(IResource resource, int kind) {
+ switch (resource.getType()) {
+ case IResource.FILE:
+ IFile file = (IFile) resource;
+ try {
+ if (file.exists()) {
+ InputStream contents = file.getContents();
+ byte[] bytes = new byte[contents.available()];
+ contents.read(bytes);
+ return new FileChangeMessage(resource.getFullPath()
+ .toString(), kind, bytes);
+ }
+ return new FileChangeMessage(resource.getFullPath().toString(),
+ kind, null);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ case IResource.FOLDER:
+ // we're not interested in folder changes
+ if (kind != IResourceDelta.CHANGED) {
+ return new FolderChangeMessage(resource.getFullPath()
+ .toString(), kind);
+ }
+ default:
+ return null;
+ }
+ }
+
+ final byte[] contents;
+ final int kind;
+ final String path;
+ private final int type;
+
+ private boolean conflicted = false;
+ private boolean ignored = false;
+
+ ResourceChangeMessage(String path, int type, int kind, byte[] contents) {
+ this.contents = contents;
+ this.kind = kind;
+ this.type = type;
+ this.path = path;
+ }
+
+ public final String getPath() {
+ return path;
+ }
+
+ public final int getType() {
+ return type;
+ }
+
+ public final int getKind() {
+ return kind;
+ }
+
+ public final byte[] getContents() {
+ return contents;
+ }
+
+ void setConflicted(boolean conflicted) {
+ this.conflicted = conflicted;
+ }
+
+ public boolean isConflicted() {
+ return conflicted;
+ }
+
+ void setIgnored(boolean ignored) {
+ this.ignored = ignored;
+ }
+
+ public boolean isIgnored() {
+ return ignored;
+ }
+
+ public final byte[] serialize() {
+ try {
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final ObjectOutputStream oos = new ObjectOutputStream(bos);
+ oos.writeObject(this);
+ return bos.toByteArray();
+ } catch (IOException e) {
+ return new byte[0];
+ }
+ }
+
+ public Object getAdapter(Class adapter) {
+ return Platform.getAdapterManager().getAdapter(this, adapter);
+ }
+
+}
diff --git a/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/ResourcesShare.java b/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/ResourcesShare.java
index 7ae8be58e..0d068c9bd 100644
--- a/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/ResourcesShare.java
+++ b/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/ResourcesShare.java
@@ -1,257 +1,257 @@
-/*******************************************************************************
- * Copyright (c) 2009 Remy Chi Jian Suen 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:
- * Remy Chi Jian Suen <remy.suen@gmail.com> - initial API and implementation
- ******************************************************************************/
-package org.eclipse.ecf.internal.sync.resources.core;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.MultiRule;
-import org.eclipse.ecf.core.identity.ID;
-import org.eclipse.ecf.core.util.ECFException;
-import org.eclipse.ecf.datashare.AbstractShare;
-import org.eclipse.ecf.datashare.IChannelContainerAdapter;
-import org.eclipse.ecf.sync.IModelChange;
-import org.eclipse.ecf.sync.IModelChangeMessage;
-
-public class ResourcesShare extends AbstractShare {
-
- private Boolean response;
-
- private Set sharedProjects = new HashSet();
-
- private ID receiverID;
-
- private ID containerID;
-
- private ID localID;
-
- public ResourcesShare(ID containerID, IChannelContainerAdapter adapter)
- throws ECFException {
- super(adapter);
- this.containerID = containerID;
- }
-
- private void attachListener() {
- if (sharedProjects.size() == 1) {
- SyncResourcesCore.getDefault().attachListener();
- }
- }
-
- private void detachListener() {
- if (sharedProjects.isEmpty()) {
- SyncResourcesCore.getDefault().detachListener();
- }
- }
-
- public void sendResponse(boolean accept, String projectName) {
- try {
- if (accept) {
- send(receiverID, new AcceptMessage(projectName));
- } else {
- send(receiverID, new DenyMessage(projectName));
- }
- } catch (ECFException e) {
- // TODO handle this
- e.printStackTrace();
- }
- }
-
- public Boolean getResponse() {
- if (response == null) {
- return null;
- }
- Boolean temp = response;
- response = null;
- return temp;
- }
-
- public ID getContainerID() {
- return containerID;
- }
-
- public ID getReceiverID() {
- return receiverID;
- }
-
- public ID getLocalID() {
- return localID;
- }
-
- public boolean isSharing(String projectName) {
- synchronized (sharedProjects) {
- return sharedProjects.contains(projectName);
- }
- }
-
- public void startShare(ID fromId, ID toID, String projectName)
- throws ECFException {
- if (sharedProjects.add(projectName)) {
- // reset in case we have a stale one
- response = null;
-
- try {
- send(toID, new StartMessage(projectName, fromId, toID));
- localID = fromId;
- receiverID = toID;
- attachListener();
- } catch (ECFException e) {
- receiverID = null;
- sharedProjects.remove(projectName);
- detachListener();
- throw e;
- }
- }
- }
-
- public void stopSharing(String projectName) {
- if (sharedProjects.remove(projectName)) {
- try {
- send(receiverID, new StopMessage(projectName));
- } catch (ECFException e) {
- // TODO handle this
- e.printStackTrace();
- } finally {
- receiverID = null;
- }
-
- detachListener();
- }
- }
-
- private void send(ID toID, Message message) throws ECFException {
- sendMessage(toID, message.serialize());
- }
-
- void send(byte[] bytes) throws ECFException {
- sendMessage(receiverID, bytes);
- }
-
- void sendResourceChangeMessage(IResource resource, int kind) {
- try {
- IModelChange change = ResourceChangeMessage.createResourceChange(
- resource, kind);
- IModelChangeMessage[] messages = ResourcesSynchronizationStrategy
- .getInstance().registerLocalChange(change);
- for (int i = 0; i < messages.length; i++) {
- send(messages[i].serialize());
- }
- } catch (ECFException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- protected void handleStartMessage(StartMessage msg) {
- receiverID = msg.getFromId();
- localID = msg.getLocalId();
- sharedProjects.add(msg.getProjectName());
- attachListener();
- }
-
- private void handleStopMessage(StopMessage msg) {
- sharedProjects.remove(msg.getProjectName());
- detachListener();
- }
-
- private void handleResourceChangeMessage(byte[] data) throws Exception {
- IModelChange remoteChange = ResourcesSynchronizationStrategy
- .getInstance().deserializeRemoteChange(data);
- final IModelChange[] remoteChanges = ResourcesSynchronizationStrategy
- .getInstance().transformRemoteChange(remoteChange);
-
- // create a scheduling rule to lock the projects
- ISchedulingRule[] rules = new ISchedulingRule[sharedProjects.size()];
- int index = 0;
- for (Iterator it = sharedProjects.iterator(); it.hasNext();) {
- String projectName = (String) it.next();
-
- rules[index] = ResourcesPlugin.getWorkspace().getRoot().getProject(
- projectName);
- index++;
- }
-
- try {
- // lock to prevent resource changes from being propagated
- lock(remoteChanges);
- applyRemoteChanges(remoteChanges, new MultiRule(rules));
- } finally {
- // unlock now that we've applied the remote changes to our
- // own workspace
- unlock(remoteChanges);
- }
-
- if (remoteChange instanceof BatchModelChange) {
- BatchModelChange batchChange = (BatchModelChange) remoteChange;
- batchChange.setOutgoing(false);
- batchChange.setTime(System.currentTimeMillis());
-
- SyncResourcesCore.add(batchChange);
- }
- }
-
- protected void lock(IModelChange[] remoteChanges) {
- SyncResourcesCore.lock();
- }
-
- protected void unlock(IModelChange[] remoteChanges) {
- SyncResourcesCore.unlock();
- }
-
- private void applyRemoteChanges(final IModelChange[] remoteChanges,
- ISchedulingRule rule) throws CoreException {
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- monitor.beginTask("Processing remote changes...",
- remoteChanges.length);
- for (int i = 0; i < remoteChanges.length; i++) {
- if (monitor.isCanceled()) {
- return;
- }
- // applies the resource changes
- remoteChanges[i].applyToModel(containerID);
- monitor.worked(1);
- }
- monitor.done();
- }
- }, rule, IWorkspace.AVOID_UPDATE, null);
-
- }
-
- protected void handleMessage(ID fromContainerID, byte[] data) {
- try {
- Object message = Message.deserialize(data);
- if (message instanceof StartMessage) {
- handleStartMessage((StartMessage) message);
- } else if (message instanceof StopMessage) {
- handleStopMessage((StopMessage) message);
- } else if (message instanceof AcceptMessage) {
- response = Boolean.TRUE;
- } else if (message instanceof DenyMessage) {
- sharedProjects.remove(((DenyMessage) message).getProjectName());
- receiverID = null;
- detachListener();
- response = Boolean.FALSE;
- } else {
- handleResourceChangeMessage(data);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2009 Remy Chi Jian Suen 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:
+ * Remy Chi Jian Suen <remy.suen@gmail.com> - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ecf.internal.sync.resources.core;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.core.runtime.jobs.MultiRule;
+import org.eclipse.ecf.core.identity.ID;
+import org.eclipse.ecf.core.util.ECFException;
+import org.eclipse.ecf.datashare.AbstractShare;
+import org.eclipse.ecf.datashare.IChannelContainerAdapter;
+import org.eclipse.ecf.sync.IModelChange;
+import org.eclipse.ecf.sync.IModelChangeMessage;
+
+public class ResourcesShare extends AbstractShare {
+
+ private Boolean response;
+
+ private Set sharedProjects = new HashSet();
+
+ private ID receiverID;
+
+ private ID containerID;
+
+ private ID localID;
+
+ public ResourcesShare(ID containerID, IChannelContainerAdapter adapter)
+ throws ECFException {
+ super(adapter);
+ this.containerID = containerID;
+ }
+
+ private void attachListener() {
+ if (sharedProjects.size() == 1) {
+ SyncResourcesCore.getDefault().attachListener();
+ }
+ }
+
+ private void detachListener() {
+ if (sharedProjects.isEmpty()) {
+ SyncResourcesCore.getDefault().detachListener();
+ }
+ }
+
+ public void sendResponse(boolean accept, String projectName) {
+ try {
+ if (accept) {
+ send(receiverID, new AcceptMessage(projectName));
+ } else {
+ send(receiverID, new DenyMessage(projectName));
+ }
+ } catch (ECFException e) {
+ // TODO handle this
+ e.printStackTrace();
+ }
+ }
+
+ public Boolean getResponse() {
+ if (response == null) {
+ return null;
+ }
+ Boolean temp = response;
+ response = null;
+ return temp;
+ }
+
+ public ID getContainerID() {
+ return containerID;
+ }
+
+ public ID getReceiverID() {
+ return receiverID;
+ }
+
+ public ID getLocalID() {
+ return localID;
+ }
+
+ public boolean isSharing(String projectName) {
+ synchronized (sharedProjects) {
+ return sharedProjects.contains(projectName);
+ }
+ }
+
+ public void startShare(ID fromId, ID toID, String projectName)
+ throws ECFException {
+ if (sharedProjects.add(projectName)) {
+ // reset in case we have a stale one
+ response = null;
+
+ try {
+ send(toID, new StartMessage(projectName, fromId, toID));
+ localID = fromId;
+ receiverID = toID;
+ attachListener();
+ } catch (ECFException e) {
+ receiverID = null;
+ sharedProjects.remove(projectName);
+ detachListener();
+ throw e;
+ }
+ }
+ }
+
+ public void stopSharing(String projectName) {
+ if (sharedProjects.remove(projectName)) {
+ try {
+ send(receiverID, new StopMessage(projectName));
+ } catch (ECFException e) {
+ // TODO handle this
+ e.printStackTrace();
+ } finally {
+ receiverID = null;
+ }
+
+ detachListener();
+ }
+ }
+
+ private void send(ID toID, Message message) throws ECFException {
+ sendMessage(toID, message.serialize());
+ }
+
+ void send(byte[] bytes) throws ECFException {
+ sendMessage(receiverID, bytes);
+ }
+
+ void sendResourceChangeMessage(IResource resource, int kind) {
+ try {
+ IModelChange change = ResourceChangeMessage.createResourceChange(
+ resource, kind);
+ IModelChangeMessage[] messages = ResourcesSynchronizationStrategy
+ .getInstance().registerLocalChange(change);
+ for (int i = 0; i < messages.length; i++) {
+ send(messages[i].serialize());
+ }
+ } catch (ECFException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ protected void handleStartMessage(StartMessage msg) {
+ receiverID = msg.getFromId();
+ localID = msg.getLocalId();
+ sharedProjects.add(msg.getProjectName());
+ attachListener();
+ }
+
+ private void handleStopMessage(StopMessage msg) {
+ sharedProjects.remove(msg.getProjectName());
+ detachListener();
+ }
+
+ private void handleResourceChangeMessage(byte[] data) throws Exception {
+ IModelChange remoteChange = ResourcesSynchronizationStrategy
+ .getInstance().deserializeRemoteChange(data);
+ final IModelChange[] remoteChanges = ResourcesSynchronizationStrategy
+ .getInstance().transformRemoteChange(remoteChange);
+
+ // create a scheduling rule to lock the projects
+ ISchedulingRule[] rules = new ISchedulingRule[sharedProjects.size()];
+ int index = 0;
+ for (Iterator it = sharedProjects.iterator(); it.hasNext();) {
+ String projectName = (String) it.next();
+
+ rules[index] = ResourcesPlugin.getWorkspace().getRoot().getProject(
+ projectName);
+ index++;
+ }
+
+ try {
+ // lock to prevent resource changes from being propagated
+ lock(remoteChanges);
+ applyRemoteChanges(remoteChanges, new MultiRule(rules));
+ } finally {
+ // unlock now that we've applied the remote changes to our
+ // own workspace
+ unlock(remoteChanges);
+ }
+
+ if (remoteChange instanceof BatchModelChange) {
+ BatchModelChange batchChange = (BatchModelChange) remoteChange;
+ batchChange.setOutgoing(false);
+ batchChange.setTime(System.currentTimeMillis());
+
+ SyncResourcesCore.add(batchChange);
+ }
+ }
+
+ protected void lock(IModelChange[] remoteChanges) {
+ SyncResourcesCore.lock();
+ }
+
+ protected void unlock(IModelChange[] remoteChanges) {
+ SyncResourcesCore.unlock();
+ }
+
+ private void applyRemoteChanges(final IModelChange[] remoteChanges,
+ ISchedulingRule rule) throws CoreException {
+ ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ monitor.beginTask("Processing remote changes...",
+ remoteChanges.length);
+ for (int i = 0; i < remoteChanges.length; i++) {
+ if (monitor.isCanceled()) {
+ return;
+ }
+ // applies the resource changes
+ remoteChanges[i].applyToModel(containerID);
+ monitor.worked(1);
+ }
+ monitor.done();
+ }
+ }, rule, IWorkspace.AVOID_UPDATE, null);
+
+ }
+
+ protected void handleMessage(ID fromContainerID, byte[] data) {
+ try {
+ Object message = Message.deserialize(data);
+ if (message instanceof StartMessage) {
+ handleStartMessage((StartMessage) message);
+ } else if (message instanceof StopMessage) {
+ handleStopMessage((StopMessage) message);
+ } else if (message instanceof AcceptMessage) {
+ response = Boolean.TRUE;
+ } else if (message instanceof DenyMessage) {
+ sharedProjects.remove(((DenyMessage) message).getProjectName());
+ receiverID = null;
+ detachListener();
+ response = Boolean.FALSE;
+ } else {
+ handleResourceChangeMessage(data);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/ResourcesSynchronizationStrategy.java b/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/ResourcesSynchronizationStrategy.java
index 4a91976c0..15f6cf50b 100644
--- a/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/ResourcesSynchronizationStrategy.java
+++ b/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/ResourcesSynchronizationStrategy.java
@@ -1,74 +1,74 @@
-/*******************************************************************************
- * Copyright (c) 2009 Remy Chi Jian Suen 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:
- * Remy Chi Jian Suen <remy.suen@gmail.com> - initial API and implementation
- ******************************************************************************/
-package org.eclipse.ecf.internal.sync.resources.core;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.ecf.sync.IModelChange;
-import org.eclipse.ecf.sync.IModelChangeMessage;
-import org.eclipse.ecf.sync.IModelSynchronizationStrategy;
-import org.eclipse.ecf.sync.SerializationException;
-import org.eclipse.ecf.sync.resources.core.IResourceChange;
-
-public class ResourcesSynchronizationStrategy implements
- IModelSynchronizationStrategy {
-
- private static final IModelSynchronizationStrategy strategy = new ResourcesSynchronizationStrategy();
-
- public static IModelSynchronizationStrategy getInstance() {
- return strategy;
- }
-
- public IModelChange deserializeRemoteChange(byte[] bytes)
- throws SerializationException {
- try {
- Object object = new ObjectInputStream(new ByteArrayInputStream(
- bytes)).readObject();
- if (object instanceof BatchModelChange
- || object instanceof IResourceChange) {
- return (IModelChange) object;
- } else {
- throw new SerializationException(
- "Resources synchronization does not support deserializing "
- + object.getClass() + " instances");
- }
- } catch (IOException e) {
- throw new SerializationException("Failed to read object");
- } catch (ClassNotFoundException e) {
- throw new SerializationException("Failed to load object class");
- }
- }
-
- public IModelChangeMessage[] registerLocalChange(IModelChange localChange) {
- if (localChange instanceof ResourceChangeMessage) {
- return new IModelChangeMessage[] { (IModelChangeMessage) localChange };
- }
- return new IModelChangeMessage[0];
- }
-
- public IModelChange[] transformRemoteChange(IModelChange remoteChange) {
- if (remoteChange instanceof BatchModelChange) {
- IModelChangeMessage[] messages = ((BatchModelChange) remoteChange).getMessages();
- IModelChange[] changes = new IModelChange[messages.length];
- System.arraycopy(messages, 0, changes, 0, messages.length);
- return changes;
- }
- return new IModelChange[] { remoteChange };
- }
-
- public Object getAdapter(Class adapter) {
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 Remy Chi Jian Suen 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:
+ * Remy Chi Jian Suen <remy.suen@gmail.com> - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ecf.internal.sync.resources.core;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.ecf.sync.IModelChange;
+import org.eclipse.ecf.sync.IModelChangeMessage;
+import org.eclipse.ecf.sync.IModelSynchronizationStrategy;
+import org.eclipse.ecf.sync.SerializationException;
+import org.eclipse.ecf.sync.resources.core.IResourceChange;
+
+public class ResourcesSynchronizationStrategy implements
+ IModelSynchronizationStrategy {
+
+ private static final IModelSynchronizationStrategy strategy = new ResourcesSynchronizationStrategy();
+
+ public static IModelSynchronizationStrategy getInstance() {
+ return strategy;
+ }
+
+ public IModelChange deserializeRemoteChange(byte[] bytes)
+ throws SerializationException {
+ try {
+ Object object = new ObjectInputStream(new ByteArrayInputStream(
+ bytes)).readObject();
+ if (object instanceof BatchModelChange
+ || object instanceof IResourceChange) {
+ return (IModelChange) object;
+ } else {
+ throw new SerializationException(
+ "Resources synchronization does not support deserializing "
+ + object.getClass() + " instances");
+ }
+ } catch (IOException e) {
+ throw new SerializationException("Failed to read object");
+ } catch (ClassNotFoundException e) {
+ throw new SerializationException("Failed to load object class");
+ }
+ }
+
+ public IModelChangeMessage[] registerLocalChange(IModelChange localChange) {
+ if (localChange instanceof ResourceChangeMessage) {
+ return new IModelChangeMessage[] { (IModelChangeMessage) localChange };
+ }
+ return new IModelChangeMessage[0];
+ }
+
+ public IModelChange[] transformRemoteChange(IModelChange remoteChange) {
+ if (remoteChange instanceof BatchModelChange) {
+ IModelChangeMessage[] messages = ((BatchModelChange) remoteChange).getMessages();
+ IModelChange[] changes = new IModelChange[messages.length];
+ System.arraycopy(messages, 0, changes, 0, messages.length);
+ return changes;
+ }
+ return new IModelChange[] { remoteChange };
+ }
+
+ public Object getAdapter(Class adapter) {
+ return Platform.getAdapterManager().getAdapter(this, adapter);
+ }
+
+}
diff --git a/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/StartMessage.java b/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/StartMessage.java
index 5e781c97d..70131cbce 100644
--- a/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/StartMessage.java
+++ b/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/StartMessage.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * Copyright (c) 2009 Remy Chi Jian Suen 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:
- * Remy Chi Jian Suen <remy.suen@gmail.com> - initial API and implementation
- ******************************************************************************/
-package org.eclipse.ecf.internal.sync.resources.core;
-
-import java.io.Serializable;
-
-import org.eclipse.ecf.core.identity.ID;
-
-public final class StartMessage extends Message implements Serializable {
-
- private static final long serialVersionUID = -5609339410051661940L;
-
- private String projectName;
-
- private ID fromId;
-
- private ID localId;
-
- StartMessage(String projectName, ID fromId, ID localId) {
- this.projectName = projectName;
- this.fromId = fromId;
- this.localId = localId;
- }
-
- public String getProjectName() {
- return projectName;
- }
-
- public ID getFromId() {
- return fromId;
- }
-
- ID getLocalId() {
- return localId;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 Remy Chi Jian Suen 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:
+ * Remy Chi Jian Suen <remy.suen@gmail.com> - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ecf.internal.sync.resources.core;
+
+import java.io.Serializable;
+
+import org.eclipse.ecf.core.identity.ID;
+
+public final class StartMessage extends Message implements Serializable {
+
+ private static final long serialVersionUID = -5609339410051661940L;
+
+ private String projectName;
+
+ private ID fromId;
+
+ private ID localId;
+
+ StartMessage(String projectName, ID fromId, ID localId) {
+ this.projectName = projectName;
+ this.fromId = fromId;
+ this.localId = localId;
+ }
+
+ public String getProjectName() {
+ return projectName;
+ }
+
+ public ID getFromId() {
+ return fromId;
+ }
+
+ ID getLocalId() {
+ return localId;
+ }
+
+}
diff --git a/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/StopMessage.java b/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/StopMessage.java
index c73c6eb87..e60e3656c 100644
--- a/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/StopMessage.java
+++ b/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/StopMessage.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2009 Remy Chi Jian Suen 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:
- * Remy Chi Jian Suen <remy.suen@gmail.com> - initial API and implementation
- ******************************************************************************/
-package org.eclipse.ecf.internal.sync.resources.core;
-
-import java.io.Serializable;
-
-final class StopMessage extends Message implements Serializable {
-
- private static final long serialVersionUID = -7843915658263321577L;
-
- private String projectName;
-
- StopMessage(String projectName) {
- this.projectName = projectName;
- }
-
- String getProjectName() {
- return projectName;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 Remy Chi Jian Suen 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:
+ * Remy Chi Jian Suen <remy.suen@gmail.com> - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ecf.internal.sync.resources.core;
+
+import java.io.Serializable;
+
+final class StopMessage extends Message implements Serializable {
+
+ private static final long serialVersionUID = -7843915658263321577L;
+
+ private String projectName;
+
+ StopMessage(String projectName) {
+ this.projectName = projectName;
+ }
+
+ String getProjectName() {
+ return projectName;
+ }
+
+}
diff --git a/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/SyncResourcesCore.java b/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/SyncResourcesCore.java
index b3eaf3b4f..67532ac95 100644
--- a/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/SyncResourcesCore.java
+++ b/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/internal/sync/resources/core/SyncResourcesCore.java
@@ -1,328 +1,328 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Composent, Inc. 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:
- * Composent, Inc. - initial API and implementation
- ******************************************************************************/
-package org.eclipse.ecf.internal.sync.resources.core;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.preferences.DefaultScope;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.ecf.core.identity.ID;
-import org.eclipse.ecf.core.util.ECFException;
-import org.eclipse.ecf.sync.IModelChange;
-import org.eclipse.ecf.sync.IModelChangeMessage;
-import org.eclipse.ecf.sync.resources.core.preferences.PreferenceConstants;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.prefs.Preferences;
-
-public class SyncResourcesCore extends Plugin implements
- IResourceChangeListener, IResourceDeltaVisitor {
-
- public static final String PLUGIN_ID = "org.eclipse.ecf.sync.resources.core"; //$NON-NLS-1$
-
- private static final int LIMIT = 25;
-
- private static final Hashtable channels = new Hashtable();
-
- private static LinkedList enqueuedChanges = new LinkedList();
-
- private static SyncResourcesCore instance;
-
- private Map resourceChanges = new HashMap();
-
- public static ResourcesShare getResourcesShare(ID containerID) {
- return (ResourcesShare) channels.get(containerID);
- }
-
- public static void addResourcesShare(ID containerID, ResourcesShare share) {
- channels.put(containerID, share);
- }
-
- public static ResourcesShare removeResourcesShare(ID containerID) {
- return (ResourcesShare) channels.remove(containerID);
- }
-
- public static Collection getResourceShares() {
- return Collections.unmodifiableCollection(channels.values());
- }
-
- /**
- * Checks and returns whether the specified project is currently being
- * shared.
- */
- public static boolean isSharing(String projectName) {
- for (Iterator it = channels.values().iterator(); it.hasNext();) {
- ResourcesShare share = (ResourcesShare) it.next();
- if (share.isSharing(projectName)) {
- return true;
- }
- }
- return false;
- }
-
- private static boolean locked = false;
-
- /**
- * Requests that all resource changes be ignored. That is, they should not
- * be monitored for distribution to remote peers.
- */
- public static void lock() {
- locked = true;
- }
-
- /**
- * Unlocks by requesting that that all resource changes be monitored for
- * distribution to remote peers.
- */
- public static void unlock() {
- locked = false;
- }
-
- public boolean visit(IResourceDelta delta) throws CoreException {
- if (locked) {
- return false;
- }
-
- IResource resource = delta.getResource();
- int type = resource.getType();
- if (type == IResource.ROOT) {
- return true;
- }
-
- String projectName = resource.getProject().getName();
- boolean isSharing = isSharing(projectName);
- if (isSharing) {
- if (type == IResource.PROJECT) {
- return true;
- }
- } else {
- // this project is not being shared so we don't care about its
- // changes, return false
- return false;
- }
-
- // we are only interested in non-derived resources
- if (!resource.isDerived() && checkDelta(delta)) {
- for (Iterator it = channels.values().iterator(); it.hasNext();) {
- ResourcesShare share = (ResourcesShare) it.next();
- if (share.isSharing(projectName)) {
- IModelChange change = ResourceChangeMessage
- .createResourceChange(resource, delta.getKind());
- if (change != null) {
- List changes = (List) resourceChanges.get(share);
- if (changes == null) {
- changes = new ArrayList();
- resourceChanges.put(share, changes);
- }
-
- changes.add(change);
- }
- }
- }
- }
- return type == IResource.FOLDER;
- }
-
- private static boolean checkDelta(IResourceDelta delta) {
- return checkFlags(delta.getFlags()) || checkKind(delta.getKind());
- }
-
- private static boolean checkKind(int kind) {
- return kind == IResourceDelta.ADDED || kind == IResourceDelta.REMOVED;
- }
-
- /**
- * Checks the flags of a how a resource has been modified and returns
- * whether this change should be propagated to remote peers.
- *
- * @param flags
- * the detail flags of a resource delta
- * @return <code>true</code> if the delta should be propagated,
- * <code>false</code> otherwise
- */
- private static boolean checkFlags(int flags) {
- // we are only interested in content change, marker changes also fire
- // resource change events but we don't care about those, from
- // preliminary investigations, monitoring marker changes will cause
- // infinite loops
- return (flags & IResourceDelta.CONTENT) != 0;
- }
-
- public void resourceChanged(IResourceChangeEvent event) {
- try {
- event.getDelta().accept(this);
- } catch (CoreException e) {
- // ignored, this isn't possible as we never throw one
- } finally {
- try {
- // we're done, at least, "partially", distribute changes
- distributeChanges();
- } finally {
- // clear the cached changes
- resourceChanges.clear();
- }
- }
- }
-
- private void distributeChanges() {
- for (Iterator it = resourceChanges.entrySet().iterator(); it.hasNext();) {
- Entry entry = (Entry) it.next();
- ResourcesShare share = (ResourcesShare) entry.getKey();
- List changes = (List) entry.getValue();
-
- List messages = new ArrayList();
- for (int i = 0; i < changes.size(); i++) {
- ResourceChangeMessage change = (ResourceChangeMessage) changes
- .get(i);
-
- switch (change.getKind()) {
- case IResourceDelta.ADDED:
- if (getInt(PreferenceConstants.LOCAL_RESOURCE_ADDITION) == PreferenceConstants.IGNORE_VALUE) {
- change.setIgnored(true);
- continue;
- }
- break;
- case IResourceDelta.CHANGED:
- if (getInt(PreferenceConstants.LOCAL_RESOURCE_CHANGE) == PreferenceConstants.IGNORE_VALUE) {
- change.setIgnored(true);
- continue;
- }
- break;
- case IResourceDelta.REMOVED:
- if (getInt(PreferenceConstants.LOCAL_RESOURCE_DELETION) == PreferenceConstants.IGNORE_VALUE) {
- change.setIgnored(true);
- continue;
- }
- break;
- }
-
- IModelChangeMessage[] changeMessages = ResourcesSynchronizationStrategy
- .getInstance().registerLocalChange(change);
- messages.addAll(Arrays.asList(changeMessages));
- }
-
- try {
- if (!messages.isEmpty()) {
- IModelChangeMessage[] messagesArray = (IModelChangeMessage[]) messages
- .toArray(new IModelChangeMessage[messages.size()]);
- BatchModelChange batchChange = new BatchModelChange(
- messagesArray);
- share.send(Message.serialize(batchChange));
-
- add(batchChange);
- }
- } catch (ECFException e) {
- getDefault().getLog().log(
- new Status(IStatus.ERROR, PLUGIN_ID,
- "Could not send resource change message", e)); //$NON-NLS-1$
- }
- }
- }
-
- private static IView viewInstance;
-
- public static synchronized void setView(IView resourcesView) {
- viewInstance = resourcesView;
- if (resourcesView != null) {
- resourcesView.setInput(enqueuedChanges);
- }
- }
-
- public static synchronized void add(Object object) {
- if (enqueuedChanges.size() == LIMIT) {
- remove();
- }
-
- enqueuedChanges.addFirst(object);
- if (viewInstance != null) {
- viewInstance.add(object);
- }
- }
-
- private static synchronized void remove() {
- Object object = enqueuedChanges.removeLast();
- if (viewInstance != null) {
- viewInstance.remove(object);
- }
- }
-
- private static Preferences preferences;
- private static Preferences defaultPreferences;
-
- public SyncResourcesCore() {
- instance = this;
- }
-
- void attachListener() {
- ResourcesPlugin.getWorkspace().addResourceChangeListener(this,
- IResourceChangeEvent.POST_CHANGE);
- }
-
- void detachListener() {
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext
- * )
- */
- public void start(BundleContext ctxt) throws Exception {
- super.start(ctxt);
- attachListener();
- preferences = new InstanceScope().getNode(SyncResourcesCore.PLUGIN_ID);
- defaultPreferences = new DefaultScope()
- .getNode(SyncResourcesCore.PLUGIN_ID);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- instance = null;
- detachListener();
- super.stop(context);
- }
-
- public static SyncResourcesCore getDefault() {
- return instance;
- }
-
- public static int getInt(String key) {
- return preferences.getInt(key, defaultPreferences.getInt(key,
- PreferenceConstants.COMMIT_VALUE));
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 Composent, Inc. 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:
+ * Composent, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ecf.internal.sync.resources.core;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.ecf.core.identity.ID;
+import org.eclipse.ecf.core.util.ECFException;
+import org.eclipse.ecf.sync.IModelChange;
+import org.eclipse.ecf.sync.IModelChangeMessage;
+import org.eclipse.ecf.sync.resources.core.preferences.PreferenceConstants;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.prefs.Preferences;
+
+public class SyncResourcesCore extends Plugin implements
+ IResourceChangeListener, IResourceDeltaVisitor {
+
+ public static final String PLUGIN_ID = "org.eclipse.ecf.sync.resources.core"; //$NON-NLS-1$
+
+ private static final int LIMIT = 25;
+
+ private static final Hashtable channels = new Hashtable();
+
+ private static LinkedList enqueuedChanges = new LinkedList();
+
+ private static SyncResourcesCore instance;
+
+ private Map resourceChanges = new HashMap();
+
+ public static ResourcesShare getResourcesShare(ID containerID) {
+ return (ResourcesShare) channels.get(containerID);
+ }
+
+ public static void addResourcesShare(ID containerID, ResourcesShare share) {
+ channels.put(containerID, share);
+ }
+
+ public static ResourcesShare removeResourcesShare(ID containerID) {
+ return (ResourcesShare) channels.remove(containerID);
+ }
+
+ public static Collection getResourceShares() {
+ return Collections.unmodifiableCollection(channels.values());
+ }
+
+ /**
+ * Checks and returns whether the specified project is currently being
+ * shared.
+ */
+ public static boolean isSharing(String projectName) {
+ for (Iterator it = channels.values().iterator(); it.hasNext();) {
+ ResourcesShare share = (ResourcesShare) it.next();
+ if (share.isSharing(projectName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static boolean locked = false;
+
+ /**
+ * Requests that all resource changes be ignored. That is, they should not
+ * be monitored for distribution to remote peers.
+ */
+ public static void lock() {
+ locked = true;
+ }
+
+ /**
+ * Unlocks by requesting that that all resource changes be monitored for
+ * distribution to remote peers.
+ */
+ public static void unlock() {
+ locked = false;
+ }
+
+ public boolean visit(IResourceDelta delta) throws CoreException {
+ if (locked) {
+ return false;
+ }
+
+ IResource resource = delta.getResource();
+ int type = resource.getType();
+ if (type == IResource.ROOT) {
+ return true;
+ }
+
+ String projectName = resource.getProject().getName();
+ boolean isSharing = isSharing(projectName);
+ if (isSharing) {
+ if (type == IResource.PROJECT) {
+ return true;
+ }
+ } else {
+ // this project is not being shared so we don't care about its
+ // changes, return false
+ return false;
+ }
+
+ // we are only interested in non-derived resources
+ if (!resource.isDerived() && checkDelta(delta)) {
+ for (Iterator it = channels.values().iterator(); it.hasNext();) {
+ ResourcesShare share = (ResourcesShare) it.next();
+ if (share.isSharing(projectName)) {
+ IModelChange change = ResourceChangeMessage
+ .createResourceChange(resource, delta.getKind());
+ if (change != null) {
+ List changes = (List) resourceChanges.get(share);
+ if (changes == null) {
+ changes = new ArrayList();
+ resourceChanges.put(share, changes);
+ }
+
+ changes.add(change);
+ }
+ }
+ }
+ }
+ return type == IResource.FOLDER;
+ }
+
+ private static boolean checkDelta(IResourceDelta delta) {
+ return checkFlags(delta.getFlags()) || checkKind(delta.getKind());
+ }
+
+ private static boolean checkKind(int kind) {
+ return kind == IResourceDelta.ADDED || kind == IResourceDelta.REMOVED;
+ }
+
+ /**
+ * Checks the flags of a how a resource has been modified and returns
+ * whether this change should be propagated to remote peers.
+ *
+ * @param flags
+ * the detail flags of a resource delta
+ * @return <code>true</code> if the delta should be propagated,
+ * <code>false</code> otherwise
+ */
+ private static boolean checkFlags(int flags) {
+ // we are only interested in content change, marker changes also fire
+ // resource change events but we don't care about those, from
+ // preliminary investigations, monitoring marker changes will cause
+ // infinite loops
+ return (flags & IResourceDelta.CONTENT) != 0;
+ }
+
+ public void resourceChanged(IResourceChangeEvent event) {
+ try {
+ event.getDelta().accept(this);
+ } catch (CoreException e) {
+ // ignored, this isn't possible as we never throw one
+ } finally {
+ try {
+ // we're done, at least, "partially", distribute changes
+ distributeChanges();
+ } finally {
+ // clear the cached changes
+ resourceChanges.clear();
+ }
+ }
+ }
+
+ private void distributeChanges() {
+ for (Iterator it = resourceChanges.entrySet().iterator(); it.hasNext();) {
+ Entry entry = (Entry) it.next();
+ ResourcesShare share = (ResourcesShare) entry.getKey();
+ List changes = (List) entry.getValue();
+
+ List messages = new ArrayList();
+ for (int i = 0; i < changes.size(); i++) {
+ ResourceChangeMessage change = (ResourceChangeMessage) changes
+ .get(i);
+
+ switch (change.getKind()) {
+ case IResourceDelta.ADDED:
+ if (getInt(PreferenceConstants.LOCAL_RESOURCE_ADDITION) == PreferenceConstants.IGNORE_VALUE) {
+ change.setIgnored(true);
+ continue;
+ }
+ break;
+ case IResourceDelta.CHANGED:
+ if (getInt(PreferenceConstants.LOCAL_RESOURCE_CHANGE) == PreferenceConstants.IGNORE_VALUE) {
+ change.setIgnored(true);
+ continue;
+ }
+ break;
+ case IResourceDelta.REMOVED:
+ if (getInt(PreferenceConstants.LOCAL_RESOURCE_DELETION) == PreferenceConstants.IGNORE_VALUE) {
+ change.setIgnored(true);
+ continue;
+ }
+ break;
+ }
+
+ IModelChangeMessage[] changeMessages = ResourcesSynchronizationStrategy
+ .getInstance().registerLocalChange(change);
+ messages.addAll(Arrays.asList(changeMessages));
+ }
+
+ try {
+ if (!messages.isEmpty()) {
+ IModelChangeMessage[] messagesArray = (IModelChangeMessage[]) messages
+ .toArray(new IModelChangeMessage[messages.size()]);
+ BatchModelChange batchChange = new BatchModelChange(
+ messagesArray);
+ share.send(Message.serialize(batchChange));
+
+ add(batchChange);
+ }
+ } catch (ECFException e) {
+ getDefault().getLog().log(
+ new Status(IStatus.ERROR, PLUGIN_ID,
+ "Could not send resource change message", e)); //$NON-NLS-1$
+ }
+ }
+ }
+
+ private static IView viewInstance;
+
+ public static synchronized void setView(IView resourcesView) {
+ viewInstance = resourcesView;
+ if (resourcesView != null) {
+ resourcesView.setInput(enqueuedChanges);
+ }
+ }
+
+ public static synchronized void add(Object object) {
+ if (enqueuedChanges.size() == LIMIT) {
+ remove();
+ }
+
+ enqueuedChanges.addFirst(object);
+ if (viewInstance != null) {
+ viewInstance.add(object);
+ }
+ }
+
+ private static synchronized void remove() {
+ Object object = enqueuedChanges.removeLast();
+ if (viewInstance != null) {
+ viewInstance.remove(object);
+ }
+ }
+
+ private static Preferences preferences;
+ private static Preferences defaultPreferences;
+
+ public SyncResourcesCore() {
+ instance = this;
+ }
+
+ void attachListener() {
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(this,
+ IResourceChangeEvent.POST_CHANGE);
+ }
+
+ void detachListener() {
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext
+ * )
+ */
+ public void start(BundleContext ctxt) throws Exception {
+ super.start(ctxt);
+ attachListener();
+ preferences = new InstanceScope().getNode(SyncResourcesCore.PLUGIN_ID);
+ defaultPreferences = new DefaultScope()
+ .getNode(SyncResourcesCore.PLUGIN_ID);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ instance = null;
+ detachListener();
+ super.stop(context);
+ }
+
+ public static SyncResourcesCore getDefault() {
+ return instance;
+ }
+
+ public static int getInt(String key) {
+ return preferences.getInt(key, defaultPreferences.getInt(key,
+ PreferenceConstants.COMMIT_VALUE));
+ }
+
+}
diff --git a/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/sync/resources/core/IResourceChange.java b/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/sync/resources/core/IResourceChange.java
index 35accde32..12cc7b503 100644
--- a/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/sync/resources/core/IResourceChange.java
+++ b/incubation/bundles/org.eclipse.ecf.sync.resources.core/src/org/eclipse/ecf/sync/resources/core/IResourceChange.java
@@ -1,55 +1,55 @@
-/*******************************************************************************
- * Copyright (c) 2009 Remy Chi Jian Suen 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:
- * Remy Chi Jian Suen <remy.suen@gmail.com> - initial API and implementation
- ******************************************************************************/
-package org.eclipse.ecf.sync.resources.core;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.ecf.sync.IModelChange;
-
-/**
- * Interface representing a change to a resource within the Eclipse workspace.
- */
-public interface IResourceChange extends IModelChange {
-
- /**
- * Returns the path of the modified resource, relative to the workspace.
- *
- * @return the workspace relative path of the modified resource
- */
- public String getPath();
-
- /**
- * Returns the type of resource that has been modified.
- *
- * @return the modified resource's type
- * @see IResource#getType()
- */
- public int getType();
-
- /**
- * Retrieves the kind of modification that has occurred.
- *
- * @return the kind of modification on the resource
- * @see IResourceDelta#getKind()
- */
- public int getKind();
-
- /**
- * Retrieves the contents of the resource that has been modified. May be
- * <code>null</code> if the resource itself represents no content such as
- * the case for folders. While the folder itself holds files with contains
- * contents, the folder itself has no content representation.
- *
- * @return the contents of the resource that has been changed, or
- * <code>null</code> if not applicable
- */
- public byte[] getContents();
-}
+/*******************************************************************************
+ * Copyright (c) 2009 Remy Chi Jian Suen 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:
+ * Remy Chi Jian Suen <remy.suen@gmail.com> - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ecf.sync.resources.core;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.ecf.sync.IModelChange;
+
+/**
+ * Interface representing a change to a resource within the Eclipse workspace.
+ */
+public interface IResourceChange extends IModelChange {
+
+ /**
+ * Returns the path of the modified resource, relative to the workspace.
+ *
+ * @return the workspace relative path of the modified resource
+ */
+ public String getPath();
+
+ /**
+ * Returns the type of resource that has been modified.
+ *
+ * @return the modified resource's type
+ * @see IResource#getType()
+ */
+ public int getType();
+
+ /**
+ * Retrieves the kind of modification that has occurred.
+ *
+ * @return the kind of modification on the resource
+ * @see IResourceDelta#getKind()
+ */
+ public int getKind();
+
+ /**
+ * Retrieves the contents of the resource that has been modified. May be
+ * <code>null</code> if the resource itself represents no content such as
+ * the case for folders. While the folder itself holds files with contains
+ * contents, the folder itself has no content representation.
+ *
+ * @return the contents of the resource that has been changed, or
+ * <code>null</code> if not applicable
+ */
+ public byte[] getContents();
+}
diff --git a/incubation/bundles/org.eclipse.ecf.sync.resources.ui/.classpath b/incubation/bundles/org.eclipse.ecf.sync.resources.ui/.classpath
index 731ea5fad..2fbb7a23e 100644
--- a/incubation/bundles/org.eclipse.ecf.sync.resources.ui/.classpath
+++ b/incubation/bundles/org.eclipse.ecf.sync.resources.ui/.classpath
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/incubation/bundles/org.eclipse.ecf.sync.resources.ui/.settings/org.eclipse.jdt.core.prefs b/incubation/bundles/org.eclipse.ecf.sync.resources.ui/.settings/org.eclipse.jdt.core.prefs
index 4678d459a..fa79c456d 100644
--- a/incubation/bundles/org.eclipse.ecf.sync.resources.ui/.settings/org.eclipse.jdt.core.prefs
+++ b/incubation/bundles/org.eclipse.ecf.sync.resources.ui/.settings/org.eclipse.jdt.core.prefs
@@ -1,7 +1,7 @@
-#Sat Nov 22 10:35:29 CET 2008
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.compliance=1.4
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.source=1.3
+#Sat Nov 22 10:35:29 CET 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.source=1.3
diff --git a/incubation/bundles/org.eclipse.ecf.sync.resources.ui/build.properties b/incubation/bundles/org.eclipse.ecf.sync.resources.ui/build.properties
index 285b8bf47..6c480f39f 100644
--- a/incubation/bundles/org.eclipse.ecf.sync.resources.ui/build.properties
+++ b/incubation/bundles/org.eclipse.ecf.sync.resources.ui/build.properties
@@ -1,6 +1,6 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml,\
- icons/
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ icons/
diff --git a/incubation/bundles/org.eclipse.ecf.sync.resources.ui/plugin.xml b/incubation/bundles/org.eclipse.ecf.sync.resources.ui/plugin.xml
index 52f444c73..51fba3d9e 100644
--- a/incubation/bundles/org.eclipse.ecf.sync.resources.ui/plugin.xml
+++ b/incubation/bundles/org.eclipse.ecf.sync.resources.ui/plugin.xml
@@ -1,129 +1,129 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.1"?>
-<plugin>
- <extension point="org.eclipse.core.expressions.definitions">
- <definition id="org.eclipse.ecf.ui.resourcesDefinition">
- <iterate ifEmpty="false">
- <adapt type="org.eclipse.core.resources.IResource"/>
- </iterate>
- </definition>
- </extension>
-
- <extension
- point="org.eclipse.ui.menus">
- <menuContribution
- locationURI="popup:org.eclipse.ui.popup.any?after=additions">
- <dynamic
- class="org.eclipse.ecf.sync.ui.resources.ResourcesShareMenuContributionItem"
- id="org.eclipse.ecf.sync.ui.resources.resourcesShareMenuContributionItem">
- <visibleWhen checkEnabled="true">
- <with variable="activeMenuSelection">
- <reference definitionId="org.eclipse.ecf.ui.resourcesDefinition"/>
- </with>
- </visibleWhen>
- </dynamic>
- </menuContribution>
- </extension>
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- category="org.eclipse.ecf.example.collab.ui.preferences"
- class="org.eclipse.ecf.sync.ui.resources.preferences.ResourcesSynchronizationPreferencePage"
- id="org.eclipse.ecf.sync.ui.resources.preferences.ResourcesSynchronizationPreferencePage"
- name="Resources">
- </page>
- </extension>
- <extension
- point="org.eclipse.ui.views">
- <category
- id="org.eclipse.ecf.sync.resources.core"
- name="Sample Category">
- </category>
- <view
- category="org.eclipse.ecf.sync.resources.core"
- class="org.eclipse.ecf.sync.resources.views.RemoteResourcesView"
- icon="icons/sample.gif"
- id="org.eclipse.ecf.sync.resources.core.views.RemoteResourcesView"
- name="Shared Resources">
- </view>
- </extension>
- <extension
- point="org.eclipse.ecf.start">
- <run
- class="org.eclipse.ecf.internal.sync.ui.resources.ECFStart">
- </run>
- </extension>
- <extension
- point="org.eclipse.ui.decorators">
- <decorator
- adaptable="true"
- class="org.eclipse.ecf.sync.ui.resources.decorators.RemotelyOpenedEditorsDecorator"
- id="org.eclipse.ecf.sync.ui.resources.decorators.RemotelyOpenedEditorsDecorator"
- label="Read-only Decorator"
- lightweight="true"
- state="true">
- <enablement>
- <and>
- <objectClass
- name="org.eclipse.core.resources.IResource">
- </objectClass>
- <or>
- <objectClass
- name="org.eclipse.core.resources.IFolder">
- </objectClass>
- <objectClass
- name="org.eclipse.core.resources.IFile">
- </objectClass>
- </or>
- </and>
- </enablement>
- </decorator>
- </extension>
- <extension
- point="org.eclipse.ui.editors.annotationTypes">
- <type
- name="org.eclipse.ecf.docshare2.annotations.RemoteSelection">
- </type>
- <type
- name="org.eclipse.ecf.docshare2.annotations.RemoteCursor"
- super="org.eclipse.ecf.docshare2.annotations.RemoteSelection">
- </type>
- </extension>
- <extension
- point="org.eclipse.ui.editors.markerAnnotationSpecification">
- <specification
- annotationType="org.eclipse.ecf.docshare2.annotations.RemoteSelection"
- colorPreferenceKey="remoteSelectionColor"
- colorPreferenceValue="231,223,143"
- contributesToHeader="false"
- highlightPreferenceKey="remoteSelectionHighlighting"
- highlightPreferenceValue="true"
- includeOnPreferencePage="true"
- label="%label.annotation.remote.selection"
- overviewRulerPreferenceKey="remoteSelectionIndicationInOverviewRuler"
- overviewRulerPreferenceValue="true"
- presentationLayer="5"
- textPreferenceKey="remoteSelectionTextIndication"
- textPreferenceValue="false"
- textStylePreferenceKey="remoteSelectionTextIndicationStyle"
- textStylePreferenceValue="NONE">
- </specification>
- <specification
- annotationType="org.eclipse.ecf.docshare2.annotations.RemoteCursor"
- colorPreferenceKey="remoteCursorColor"
- colorPreferenceValue="166,138,60"
- contributesToHeader="false"
- highlightPreferenceKey="remoteCursorHighlighting"
- highlightPreferenceValue="false"
- includeOnPreferencePage="true"
- label="%label.annotation.remote.cursor"
- overviewRulerPreferenceKey="remoteCursorIndicationInOverviewRuler"
- overviewRulerPreferenceValue="true"
- presentationLayer="5"
- textPreferenceKey="remoteCursorTextIndication"
- textPreferenceValue="true"
- textStylePreferenceKey="remoteCursorTextIndicationStyle"
- textStylePreferenceValue="IBEAM">
- </specification>
- </extension>
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.1"?>
+<plugin>
+ <extension point="org.eclipse.core.expressions.definitions">
+ <definition id="org.eclipse.ecf.ui.resourcesDefinition">
+ <iterate ifEmpty="false">
+ <adapt type="org.eclipse.core.resources.IResource"/>
+ </iterate>
+ </definition>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="popup:org.eclipse.ui.popup.any?after=additions">
+ <dynamic
+ class="org.eclipse.ecf.sync.ui.resources.ResourcesShareMenuContributionItem"
+ id="org.eclipse.ecf.sync.ui.resources.resourcesShareMenuContributionItem">
+ <visibleWhen checkEnabled="true">
+ <with variable="activeMenuSelection">
+ <reference definitionId="org.eclipse.ecf.ui.resourcesDefinition"/>
+ </with>
+ </visibleWhen>
+ </dynamic>
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.eclipse.ecf.example.collab.ui.preferences"
+ class="org.eclipse.ecf.sync.ui.resources.preferences.ResourcesSynchronizationPreferencePage"
+ id="org.eclipse.ecf.sync.ui.resources.preferences.ResourcesSynchronizationPreferencePage"
+ name="Resources">
+ </page>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views">
+ <category
+ id="org.eclipse.ecf.sync.resources.core"
+ name="Sample Category">
+ </category>
+ <view
+ category="org.eclipse.ecf.sync.resources.core"
+ class="org.eclipse.ecf.sync.resources.views.RemoteResourcesView"
+ icon="icons/sample.gif"
+ id="org.eclipse.ecf.sync.resources.core.views.RemoteResourcesView"
+ name="Shared Resources">
+ </view>
+ </extension>
+ <extension
+ point="org.eclipse.ecf.start">
+ <run
+ class="org.eclipse.ecf.internal.sync.ui.resources.ECFStart">
+ </run>
+ </extension>
+ <extension
+ point="org.eclipse.ui.decorators">
+ <decorator
+ adaptable="true"
+ class="org.eclipse.ecf.sync.ui.resources.decorators.RemotelyOpenedEditorsDecorator"
+ id="org.eclipse.ecf.sync.ui.resources.decorators.RemotelyOpenedEditorsDecorator"
+ label="Read-only Decorator"
+ lightweight="true"
+ state="true">
+ <enablement>
+ <and>
+ <objectClass
+ name="org.eclipse.core.resources.IResource">
+ </objectClass>
+ <or>
+ <objectClass
+ name="org.eclipse.core.resources.IFolder">
+ </objectClass>
+ <objectClass
+ name="org.eclipse.core.resources.IFile">
+ </objectClass>
+ </or>
+ </and>
+ </enablement>
+ </decorator>
+ </extension>
+ <extension
+ point="org.eclipse.ui.editors.annotationTypes">
+ <type
+ name="org.eclipse.ecf.docshare2.annotations.RemoteSelection">
+ </type>
+ <type
+ name="org.eclipse.ecf.docshare2.annotations.RemoteCursor"
+ super="org.eclipse.ecf.docshare2.annotations.RemoteSelection">
+ </type>
+ </extension>
+ <extension
+ point="org.eclipse.ui.editors.markerAnnotationSpecification">
+ <specification
+ annotationType="org.eclipse.ecf.docshare2.annotations.RemoteSelection"
+ colorPreferenceKey="remoteSelectionColor"
+ colorPreferenceValue="231,223,143"
+ contributesToHeader="false"
+ highlightPreferenceKey="remoteSelectionHighlighting"
+ highlightPreferenceValue="true"
+ includeOnPreferencePage="true"
+ label="%label.annotation.remote.selection"
+ overviewRulerPreferenceKey="remoteSelectionIndicationInOverviewRuler"
+ overviewRulerPreferenceValue="true"
+ presentationLayer="5"
+ textPreferenceKey="remoteSelectionTextIndication"
+ textPreferenceValue="false"
+ textStylePreferenceKey="remoteSelectionTextIndicationStyle"
+ textStylePreferenceValue="NONE">
+ </specification>
+ <specification
+ annotationType="org.eclipse.ecf.docshare2.annotations.RemoteCursor"
+ colorPreferenceKey="remoteCursorColor"
+ colorPreferenceValue="166,138,60"
+ contributesToHeader="false"
+ highlightPreferenceKey="remoteCursorHighlighting"
+ highlightPreferenceValue="false"
+ includeOnPreferencePage="true"
+ label="%label.annotation.remote.cursor"
+ overviewRulerPreferenceKey="remoteCursorIndicationInOverviewRuler"
+ overviewRulerPreferenceValue="true"
+ presentationLayer="5"
+ textPreferenceKey="remoteCursorTextIndication"
+ textPreferenceValue="true"
+ textStylePreferenceKey="remoteCursorTextIndicationStyle"
+ textStylePreferenceValue="IBEAM">
+ </specification>
+ </extension>
+</plugin>
diff --git a/incubation/bundles/org.eclipse.ecf.sync.resources.ui/src/org/eclipse/ecf/internal/sync/ui/resources/SyncResourcesUI.java b/incubation/bundles/org.eclipse.ecf.sync.resources.ui/src/org/eclipse/ecf/internal/sync/ui/resources/SyncResourcesUI.java
index eb0f00dcc..4cc055898 100644
--- a/incubation/bundles/org.eclipse.ecf.sync.resources.ui/src/org/eclipse/ecf/internal/sync/ui/resources/SyncResourcesUI.java
+++ b/incubation/bundles/org.eclipse.ecf.sync.resources.ui/src/org/eclipse/ecf/internal/sync/ui/resources/SyncResourcesUI.java
@@ -1,348 +1,348 @@
-/*******************************************************************************
- * Copyright (c) 2009 Remy Chi Jian Suen 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:
- * Remy Chi Jian Suen <remy.suen@gmail.com> - initial API and implementation
- ******************************************************************************/
-package org.eclipse.ecf.internal.sync.ui.resources;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.ecf.core.identity.ID;
-import org.eclipse.ecf.core.util.ECFException;
-import org.eclipse.ecf.datashare.IChannelContainerAdapter;
-import org.eclipse.ecf.docshare2.DocShare;
-import org.eclipse.ecf.internal.sync.resources.core.ResourcesShare;
-import org.eclipse.ecf.internal.sync.resources.core.SyncResourcesCore;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.viewers.IPostSelectionProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IPageListener;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.IWindowListener;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.ui.statushandlers.StatusManager;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.osgi.framework.BundleContext;
-
-public class SyncResourcesUI extends AbstractUIPlugin {
-
- public static final String PLUGIN_ID = "org.eclipse.ecf.sync.ui.resources"; //$NON-NLS-1$
-
- private static SyncResourcesUI instance;
-
- private IWindowListener windowListener = new IWindowListener() {
-
- public void windowOpened(IWorkbenchWindow window) {
- window.addPageListener(pageListener);
- }
-
- public void windowDeactivated(IWorkbenchWindow window) {
- // nothing to do
- }
-
- public void windowClosed(IWorkbenchWindow window) {
- window.removePageListener(pageListener);
- }
-
- public void windowActivated(IWorkbenchWindow window) {
- // nothing to do
- }
- };
-
- private IPageListener pageListener = new IPageListener() {
-
- public void pageOpened(IWorkbenchPage page) {
- page.addPartListener(partListener);
- }
-
- public void pageClosed(IWorkbenchPage page) {
- page.removePartListener(partListener);
- }
-
- public void pageActivated(IWorkbenchPage page) {
- // nothing to do
- }
- };
-
- private IPartListener partListener = new IPartListener() {
-
- public void partOpened(IWorkbenchPart part) {
- ITextEditor editor = (ITextEditor) part
- .getAdapter(ITextEditor.class);
- if (editor != null) {
- IFile file = (IFile) editor.getEditorInput().getAdapter(
- IFile.class);
- if (file != null) {
- startSharing(editor, file);
- }
- }
- }
-
- public void partDeactivated(IWorkbenchPart part) {
- // nothing to do
- }
-
- public void partClosed(IWorkbenchPart part) {
- ITextEditor editor = (ITextEditor) part
- .getAdapter(ITextEditor.class);
- if (editor != null) {
- IFile file = (IFile) editor.getEditorInput().getAdapter(
- IFile.class);
- if (file != null) {
- stopSharing(editor, file);
- }
- }
- }
-
- public void partBroughtToTop(IWorkbenchPart part) {
- // nothing to do
- }
-
- public void partActivated(IWorkbenchPart part) {
- // nothing to do
- }
- };
-
- private Map sharedFiles = new HashMap();
-
- private Map sharedEditors = new HashMap();
-
- private boolean share(IFile file) {
- IPath path = file.getFullPath();
- Integer integer = (Integer) sharedFiles.get(path);
- if (integer == null) {
- sharedFiles.put(path, new Integer(1));
- return true;
- }
- sharedFiles.put(path, new Integer(integer.intValue() + 1));
- return false;
- }
-
- private boolean unshare(IFile file) {
- IPath path = file.getFullPath();
- Integer integer = (Integer) sharedFiles.remove(path);
- if (integer == null) {
- // if this file isn't being shared, will be null, return false
- return false;
- }
-
- if (integer.intValue() == 1) {
- return true;
- }
-
- sharedFiles.put(path, new Integer(integer.intValue() - 1));
- return false;
- }
-
- private void startSharing(ITextEditor editor, IFile file) {
- String projectName = file.getProject().getName();
- for (Iterator it = SyncResourcesCore.getResourceShares().iterator(); it
- .hasNext();) {
- ResourcesShare share = (ResourcesShare) it.next();
- if (share.isSharing(projectName) && share(file)) {
- DocShare docShare = getDocShare(share.getContainerID());
- try {
- IAnnotationModel annotationModel = editor
- .getDocumentProvider().getAnnotationModel(
- editor.getEditorInput());
- docShare.startSharing(share.getLocalID(), share
- .getReceiverID(), file.getFullPath().toString(),
- annotationModel);
- ISelectionProvider provider = editor.getSelectionProvider();
- if (provider instanceof IPostSelectionProvider) {
- ISelectionChangedListener listener = new SelectionChangedListener(
- share.getReceiverID(), file.getFullPath()
- .toString(), docShare);
- ((IPostSelectionProvider) provider)
- .addPostSelectionChangedListener(listener);
- sharedEditors.put(editor, listener);
- }
- } catch (ECFException e) {
- IStatus status = new Status(IStatus.ERROR, PLUGIN_ID,
- "Could not send initiation request to " //$NON-NLS-1$
- + share.getReceiverID(), e);
- log(status);
- StatusManager.getManager().handle(status,
- StatusManager.SHOW);
- } catch (CoreException e) {
- IStatus status = new Status(IStatus.ERROR, PLUGIN_ID,
- "Could not connect to the file buffer of " //$NON-NLS-1$
- + file.getFullPath(), e);
- log(status);
- StatusManager.getManager().handle(status,
- StatusManager.SHOW);
- }
- }
- }
- }
-
- private void stopSharing(ITextEditor editor, IFile file) {
- String projectName = file.getProject().getName();
- for (Iterator it = SyncResourcesCore.getResourceShares().iterator(); it
- .hasNext();) {
- ResourcesShare share = (ResourcesShare) it.next();
- if (share.isSharing(projectName) && unshare(file)) {
- DocShare docShare = getDocShare(share.getContainerID());
- stopSharing(docShare, share.getReceiverID(), editor, file);
- }
- }
- }
-
- private void stopSharing(DocShare share, ID id, ITextEditor editor,
- IFile file) {
- try {
- share.stopSharing(id, file.getFullPath().toString());
- } catch (ECFException e) {
- log(new Status(IStatus.ERROR, PLUGIN_ID,
- "Could not send stop message to " + id, e)); //$NON-NLS-1$
- }
-
- ISelectionChangedListener listener = (ISelectionChangedListener) sharedEditors
- .remove(editor);
- if (listener != null) {
- ISelectionProvider provider = editor.getSelectionProvider();
- if (provider instanceof IPostSelectionProvider) {
- ((IPostSelectionProvider) provider)
- .removePostSelectionChangedListener(listener);
- }
- }
- }
-
- public SyncResourcesUI() {
- instance = this;
- }
-
- public void start(BundleContext context) throws Exception {
- super.start(context);
-
- getWorkbench().addWindowListener(windowListener);
-
- IWorkbenchWindow[] workbenchWindows = getWorkbench()
- .getWorkbenchWindows();
- for (int i = 0; i < workbenchWindows.length; i++) {
- workbenchWindows[i].addPageListener(pageListener);
- IWorkbenchPage[] pages = workbenchWindows[i].getPages();
- for (int j = 0; j < pages.length; j++) {
- pages[j].addPartListener(partListener);
- }
- }
- }
-
- public static SyncResourcesUI getDefault() {
- return instance;
- }
-
- public Display getDisplay() {
- return getWorkbench().getDisplay();
- }
-
- public static void log(IStatus status) {
- instance.getLog().log(status);
- }
-
- public void stop(BundleContext context) throws Exception {
- getWorkbench().removeWindowListener(windowListener);
-
- IWorkbenchWindow[] workbenchWindows = getWorkbench()
- .getWorkbenchWindows();
- for (int i = 0; i < workbenchWindows.length; i++) {
- workbenchWindows[i].removePageListener(pageListener);
- IWorkbenchPage[] pages = workbenchWindows[i].getPages();
- for (int j = 0; j < pages.length; j++) {
- pages[j].removePartListener(partListener);
- }
- }
-
- super.stop(context);
- }
-
- private static Map docshareChannels = new HashMap();
-
- public static DocShare getDocShare(ID containerID) {
- return (DocShare) docshareChannels.get(containerID);
- }
-
- public static DocShare addDocShare(ID containerID,
- IChannelContainerAdapter channelAdapter) throws ECFException {
- DocShare docShare = (DocShare) docshareChannels.get(containerID);
- if (docShare == null) {
- return (DocShare) docshareChannels.put(containerID,
- new WorkbenchAwareDocShare(channelAdapter));
- }
- return docShare;
- }
-
- public static DocShare removeDocShare(ID containerID) {
- return (DocShare) docshareChannels.remove(containerID);
- }
-
- public static ResourcesShare getResourceShare(ID containerID) {
- return SyncResourcesCore.getResourcesShare(containerID);
- }
-
- public static ResourcesShare addResourceShare(ID containerID,
- IChannelContainerAdapter channelAdapter) throws ECFException {
- ResourcesShare resourcesShare = SyncResourcesCore
- .getResourcesShare(containerID);
- if (resourcesShare == null) {
- resourcesShare = new WorkbenchAwareResourcesShare(containerID,
- channelAdapter);
- SyncResourcesCore.addResourcesShare(containerID, resourcesShare);
- }
- return resourcesShare;
- }
-
- public static ResourcesShare removeResourceShare(ID containerID) {
- return SyncResourcesCore.removeResourcesShare(containerID);
- }
-
- private class SelectionChangedListener implements ISelectionChangedListener {
-
- private ID targetID;
- private String path;
- private DocShare share;
-
- public SelectionChangedListener(ID targetID, String path, DocShare share) {
- this.targetID = targetID;
- this.path = path;
- this.share = share;
- }
-
- public void selectionChanged(SelectionChangedEvent e) {
- ISelection selection = e.getSelection();
- if (selection instanceof ITextSelection) {
- ITextSelection textSelection = (ITextSelection) selection;
- try {
- share.sendSelection(targetID, path, textSelection
- .getOffset(), textSelection.getLength());
- } catch (ECFException exception) {
- log(new Status(IStatus.ERROR, PLUGIN_ID,
- "Could not send selection message to " + targetID, //$NON-NLS-1$
- exception));
- }
- }
- }
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 Remy Chi Jian Suen 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:
+ * Remy Chi Jian Suen <remy.suen@gmail.com> - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ecf.internal.sync.ui.resources;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ecf.core.identity.ID;
+import org.eclipse.ecf.core.util.ECFException;
+import org.eclipse.ecf.datashare.IChannelContainerAdapter;
+import org.eclipse.ecf.docshare2.DocShare;
+import org.eclipse.ecf.internal.sync.resources.core.ResourcesShare;
+import org.eclipse.ecf.internal.sync.resources.core.SyncResourcesCore;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.text.source.IAnnotationModel;
+import org.eclipse.jface.viewers.IPostSelectionProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IPageListener;
+import org.eclipse.ui.IPartListener;
+import org.eclipse.ui.IWindowListener;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.ui.statushandlers.StatusManager;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.osgi.framework.BundleContext;
+
+public class SyncResourcesUI extends AbstractUIPlugin {
+
+ public static final String PLUGIN_ID = "org.eclipse.ecf.sync.ui.resources"; //$NON-NLS-1$
+
+ private static SyncResourcesUI instance;
+
+ private IWindowListener windowListener = new IWindowListener() {
+
+ public void windowOpened(IWorkbenchWindow window) {
+ window.addPageListener(pageListener);
+ }
+
+ public void windowDeactivated(IWorkbenchWindow window) {
+ // nothing to do
+ }
+
+ public void windowClosed(IWorkbenchWindow window) {
+ window.removePageListener(pageListener);
+ }
+
+ public void windowActivated(IWorkbenchWindow window) {
+ // nothing to do
+ }
+ };
+
+ private IPageListener pageListener = new IPageListener() {
+
+ public void pageOpened(IWorkbenchPage page) {
+ page.addPartListener(partListener);
+ }
+
+ public void pageClosed(IWorkbenchPage page) {
+ page.removePartListener(partListener);
+ }
+
+ public void pageActivated(IWorkbenchPage page) {
+ // nothing to do
+ }
+ };
+
+ private IPartListener partListener = new IPartListener() {
+
+ public void partOpened(IWorkbenchPart part) {
+ ITextEditor editor = (ITextEditor) part
+ .getAdapter(ITextEditor.class);
+ if (editor != null) {
+ IFile file = (IFile) editor.getEditorInput().getAdapter(
+ IFile.class);
+ if (file != null) {
+ startSharing(editor, file);
+ }
+ }
+ }
+
+ public void partDeactivated(IWorkbenchPart part) {
+ // nothing to do
+ }
+
+ public void partClosed(IWorkbenchPart part) {
+ ITextEditor editor = (ITextEditor) part
+ .getAdapter(ITextEditor.class);
+ if (editor != null) {
+ IFile file = (IFile) editor.getEditorInput().getAdapter(
+ IFile.class);
+ if (file != null) {
+ stopSharing(editor, file);
+ }
+ }
+ }
+
+ public void partBroughtToTop(IWorkbenchPart part) {
+ // nothing to do
+ }
+
+ public void partActivated(IWorkbenchPart part) {
+ // nothing to do
+ }
+ };
+
+ private Map sharedFiles = new HashMap();
+
+ private Map sharedEditors = new HashMap();
+
+ private boolean share(IFile file) {
+ IPath path = file.getFullPath();
+ Integer integer = (Integer) sharedFiles.get(path);
+ if (integer == null) {
+ sharedFiles.put(path, new Integer(1));
+ return true;
+ }
+ sharedFiles.put(path, new Integer(integer.intValue() + 1));
+ return false;
+ }
+
+ private boolean unshare(IFile file) {
+ IPath path = file.getFullPath();
+ Integer integer = (Integer) sharedFiles.remove(path);
+ if (integer == null) {
+ // if this file isn't being shared, will be null, return false
+ return false;
+ }
+
+ if (integer.intValue() == 1) {
+ return true;
+ }
+
+ sharedFiles.put(path, new Integer(integer.intValue() - 1));
+ return false;
+ }
+
+ private void startSharing(ITextEditor editor, IFile file) {
+ String projectName = file.getProject().getName();
+ for (Iterator it = SyncResourcesCore.getResourceShares().iterator(); it
+ .hasNext();) {
+ ResourcesShare share = (ResourcesShare) it.next();
+ if (share.isSharing(projectName) && share(file)) {
+ DocShare docShare = getDocShare(share.getContainerID());
+ try {
+ IAnnotationModel annotationModel = editor
+ .getDocumentProvider().getAnnotationModel(
+ editor.getEditorInput());
+ docShare.startSharing(share.getLocalID(), share
+ .getReceiverID(), file.getFullPath().toString(),
+ annotationModel);
+ ISelectionProvider provider = editor.getSelectionProvider();
+ if (provider instanceof IPostSelectionProvider) {
+ ISelectionChangedListener listener = new SelectionChangedListener(
+ share.getReceiverID(), file.getFullPath()
+ .toString(), docShare);
+ ((IPostSelectionProvider) provider)
+ .addPostSelectionChangedListener(listener);
+ sharedEditors.put(editor, listener);
+ }
+ } catch (ECFException e) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID,
+ "Could not send initiation request to " //$NON-NLS-1$
+ + share.getReceiverID(), e);
+ log(status);
+ StatusManager.getManager().handle(status,
+ StatusManager.SHOW);
+ } catch (CoreException e) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID,
+ "Could not connect to the file buffer of " //$NON-NLS-1$
+ + file.getFullPath(), e);
+ log(status);
+ StatusManager.getManager().handle(status,
+ StatusManager.SHOW);
+ }
+ }
+ }
+ }
+
+ private void stopSharing(ITextEditor editor, IFile file) {
+ String projectName = file.getProject().getName();
+ for (Iterator it = SyncResourcesCore.getResourceShares().iterator(); it
+ .hasNext();) {
+ ResourcesShare share = (ResourcesShare) it.next();
+ if (share.isSharing(projectName) && unshare(file)) {
+ DocShare docShare = getDocShare(share.getContainerID());
+ stopSharing(docShare, share.getReceiverID(), editor, file);
+ }
+ }
+ }
+
+ private void stopSharing(DocShare share, ID id, ITextEditor editor,
+ IFile file) {
+ try {
+ share.stopSharing(id, file.getFullPath().toString());
+ } catch (ECFException e) {
+ log(new Status(IStatus.ERROR, PLUGIN_ID,
+ "Could not send stop message to " + id, e)); //$NON-NLS-1$
+ }
+
+ ISelectionChangedListener listener = (ISelectionChangedListener) sharedEditors
+ .remove(editor);
+ if (listener != null) {
+ ISelectionProvider provider = editor.getSelectionProvider();
+ if (provider instanceof IPostSelectionProvider) {
+ ((IPostSelectionProvider) provider)
+ .removePostSelectionChangedListener(listener);
+ }
+ }
+ }
+
+ public SyncResourcesUI() {
+ instance = this;
+ }
+
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+
+ getWorkbench().addWindowListener(windowListener);
+
+ IWorkbenchWindow[] workbenchWindows = getWorkbench()
+ .getWorkbenchWindows();
+ for (int i = 0; i < workbenchWindows.length; i++) {
+ workbenchWindows[i].addPageListener(pageListener);
+ IWorkbenchPage[] pages = workbenchWindows[i].getPages();
+ for (int j = 0; j < pages.length; j++) {
+ pages[j].addPartListener(partListener);
+ }
+ }
+ }
+
+ public static SyncResourcesUI getDefault() {
+ return instance;
+ }
+
+ public Display getDisplay() {
+ return getWorkbench().getDisplay();
+ }
+
+ public static void log(IStatus status) {
+ instance.getLog().log(status);
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ getWorkbench().removeWindowListener(windowListener);
+
+ IWorkbenchWindow[] workbenchWindows = getWorkbench()
+ .getWorkbenchWindows();
+ for (int i = 0; i < workbenchWindows.length; i++) {
+ workbenchWindows[i].removePageListener(pageListener);
+ IWorkbenchPage[] pages = workbenchWindows[i].getPages();
+ for (int j = 0; j < pages.length; j++) {
+ pages[j].removePartListener(partListener);
+ }
+ }
+
+ super.stop(context);
+ }
+
+ private static Map docshareChannels = new HashMap();
+
+ public static DocShare getDocShare(ID containerID) {
+ return (DocShare) docshareChannels.get(containerID);
+ }
+
+ public static DocShare addDocShare(ID containerID,
+ IChannelContainerAdapter channelAdapter) throws ECFException {
+ DocShare docShare = (DocShare) docshareChannels.get(containerID);
+ if (docShare == null) {
+ return (DocShare) docshareChannels.put(containerID,
+ new WorkbenchAwareDocShare(channelAdapter));
+ }
+ return docShare;
+ }
+
+ public static DocShare removeDocShare(ID containerID) {
+ return (DocShare) docshareChannels.remove(containerID);
+ }
+
+ public static ResourcesShare getResourceShare(ID containerID) {
+ return SyncResourcesCore.getResourcesShare(containerID);
+ }
+
+ public static ResourcesShare addResourceShare(ID containerID,
+ IChannelContainerAdapter channelAdapter) throws ECFException {
+ ResourcesShare resourcesShare = SyncResourcesCore
+ .getResourcesShare(containerID);
+ if (resourcesShare == null) {
+ resourcesShare = new WorkbenchAwareResourcesShare(containerID,
+ channelAdapter);
+ SyncResourcesCore.addResourcesShare(containerID, resourcesShare);
+ }
+ return resourcesShare;
+ }
+
+ public static ResourcesShare removeResourceShare(ID containerID) {
+ return SyncResourcesCore.removeResourcesShare(containerID);
+ }
+
+ private class SelectionChangedListener implements ISelectionChangedListener {
+
+ private ID targetID;
+ private String path;
+ private DocShare share;
+
+ public SelectionChangedListener(ID targetID, String path, DocShare share) {
+ this.targetID = targetID;
+ this.path = path;
+ this.share = share;
+ }
+
+ public void selectionChanged(SelectionChangedEvent e) {
+ ISelection selection = e.getSelection();
+ if (selection instanceof ITextSelection) {
+ ITextSelection textSelection = (ITextSelection) selection;
+ try {
+ share.sendSelection(targetID, path, textSelection
+ .getOffset(), textSelection.getLength());
+ } catch (ECFException exception) {
+ log(new Status(IStatus.ERROR, PLUGIN_ID,
+ "Could not send selection message to " + targetID, //$NON-NLS-1$
+ exception));
+ }
+ }
+ }
+
+ }
+
+}

Back to the top