Browse files

Starts from scratch to manage NoSQL IDE with MongoDB + OrientDB

implementation.
  • Loading branch information...
1 parent 7a1c21e commit c4008deb79a33c97baee2fb2487329044037b9cd @angelozerr angelozerr committed Sep 3, 2012
Showing with 6,996 additions and 1 deletion.
  1. +1 −1 fr.opensagres.mongodb.ide.ui/src/fr/opensagres/mongodb/ide/ui/views/ServerTreeViewer.java
  2. +7 −0 fr.opensagres.nosql.ide.core/.classpath
  3. +28 −0 fr.opensagres.nosql.ide.core/.project
  4. +8 −0 fr.opensagres.nosql.ide.core/.settings/org.eclipse.jdt.core.prefs
  5. +15 −0 fr.opensagres.nosql.ide.core/META-INF/MANIFEST.MF
  6. +7 −0 fr.opensagres.nosql.ide.core/build.properties
  7. +16 −0 fr.opensagres.nosql.ide.core/plugin.properties
  8. +10 −0 fr.opensagres.nosql.ide.core/plugin.xml
  9. +13 −0 fr.opensagres.nosql.ide.core/pom.xml
  10. +95 −0 fr.opensagres.nosql.ide.core/schema/serverFactories.exsd
  11. +89 −0 fr.opensagres.nosql.ide.core/schema/serverTypes.exsd
  12. +31 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/IServerLifecycleListener.java
  13. +28 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/IServerListener.java
  14. +26 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/IServerManager.java
  15. +11 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/IServerRuntimeListener.java
  16. +19 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/IServerRuntimeManager.java
  17. +11 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/ISettingsManager.java
  18. +27 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/Platform.java
  19. +148 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/ServerEvent.java
  20. +83 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/extensions/AbstractRegistry.java
  21. +40 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/extensions/AbstractServerFactory.java
  22. +8 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/extensions/IRegistry.java
  23. +11 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/extensions/IServerFactory.java
  24. +21 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/extensions/IServerFactoryRegistry.java
  25. +7 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/extensions/IServerType.java
  26. +16 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/extensions/IServerTypeRegistry.java
  27. +41 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/internal/AbstractManager.java
  28. +45 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/internal/Activator.java
  29. +162 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/internal/ServerManager.java
  30. +191 −0 ...pensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/internal/ServerNotificationManager.java
  31. +104 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/internal/ServerRuntimeManager.java
  32. +145 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/internal/Trace.java
  33. +145 −0 ...es.nosql.ide.core/src/fr/opensagres/nosql/ide/core/internal/extensions/ServerFactoryRegistry.java
  34. +26 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/internal/extensions/ServerType.java
  35. +134 −0 ...agres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/internal/extensions/ServerTypeRegistry.java
  36. +14 −0 ...res.nosql.ide.core/src/fr/opensagres/nosql/ide/core/internal/settings/AbstractContentHandler.java
  37. +49 −0 ...pensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/internal/settings/AbstractSettings.java
  38. +38 −0 ...pensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/internal/settings/RuntimesSettings.java
  39. +58 −0 ...gres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/internal/settings/ServersContentHandler.java
  40. +35 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/internal/settings/ServersSettings.java
  41. +244 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/model/AbstractServer.java
  42. +27 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/model/Error.java
  43. +7 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/model/IDatabase.java
  44. +10 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/model/IModelIdentity.java
  45. +30 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/model/IServer.java
  46. +9 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/model/IServerRuntime.java
  47. +10 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/model/ITreeContainerNode.java
  48. +11 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/model/ITreeSimpleNode.java
  49. +6 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/model/NodeStatus.java
  50. +18 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/model/NodeTypeConstants.java
  51. +6 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/model/ServerState.java
  52. +53 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/model/TreeContainerNode.java
  53. +28 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/model/TreeSimpleNode.java
  54. +10 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/settings/RuntimesConstants.java
  55. +12 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/settings/ServersConstants.java
  56. +50 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/utils/StringUtils.java
  57. +21 −0 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/utils/XMLUtils.java
  58. +7 −0 fr.opensagres.nosql.ide.mongodb.core/.classpath
  59. +28 −0 fr.opensagres.nosql.ide.mongodb.core/.project
  60. +8 −0 fr.opensagres.nosql.ide.mongodb.core/.settings/org.eclipse.jdt.core.prefs
  61. +19 −0 fr.opensagres.nosql.ide.mongodb.core/META-INF/MANIFEST.MF
  62. +6 −0 fr.opensagres.nosql.ide.mongodb.core/build.properties
  63. +14 −0 fr.opensagres.nosql.ide.mongodb.core/plugin.properties
  64. +20 −0 fr.opensagres.nosql.ide.mongodb.core/plugin.xml
  65. +13 −0 fr.opensagres.nosql.ide.mongodb.core/pom.xml
  66. +39 −0 ...pensagres.nosql.ide.mongodb.core/src/fr/opensagres/nosql/ide/mongodb/core/internal/Activator.java
  67. +19 −0 ....nosql.ide.mongodb.core/src/fr/opensagres/nosql/ide/mongodb/core/internal/MongoServerFactory.java
  68. +145 −0 fr.opensagres.nosql.ide.mongodb.core/src/fr/opensagres/nosql/ide/mongodb/core/internal/Trace.java
  69. +99 −0 fr.opensagres.nosql.ide.mongodb.core/src/fr/opensagres/nosql/ide/mongodb/core/model/MongoServer.java
  70. +7 −0 fr.opensagres.nosql.ide.mongodb.ui/.classpath
  71. +2 −0 fr.opensagres.nosql.ide.mongodb.ui/.gitignore
  72. +28 −0 fr.opensagres.nosql.ide.mongodb.ui/.project
  73. +8 −0 fr.opensagres.nosql.ide.mongodb.ui/.settings/org.eclipse.jdt.core.prefs
  74. +24 −0 fr.opensagres.nosql.ide.mongodb.ui/META-INF/MANIFEST.MF
  75. +7 −0 fr.opensagres.nosql.ide.mongodb.ui/build.properties
  76. BIN fr.opensagres.nosql.ide.mongodb.ui/icons/ctool16/wiz_new_database.png
  77. BIN fr.opensagres.nosql.ide.mongodb.ui/icons/ctool16/wiz_new_server.gif
  78. BIN fr.opensagres.nosql.ide.mongodb.ui/icons/obj16/mongodb.png
  79. BIN fr.opensagres.nosql.ide.mongodb.ui/icons/wizban/new_database_wiz.png
  80. BIN fr.opensagres.nosql.ide.mongodb.ui/icons/wizban/new_server_wiz.png
  81. +18 −0 fr.opensagres.nosql.ide.mongodb.ui/plugin.properties
  82. +28 −0 fr.opensagres.nosql.ide.mongodb.ui/plugin.xml
  83. +13 −0 fr.opensagres.nosql.ide.mongodb.ui/pom.xml
  84. +75 −0 fr.opensagres.nosql.ide.mongodb.ui/src/fr/opensagres/nosql/ide/mongodb/ui/internal/Activator.java
  85. +179 −0 ...ensagres.nosql.ide.mongodb.ui/src/fr/opensagres/nosql/ide/mongodb/ui/internal/ImageResources.java
  86. +179 −0 fr.opensagres.nosql.ide.mongodb.ui/src/fr/opensagres/nosql/ide/mongodb/ui/internal/Messages.java
  87. +184 −0 ...ensagres.nosql.ide.mongodb.ui/src/fr/opensagres/nosql/ide/mongodb/ui/internal/Messages.properties
  88. +47 −0 ...s.nosql.ide.mongodb.ui/src/fr/opensagres/nosql/ide/mongodb/ui/wizards/server/NewServerWizard.java
  89. +328 −0 ...sql.ide.mongodb.ui/src/fr/opensagres/nosql/ide/mongodb/ui/wizards/server/NewServerWizardPage.java
  90. +7 −0 fr.opensagres.nosql.ide.orientdb.core/.classpath
  91. +2 −0 fr.opensagres.nosql.ide.orientdb.core/.gitignore
  92. +28 −0 fr.opensagres.nosql.ide.orientdb.core/.project
  93. +8 −0 fr.opensagres.nosql.ide.orientdb.core/.settings/org.eclipse.jdt.core.prefs
  94. +11 −0 fr.opensagres.nosql.ide.orientdb.core/META-INF/MANIFEST.MF
  95. +6 −0 fr.opensagres.nosql.ide.orientdb.core/build.properties
  96. +14 −0 fr.opensagres.nosql.ide.orientdb.core/plugin.properties
  97. +21 −0 fr.opensagres.nosql.ide.orientdb.core/plugin.xml
  98. +13 −0 fr.opensagres.nosql.ide.orientdb.core/pom.xml
  99. +38 −0 ...nsagres.nosql.ide.orientdb.core/src/fr/opensagres/nosql/ide/orientdb/core/model/OrientServer.java
  100. +16 −0 ...e.orientdb.core/src/fr/opensagres/nosql/ide/orientdb/core/model/internal/OrientServerFactory.java
  101. +7 −0 fr.opensagres.nosql.ide.orientdb.ui/.classpath
  102. +2 −0 fr.opensagres.nosql.ide.orientdb.ui/.gitignore
  103. +28 −0 fr.opensagres.nosql.ide.orientdb.ui/.project
  104. +8 −0 fr.opensagres.nosql.ide.orientdb.ui/.settings/org.eclipse.jdt.core.prefs
  105. +18 −0 fr.opensagres.nosql.ide.orientdb.ui/META-INF/MANIFEST.MF
  106. +7 −0 fr.opensagres.nosql.ide.orientdb.ui/build.properties
  107. BIN fr.opensagres.nosql.ide.orientdb.ui/icons/ctool16/wiz_new_database.png
  108. BIN fr.opensagres.nosql.ide.orientdb.ui/icons/ctool16/wiz_new_server.gif
  109. +18 −0 fr.opensagres.nosql.ide.orientdb.ui/plugin.properties
  110. +28 −0 fr.opensagres.nosql.ide.orientdb.ui/plugin.xml
  111. +13 −0 fr.opensagres.nosql.ide.orientdb.ui/pom.xml
  112. +75 −0 fr.opensagres.nosql.ide.orientdb.ui/src/fr/opensagres/nosql/ide/orientdb/ui/internal/Activator.java
  113. +179 −0 ...sagres.nosql.ide.orientdb.ui/src/fr/opensagres/nosql/ide/orientdb/ui/internal/ImageResources.java
  114. +179 −0 fr.opensagres.nosql.ide.orientdb.ui/src/fr/opensagres/nosql/ide/orientdb/ui/internal/Messages.java
  115. +184 −0 ...sagres.nosql.ide.orientdb.ui/src/fr/opensagres/nosql/ide/orientdb/ui/internal/Messages.properties
  116. +48 −0 ...nosql.ide.orientdb.ui/src/fr/opensagres/nosql/ide/orientdb/ui/wizards/server/NewServerWizard.java
  117. +340 −0 ...l.ide.orientdb.ui/src/fr/opensagres/nosql/ide/orientdb/ui/wizards/server/NewServerWizardPage.java
  118. +7 −0 fr.opensagres.nosql.ide.ui/.classpath
  119. +28 −0 fr.opensagres.nosql.ide.ui/.project
  120. +8 −0 fr.opensagres.nosql.ide.ui/.settings/org.eclipse.jdt.core.prefs
  121. +23 −0 fr.opensagres.nosql.ide.ui/META-INF/MANIFEST.MF
  122. +8 −0 fr.opensagres.nosql.ide.ui/build.properties
  123. BIN fr.opensagres.nosql.ide.ui/icons/checkboxes/disabled_checked.gif
  124. BIN fr.opensagres.nosql.ide.ui/icons/checkboxes/disabled_unchecked.gif
  125. BIN fr.opensagres.nosql.ide.ui/icons/checkboxes/enabled_checked.gif
  126. BIN fr.opensagres.nosql.ide.ui/icons/checkboxes/enabled_unchecked.gif
  127. BIN fr.opensagres.nosql.ide.ui/icons/clcl16/launch_restart.gif
  128. BIN fr.opensagres.nosql.ide.ui/icons/clcl16/launch_run.gif
  129. BIN fr.opensagres.nosql.ide.ui/icons/clcl16/launch_stop.gif
  130. BIN fr.opensagres.nosql.ide.ui/icons/clcl16/start_shell.png
  131. BIN fr.opensagres.nosql.ide.ui/icons/clcl16/stop_shell.png
  132. BIN fr.opensagres.nosql.ide.ui/icons/ctool16/wiz_new_database.png
  133. BIN fr.opensagres.nosql.ide.ui/icons/ctool16/wiz_new_server.gif
  134. BIN fr.opensagres.nosql.ide.ui/icons/dlcl16/launch_restart.gif
  135. BIN fr.opensagres.nosql.ide.ui/icons/dlcl16/launch_run.gif
  136. BIN fr.opensagres.nosql.ide.ui/icons/dlcl16/launch_stop.gif
  137. BIN fr.opensagres.nosql.ide.ui/icons/dlcl16/start_shell.png
  138. BIN fr.opensagres.nosql.ide.ui/icons/dlcl16/stop_shell.png
  139. BIN fr.opensagres.nosql.ide.ui/icons/elcl16/launch_restart.gif
  140. BIN fr.opensagres.nosql.ide.ui/icons/elcl16/launch_run.gif
  141. BIN fr.opensagres.nosql.ide.ui/icons/elcl16/launch_stop.gif
  142. BIN fr.opensagres.nosql.ide.ui/icons/elcl16/start_shell.png
  143. BIN fr.opensagres.nosql.ide.ui/icons/elcl16/stop_shell.png
  144. BIN fr.opensagres.nosql.ide.ui/icons/eview16/mongoperspective.png
  145. BIN fr.opensagres.nosql.ide.ui/icons/obj16/category.gif
  146. BIN fr.opensagres.nosql.ide.ui/icons/obj16/collection.png
  147. BIN fr.opensagres.nosql.ide.ui/icons/obj16/database-new.png
  148. BIN fr.opensagres.nosql.ide.ui/icons/obj16/database.png
  149. BIN fr.opensagres.nosql.ide.ui/icons/obj16/delete.gif
  150. BIN fr.opensagres.nosql.ide.ui/icons/obj16/document.gif
  151. BIN fr.opensagres.nosql.ide.ui/icons/obj16/error.gif
  152. BIN fr.opensagres.nosql.ide.ui/icons/obj16/gridfs.png
  153. BIN fr.opensagres.nosql.ide.ui/icons/obj16/index.png
  154. BIN fr.opensagres.nosql.ide.ui/icons/obj16/index.png-old
  155. BIN fr.opensagres.nosql.ide.ui/icons/obj16/index.png-old2
  156. BIN fr.opensagres.nosql.ide.ui/icons/obj16/mongo.png
  157. BIN fr.opensagres.nosql.ide.ui/icons/obj16/refresh.gif
  158. BIN fr.opensagres.nosql.ide.ui/icons/obj16/server-new.png
  159. BIN fr.opensagres.nosql.ide.ui/icons/obj16/server.gif
  160. BIN fr.opensagres.nosql.ide.ui/icons/obj16/server_started.gif
  161. BIN fr.opensagres.nosql.ide.ui/icons/obj16/server_stopped.gif
  162. BIN fr.opensagres.nosql.ide.ui/icons/obj16/shellcommand.png
  163. BIN fr.opensagres.nosql.ide.ui/icons/obj16/stats.png
  164. BIN fr.opensagres.nosql.ide.ui/icons/obj16/th_horizontal.gif
  165. BIN fr.opensagres.nosql.ide.ui/icons/obj16/th_vertical.gif
  166. BIN fr.opensagres.nosql.ide.ui/icons/obj16/users.png
  167. BIN fr.opensagres.nosql.ide.ui/icons/wizban/new_database_wiz.png
  168. BIN fr.opensagres.nosql.ide.ui/icons/wizban/new_server_wiz.png
  169. +22 −0 fr.opensagres.nosql.ide.ui/plugin.properties
  170. +42 −0 fr.opensagres.nosql.ide.ui/plugin.xml
  171. +13 −0 fr.opensagres.nosql.ide.ui/pom.xml
  172. +95 −0 fr.opensagres.nosql.ide.ui/schema/serverImages.exsd
  173. +13 −0 fr.opensagres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/PlatformUI.java
  174. +18 −0 fr.opensagres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/ServerUI.java
  175. +22 −0 fr.opensagres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/dialogs/StackTraceErrorDialog.java
  176. +33 −0 fr.opensagres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/extensions/AbstractUIRegistry.java
  177. +12 −0 fr.opensagres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/extensions/IServerImage.java
  178. +34 −0 fr.opensagres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/extensions/IServerImageRegistry.java
  179. +75 −0 fr.opensagres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/internal/Activator.java
  180. +45 −0 fr.opensagres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/internal/Application.java
  181. +30 −0 fr.opensagres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/internal/ApplicationActionBarAdvisor.java
  182. +20 −0 fr.opensagres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/internal/ApplicationWorkbenchAdvisor.java
  183. +27 −0 ...agres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/internal/ApplicationWorkbenchWindowAdvisor.java
  184. +119 −0 fr.opensagres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/internal/FormLayoutFactory.java
  185. +7 −0 fr.opensagres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/internal/IErrorMessageAware.java
  186. +179 −0 fr.opensagres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/internal/ImageResources.java
  187. +30 −0 fr.opensagres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/internal/Perspective.java
  188. +25 −0 fr.opensagres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/internal/extensions/ServerImage.java
  189. +142 −0 ...ensagres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/internal/extensions/ServerImageRegistry.java
  190. +68 −0 fr.opensagres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/internal/viewers/ServerLabelProvider.java
  191. +63 −0 ...agres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/internal/viewers/ServerTreeContentProvider.java
  192. +168 −0 fr.opensagres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/internal/views/ServerTreeViewer.java
  193. +38 −0 fr.opensagres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/internal/views/ServersExplorer.java
  194. +34 −0 fr.opensagres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/viewers/RuntimeContentProvider.java
  195. +25 −0 fr.opensagres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/viewers/RuntimeLabelProvider.java
  196. +8 −0 fr.opensagres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/wizards/AbstractNewWizard.java
  197. +22 −0 fr.opensagres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/wizards/AbstractWizard.java
  198. +56 −0 fr.opensagres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/wizards/AbstractWizardPage.java
  199. +50 −0 fr.opensagres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/wizards/WizardHelper.java
  200. +30 −0 ...pensagres.nosql.ide.ui/src/fr/opensagres/nosql/ide/ui/wizards/server/AbstractNewServerWizard.java
