Changeset 5734
- Timestamp:
- Sep 13, 2011, 11:41:48 AM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/common-queries.xml
r5733 r5734 3267 3267 3268 3268 3269 <query id="DELETE_PLUGINGUICONTEXTS_ ITEMTYPE" type="SQL">3270 <sql> 3271 DELETE FROM PluginDefinitionGuiContexts3272 WHERE item_type={1}3269 <query id="DELETE_PLUGINGUICONTEXTS_FOR_ITEMTYPE" type="SQL"> 3270 <sql> 3271 DELETE FROM [PluginDefinitionGuiContexts] 3272 WHERE [item_type] = :itemType 3273 3273 </sql> 3274 3274 <description> … … 3277 3277 </description> 3278 3278 </query> 3279 3280 <query id="DELETE_PLUGINKEYS_FOR_ITEMTYPE" type="SQL"> 3281 <sql> 3282 DELETE FROM [PluginKeys] 3283 WHERE [key_id] IN ( 3284 SELECT k.[id] 3285 FROM [Keys] k 3286 WHERE k.[item_type] = :itemType 3287 ) 3288 </sql> 3289 <description> 3290 An SQL query that delete plug-in keys referencing keys 3291 for a given item type. 3292 </description> 3293 </query> 3294 3279 3295 3280 3296 <query id="GET_SUBTYPABLE_ITEMS_FOR_SUBTYPE_OF_CLASS" type="HQL"> -
trunk/src/core/net/sf/basedb/core/Install.java
r5733 r5734 2356 2356 dc = sessionControl.newDbControl(); 2357 2357 plugin = PluginDefinition.installOrUpdate(dc, info, null, shareToEveryone); 2358 boolean isNew = !plugin.isInDatabase(); 2359 2360 if (isNew) 2361 { 2362 plugin.setTrusted(true); 2363 } 2364 dc.commit(); 2365 2366 if (isNew) 2367 { 2368 log.info("createPluginDefinition: OK [class="+className+"]"); 2358 if (plugin != null) 2359 { 2360 boolean isNew = !plugin.isInDatabase(); 2361 if (isNew) 2362 { 2363 plugin.setTrusted(true); 2364 } 2365 dc.commit(); 2366 if (isNew) 2367 { 2368 log.info("createPluginDefinition: OK [class="+className+"]"); 2369 } 2370 else 2371 { 2372 log.info("createPluginDefinition: UPDATED [class="+className+"]"); 2373 } 2369 2374 } 2370 2375 else 2371 2376 { 2372 log.info("createPluginDefinition: UPDATED [class="+className+"]");2377 log.info("createPluginDefinition: SKIPPED [class="+className+"]"); 2373 2378 } 2374 2379 } … … 2649 2654 { 2650 2655 log.info("createDataFileType: EXISTS [externalId="+externalId+"]"); 2651 /*2652 TODO #1591: Make sure that updating create proper file type links2653 if (itemSubtypes != null && schemaVersion.getSchemaVersion() < 100)2654 {2655 for (ItemSubtypeFT sft : itemSubtypes)2656 {2657 ItemSubtypeFileTypeData subtypeFile = new ItemSubtypeFileTypeData();2658 subtypeFile.setItemSubtype(sft.subtype);2659 subtypeFile.setDataFileType(fileType);2660 subtypeFile.setRequired(sft.required);2661 subtypeFile.setAllowMultiple(sft.multiple);2662 HibernateUtil.saveData(session, subtypeFile);2663 }2664 }2665 */2666 2656 HibernateUtil.commit(tx); 2667 2657 } -
trunk/src/core/net/sf/basedb/core/PluginDefinition.java
r5616 r5734 376 376 /** 377 377 Install or update the plug-in definition with information from the info 378 object. Existing plug-ins will be updated and the disabled flag is cleared. 378 object. Existing plug-ins will be updated and the disabled flag is cleared 379 (unless it is deprecated). 379 380 New plug-ins are configured with additional options from the info object: 380 381 <ul> … … 383 384 <li>immediate-execution: If the plug-in is allowed to bypass the job queue. 384 385 <li>everyone-use: If the plug-in should be shared with USE permission to everyone. 386 <li>deprecated: Disable the plug-in if it is already installed, do not install 387 if it is missing 385 388 </ul> 389 @return The plugin definition or null if no plug-in was installed 386 390 @since 3.0 387 391 */ … … 390 394 PluginDefinition plugin = null; 391 395 String className = info.getClassName(); 396 boolean deprecated = Values.getBoolean(info.getProperty("deprecated")); 392 397 try 393 398 { … … 397 402 catch (ItemNotFoundException ex) 398 403 { 399 plugin = PluginDefinition.getNew(dc, className, jarFile, true); 400 plugin.setMaxMemory(Values.getLong(info.getProperty("max-memory"), null)); 401 plugin.setAllowImmediateExecution(Values.getBoolean(info.getProperty("immediate-execution"))); 402 if (Values.getBoolean(info.getProperty("everyone-use"))) 404 if (!deprecated) 403 405 { 404 plugin.setItemKey(shareToEveryone); 406 plugin = PluginDefinition.getNew(dc, className, jarFile, true); 407 plugin.setMaxMemory(Values.getLong(info.getProperty("max-memory"), null)); 408 plugin.setAllowImmediateExecution(Values.getBoolean(info.getProperty("immediate-execution"))); 409 if (Values.getBoolean(info.getProperty("everyone-use"))) 410 { 411 plugin.setItemKey(shareToEveryone); 412 } 413 dc.saveItem(plugin); 414 plugin.info = info; // So that we can set an ID on the info object after commit. 405 415 } 406 dc.saveItem(plugin); 407 plugin.info = info; // So that we can set an ID on the info object after commit. 408 } 409 plugin.setAbout(info.getAbout(), true); 410 plugin.setDisabled(false); 416 } 417 if (plugin != null) 418 { 419 plugin.setAbout(info.getAbout(), true); 420 plugin.setDisabled(deprecated); 421 } 411 422 return plugin; 412 423 } … … 801 812 Checks if this plugin is disabled or not. A disabled plugin 802 813 can't be used. 803 @ return814 @since 3.0 804 815 */ 805 816 public boolean isDisabled() … … 809 820 810 821 /** 811 Disabled or enabled this plugin. 822 Disabled or enable this plugin. 823 @since 3.0 812 824 */ 813 825 public void setDisabled(boolean disabled) -
trunk/src/core/net/sf/basedb/core/Update.java
r5733 r5734 50 50 import net.sf.basedb.core.data.ItemSubtypeData; 51 51 import net.sf.basedb.core.data.PhysicalBioAssayData; 52 import net.sf.basedb.core.data.PluginDefinitionData; 52 53 import net.sf.basedb.core.data.ProjectKeyData; 53 54 import net.sf.basedb.core.data.PropertyFilterData; 54 55 import net.sf.basedb.core.data.ProtocolData; 56 import net.sf.basedb.core.data.RoleKeyData; 55 57 import net.sf.basedb.core.data.SchemaVersionData; 56 58 import net.sf.basedb.core.data.UserData; … … 333 335 session.delete(tmpType); 334 336 335 // Update the shcema version number 337 // Disable the 'BioAssaySetExporter' plug-in since it is no longer included in the code 338 query = HibernateUtil.getPredefinedQuery(session, "GET_PLUGINDEFINITION_FOR_CLASSNAME"); 339 query.setString("className", "net.sf.basedb.plugins.BioAssaySetExporter"); 340 PluginDefinitionData plugin = HibernateUtil.loadData(PluginDefinitionData.class, query); 341 if (plugin != null) 342 { 343 plugin.setDisabled(true); 344 } 345 346 // Update the schema version number 336 347 setSchemaVersion(session, schemaVersion); 337 348 … … 411 422 progress.display(30, "--Converting hybridizations to bioassays"); 412 423 Map<Integer, Integer> hybMap = copyHybridizations(session); 424 cleanContextFromProperty(session, Item.ARRAYSLIDE, "hybridization", "physicalBioAssay", false); 413 425 removeContext(session, HYBRIDIZATION); 414 cleanContextFromProperty(session, Item.ARRAYSLIDE, "hybridization", "physicalBioAssay", false);415 426 416 427 progress.display(35, "--Converting scans to bioassays"); … … 446 457 cleanContextFromProperty(session, Item.DATAFILETYPE, "genericType", "genericType", true); 447 458 removeContext(session, FILETYPE); 448 459 449 460 // 2: remove unused columns/tables 450 461 progress.display(80, "--Dropping old database objects"); … … 646 657 } 647 658 } 648 659 660 /** 661 Remove context-related information for the given item type. 662 */ 649 663 private static void removeContext(org.hibernate.Session session, int itemType) 650 664 { … … 661 675 { 662 676 session.delete(ctx); 677 } 678 679 // DELETE FROM PluginDefinitionGuiContexts WHERE item_type=? 680 query = HibernateUtil.getPredefinedSQLQuery(session, 681 "DELETE_PLUGINGUICONTEXTS_FOR_ITEMTYPE"); 682 query.setInteger("itemType", itemType); 683 query.executeUpdate(); 684 685 log.debug("Removing role key for item: " + itemType); 686 // DELETE FROM PluginKeys WHERE item_type=? 687 query = HibernateUtil.getPredefinedSQLQuery(session, 688 "DELETE_PLUGINKEYS_FOR_ITEMTYPE"); 689 query.setInteger("itemType", itemType); 690 query.executeUpdate(); 691 692 query = HibernateUtil.createQuery(session, "SELECT key FROM RoleKeyData key WHERE key.itemType = :itemType"); 693 query.setInteger("itemType", itemType); 694 for (RoleKeyData key : HibernateUtil.loadList(RoleKeyData.class, query, null)) 695 { 696 session.delete(key); 663 697 } 664 698 … … 913 947 { 914 948 Object[] imgRow = (Object[])it2.next(); 915 916 if (file Set == null)949 Integer fileId = (Integer)imgRow[2]; 950 if (fileId != null) 917 951 { 918 fileSet = new FileSetData(); 919 fileSet.setItemType(Item.DERIVEDBIOASSAY.getValue()); 920 session.save(fileSet); 921 bioAssay.setFileSet(fileSet); 952 if (fileSet == null) 953 { 954 fileSet = new FileSetData(); 955 fileSet.setItemType(Item.DERIVEDBIOASSAY.getValue()); 956 session.save(fileSet); 957 bioAssay.setFileSet(fileSet); 958 } 959 if (fileType == null) 960 { 961 // Create a temporary file type, which will be removed 962 // once the install has created the correct one 963 fileType = new DataFileTypeData(); 964 fileType.setName("Temporary file type for scanned images"); 965 fileType.setExternalId("tmp.image"); 966 fileType.setItemType(Item.DERIVEDBIOASSAY.getValue()); 967 session.save(fileType); 968 } 969 970 FileSetMemberData member = new FileSetMemberData(); 971 member.setFile(load(session, FileData.class, fileId)); 972 member.setFileSet(fileSet); 973 member.setDataFileType(fileType); 974 session.save(member); 922 975 } 923 if (fileType == null)924 {925 // Create a temporary file type, which will be removed926 // once the install has created the correct one927 fileType = new DataFileTypeData();928 fileType.setName("Temporary file type for scanned images");929 fileType.setExternalId("tmp.image");930 fileType.setItemType(Item.DERIVEDBIOASSAY.getValue());931 session.save(fileType);932 }933 934 FileSetMemberData member = new FileSetMemberData();935 member.setFile(load(session, FileData.class, imgRow[2]));936 member.setFileSet(fileSet);937 member.setDataFileType(fileType);938 session.save(member);939 976 } 940 977 … … 1456 1493 HibernateUtil.getPredefinedSQLQuery(session, "UPDATE_ITEMTYPE", 1457 1494 "BioPlateTypes", "biomaterial_type", oldTypeS, newTypeS).executeUpdate(); 1458 // DELETE FROM PluginDefinitionGuiContexts WHERE item_type={1}1459 HibernateUtil.getPredefinedSQLQuery(session,1460 "DELETE_PLUGINGUICONTEXTS_ITEMTYPE", oldTypeS).executeUpdate();1461 1495 1462 1496 } -
trunk/src/core/net/sf/basedb/core/data/PluginDefinitionData.java
r5615 r5734 292 292 If the plugin is enabled or disabled. 293 293 // Mapped in hibernate-properties-PluginDefinitionData.xml since annotation doesn't support a default value 294 @since 3.0 294 295 */ 295 296 public boolean isDisabled() -
trunk/src/core/net/sf/basedb/util/extensions/manager/processor/PluginInstallationProcessor.java
r5617 r5734 137 137 { 138 138 PluginDefinition plugin = PluginDefinition.installOrUpdate(dc, info, jarFile, shareToEveryone); 139 allPlugins.put(info.getClassName(), plugin); 140 if (plugin.isInDatabase()) 139 if (plugin != null) 141 140 { 142 numUpdated++; 143 } 144 else 145 { 146 numInstalled++; 141 allPlugins.put(info.getClassName(), plugin); 142 if (plugin.isInDatabase()) 143 { 144 numUpdated++; 145 } 146 else 147 { 148 numInstalled++; 149 } 147 150 } 148 151 } -
trunk/src/plugins/core/core-plugins.xml
r5729 r5734 555 555 </plugin-definition> 556 556 557 <!-- 558 Used for backwards compatibility with older server installations 557 <!-- Used for backwards compatibility with older server installations --> 559 558 <plugin-definition id="LabeledExtractImporter"> 560 559 <about> 561 <name>Labeled extract importer </name>560 <name>Labeled extract importer (deprecated)</name> 562 561 <description> 563 562 Imports and updates labeled extracts in a batch. … … 567 566 <settings> 568 567 <property name="everyone-use">1</property> 569 </settings>570 </plugin-definition>571 -->572 <!-- 573 Used for backwards compatibility with older server installations568 <property name="deprecated">1</property> 569 </settings> 570 </plugin-definition> 571 572 <!-- Used for backwards compatibility with older server installations --> 574 573 <plugin-definition id="HybridizationImporter"> 575 574 <about> 576 <name>Hybridization importer </name>575 <name>Hybridization importer (deprecated)</name> 577 576 <description> 578 577 Imports and updates hybridizations in a batch. … … 582 581 <settings> 583 582 <property name="everyone-use">1</property> 584 </settings> 585 </plugin-definition> 586 --> 583 <property name="deprecated">1</property> 584 </settings> 585 </plugin-definition> 586 587 587 <plugin-definition id="PhysicalBioAssayImporter"> 588 588 <about> … … 598 598 </plugin-definition> 599 599 600 <!-- 601 Used for backwards compatibility with older server installations 600 <!-- Used for backwards compatibility with older server installations --> 602 601 <plugin-definition id="ScanImporter"> 603 602 <about> 604 <name>Scan importer </name>603 <name>Scan importer (deprecated)</name> 605 604 <description> 606 605 Imports and updates scans in a batch. … … 610 609 <settings> 611 610 <property name="everyone-use">1</property> 612 </settings>613 </plugin-definition>614 -->611 <property name="deprecated">1</property> 612 </settings> 613 </plugin-definition> 615 614 616 615 <plugin-definition id="DerivedBioAssayImporter"> -
trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/HybridizationImporter.java
r5662 r5734 58 58 @version 2.8 59 59 @base.modified $Date$ 60 @deprecated In 3.0, use {@link PhysicalBioAssayImporter} instead 60 61 */ 62 @Deprecated 61 63 public class HybridizationImporter 62 64 extends AbstractItemImporter<PhysicalBioAssay> -
trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/LabeledExtractImporter.java
r5667 r5734 53 53 @version 2.8 54 54 @base.modified $Date$ 55 @deprecated In 3.0, use {@link ExtractImporter} instead 55 56 */ 57 @Deprecated 56 58 public class LabeledExtractImporter 57 59 extends AbstractItemImporter<Extract> -
trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/ScanImporter.java
r5729 r5734 54 54 @version 2.8 55 55 @base.modified $Date$ 56 @deprecated In 3.0, use {@link DerivedBioAssayImporter} instead 56 57 */ 58 @Deprecated 57 59 public class ScanImporter 58 60 extends AbstractItemImporter<DerivedBioAssay>
Note: See TracChangeset
for help on using the changeset viewer.