View
2 fr.opensagres.mongodb.ide.ui/src/fr/opensagres/mongodb/ide/ui/views/ServerTreeViewer.java
@@ -30,7 +30,7 @@
protected IServerListener serverListener;
public ServerTreeViewer(Composite parent, int style) {
- super(parent, style);
+ super(parent, style);
}
protected void initialize() {
View
7 fr.opensagres.nosql.ide.core/.classpath
@@ -0,0 +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>
View
28 fr.opensagres.nosql.ide.core/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>fr.opensagres.nosql.ide.core</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>
View
8 fr.opensagres.nosql.ide.core/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Sat Sep 01 19:07:02 CEST 2012
+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.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
View
15 fr.opensagres.nosql.ide.core/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-SymbolicName: fr.opensagres.nosql.ide.core;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: fr.opensagres.nosql.ide.core,
+ fr.opensagres.nosql.ide.core.extensions,
+ fr.opensagres.nosql.ide.core.model,
+ fr.opensagres.nosql.ide.core.utils
+Require-Bundle: org.eclipse.core.runtime
+Bundle-Activator: fr.opensagres.nosql.ide.core.internal.Activator
View
7 fr.opensagres.nosql.ide.core/build.properties
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ plugin.xml,\
+ schema/
View
16 fr.opensagres.nosql.ide.core/plugin.properties
@@ -0,0 +1,16 @@
+###############################################################################
+# Copyright (c) 2012 Angelo Zerr 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:
+# Angelo Zerr <angelo.zerr@gmail.com> - Initial API and implementation
+###############################################################################
+pluginName=NoSQL IDE Core
+providerName=Opensagres
+
+# Extension Point
+serverTypesContributionName=NoSQL Server types contribution.
+serverFactoriesContributionName=NoSQL Server factories contribution.
View
10 fr.opensagres.nosql.ide.core/plugin.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+ <extension-point id="serverTypes" name="%serverTypesContributionName"
+ schema="schema/serverTypes.exsd" />
+ <extension-point id="serverFactories" name="%serverFactoriesContributionName"
+ schema="schema/serverFactories.exsd" />
+
+</plugin>
View
13 fr.opensagres.nosql.ide.core/pom.xml
@@ -0,0 +1,13 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>fr.opensagres.nosql.ide.core</artifactId>
+
+ <packaging>eclipse-plugin</packaging>
+ <parent>
+ <groupId>fr.opensagres.mongodb-ide</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+</project>
View
95 fr.opensagres.nosql.ide.core/schema/serverFactories.exsd
@@ -0,0 +1,95 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="fr.opensagres.nosql.ide.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="fr.opensagres.nosql.ide.core" id="serverFactories" name="Serverfactories."/>
+ </appinfo>
+ <documentation>
+ Extension point for add NoSQL Server Factories.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="serverFactory" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully-qualified name of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ an optional id
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ an optional name
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="serverFactory">
+ <complexType>
+ <sequence>
+ </sequence>
+ <attribute name="serverType" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":fr.opensagres.nosql.ide.core.extensions.IServerFactory"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 2.0
+ </documentation>
+ </annotation>
+
+
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ This plugin itself does not have any predefined builders.
+ </documentation>
+ </annotation>
+
+
+</schema>
View
89 fr.opensagres.nosql.ide.core/schema/serverTypes.exsd
@@ -0,0 +1,89 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="fr.opensagres.nosql.ide.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="fr.opensagres.nosql.ide.core" id="serverTypes" name="Server Type."/>
+ </appinfo>
+ <documentation>
+ Extension point for add NoSQL Server Type.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="serverType" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully-qualified name of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ an optional id
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ an optional name
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="serverType">
+ <complexType>
+ <sequence>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 2.0
+ </documentation>
+ </annotation>
+
+
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ This plugin itself does not have any predefined builders.
+ </documentation>
+ </annotation>
+
+
+</schema>
View
31 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/IServerLifecycleListener.java
@@ -0,0 +1,31 @@
+package fr.opensagres.nosql.ide.core;
+
+import fr.opensagres.nosql.ide.core.model.IServer;
+
+public interface IServerLifecycleListener {
+
+ /**
+ * A new server has been created.
+ *
+ * @param server
+ * the new server
+ */
+ public void serverAdded(IServer server);
+
+ /**
+ * An existing server has been updated or modified.
+ *
+ * @param server
+ * the modified server
+ */
+ public void serverChanged(IServer server);
+
+ /**
+ * A existing server has been removed.
+ *
+ * @param server
+ * the removed server
+ */
+ public void serverRemoved(IServer server);
+
+}
View
28 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/IServerListener.java
@@ -0,0 +1,28 @@
+package fr.opensagres.nosql.ide.core;
+
+/**
+ * This interface is used by the server to broadcast a change of state. Usually,
+ * the change of state will be caused by some user action, (e.g. requesting to
+ * start a server) however, it is equally fine for a server to broadcast a
+ * change of state through no direct user action. (e.g. stopping because the
+ * server crashed) This information can be used to inform the user of the change
+ * or update the UI.
+ *
+ * <p>
+ * Note: The server listener event MUST NOT directly be used to modify the
+ * server's or module's state via one of the server's method. For example, a
+ * server stopped event cannot directly trigger a start(). Doing this may cause
+ * the thread to hang.
+ * </p>
+ *
+ * @since 1.0
+ */
+public interface IServerListener {
+ /**
+ * A server or module has been changed as specified in the event.
+ *
+ * @param event
+ * a server event that contains information on the change
+ */
+ public void serverChanged(ServerEvent event);
+}
View
26 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/IServerManager.java
@@ -0,0 +1,26 @@
+package fr.opensagres.nosql.ide.core;
+
+import java.util.List;
+
+import fr.opensagres.nosql.ide.core.extensions.IServerType;
+import fr.opensagres.nosql.ide.core.model.IServer;
+
+public interface IServerManager extends ISettingsManager {
+
+ void addServer(IServer server) throws Exception;
+
+ void removeServer(IServer server) throws Exception;
+
+ List<IServer> getServers();
+
+ List<IServer> getServers(IServerType serverType);
+
+ void addServerLifecycleListener(IServerLifecycleListener listener);
+
+ void removeServerLifecycleListener(IServerLifecycleListener listener);
+
+ void dispose();
+
+ IServer findServer(String serverId);
+
+}
View
11 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/IServerRuntimeListener.java
@@ -0,0 +1,11 @@
+package fr.opensagres.nosql.ide.core;
+
+import fr.opensagres.nosql.ide.core.model.IServerRuntime;
+
+public interface IServerRuntimeListener {
+
+ void runtimeAdded(IServerRuntime runtime);
+
+ void runtimeRemoved(IServerRuntime runtime);
+
+}
View
19 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/IServerRuntimeManager.java
@@ -0,0 +1,19 @@
+package fr.opensagres.nosql.ide.core;
+
+import java.util.List;
+
+import fr.opensagres.nosql.ide.core.extensions.IServerType;
+import fr.opensagres.nosql.ide.core.model.IServerRuntime;
+
+public interface IServerRuntimeManager extends ISettingsManager {
+
+ List<IServerRuntime> getRuntimes();
+
+ List<IServerRuntime> getRuntimes(IServerType serverType);
+
+ void addRuntime(IServerRuntime runtime) throws Exception;
+
+ void removeRuntime(IServerRuntime runtime) throws Exception;
+
+ IServerRuntime findRuntime(String runtimeId);
+}
View
11 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/ISettingsManager.java
@@ -0,0 +1,11 @@
+package fr.opensagres.nosql.ide.core;
+
+
+public interface ISettingsManager {
+
+ void initialize() throws Exception;
+
+ void load() throws Exception;
+
+ public void save() throws Exception;
+}
View
27 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/Platform.java
@@ -0,0 +1,27 @@
+package fr.opensagres.nosql.ide.core;
+
+import fr.opensagres.nosql.ide.core.extensions.IServerFactoryRegistry;
+import fr.opensagres.nosql.ide.core.extensions.IServerTypeRegistry;
+import fr.opensagres.nosql.ide.core.internal.ServerManager;
+import fr.opensagres.nosql.ide.core.internal.ServerRuntimeManager;
+import fr.opensagres.nosql.ide.core.internal.extensions.ServerFactoryRegistry;
+import fr.opensagres.nosql.ide.core.internal.extensions.ServerTypeRegistry;
+
+public class Platform {
+
+ public static IServerTypeRegistry getServerTypeRegistry() {
+ return ServerTypeRegistry.getInstance();
+ }
+
+ public static IServerManager getServerManager() {
+ return ServerManager.getInstance();
+ }
+
+ public static IServerFactoryRegistry getServerFactoryRegistry() {
+ return ServerFactoryRegistry.getInstance();
+ }
+
+ public static IServerRuntimeManager getServerRuntimeManager() {
+ return ServerRuntimeManager.getInstance();
+ }
+}
View
148 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/ServerEvent.java
@@ -0,0 +1,148 @@
+package fr.opensagres.nosql.ide.core;
+
+import fr.opensagres.nosql.ide.core.model.IDatabase;
+import fr.opensagres.nosql.ide.core.model.IServer;
+import fr.opensagres.nosql.ide.core.model.ServerState;
+
+public class ServerEvent {
+
+ private IServer server;
+ private ServerState state;
+ private int kind;
+ private IDatabase database;
+ //private Collection collection;
+
+ /**
+ * For notification when the state has changed.
+ * <p>
+ * This kind is mutually exclusive with <code>PUBLISH_STATE_CHANGE</code>
+ * and <code>RESTART_STATE_CHANGE</code>.
+ * </p>
+ *
+ * @see #getKind()
+ */
+ public static final int STATE_CHANGE = 0x0001;
+
+ /**
+ * For event on server changes. This kind is mutually exclusive with
+ * <code>MODULE_CHANGE</code>.
+ *
+ * @see #getKind()
+ */
+ public static final int SERVER_CHANGE = 0x0010;
+ public static final int SERVER_SAVED = 0x0011;
+
+ public static final int DATABASE_CHANGE = 0x0020;
+ public static final int DATABASE_CREATED = 0x0012;
+ public static final int DATABASE_DROPPED = 0x0014;
+
+ public static final int COLLECTION_CHANGE = 0x0030;
+ public static final int COLLECTION_CREATED = 0x0032;
+
+ /**
+ * Returns the server involved in the change event.
+ *
+ * @return the server involved in the change event.
+ */
+ public IServer getServer() {
+ return server;
+ }
+
+ /**
+ * Create a new server event for server change events.
+ *
+ * @param kind
+ * the kind of the change. (<code>XXX_CHANGE</code>). If the kind
+ * does not include the <code>SERVER_CHANGE</code> kind, the
+ * SERVER_CHANGE will be added automatically. constants declared
+ * on {@link ServerEvent}
+ * @param server
+ * the server that the server event takes place
+ * @param state
+ * the server state after the change (<code>STATE_XXX</code>)
+ * constants declared on {@link IServer}
+ * @param publishingState
+ * the server publishing state after the change (
+ * <code>PUBLISH_STATE_XXX</code>) constants declared on
+ * {@link IServer}
+ * @param restartState
+ * get the server restart state after the server is restart
+ * needed property change event
+ * @param status
+ * the server status after the change
+ */
+ public ServerEvent(int kind, IServer server, ServerState state) {
+ this.kind = kind |= SERVER_CHANGE;
+ this.server = server;
+ this.state = state;
+
+ if (server == null)
+ throw new IllegalArgumentException(
+ "Server parameter must not be null");
+ }
+
+ public ServerEvent(int kind, IDatabase database) {
+ this.kind = kind |= DATABASE_CHANGE;
+ this.database = database;
+ if (database == null)
+ throw new IllegalArgumentException(
+ "Database parameter must not be null");
+ //this.server = database.getParent();
+ }
+
+// public ServerEvent(int kind, Collection collection) {
+// this.kind = kind |= COLLECTION_CHANGE;
+// this.collection = collection;
+// this.database = collection.getDatabase();
+// if (database == null)
+// throw new IllegalArgumentException(
+// "Database parameter must not be null");
+// this.server = database.getParent();
+// }
+
+ /**
+ * Returns the kind of the server event.
+ * <p>
+ * This kind can be used to test whether this event is a server event or
+ * module event by using the following code (the example is checking for the
+ * server event): ((getKind() & SERVER_CHANGE) != 0)
+ *
+ * @return the kind of the change (<code>XXX_CHANGE</code> constants
+ * declared on {@link ServerEvent}
+ */
+ public int getKind() {
+ return kind;
+ }
+
+ /**
+ * Get the state after the change that triggers this server event. If this
+ * event is of the SERVER_CHANGE kind, then the state is the server state.
+ * If this event is of the MODULE_CHANGE kind, then the state is the module
+ * state.
+ *
+ * @return the server state after the change (<code>STATE_XXX</code>)
+ * constants declared on {@link ServerState}
+ */
+ public ServerState getState() {
+ return state;
+ }
+
+ public IDatabase getDatabase() {
+ return database;
+ }
+
+// public Collection getCollection() {
+// return collection;
+// }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return "<Server-Event" + " id=" + this.hashCode() + " kind="
+ + getKind() + " server=" + getServer() + " state=" + getState()
+ + ">";
+ }
+}
View
83 ...ensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/extensions/AbstractRegistry.java
@@ -0,0 +1,83 @@
+package fr.opensagres.nosql.ide.core.extensions;
+
+import org.eclipse.core.runtime.IExtensionDelta;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.IRegistryChangeEvent;
+import org.eclipse.core.runtime.IRegistryChangeListener;
+import org.eclipse.core.runtime.Platform;
+
+public abstract class AbstractRegistry implements IRegistryChangeListener {
+
+ public static final String ID_ATTR = "id";
+ public static final String NAME_ATTR = "name";
+ public static final String DESCRIPTION_ATTR = "description";
+ public static final String CLASS_ATTR = "class";
+
+ private boolean registryListenerIntialized = false;
+
+ public void initialize() {
+
+ }
+
+ public void destroy() {
+ Platform.getExtensionRegistry().removeRegistryChangeListener(this);
+ }
+
+ private void addRegistryListenerIfNeeded() {
+ if (registryListenerIntialized)
+ return;
+
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ if (registry != null) {
+ registry.addRegistryChangeListener(this, getPluginId());
+ }
+ registryListenerIntialized = true;
+ }
+
+ public void registryChanged(IRegistryChangeEvent event) {
+ IExtensionDelta[] deltas = event.getExtensionDeltas(getPluginId(),
+ getExtensionPoint());
+ if (deltas != null) {
+ for (IExtensionDelta delta : deltas)
+ handleExtensionDelta(delta);
+ }
+ }
+
+ protected void loadRegistryIfNedded() {
+ if (!isRegistryIntialized()) {
+ loadRegistry();
+ addRegistryListenerIfNeeded();
+ }
+ }
+
+ protected boolean isRegistryIntialized() {
+ return registryListenerIntialized;
+ }
+
+// protected Image getIconImage(IConfigurationElement cfig) {
+// ImageDescriptor imageDescriptor = getIconImageDescriptor(cfig);
+// if (imageDescriptor != null) {
+// return JFaceResources.getResources().createImageWithDefault(
+// imageDescriptor);
+//
+// }
+// return null;
+// }
+//
+// protected ImageDescriptor getIconImageDescriptor(IConfigurationElement cfig) {
+// String strIcon = cfig.getAttribute(ICON_ATTR);//$NON-NLS-1$
+// if (strIcon != null) {
+// return AbstractUIPlugin.imageDescriptorFromPlugin(
+// cfig.getNamespaceIdentifier(), strIcon);
+// }
+// return null;
+// }
+
+ protected abstract void loadRegistry();
+
+ protected abstract void handleExtensionDelta(IExtensionDelta delta);
+
+ protected abstract String getPluginId();
+
+ protected abstract String getExtensionPoint();
+}
View
40 ...res.nosql.ide.core/src/fr/opensagres/nosql/ide/core/extensions/AbstractServerFactory.java
@@ -0,0 +1,40 @@
+package fr.opensagres.nosql.ide.core.extensions;
+
+import org.xml.sax.Attributes;
+
+import fr.opensagres.nosql.ide.core.Platform;
+import fr.opensagres.nosql.ide.core.model.IServer;
+import fr.opensagres.nosql.ide.core.model.IServerRuntime;
+import fr.opensagres.nosql.ide.core.settings.ServersConstants;
+
+public abstract class AbstractServerFactory implements IServerFactory {
+
+ public IServer create(Attributes attributes) {
+ String id = attributes.getValue(ServersConstants.ID_ATTR);
+ String name = attributes.getValue(ServersConstants.NAME_ATTR);
+ String url = attributes.getValue(ServersConstants.URL_ATTR);
+ IServer server = doCreate(id, name, url, attributes);
+ if (server != null) {
+ String runtimeId = attributes
+ .getValue(ServersConstants.RUNTIME_ID_ATTR);
+ IServerRuntime runtime = Platform.getServerRuntimeManager().findRuntime(
+ runtimeId);
+ server.setRuntime(runtime);
+ // String mongoURI = attributes
+ // .getValue(ServersConstants.MONGO_URI_ATTR);
+ // if (!StringUtils.isEmpty(mongoURI)) {
+ // String id = attributes.getValue(ServersConstants.ID_ATTR);
+ // String name = attributes.getValue(ServersConstants.NAME_ATTR);
+ // // Server server = new Server(id, name, new MongoURI(mongoURI));
+ // // String runtimeId = attributes
+ // // .getValue(ServersConstants.RUNTIME_ID_ATTR);
+ // // MongoRuntime runtime = Platform.getMongoRuntimeManager()
+ // // .findRuntime(runtimeId);
+ // // server.setRuntime(runtime);
+ }
+ return server;
+ }
+
+ protected abstract IServer doCreate(String id, String name, String url,
+ Attributes attributes);
+}
View
8 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/extensions/IRegistry.java
@@ -0,0 +1,8 @@
+package fr.opensagres.nosql.ide.core.extensions;
+
+public interface IRegistry {
+
+ void initialize();
+
+ void destroy();
+}
View
11 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/extensions/IServerFactory.java
@@ -0,0 +1,11 @@
+package fr.opensagres.nosql.ide.core.extensions;
+
+import org.xml.sax.Attributes;
+
+import fr.opensagres.nosql.ide.core.model.IServer;
+
+public interface IServerFactory {
+
+ IServer create(Attributes attributes);
+
+}
View
21 ...es.nosql.ide.core/src/fr/opensagres/nosql/ide/core/extensions/IServerFactoryRegistry.java
@@ -0,0 +1,21 @@
+package fr.opensagres.nosql.ide.core.extensions;
+
+import java.util.Collection;
+
+public interface IServerFactoryRegistry extends IRegistry {
+
+ /**
+ * Return the {@link IServerFactory} retrieved by the given id.
+ *
+ * @param id
+ * @return
+ */
+ IServerFactory getFactory(IServerType serverType);
+
+ /**
+ * Return the list of the {@link IServerFactory}.
+ *
+ * @return
+ */
+ Collection<IServerFactory> getFactories();
+}
View
7 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/extensions/IServerType.java
@@ -0,0 +1,7 @@
+package fr.opensagres.nosql.ide.core.extensions;
+
+import fr.opensagres.nosql.ide.core.model.IModelIdentity;
+
+public interface IServerType extends IModelIdentity {
+
+}
View
16 ...agres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/extensions/IServerTypeRegistry.java
@@ -0,0 +1,16 @@
+package fr.opensagres.nosql.ide.core.extensions;
+
+import java.util.Collection;
+
+public interface IServerTypeRegistry extends IRegistry {
+
+ /**
+ * Return the {@link IServerType} retrieved by the given id.
+ *
+ * @param id
+ * @return
+ */
+ IServerType getType(String id);
+
+ Collection<IServerType> getTypes();
+}
View
41 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/internal/AbstractManager.java
@@ -0,0 +1,41 @@
+package fr.opensagres.nosql.ide.core.internal;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.InputStream;
+import java.io.Writer;
+import java.util.ArrayList;
+
+import fr.opensagres.nosql.ide.core.internal.settings.AbstractSettings;
+
+public abstract class AbstractManager<T> extends ArrayList<T> {
+
+ private final AbstractSettings<T> settings;
+ private final File settingsFile;
+
+ public AbstractManager(String settingsFileName, AbstractSettings<T> settings) {
+ this.settingsFile = new File(Activator.getDefault().getStateLocation()
+ .toFile(), settingsFileName);
+ this.settingsFile.getParentFile().mkdirs();
+ this.settings = settings;
+ }
+
+ public void initialize() throws Exception {
+ if (settingsFile.exists()) {
+ load();
+ }
+ }
+
+ public void load() throws Exception {
+ super.clear();
+ InputStream stream = new FileInputStream(settingsFile);
+ settings.load(stream, this);
+ }
+
+ public void save() throws Exception {
+ Writer stream = new FileWriter(settingsFile);
+ settings.save(this, stream);
+ }
+
+}
View
45 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/internal/Activator.java
@@ -0,0 +1,45 @@
+package fr.opensagres.nosql.ide.core.internal;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+import fr.opensagres.nosql.ide.core.Platform;
+
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "fr.opensagres.nosql.ide.core"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext
+ * )
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ Platform.getServerTypeRegistry().initialize();
+ Platform.getServerManager().initialize();
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ Platform.getServerTypeRegistry().destroy();
+ Platform.getServerManager().dispose();
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+}
View
162 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/internal/ServerManager.java
@@ -0,0 +1,162 @@
+package fr.opensagres.nosql.ide.core.internal;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import fr.opensagres.nosql.ide.core.IServerLifecycleListener;
+import fr.opensagres.nosql.ide.core.IServerManager;
+import fr.opensagres.nosql.ide.core.extensions.IServerType;
+import fr.opensagres.nosql.ide.core.internal.settings.ServersSettings;
+import fr.opensagres.nosql.ide.core.model.IServer;
+import fr.opensagres.nosql.ide.core.utils.StringUtils;
+
+public class ServerManager extends AbstractManager<IServer> implements
+ IServerManager {
+
+ private static final long serialVersionUID = -8525280179973199825L;
+
+ private static final IServerManager INSTANCE = new ServerManager();
+
+ private static final byte EVENT_ADDED = 0;
+ private static final byte EVENT_CHANGED = 1;
+ private static final byte EVENT_REMOVED = 2;
+
+ public static IServerManager getInstance() {
+ return INSTANCE;
+ }
+
+ private final List<IServerLifecycleListener> serverListeners;
+
+ public ServerManager() {
+ super("servers.xml", ServersSettings.getInstance());
+ this.serverListeners = new ArrayList<IServerLifecycleListener>();
+ }
+
+ public void addServer(IServer server) throws Exception {
+ if (server == null)
+ return;
+
+ if (!super.contains(server)) {
+ super.add(server);
+ fireServerEvent(server, EVENT_ADDED);
+ } else
+ fireServerEvent(server, EVENT_CHANGED);
+ super.save();
+ }
+
+ public void removeServer(IServer server) throws Exception {
+ super.remove(server);
+ super.save();
+ fireServerEvent(server, EVENT_REMOVED);
+ server.dispose();
+ }
+
+ public List<IServer> getServers() {
+ return this;
+ }
+
+ public List<IServer> getServers(IServerType serverType) {
+ List<IServer> allServers = getServers();
+ if (allServers.isEmpty()) {
+ return Collections.emptyList();
+ }
+ List<IServer> servers = new ArrayList<IServer>();
+ for (IServer server : allServers) {
+ if (serverType.equals(server.getServerType())) {
+ servers.add(server);
+ }
+ }
+ return servers;
+ }
+
+ public void addServerLifecycleListener(IServerLifecycleListener listener) {
+ if (Trace.LISTENERS) {
+ Trace.trace(Trace.STRING_LISTENERS,
+ "Adding server lifecycle listener " + listener + " to "
+ + this);
+ }
+
+ synchronized (serverListeners) {
+ serverListeners.add(listener);
+ }
+ }
+
+ /*
+ *
+ */
+ public void removeServerLifecycleListener(IServerLifecycleListener listener) {
+ if (Trace.LISTENERS) {
+ Trace.trace(Trace.STRING_LISTENERS,
+ "Removing server lifecycle listener " + listener + " from "
+ + this);
+ }
+
+ synchronized (serverListeners) {
+ serverListeners.remove(listener);
+ }
+ }
+
+ /**
+ * Fire a server event.
+ */
+ private void fireServerEvent(final IServer server, byte b) {
+ if (Trace.LISTENERS) {
+ Trace.trace(Trace.STRING_LISTENERS, "->- Firing server event: "
+ + server.getName() + " ->-");
+ }
+
+ if (serverListeners.isEmpty())
+ return;
+
+ List<IServerLifecycleListener> clone = new ArrayList<IServerLifecycleListener>();
+ clone.addAll(serverListeners);
+ for (IServerLifecycleListener srl : clone) {
+ if (Trace.LISTENERS) {
+ Trace.trace(Trace.STRING_LISTENERS, " Firing server event to "
+ + srl);
+ }
+ try {
+ if (b == EVENT_ADDED)
+ srl.serverAdded(server);
+ else if (b == EVENT_CHANGED)
+ srl.serverChanged(server);
+ else if (b == EVENT_REMOVED)
+ srl.serverRemoved(server);
+ } catch (Exception e) {
+ if (Trace.SEVERE) {
+ Trace.trace(Trace.STRING_SEVERE,
+ " Error firing server event to " + srl, e);
+ }
+ }
+ }
+ if (Trace.LISTENERS) {
+ Trace.trace(Trace.STRING_LISTENERS,
+ "-<- Done firing server event -<-");
+ }
+ }
+
+ public void dispose() {
+ for (IServer server : this) {
+ try {
+ server.dispose();
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+ }
+
+ public IServer findServer(String serverId) {
+ if (StringUtils.isEmpty(serverId)) {
+ return null;
+ }
+ for (IServer server : this) {
+ if (serverId.equals(server.getId())) {
+ return server;
+ }
+ }
+ return null;
+ }
+
+}
View
191 ...s.nosql.ide.core/src/fr/opensagres/nosql/ide/core/internal/ServerNotificationManager.java
@@ -0,0 +1,191 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - Initial API and implementation
+ *******************************************************************************/
+package fr.opensagres.nosql.ide.core.internal;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import fr.opensagres.nosql.ide.core.IServerListener;
+import fr.opensagres.nosql.ide.core.ServerEvent;
+
+/**
+ * Notification manager for server.
+ */
+public class ServerNotificationManager {
+ private List<ListenerEntry> listenerList = new ArrayList<ListenerEntry>();
+
+ /**
+ * For masking event on all changes.
+ */
+ public static final int ALL_EVENTS = 0xFFFF;
+
+ private class ListenerEntry {
+ private IServerListener listener;
+ private int eventMask;
+
+ protected ListenerEntry(IServerListener curListener, int curEventMask) {
+ listener = curListener;
+ eventMask = curEventMask;
+ }
+
+ protected IServerListener getListener() {
+ return listener;
+ }
+
+ protected int getEventMask() {
+ return eventMask;
+ }
+ }
+
+ /**
+ * Create a new notification manager.
+ */
+ public ServerNotificationManager() {
+ super();
+ }
+
+ /**
+ * Add listener for all events.
+ *
+ * @param curListener
+ */
+ public void addListener(IServerListener curListener) {
+ addListener(curListener, ALL_EVENTS);
+ }
+
+ /**
+ * Add listener for the events specified by the mask.
+ *
+ * @param curListener
+ * @param eventMask
+ */
+ public void addListener(IServerListener curListener, int eventMask) {
+ if (Trace.FINEST) {
+ Trace.trace(Trace.STRING_FINEST,
+ "->- Adding server listener to notification manager: "
+ + curListener + " " + eventMask + " ->-");
+ }
+ if (curListener == null) {
+ return;
+ }
+
+ synchronized (listenerList) {
+ listenerList.add(new ListenerEntry(curListener, eventMask));
+ }
+ }
+
+ public void broadcastChange(ServerEvent event) {
+ if (Trace.FINEST) {
+ Trace.trace(Trace.STRING_FINEST, "->- Broadcasting server event: "
+ + event + " ->-");
+ }
+ if (event == null) {
+ return;
+ }
+ int eventKind = event.getKind();
+ if (Trace.FINEST) {
+ Trace.trace(Trace.STRING_FINEST, " Server event kind: "
+ + eventKind + " ->-");
+ }
+
+ // only notify listeners that listen to module event
+ int size;
+ ListenerEntry[] listeners;
+ synchronized (listenerList) {
+ size = listenerList.size();
+ listeners = listenerList.toArray(new ListenerEntry[size]);
+ }
+ for (int i = 0; i < size; i++) {
+ ListenerEntry curEntry = listeners[i];
+ int mask = curEntry.getEventMask();
+
+ // check if the type of the event matches the mask, e.g. server or
+ // module change
+ boolean isTypeMatch = ((mask & eventKind & ServerEvent.SERVER_CHANGE) != 0)
+ || ((mask & eventKind & ServerEvent.DATABASE_CHANGE) != 0);
+ // check the kind of change
+ // take out the ServerEvent.SERVER_CHANGE bit and
+ // ServerEvent.MODULE_CHANGE bit
+ int kindOnly = (eventKind | ServerEvent.SERVER_CHANGE | ServerEvent.DATABASE_CHANGE)
+ ^ ServerEvent.SERVER_CHANGE ^ ServerEvent.DATABASE_CHANGE;
+ boolean isKindMatch = (mask & kindOnly) != 0;
+ if (isTypeMatch && isKindMatch) {
+ if (Trace.FINEST) {
+ Trace.trace(
+ Trace.STRING_FINEST,
+ "->- Firing server event to listener: "
+ + curEntry.getListener() + " ->-");
+ }
+ try {
+ if (Trace.LISTENERS) {
+ Trace.trace(Trace.STRING_LISTENERS,
+ " Firing server event to listener: "
+ + curEntry.getListener());
+ }
+ curEntry.getListener().serverChanged(event);
+ } catch (Exception e) {
+ if (Trace.SEVERE) {
+ Trace.trace(
+ Trace.STRING_SEVERE,
+ " Error firing server event: "
+ + curEntry.getListener(), e);
+ }
+ }
+ if (Trace.LISTENERS) {
+ Trace.trace(Trace.STRING_LISTENERS,
+ "-<- Done firing server event -<-");
+ }
+ }
+ }
+ if (Trace.FINEST) {
+ Trace.trace(Trace.STRING_FINEST,
+ "-<- Done broadcasting server event -<-");
+ }
+ }
+
+ /**
+ * Returns true if the listener list is empty, or false otherwise.
+ *
+ * @return true if the listener list is empty, or false otherwise
+ */
+ public boolean hasNoListeners() {
+ return listenerList.isEmpty();
+ }
+
+ /**
+ * Remove a listener from notification.
+ *
+ * @param curListener
+ */
+ public void removeListener(IServerListener curListener) {
+ if (Trace.FINEST) {
+ Trace.trace(Trace.STRING_FINEST,
+ "->- Removing server listener from notification manager: "
+ + curListener + " ->-");
+ }
+ if (curListener == null)
+ return;
+
+ synchronized (listenerList) {
+ ListenerEntry matchedListenerEntry = null;
+ Iterator listenerIter = listenerList.iterator();
+ while (matchedListenerEntry == null && listenerIter.hasNext()) {
+ ListenerEntry curEntry = (ListenerEntry) listenerIter.next();
+ if (curListener.equals(curEntry.getListener())) {
+ matchedListenerEntry = curEntry;
+ }
+ }
+ if (matchedListenerEntry != null)
+ listenerList.remove(matchedListenerEntry);
+ }
+ }
+}
View
104 ...sagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/internal/ServerRuntimeManager.java
@@ -0,0 +1,104 @@
+package fr.opensagres.nosql.ide.core.internal;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.ListenerList;
+
+import fr.opensagres.nosql.ide.core.IServerRuntimeListener;
+import fr.opensagres.nosql.ide.core.IServerRuntimeManager;
+import fr.opensagres.nosql.ide.core.extensions.IServerType;
+import fr.opensagres.nosql.ide.core.internal.settings.RuntimesSettings;
+import fr.opensagres.nosql.ide.core.model.IServerRuntime;
+import fr.opensagres.nosql.ide.core.utils.StringUtils;
+
+public class ServerRuntimeManager extends AbstractManager<IServerRuntime>
+ implements IServerRuntimeManager {
+
+ private static final IServerRuntimeManager INSTANCE = new ServerRuntimeManager();
+
+ public static IServerRuntimeManager getInstance() {
+ return INSTANCE;
+ }
+
+ private final ListenerList listeners;
+
+ public ServerRuntimeManager() {
+ super("runtmes.xml", RuntimesSettings.getInstance());
+ this.listeners = new ListenerList();
+ }
+
+ public List<IServerRuntime> getRuntimes() {
+ return this;
+ }
+
+ public List<IServerRuntime> getRuntimes(IServerType serverType) {
+ List<IServerRuntime> allRuntimes = getRuntimes();
+ if (allRuntimes.isEmpty()) {
+ return Collections.emptyList();
+ }
+ List<IServerRuntime> runtimes = new ArrayList<IServerRuntime>();
+ for (IServerRuntime runtime : allRuntimes) {
+ if (serverType.equals(runtime.getServerType())) {
+ runtimes.add(runtime);
+ }
+ }
+ return runtimes;
+ }
+
+ public void addRuntime(IServerRuntime runtime) throws Exception {
+ addRuntime(runtime, true);
+ }
+
+ private void addRuntime(IServerRuntime runtime, boolean save)
+ throws Exception {
+ super.add(runtime);
+ if (save) {
+ super.save();
+ }
+ processListeners(runtime, true);
+ }
+
+ public void removeRuntime(IServerRuntime runtime) throws Exception {
+ super.remove(runtime);
+ super.save();
+ processListeners(runtime, false);
+ // runtime.dispose();
+ }
+
+ private void processListeners(IServerRuntime runtime, boolean start) {
+ Object[] changeListeners = this.listeners.getListeners();
+ if (changeListeners.length == 0)
+ return;
+ for (int i = 0; i < changeListeners.length; ++i) {
+ final IServerRuntimeListener l = (IServerRuntimeListener) changeListeners[i];
+ if (start) {
+ l.runtimeAdded(runtime);
+ } else {
+ l.runtimeRemoved(runtime);
+ }
+ }
+ }
+
+ public void setRuntimes(IServerRuntime[] runtimes) throws Exception {
+ clear();
+ for (IServerRuntime runtime : runtimes) {
+ addRuntime(runtime, false);
+ }
+ save();
+ }
+
+ public IServerRuntime findRuntime(String runtimeId) {
+ if (StringUtils.isEmpty(runtimeId)) {
+ return null;
+ }
+ for (IServerRuntime runtime : this) {
+ if (runtimeId.equals(runtime.getId())) {
+ return runtime;
+ }
+ }
+ return null;
+ }
+
+}
View
145 fr.opensagres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/internal/Trace.java
@@ -0,0 +1,145 @@
+package fr.opensagres.nosql.ide.core.internal;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.service.debug.DebugOptions;
+import org.eclipse.osgi.service.debug.DebugOptionsListener;
+
+/**
+ * Helper class to route trace output.
+ */
+public class Trace implements DebugOptionsListener {
+
+ private static final SimpleDateFormat sdf = new SimpleDateFormat(
+ "dd/MM/yy HH:mm.ss.SSS"); //$NON-NLS-1$
+
+ private static Set<String> logged = new HashSet<String>();
+
+ // tracing enablement flags
+ public static boolean CONFIG = false;
+ public static boolean INFO = false;
+ public static boolean WARNING = false;
+ public static boolean SEVERE = false;
+ public static boolean FINER = false;
+ public static boolean FINEST = false;
+ public static boolean RESOURCES = false;
+ public static boolean EXTENSION_POINT = false;
+ public static boolean LISTENERS = false;
+ public static boolean RUNTIME_TARGET = false;
+ public static boolean PERFORMANCE = false;
+ public static boolean PUBLISHING = false;
+
+ // tracing levels. One most exist for each debug option
+ public final static String STRING_CONFIG = "/config"; //$NON-NLS-1$
+ public final static String STRING_INFO = "/info"; //$NON-NLS-1$
+ public final static String STRING_WARNING = "/warning"; //$NON-NLS-1$
+ public final static String STRING_SEVERE = "/severe"; //$NON-NLS-1$
+ public final static String STRING_FINER = "/finer"; //$NON-NLS-1$
+ public final static String STRING_FINEST = "/finest"; //$NON-NLS-1$
+ public final static String STRING_RESOURCES = "/resources"; //$NON-NLS-1$
+ public final static String STRING_EXTENSION_POINT = "/extension_point"; //$NON-NLS-1$
+ public final static String STRING_LISTENERS = "/listeners"; //$NON-NLS-1$
+ public final static String STRING_RUNTIME_TARGET = "/runtime_target"; //$NON-NLS-1$
+ public final static String STRING_PERFORMANCE = "/performance"; //$NON-NLS-1$
+ public final static String STRING_PUBLISHING = "/publishing"; //$NON-NLS-1$
+
+ /**
+ * Trace constructor. This should never be explicitly called by clients and
+ * is used to register this class with the {@link DebugOptions} service.
+ */
+ public Trace() {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osgi.service.debug.DebugOptionsListener#optionsChanged(org
+ * .eclipse.osgi.service.debug.DebugOptions)
+ */
+ public void optionsChanged(DebugOptions options) {
+ Trace.CONFIG = options.getBooleanOption(Activator.PLUGIN_ID
+ + Trace.STRING_CONFIG, false);
+ Trace.INFO = options.getBooleanOption(Activator.PLUGIN_ID
+ + Trace.STRING_INFO, false);
+ Trace.WARNING = options.getBooleanOption(Activator.PLUGIN_ID
+ + Trace.STRING_WARNING, false);
+ Trace.SEVERE = options.getBooleanOption(Activator.PLUGIN_ID
+ + Trace.STRING_SEVERE, false);
+ Trace.FINER = options.getBooleanOption(Activator.PLUGIN_ID
+ + Trace.STRING_FINER, false);
+ Trace.FINEST = options.getBooleanOption(Activator.PLUGIN_ID
+ + Trace.STRING_FINEST, false);
+ Trace.RESOURCES = options.getBooleanOption(Activator.PLUGIN_ID
+ + Trace.STRING_RESOURCES, false);
+ Trace.EXTENSION_POINT = options.getBooleanOption(Activator.PLUGIN_ID
+ + Trace.STRING_EXTENSION_POINT, false);
+ Trace.LISTENERS = options.getBooleanOption(Activator.PLUGIN_ID
+ + Trace.STRING_LISTENERS, false);
+ Trace.RUNTIME_TARGET = options.getBooleanOption(Activator.PLUGIN_ID
+ + Trace.STRING_RUNTIME_TARGET, false);
+ Trace.PERFORMANCE = options.getBooleanOption(Activator.PLUGIN_ID
+ + Trace.STRING_PERFORMANCE, false);
+ Trace.PUBLISHING = options.getBooleanOption(Activator.PLUGIN_ID
+ + Trace.STRING_PUBLISHING, false);
+ }
+
+ /**
+ * Trace the given message.
+ *
+ * @param level
+ * The tracing level.
+ * @param s
+ * The message to trace
+ */
+ public static void trace(final String level, String s) {
+
+ Trace.trace(level, s, null);
+ }
+
+ /**
+ * Trace the given message and exception.
+ *
+ * @param level
+ * The tracing level.
+ * @param s
+ * The message to trace
+ * @param t
+ * A {@link Throwable} to trace
+ */
+ public static void trace(final String level, String s, Throwable t) {
+ if (s == null) {
+ return;
+ }
+ if (Trace.STRING_SEVERE.equals(level)) {
+ if (!logged.contains(s)) {
+ Activator
+ .getDefault()
+ .getLog()
+ .log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, s,
+ t));
+ logged.add(s);
+ }
+ }
+ if (Activator.getDefault().isDebugging()) {
+ final StringBuffer sb = new StringBuffer(Activator.PLUGIN_ID);
+ sb.append(" "); //$NON-NLS-1$
+ sb.append(level);
+ sb.append(" "); //$NON-NLS-1$
+ sb.append(sdf.format(new Date()));
+ sb.append(" "); //$NON-NLS-1$
+ sb.append(s);
+ System.out.println(sb.toString());
+ if (t != null) {
+ t.printStackTrace();
+ }
+ }
+ }
+
+}
View
145 ....ide.core/src/fr/opensagres/nosql/ide/core/internal/extensions/ServerFactoryRegistry.java
@@ -0,0 +1,145 @@
+/*******************************************************************************
+ * Copyright (C) 2012 Angelo Zerr <angelo.zerr@gmail.com>, Pascal Leclercq <pascal.leclercq@gmail.com>
+ * 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:
+ * Angelo ZERR - initial API and implementation
+ * Pascal Leclercq - initial API and implementation
+ *******************************************************************************/
+package fr.opensagres.nosql.ide.core.internal.extensions;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionDelta;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+
+import fr.opensagres.nosql.ide.core.extensions.AbstractRegistry;
+import fr.opensagres.nosql.ide.core.extensions.IServerFactory;
+import fr.opensagres.nosql.ide.core.extensions.IServerFactoryRegistry;
+import fr.opensagres.nosql.ide.core.extensions.IServerType;
+import fr.opensagres.nosql.ide.core.internal.Activator;
+import fr.opensagres.nosql.ide.core.internal.Trace;
+
+/**
+ * Registry which holds instance of {@link IServerFactory} created by the
+ * fr.opensagres.nosql.ide.core.serverFactorys" extension point.
+ *
+ */
+public class ServerFactoryRegistry extends AbstractRegistry implements
+ IServerFactoryRegistry {
+
+ private static final IServerFactoryRegistry INSTANCE = new ServerFactoryRegistry();
+
+ private static final String SERVER_FACTORY_ELT = "serverFactory";
+ public static final String SERVER_TYPE_ATTR = "serverType";
+ private static final String SERVER_FACTORIES_EXTENSION_POINT = "serverFactories";
+
+ public static IServerFactoryRegistry getInstance() {
+ return INSTANCE;
+ }
+
+ private Map<IServerType, IServerFactory> serverFactories = new HashMap<IServerType, IServerFactory>();
+
+ /**
+ * Return the {@link IServerFactory} retrieved by the given id.
+ *
+ * @param id
+ * @return
+ */
+ public IServerFactory getFactory(IServerType serverType) {
+ if (serverType == null) {
+ throw new IllegalArgumentException();
+ }
+ loadRegistryIfNedded();
+ return serverFactories.get(serverType);
+ }
+
+ /**
+ * Return the list of the {@link IServerFactory}.
+ *
+ * @return
+ */
+ public Collection<IServerFactory> getFactories() {
+ loadRegistryIfNedded();
+ return serverFactories.values();
+ }
+
+ @Override
+ protected void handleExtensionDelta(IExtensionDelta delta) {
+ if (delta.getKind() == IExtensionDelta.ADDED) {
+ IConfigurationElement[] cf = delta.getExtension()
+ .getConfigurationElements();
+ parseServerFactoryManagers(cf);
+ } else {
+ // TODO : remove references
+ }
+
+ }
+
+ protected synchronized void loadRegistry() {
+ if (isRegistryIntialized()) {
+ return;
+ }
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ if (registry != null) {
+ IConfigurationElement[] cf = registry.getConfigurationElementsFor(
+ getPluginId(), getExtensionPoint());
+ parseServerFactoryManagers(cf);
+ }
+ }
+
+ /**
+ * Parse elements of the extension poit and create for each server element
+ * an instance of {@link IServerFactory}.
+ *
+ * <pre>
+ * <extension
+ * point="fr.opensagres.nosql.ide.core.serverFactorys">
+ * <serverFactory
+ * id="fr.opensagres.nosql.ide.mongodb.core"
+ * name="%serverFactory.name">
+ * </serverFactory>
+ * </extension>
+ * </pre>
+ *
+ * @param cf
+ */
+ private void parseServerFactoryManagers(IConfigurationElement[] cf) {
+ for (IConfigurationElement ce : cf) {
+ IServerType serverType = null;
+ String serverTypeId = null;
+ IServerFactory factory = null;
+ if (SERVER_FACTORY_ELT.equals(ce.getName())) {
+ serverTypeId = ce.getAttribute(SERVER_TYPE_ATTR);
+ serverType = fr.opensagres.nosql.ide.core.Platform
+ .getServerTypeRegistry().getType(serverTypeId);
+ try {
+ factory = (IServerFactory) ce
+ .createExecutableExtension(CLASS_ATTR);
+ serverFactories.put(serverType, factory);
+ } catch (CoreException e) {
+ Trace.trace(Trace.STRING_SEVERE, e.getMessage());
+ }
+ }
+ }
+ }
+
+ @Override
+ protected String getPluginId() {
+ return Activator.PLUGIN_ID;
+ }
+
+ @Override
+ protected String getExtensionPoint() {
+ return SERVER_FACTORIES_EXTENSION_POINT;
+ }
+
+}
View
26 ...agres.nosql.ide.core/src/fr/opensagres/nosql/ide/core/internal/extensions/ServerType.java
@@ -0,0 +1,26 @@
+package fr.opensagres.nosql.ide.core.internal.extensions;
+
+import fr.opensagres.nosql.ide.core.extensions.IServerType;
+
+public class ServerType implements IServerType {
+
+ private final String id;
+ private final String name;
+
+ public ServerType(String id, String name) {
+ this.id = id;
+ this.name = name;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getLabel() {
+ return getName();
+ }
+}
View
134 ...sql.ide.core/src/fr/opensagres/nosql/ide/core/internal/extensions/ServerTypeRegistry.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (C) 2012 Angelo Zerr <angelo.zerr@gmail.com>, Pascal Leclercq <pascal.leclercq@gmail.com>
+ * 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:
+ * Angelo ZERR - initial API and implementation
+ * Pascal Leclercq - initial API and implementation
+ *******************************************************************************/
+package fr.opensagres.nosql.ide.core.internal.extensions;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionDelta;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+
+import fr.opensagres.nosql.ide.core.extensions.AbstractRegistry;
+import fr.opensagres.nosql.ide.core.extensions.IServerType;
+import fr.opensagres.nosql.ide.core.extensions.IServerTypeRegistry;
+import fr.opensagres.nosql.ide.core.internal.Activator;
+
+/**
+ * Registry which holds instance of {@link IServerType} created by the
+ * fr.opensagres.nosql.ide.core.serverTypes" extension point.
+ *
+ */
+public class ServerTypeRegistry extends AbstractRegistry implements
+ IServerTypeRegistry {
+
+ private static final IServerTypeRegistry INSTANCE = new ServerTypeRegistry();
+ private static final String SERVER_TYPE_ELT = "serverType";
+ public static final String NAME_ATTR = "name";
+ private static final String SERVER_TYPES_EXTENSION_POINT = "serverTypes";
+
+ public static IServerTypeRegistry getInstance() {
+ return INSTANCE;
+ }
+
+ private Map<String, IServerType> serverTypes = new HashMap<String, IServerType>();
+
+ /**
+ * Return the {@link IServerType} retrieved by the given id.
+ *
+ * @param id
+ * @return
+ */
+ public IServerType getType(String id) {
+ if (id == null) {
+ throw new IllegalArgumentException();
+ }
+ loadRegistryIfNedded();
+ return serverTypes.get(id);
+ }
+
+ /**
+ * Return the list of the {@link IServerType}.
+ *
+ * @return
+ */
+ public Collection<IServerType> getTypes() {
+ loadRegistryIfNedded();
+ return serverTypes.values();
+ }
+
+ @Override
+ protected void handleExtensionDelta(IExtensionDelta delta) {
+ if (delta.getKind() == IExtensionDelta.ADDED) {
+ IConfigurationElement[] cf = delta.getExtension()
+ .getConfigurationElements();
+ parseServerTypeManagers(cf);
+ } else {
+ // TODO : remove references
+ }
+
+ }
+
+ protected synchronized void loadRegistry() {
+ if (isRegistryIntialized()) {
+ return;
+ }
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ if (registry != null) {
+ IConfigurationElement[] cf = registry.getConfigurationElementsFor(
+ getPluginId(), getExtensionPoint());
+ parseServerTypeManagers(cf);
+ }
+ }
+
+ /**
+ * Parse elements of the extension poit and create for each server element
+ * an instance of {@link IServerType}.
+ *
+ * <pre>
+ * <extension
+ * point="fr.opensagres.nosql.ide.core.serverTypes">
+ * <serverType
+ * id="fr.opensagres.nosql.ide.mongodb.core"
+ * name="%serverType.name">
+ * </serverType>
+ * </extension>
+ * </pre>
+ *
+ * @param cf
+ */
+ private void parseServerTypeManagers(IConfigurationElement[] cf) {
+ for (IConfigurationElement ce : cf) {
+ String id = null;
+ String name = null;
+ if (SERVER_TYPE_ELT.equals(ce.getName())) {
+ id = ce.getAttribute(ID_ATTR);
+ name = ce.getAttribute(NAME_ATTR);
+ serverTypes.put(id, new ServerType(id, name));
+ }
+ }
+
+ }
+
+ @Override
+ protected String getPluginId() {
+ return Activator.PLUGIN_ID;
+ }
+
+ @Override
+ protected String getExtensionPoint() {
+ return SERVER_TYPES_EXTENSION_POINT;
+ }
+
+}
View
14 ...l.ide.core/src/fr/opensagres/nosql/ide/core/internal/settings/AbstractContentHandler.java
@@ -0,0 +1,14 @@
+package fr.opensagres.nosql.ide.core.internal.settings;
+
+import java.util.Collection;
+
+import org.xml.sax.helpers.DefaultHandler;
+
+public abstract class AbstractContentHandler<T> extends DefaultHandler {
+
+ protected final Collection<T> list;
+
+ public AbstractContentHandler(Collection<T> list) {
+ this.list = list;
+ }
+}
View
49 ...s.nosql.ide.core/src/fr/opensagres/nosql/ide/core/internal/settings/AbstractSettings.java
@@ -0,0 +1,49 @@
+package fr.opensagres.nosql.ide.core.internal.settings;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Writer;
+import java.util.Collection;
+
+import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+public abstract class AbstractSettings<T> {
+
+ public void load(InputStream stream, Collection<T> list)
+ throws SAXException, IOException {
+ XMLReader xmlReader = XMLReaderFactory.createXMLReader();
+ ContentHandler contentHandler = createContentHandler(list);
+ xmlReader.setContentHandler(contentHandler);
+ xmlReader.parse(new InputSource(stream));
+ }
+
+ public void save(Collection<T> list, Writer out) throws SAXException,
+ IOException {
+ try {
+ String root = getXMLRootElementName();
+ out.append("<");
+ out.append(root);
+ out.append(">");
+ for (T t : list) {
+ save(t, out);
+ }
+ out.append("</");
+ out.append(root);
+ out.append(">");
+ } finally {
+ out.flush();
+ out.close();
+ }
+ }
+
+ protected abstract ContentHandler createContentHandler(Collection<T> list);
+
+ protected abstract String getXMLRootElementName();
+
+ protected abstract void save(T t, Writer out) throws IOException;
+
+}
View
38 ...s.nosql.ide.core/src/fr/opensagres/nosql/ide/core/internal/settings/RuntimesSettings.java
@@ -0,0 +1,38 @@
+package fr.opensagres.nosql.ide.core.internal.settings;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Collection;
+
+import org.xml.sax.ContentHandler;
+
+import fr.opensagres.nosql.ide.core.model.IServerRuntime;
+import fr.opensagres.nosql.ide.core.settings.RuntimesConstants;
+
+public class RuntimesSettings extends AbstractSettings<IServerRuntime> {
+
+ private static final RuntimesSettings INSTANCE = new RuntimesSettings();
+
+ public static RuntimesSettings getInstance() {
+ return INSTANCE;
+ }
+
+ @Override
+ protected ContentHandler createContentHandler(