From f460b5b994cfb1191e19a9cec56a1d4ef9b0da6a Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Wed, 8 Jan 2014 15:08:38 +0100 Subject: [PATCH] [Cleanup&.gitignore] Remove target, target-eclipse from repository and rename .gitignore files to .git_empty_directory. Remove grails compiler level requirement. --- .classpath | 1 - .gitignore | 1 + .project | 2 +- .settings/org.eclipse.core.resources.prefs | 4 - .settings/org.eclipse.jdt.groovy.core.prefs | 2 +- .../{.gitignore => .git_empty_directory} | 0 .../{.gitignore => .git_empty_directory} | 0 .../{.gitignore => .git_empty_directory} | 0 .../{.gitignore => .git_empty_directory} | 0 .../{.gitignore => .git_empty_directory} | 0 .../{.gitignore => .git_empty_directory} | 0 lib/{.gitignore => .git_empty_directory} | 0 scripts/{.gitignore => .git_empty_directory} | 0 .../{.gitignore => .git_empty_directory} | 0 src/java/{.gitignore => .git_empty_directory} | 0 target-eclipse/classes/dbdoc/_globalnav.gsp | 24 - target-eclipse/classes/dbdoc/_index.gsp | 22 - .../classes/dbdoc/_overview-summary.gsp | 11 - target-eclipse/classes/dbdoc/_stylesheet.gsp | 60 - target-eclipse/classes/hibernate.cfg.xml | 18 - target/classes/application.properties | 5 - ...ationService$_serviceMethod_closure1.class | Bin 2550 -> 0 bytes .../outofbounds/AuthentificationService.class | Bin 6724 -> 0 bytes .../integration/application.properties | 5 - target/test-classes/spring/resources.groovy | 3 - target/test-reports/TESTS-TestSuites.xml | 2 - target/test-reports/html/all.html | 181 - target/test-reports/html/failed.html | 181 - target/test-reports/html/index.html | 43 - target/test-reports/html/stylesheet.css | 290 - target/test-reports/plain/.gitignore | 0 .../work/plugin-provided-classes/.gitignore | 0 .../cache-1.1.1/CacheGrailsPlugin.groovy | 207 - .../cache-1.1.1/application.properties | 1 - .../plugins/cache-1.1.1/dependencies.groovy | 47 - .../grails-app/conf/DefaultCacheConfig.groovy | 8 - .../cache/GrailsCacheAdminService.groovy | 28 - .../grails/plugin/cache/CacheTagLib.groovy | 124 - target/work/plugins/cache-1.1.1/plugin.xml | 41 - .../grails/plugin/cache/ConfigBuilder.groovy | 175 - .../grails/plugin/cache/ConfigLoader.groovy | 131 - .../grails/plugin/cache/BlockingCache.java | 27 - .../plugin/cache/CacheBeanPostProcessor.java | 94 - .../cache/CacheConfigArtefactHandler.java | 83 - .../plugin/cache/CacheConfiguration.java | 25 - .../java/grails/plugin/cache/CacheEvict.java | 72 - .../java/grails/plugin/cache/CachePut.java | 59 - .../java/grails/plugin/cache/Cacheable.java | 59 - .../plugin/cache/CustomCacheKeyGenerator.java | 41 - .../GrailsAnnotationCacheOperationSource.java | 283 - .../java/grails/plugin/cache/GrailsCache.java | 27 - .../plugin/cache/GrailsCacheManager.java | 27 - .../cache/GrailsConcurrentMapCache.java | 55 - .../GrailsConcurrentMapCacheManager.java | 61 - .../plugin/cache/GrailsValueWrapper.java | 36 - .../SerializableByteArrayOutputStream.java | 109 - .../cache/SerializableOutputStream.java | 28 - .../src/java/grails/plugin/cache/Timer.java | 50 - .../cache/compiler/CacheTransformation.java | 69 - .../grails/plugin/cache/util/ClassUtils.java | 59 - .../cache/web/AlreadyGzippedException.java | 30 - .../cache/web/ContentCacheParameters.java | 129 - .../cache/web/GenericResponseWrapper.java | 317 - .../java/grails/plugin/cache/web/Header.java | 196 - .../plugin/cache/web/HttpDateFormatter.java | 100 - .../grails/plugin/cache/web/PageInfo.java | 428 - ...ProxyAwareMixedGrailsControllerHelper.java | 53 - .../plugin/cache/web/SerializableCookie.java | 64 - .../cache/web/filter/AbstractFilter.java | 232 - .../web/filter/CacheExpressionRootObject.java | 59 - .../web/filter/CacheOperationContext.java | 82 - .../web/filter/DefaultWebKeyGenerator.java | 63 - .../cache/web/filter/ExpressionEvaluator.java | 76 - .../web/filter/FilterServletOutputStream.java | 56 - .../LazyParamAwareEvaluationContext.java | 109 - .../plugin/cache/web/filter/NoOpFilter.java | 39 - .../web/filter/PageFragmentCachingFilter.java | 898 -- .../cache/web/filter/WebKeyGenerator.java | 26 - .../filter/simple/MemoryBlockingCache.java | 55 - .../simple/MemoryCacheConfiguration.java | 33 - .../MemoryPageFragmentCachingFilter.java | 62 - .../DatabaseMigrationGrailsPlugin.groovy | 139 - .../database-migration-1.3.8/LICENSE.txt | 201 - .../application.properties | 1 - .../dependencies.groovy | 31 - .../grails-app/conf/DbdocUrlMappings.groovy | 5 - .../databasemigration/DbdocController.groovy | 154 - .../grails-app/views/dbdoc/_globalnav.gsp | 24 - .../grails-app/views/dbdoc/_index.gsp | 22 - .../views/dbdoc/_overview-summary.gsp | 11 - .../grails-app/views/dbdoc/_stylesheet.gsp | 60 - .../database-migration-1.3.8/plugin.xml | 26 - .../scripts/DbmChangelogSync.groovy | 30 - .../scripts/DbmChangelogSyncSql.groovy | 32 - .../scripts/DbmChangelogToGroovy.groovy | 40 - .../scripts/DbmClearChecksums.groovy | 30 - .../scripts/DbmCreateChangelog.groovy | 53 - .../scripts/DbmDbDoc.groovy | 31 - .../scripts/DbmDiff.groovy | 148 - .../scripts/DbmDropAll.groovy | 40 - .../scripts/DbmFutureRollbackSql.groovy | 32 - .../scripts/DbmGenerateChangelog.groovy | 34 - .../scripts/DbmGenerateGormChangelog.groovy | 41 - .../scripts/DbmGormDiff.groovy | 68 - .../scripts/DbmListLocks.groovy | 32 - .../scripts/DbmListTags.groovy | 54 - .../scripts/DbmMarkNextChangesetRan.groovy | 36 - .../scripts/DbmPreviousChangesetSql.groovy | 47 - .../scripts/DbmRegisterChangelog.groovy | 38 - .../scripts/DbmReleaseLocks.groovy | 30 - .../scripts/DbmRollback.groovy | 35 - .../scripts/DbmRollbackCount.groovy | 39 - .../scripts/DbmRollbackCountSql.groovy | 41 - .../scripts/DbmRollbackSql.groovy | 37 - .../scripts/DbmRollbackToDate.groovy | 30 - .../scripts/DbmRollbackToDateSql.groovy | 39 - .../scripts/DbmStatus.groovy | 33 - .../scripts/DbmTag.groovy | 35 - .../scripts/DbmUpdate.groovy | 30 - .../scripts/DbmUpdateCount.groovy | 39 - .../scripts/DbmUpdateCountSql.groovy | 41 - .../scripts/DbmUpdateSql.groovy | 32 - .../scripts/DbmValidate.groovy | 29 - .../scripts/_DatabaseMigrationCommon.groovy | 138 - .../scripts/_Events.groovy | 27 - .../scripts/_Install.groovy | 1 - .../ChangelogXml2Groovy.groovy | 103 - .../databasemigration/DslBuilder.groovy | 759 -- .../databasemigration/GormColumn.groovy | 119 - .../databasemigration/GormDatabase.groovy | 71 - .../GormDatabaseSnapshotGenerator.groovy | 259 - .../GormDatabaseTypeConverter.groovy | 54 - .../plugin/databasemigration/GormDiff.groovy | 164 - .../databasemigration/GrailsChange.groovy | 283 - .../GrailsChangeLogParser.groovy | 115 - .../GrailsClassLoaderResourceAccessor.groovy | 37 - .../GrailsDiffStatusListener.groovy | 32 - .../GrailsPrecondition.groovy | 173 - ...roovyAwareStringChangeLogSerializer.groovy | 156 - .../HibernateAwareTypeConverter.groovy | 92 - .../databasemigration/MigrationRunner.groovy | 102 - .../databasemigration/MigrationUtils.groovy | 376 - .../MySQLCompatibleChangeLogSerializer.groovy | 54 - .../MysqlAwareCreateTableGenerator.groovy | 75 - .../databasemigration/NoopVisitor.groovy | 41 - .../databasemigration/ScriptUtils.groovy | 283 - .../databasemigration/Slf4jLogger.groovy | 70 - .../dbdoc/AuthorListWriter.groovy | 25 - .../dbdoc/AuthorWriter.groovy | 36 - .../dbdoc/ChangeLogListWriter.groovy | 24 - .../dbdoc/ChangeLogWriter.groovy | 34 - .../dbdoc/ColumnWriter.groovy | 36 - .../dbdoc/HTMLListWriter.groovy | 70 - .../databasemigration/dbdoc/HTMLWriter.groovy | 187 - .../dbdoc/MemoryDocVisitor.groovy | 127 - .../dbdoc/PendingChangesWriter.groovy | 42 - .../dbdoc/PendingSQLWriter.groovy | 73 - .../dbdoc/RecentChangesWriter.groovy | 42 - .../dbdoc/TableListWriter.groovy | 25 - .../dbdoc/TableWriter.groovy | 41 - .../src/resources/changelog.template | 6 - .../HibernateGrailsPlugin.groovy | 47 - .../work/plugins/hibernate-3.6.10.6/LICENSE | 15 - .../hibernate-3.6.10.6/application.properties | 5 - .../grails-app/i18n/messages.properties | 0 .../plugins/hibernate-3.6.10.6/plugin.xml | 7 - .../scripts/CreateHibernateCfgXml.groovy | 56 - .../scripts/SchemaExport.groovy | 69 - .../src/docs/ref/Domain/attach.gdoc | 20 - .../src/docs/ref/Domain/delete.gdoc | 20 - .../src/docs/ref/Domain/discard.gdoc | 20 - .../ref/Domain/getDirtyPropertyNames.gdoc | 20 - .../docs/ref/Domain/getPersistentValue.gdoc | 21 - .../src/docs/ref/Domain/instanceOf.gdoc | 21 - .../src/docs/ref/Domain/isAttached.gdoc | 20 - .../src/docs/ref/Domain/isDirty.gdoc | 20 - .../src/docs/ref/Domain/lock.gdoc | 20 - .../src/docs/ref/Domain/merge.gdoc | 21 - .../src/docs/ref/Domain/methodMissing.gdoc | 22 - .../src/docs/ref/Domain/refresh.gdoc | 20 - .../src/docs/ref/Domain/save.gdoc | 21 - .../src/docs/ref/Domain/validate.gdoc | 20 - .../hibernate3/HibernatePluginSupport.groovy | 465 - .../src/java/hibernate.cfg.xml | 18 - .../jquery-1.10.2.2/JqueryGrailsPlugin.groovy | 95 - .../work/plugins/jquery-1.10.2.2/LICENSE.txt | 54 - .../jquery-1.10.2.2/application.properties | 1 - .../jquery-1.10.2.2/dependencies.groovy | 18 - .../grails-app/conf/JQueryConfig.groovy | 4 - .../conf/JQueryPluginResources.groovy | 16 - .../grails-app/services/JQueryService.groovy | 85 - .../taglib/JQueryResourceTagLib.groovy | 128 - .../grails-app/taglib/JQueryTagLib.groovy | 107 - .../work/plugins/jquery-1.10.2.2/plugin.xml | 21 - .../scripts/InstallJQuery.groovy | 22 - .../grails/plugins/jquery/JQueryConfig.groovy | 41 - .../plugins/jquery/JQueryProvider.groovy | 190 - .../web-app/js/jquery/jquery-1.10.2.js | 9789 ----------------- .../web-app/js/jquery/jquery-1.10.2.min.js | 6 - .../web-app/js/jquery/jquery-1.10.2.min.map | 1 - .../work/plugins/resources-1.2.1/LICENSE.txt | 14 - .../ResourcesGrailsPlugin.groovy | 263 - .../resources-1.2.1/application.properties | 5 - .../resources-1.2.1/dependencies.groovy | 42 - .../grails-app/conf/ResourcesBootStrap.groovy | 25 - .../grails-app/i18n/messages.properties | 0 .../resource/BaseUrlResourceMapper.groovy | 85 - .../resource/BundleResourceMapper.groovy | 62 - .../CSSPreprocessorResourceMapper.groovy | 91 - .../resource/CSSRewriterResourceMapper.groovy | 72 - .../plugin/resource/ResourceTagLib.groovy | 684 -- .../work/plugins/resources-1.2.1/plugin.xml | 34 - .../src/docs/guide/1. Overview.gdoc | 22 - .../src/docs/guide/1.1 Quick Start.gdoc | 2 - ... Make sure jQuery plugin is installed.gdoc | 5 - ...stall jQuery UI and Blueprint plugins.gdoc | 6 - .../1.1.3 Edit your Sitemesh layout.gdoc | 17 - ... Edit your GSP page to include jQuery.gdoc | 22 - .../guide/1.1.5 View the page source.gdoc | 6 - .../1.1.6 Now optimize your application.gdoc | 16 - .../src/docs/guide/10. Security.gdoc | 9 - .../src/docs/guide/2. Concepts.gdoc | 55 - .../docs/guide/3. Declaring resources.gdoc | 4 - .../src/docs/guide/3.1 The resource DSL.gdoc | 34 - .../guide/3.1.1 The dependsOn method.gdoc | 11 - .../docs/guide/3.1.2 The resource method.gdoc | 53 - .../guide/3.1.3 The defaultBundle method.gdoc | 28 - .../docs/guide/3.2 Resource artefacts.gdoc | 31 - .../src/docs/guide/3.3 Config.groovy.gdoc | 30 - .../src/docs/guide/3.4 Bundling.gdoc | 21 - .../src/docs/guide/4. Using resources.gdoc | 7 - .../4.1 Linking to CSS, JavaScript etc..gdoc | 40 - .../src/docs/guide/4.2 Linking to images.gdoc | 22 - ...sources explicitly, bypassing modules.gdoc | 14 - ... JavaScript code generated at runtime.gdoc | 31 - .../docs/guide/5. Overriding resources.gdoc | 26 - .../guide/6. Creating custom mappers.gdoc | 9 - .../src/docs/guide/6.1 Defining a mapper.gdoc | 31 - .../guide/6.2 Mapper phases and priority.gdoc | 21 - .../src/docs/guide/6.3 Operation.gdoc | 26 - ...cessing only the right types of files.gdoc | 25 - ...nse headers and intercepting requests.gdoc | 30 - ...7. Writing plugins that use Resources.gdoc | 29 - .../src/docs/guide/8. Debugging.gdoc | 48 - .../src/docs/guide/9. Configuration.gdoc | 100 - .../src/docs/ref/Mappers/baseurl.gdoc | 29 - .../src/docs/ref/Mappers/bundle.gdoc | 9 - .../src/docs/ref/Mappers/csspreprocessor.gdoc | 7 - .../src/docs/ref/Mappers/cssrewriter.gdoc | 7 - .../src/docs/ref/Tags/external.gdoc | 35 - .../src/docs/ref/Tags/img.gdoc | 12 - .../src/docs/ref/Tags/layoutResources.gdoc | 28 - .../src/docs/ref/Tags/require.gdoc | 36 - .../src/docs/ref/Tags/resource.gdoc | 16 - .../src/docs/ref/Tags/resourceLink.gdoc | 3 - .../src/docs/ref/Tags/script.gdoc | 36 - .../src/docs/ref/Tags/stash.gdoc | 35 - .../src/docs/ref/Tags/style.gdoc | 30 - .../src/docs/ref/Tags/use.gdoc | 3 - .../resource/AggregatedResourceMeta.groovy | 107 - .../resource/CSSBundleResourceMeta.groovy | 27 - .../plugin/resource/CSSLinkProcessor.groovy | 68 - .../resource/DevModeSanityFilter.groovy | 61 - .../JavaScriptBundleResourceMeta.groovy | 15 - .../plugin/resource/ProcessingFilter.groovy | 47 - .../plugin/resource/ResourceMeta.groovy | 471 - .../plugin/resource/ResourceModule.groovy | 174 - .../plugin/resource/ResourceProcessor.groovy | 1102 -- .../resource/ResourceProcessorBatch.groovy | 19 - .../grails/plugin/resource/URLUtils.groovy | 32 - .../plugin/resource/mapper/MapperPhase.groovy | 20 - .../resource/mapper/ResourceMapper.groovy | 174 - .../mapper/ResourceMappersFactory.groovy | 81 - .../resource/module/ModuleBuilder.groovy | 51 - .../module/ModuleDeclarationsFactory.groovy | 78 - .../resource/module/ModulesBuilder.groovy | 84 - .../resource/util/DispositionsUtils.groovy | 98 - .../util/HalfBakedLegacyLinkGenerator.groovy | 83 - .../resource/util/ResourceMetaStore.groovy | 146 - .../plugin/resource/util/StatsManager.groovy | 66 - .../AbstractResourcesArtefactHandler.java | 18 - .../artefacts/DefaultResourceMapperClass.java | 13 - .../artefacts/DefaultResourcesClass.java | 12 - .../ResourceMapperArtefactHandler.java | 17 - .../artefacts/ResourceMapperClass.java | 8 - .../artefacts/ResourcesArtefactHandler.java | 17 - .../resources/artefacts/ResourcesClass.java | 8 - .../web-app/GPRESOURCES-207/file1.js | 0 .../web-app/GPRESOURCES-207/file2.js | 0 .../web-app/GPRESOURCES-207/file3.js | 0 .../web-app/GPRESOURCES-207/file4.js | 0 .../web-app/GPRESOURCES-207/file5.js | 0 .../web-app/GPRESOURCES-210/file1.js | 1 - .../web-app/GPRESOURCES-210/file2.js | 1 - .../ScaffoldingGrailsPlugin.groovy | 208 - .../scaffolding-2.0.1/application.properties | 4 - .../work/plugins/scaffolding-2.0.1/plugin.xml | 9 - .../scripts/CreateScaffoldController.groovy | 67 - .../scripts/GenerateAll.groovy | 50 - .../scripts/GenerateAsyncController.groovy | 55 - .../scripts/GenerateController.groovy | 53 - .../scripts/GenerateViews.groovy | 53 - .../scaffolding-2.0.1/scripts/_Events.groovy | 52 - .../scripts/_GrailsGenerate.groovy | 103 - .../DefaultGrailsTemplateGenerator.groovy | 57 - .../AbstractGrailsTemplateGenerator.java | 415 - .../DomainClassPropertyComparator.java | 83 - .../scaffolding/GrailsTemplateGenerator.java | 97 - .../SimpleDomainClassPropertyComparator.java | 47 - .../view/ScaffoldedGroovyPageView.java | 107 - .../view/ScaffoldingViewResolver.java | 123 - .../artifacts/ScaffoldingController.groovy | 3 - .../scaffolding/AsyncController.groovy | 112 - .../templates/scaffolding/AsyncSpec.groovy | 148 - .../templates/scaffolding/Controller.groovy | 102 - .../src/templates/scaffolding/Spec.groovy | 144 - .../src/templates/scaffolding/_form.gsp | 47 - .../src/templates/scaffolding/create.gsp | 38 - .../src/templates/scaffolding/edit.gsp | 41 - .../src/templates/scaffolding/index.gsp | 62 - .../scaffolding/renderEditor.template | 270 - .../src/templates/scaffolding/show.gsp | 60 - target/work/plugins/tomcat-7.0.47/LICENSE | 15 - .../tomcat-7.0.47/TomcatGrailsPlugin.groovy | 28 - .../tomcat-7.0.47/application.properties | 3 - .../grails-plugin-tomcat-7.0.47.jar | Bin 60014 -> 0 bytes target/work/plugins/tomcat-7.0.47/plugin.xml | 9 - .../tomcat-7.0.47/scripts/Tomcat.groovy | 51 - .../tomcat-7.0.47/scripts/_Events.groovy | 14 - .../tomcat/InlineExplodedTomcatServer.groovy | 182 - .../grails/plugins/tomcat/TomcatLoader.groovy | 102 - .../grails/plugins/tomcat/TomcatServer.groovy | 205 - .../plugins/tomcat/TomcatServerFactory.groovy | 76 - .../tomcat/fork/ForkedTomcatServer.groovy | 212 - .../fork/TomcatDevelopmentRunner.groovy | 90 - .../tomcat/fork/TomcatExecutionContext.groovy | 49 - .../tomcat/fork/TomcatWarRunner.groovy | 127 - .../tomcat/ParentDelegatingClassLoader.java | 62 - .../plugins/tomcat/TomcatKillSwitch.java | 60 - target/work/plugins/webxml-1.4.1/LICENSE.txt | 201 - .../webxml-1.4.1/WebxmlGrailsPlugin.groovy | 153 - .../webxml-1.4.1/application.properties | 6 - .../plugins/webxml-1.4.1/dependencies.groovy | 23 - .../conf/DefaultWebXmlConfig.groovy | 33 - target/work/plugins/webxml-1.4.1/plugin.xml | 13 - .../scripts/CreateWebXmlConfig.groovy | 14 - .../webxml-1.4.1/scripts/_Events.groovy | 100 - .../grails/plugin/webxml/FilterManager.groovy | 23 - .../src/samples/_WebXmlConfig.groovy | 55 - .../grails-app/i18n/messages.properties | 55 - .../grails-app/i18n/messages_cs_CZ.properties | 55 - .../grails-app/i18n/messages_da.properties | 56 - .../grails-app/i18n/messages_de.properties | 55 - .../grails-app/i18n/messages_es.properties | 55 - .../grails-app/i18n/messages_fr.properties | 19 - .../grails-app/i18n/messages_it.properties | 55 - .../grails-app/i18n/messages_ja.properties | 55 - .../grails-app/i18n/messages_nb.properties | 56 - .../grails-app/i18n/messages_nl.properties | 55 - .../grails-app/i18n/messages_pl.properties | 59 - .../grails-app/i18n/messages_pt_BR.properties | 59 - .../grails-app/i18n/messages_pt_PT.properties | 34 - .../grails-app/i18n/messages_ru.properties | 31 - .../grails-app/i18n/messages_sv.properties | 55 - .../grails-app/i18n/messages_th.properties | 55 - .../grails-app/i18n/messages_zh_CN.properties | 18 - target/work/resources/hibernate.cfg.xml | 18 - .../grails-app/i18n/messages.properties | 0 .../grails-app/i18n/messages.properties | 0 target/work/resources/web.xml | 225 - .../scriptCache/RunApp$_run_closure1.class | Bin 3260 -> 0 bytes target/work/scriptCache/RunApp.class | Bin 6574 -> 0 bytes .../scriptCache/Shell$_run_closure1.class | Bin 2964 -> 0 bytes .../scriptCache/Shell$_run_closure2.class | Bin 5546 -> 0 bytes .../Shell$_run_closure2_closure3.class | Bin 2706 -> 0 bytes .../Shell$_run_closure2_closure4.class | Bin 2661 -> 0 bytes ...hell$_run_closure2_closure4_closure7.class | Bin 2634 -> 0 bytes .../Shell$_run_closure2_closure5.class | Bin 2517 -> 0 bytes .../Shell$_run_closure2_closure6.class | Bin 2746 -> 0 bytes target/work/scriptCache/Shell.class | Bin 6724 -> 0 bytes .../scriptCache/TestApp$_run_closure1.class | Bin 2848 -> 0 bytes target/work/scriptCache/TestApp.class | Bin 6859 -> 0 bytes ...GrailsBootstrap_groovy$_run_closure1.class | Bin 3312 -> 0 bytes ...GrailsBootstrap_groovy$_run_closure2.class | Bin 3419 -> 0 bytes ...GrailsBootstrap_groovy$_run_closure3.class | Bin 2332 -> 0 bytes ...GrailsBootstrap_groovy$_run_closure4.class | Bin 2332 -> 0 bytes ...GrailsBootstrap_groovy$_run_closure5.class | Bin 2674 -> 0 bytes ...GrailsBootstrap_groovy$_run_closure6.class | Bin 2585 -> 0 bytes ...GrailsBootstrap_groovy$_run_closure7.class | Bin 3113 -> 0 bytes ...GrailsBootstrap_groovy$_run_closure8.class | Bin 2566 -> 0 bytes .../scriptCache/_GrailsBootstrap_groovy.class | Bin 8242 -> 0 bytes ...CreateArtifacts_groovy$_run_closure1.class | Bin 10330 -> 0 bytes ...facts_groovy$_run_closure1_closure10.class | Bin 3060 -> 0 bytes ...ifacts_groovy$_run_closure1_closure6.class | Bin 3493 -> 0 bytes ...ifacts_groovy$_run_closure1_closure7.class | Bin 2559 -> 0 bytes ...ifacts_groovy$_run_closure1_closure8.class | Bin 3036 -> 0 bytes ...ifacts_groovy$_run_closure1_closure9.class | Bin 3211 -> 0 bytes ...CreateArtifacts_groovy$_run_closure2.class | Bin 3668 -> 0 bytes ...CreateArtifacts_groovy$_run_closure3.class | Bin 3665 -> 0 bytes ...CreateArtifacts_groovy$_run_closure4.class | Bin 3491 -> 0 bytes ...CreateArtifacts_groovy$_run_closure5.class | Bin 3526 -> 0 bytes .../_GrailsCreateArtifacts_groovy.class | Bin 7662 -> 0 bytes .../_GrailsTest_groovy$_run_closure1.class | Bin 4258 -> 0 bytes .../_GrailsTest_groovy$_run_closure10.class | Bin 2319 -> 0 bytes .../_GrailsTest_groovy$_run_closure11.class | Bin 2319 -> 0 bytes .../_GrailsTest_groovy$_run_closure12.class | Bin 2803 -> 0 bytes .../_GrailsTest_groovy$_run_closure2.class | Bin 3077 -> 0 bytes .../_GrailsTest_groovy$_run_closure3.class | Bin 3428 -> 0 bytes .../_GrailsTest_groovy$_run_closure4.class | Bin 2317 -> 0 bytes .../_GrailsTest_groovy$_run_closure5.class | Bin 2317 -> 0 bytes .../_GrailsTest_groovy$_run_closure6.class | Bin 2799 -> 0 bytes .../_GrailsTest_groovy$_run_closure7.class | Bin 2799 -> 0 bytes .../_GrailsTest_groovy$_run_closure8.class | Bin 2797 -> 0 bytes .../_GrailsTest_groovy$_run_closure9.class | Bin 2797 -> 0 bytes .../work/scriptCache/_GrailsTest_groovy.class | Bin 11294 -> 0 bytes .../grails-resources/js/application.js | 9 - .../js/jquery/jquery-1.10.2.js | 9789 ----------------- .../js/jquery/jquery-1.10.2.min.js | 6 - target/work/web.xml.tmp | 93 - .../integration/.git_empty_directory | 0 test/integration/.gitignore | 0 .../unit/.git_empty_directory | 0 test/unit/.gitignore | 0 .../META-INF/.git_empty_directory | 0 web-app/META-INF/.gitignore | 0 425 files changed, 3 insertions(+), 44909 deletions(-) rename grails-app/controllers/{.gitignore => .git_empty_directory} (100%) rename grails-app/domain/{.gitignore => .git_empty_directory} (100%) rename grails-app/migrations/{.gitignore => .git_empty_directory} (100%) rename grails-app/services/{.gitignore => .git_empty_directory} (100%) rename grails-app/taglib/{.gitignore => .git_empty_directory} (100%) rename grails-app/utils/{.gitignore => .git_empty_directory} (100%) rename lib/{.gitignore => .git_empty_directory} (100%) rename scripts/{.gitignore => .git_empty_directory} (100%) rename src/groovy/{.gitignore => .git_empty_directory} (100%) rename src/java/{.gitignore => .git_empty_directory} (100%) delete mode 100644 target-eclipse/classes/dbdoc/_globalnav.gsp delete mode 100644 target-eclipse/classes/dbdoc/_index.gsp delete mode 100644 target-eclipse/classes/dbdoc/_overview-summary.gsp delete mode 100644 target-eclipse/classes/dbdoc/_stylesheet.gsp delete mode 100644 target-eclipse/classes/hibernate.cfg.xml delete mode 100644 target/classes/application.properties delete mode 100644 target/classes/outofbounds/AuthentificationService$_serviceMethod_closure1.class delete mode 100644 target/classes/outofbounds/AuthentificationService.class delete mode 100644 target/test-classes/integration/application.properties delete mode 100644 target/test-classes/spring/resources.groovy delete mode 100644 target/test-reports/TESTS-TestSuites.xml delete mode 100644 target/test-reports/html/all.html delete mode 100644 target/test-reports/html/failed.html delete mode 100644 target/test-reports/html/index.html delete mode 100644 target/test-reports/html/stylesheet.css delete mode 100644 target/test-reports/plain/.gitignore delete mode 100644 target/work/plugin-provided-classes/.gitignore delete mode 100644 target/work/plugins/cache-1.1.1/CacheGrailsPlugin.groovy delete mode 100644 target/work/plugins/cache-1.1.1/application.properties delete mode 100644 target/work/plugins/cache-1.1.1/dependencies.groovy delete mode 100644 target/work/plugins/cache-1.1.1/grails-app/conf/DefaultCacheConfig.groovy delete mode 100644 target/work/plugins/cache-1.1.1/grails-app/services/grails/plugin/cache/GrailsCacheAdminService.groovy delete mode 100644 target/work/plugins/cache-1.1.1/grails-app/taglib/grails/plugin/cache/CacheTagLib.groovy delete mode 100644 target/work/plugins/cache-1.1.1/plugin.xml delete mode 100644 target/work/plugins/cache-1.1.1/src/groovy/grails/plugin/cache/ConfigBuilder.groovy delete mode 100644 target/work/plugins/cache-1.1.1/src/groovy/grails/plugin/cache/ConfigLoader.groovy delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/BlockingCache.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/CacheBeanPostProcessor.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/CacheConfigArtefactHandler.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/CacheConfiguration.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/CacheEvict.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/CachePut.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/Cacheable.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/CustomCacheKeyGenerator.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/GrailsAnnotationCacheOperationSource.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/GrailsCache.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/GrailsCacheManager.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/GrailsConcurrentMapCache.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/GrailsConcurrentMapCacheManager.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/GrailsValueWrapper.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/SerializableByteArrayOutputStream.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/SerializableOutputStream.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/Timer.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/compiler/CacheTransformation.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/util/ClassUtils.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/AlreadyGzippedException.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/ContentCacheParameters.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/GenericResponseWrapper.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/Header.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/HttpDateFormatter.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/PageInfo.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/ProxyAwareMixedGrailsControllerHelper.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/SerializableCookie.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/AbstractFilter.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/CacheExpressionRootObject.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/CacheOperationContext.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/DefaultWebKeyGenerator.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/ExpressionEvaluator.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/FilterServletOutputStream.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/LazyParamAwareEvaluationContext.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/NoOpFilter.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/PageFragmentCachingFilter.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/WebKeyGenerator.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/simple/MemoryBlockingCache.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/simple/MemoryCacheConfiguration.java delete mode 100644 target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/simple/MemoryPageFragmentCachingFilter.java delete mode 100644 target/work/plugins/database-migration-1.3.8/DatabaseMigrationGrailsPlugin.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/LICENSE.txt delete mode 100644 target/work/plugins/database-migration-1.3.8/application.properties delete mode 100644 target/work/plugins/database-migration-1.3.8/dependencies.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/grails-app/conf/DbdocUrlMappings.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/grails-app/controllers/grails/plugin/databasemigration/DbdocController.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/grails-app/views/dbdoc/_globalnav.gsp delete mode 100644 target/work/plugins/database-migration-1.3.8/grails-app/views/dbdoc/_index.gsp delete mode 100644 target/work/plugins/database-migration-1.3.8/grails-app/views/dbdoc/_overview-summary.gsp delete mode 100644 target/work/plugins/database-migration-1.3.8/grails-app/views/dbdoc/_stylesheet.gsp delete mode 100644 target/work/plugins/database-migration-1.3.8/plugin.xml delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmChangelogSync.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmChangelogSyncSql.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmChangelogToGroovy.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmClearChecksums.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmCreateChangelog.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmDbDoc.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmDiff.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmDropAll.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmFutureRollbackSql.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmGenerateChangelog.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmGenerateGormChangelog.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmGormDiff.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmListLocks.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmListTags.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmMarkNextChangesetRan.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmPreviousChangesetSql.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmRegisterChangelog.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmReleaseLocks.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmRollback.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmRollbackCount.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmRollbackCountSql.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmRollbackSql.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmRollbackToDate.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmRollbackToDateSql.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmStatus.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmTag.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmUpdate.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmUpdateCount.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmUpdateCountSql.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmUpdateSql.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/DbmValidate.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/_DatabaseMigrationCommon.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/_Events.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/scripts/_Install.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/ChangelogXml2Groovy.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/DslBuilder.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GormColumn.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GormDatabase.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GormDatabaseSnapshotGenerator.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GormDatabaseTypeConverter.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GormDiff.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GrailsChange.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GrailsChangeLogParser.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GrailsClassLoaderResourceAccessor.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GrailsDiffStatusListener.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GrailsPrecondition.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GroovyAwareStringChangeLogSerializer.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/HibernateAwareTypeConverter.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/MigrationRunner.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/MigrationUtils.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/MySQLCompatibleChangeLogSerializer.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/MysqlAwareCreateTableGenerator.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/NoopVisitor.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/ScriptUtils.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/Slf4jLogger.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/AuthorListWriter.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/AuthorWriter.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/ChangeLogListWriter.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/ChangeLogWriter.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/ColumnWriter.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/HTMLListWriter.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/HTMLWriter.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/MemoryDocVisitor.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/PendingChangesWriter.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/PendingSQLWriter.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/RecentChangesWriter.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/TableListWriter.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/TableWriter.groovy delete mode 100644 target/work/plugins/database-migration-1.3.8/src/resources/changelog.template delete mode 100644 target/work/plugins/hibernate-3.6.10.6/HibernateGrailsPlugin.groovy delete mode 100644 target/work/plugins/hibernate-3.6.10.6/LICENSE delete mode 100644 target/work/plugins/hibernate-3.6.10.6/application.properties delete mode 100644 target/work/plugins/hibernate-3.6.10.6/grails-app/i18n/messages.properties delete mode 100644 target/work/plugins/hibernate-3.6.10.6/plugin.xml delete mode 100644 target/work/plugins/hibernate-3.6.10.6/scripts/CreateHibernateCfgXml.groovy delete mode 100644 target/work/plugins/hibernate-3.6.10.6/scripts/SchemaExport.groovy delete mode 100644 target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/attach.gdoc delete mode 100644 target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/delete.gdoc delete mode 100644 target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/discard.gdoc delete mode 100644 target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/getDirtyPropertyNames.gdoc delete mode 100644 target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/getPersistentValue.gdoc delete mode 100644 target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/instanceOf.gdoc delete mode 100644 target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/isAttached.gdoc delete mode 100644 target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/isDirty.gdoc delete mode 100644 target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/lock.gdoc delete mode 100644 target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/merge.gdoc delete mode 100644 target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/methodMissing.gdoc delete mode 100644 target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/refresh.gdoc delete mode 100644 target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/save.gdoc delete mode 100644 target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/validate.gdoc delete mode 100644 target/work/plugins/hibernate-3.6.10.6/src/groovy/grails/plugin/hibernate3/HibernatePluginSupport.groovy delete mode 100644 target/work/plugins/hibernate-3.6.10.6/src/java/hibernate.cfg.xml delete mode 100644 target/work/plugins/jquery-1.10.2.2/JqueryGrailsPlugin.groovy delete mode 100644 target/work/plugins/jquery-1.10.2.2/LICENSE.txt delete mode 100644 target/work/plugins/jquery-1.10.2.2/application.properties delete mode 100644 target/work/plugins/jquery-1.10.2.2/dependencies.groovy delete mode 100644 target/work/plugins/jquery-1.10.2.2/grails-app/conf/JQueryConfig.groovy delete mode 100644 target/work/plugins/jquery-1.10.2.2/grails-app/conf/JQueryPluginResources.groovy delete mode 100644 target/work/plugins/jquery-1.10.2.2/grails-app/services/JQueryService.groovy delete mode 100644 target/work/plugins/jquery-1.10.2.2/grails-app/taglib/JQueryResourceTagLib.groovy delete mode 100644 target/work/plugins/jquery-1.10.2.2/grails-app/taglib/JQueryTagLib.groovy delete mode 100644 target/work/plugins/jquery-1.10.2.2/plugin.xml delete mode 100644 target/work/plugins/jquery-1.10.2.2/scripts/InstallJQuery.groovy delete mode 100644 target/work/plugins/jquery-1.10.2.2/src/groovy/org/codehaus/groovy/grails/plugins/jquery/JQueryConfig.groovy delete mode 100644 target/work/plugins/jquery-1.10.2.2/src/groovy/org/codehaus/groovy/grails/plugins/jquery/JQueryProvider.groovy delete mode 100644 target/work/plugins/jquery-1.10.2.2/web-app/js/jquery/jquery-1.10.2.js delete mode 100644 target/work/plugins/jquery-1.10.2.2/web-app/js/jquery/jquery-1.10.2.min.js delete mode 100644 target/work/plugins/jquery-1.10.2.2/web-app/js/jquery/jquery-1.10.2.min.map delete mode 100644 target/work/plugins/resources-1.2.1/LICENSE.txt delete mode 100644 target/work/plugins/resources-1.2.1/ResourcesGrailsPlugin.groovy delete mode 100644 target/work/plugins/resources-1.2.1/application.properties delete mode 100644 target/work/plugins/resources-1.2.1/dependencies.groovy delete mode 100644 target/work/plugins/resources-1.2.1/grails-app/conf/ResourcesBootStrap.groovy delete mode 100644 target/work/plugins/resources-1.2.1/grails-app/i18n/messages.properties delete mode 100644 target/work/plugins/resources-1.2.1/grails-app/resourceMappers/org/grails/plugin/resource/BaseUrlResourceMapper.groovy delete mode 100644 target/work/plugins/resources-1.2.1/grails-app/resourceMappers/org/grails/plugin/resource/BundleResourceMapper.groovy delete mode 100644 target/work/plugins/resources-1.2.1/grails-app/resourceMappers/org/grails/plugin/resource/CSSPreprocessorResourceMapper.groovy delete mode 100644 target/work/plugins/resources-1.2.1/grails-app/resourceMappers/org/grails/plugin/resource/CSSRewriterResourceMapper.groovy delete mode 100644 target/work/plugins/resources-1.2.1/grails-app/taglib/org/grails/plugin/resource/ResourceTagLib.groovy delete mode 100644 target/work/plugins/resources-1.2.1/plugin.xml delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/1. Overview.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/1.1 Quick Start.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/1.1.1 Make sure jQuery plugin is installed.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/1.1.2 Install jQuery UI and Blueprint plugins.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/1.1.3 Edit your Sitemesh layout.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/1.1.4 Edit your GSP page to include jQuery.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/1.1.5 View the page source.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/1.1.6 Now optimize your application.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/10. Security.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/2. Concepts.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/3. Declaring resources.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/3.1 The resource DSL.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/3.1.1 The dependsOn method.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/3.1.2 The resource method.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/3.1.3 The defaultBundle method.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/3.2 Resource artefacts.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/3.3 Config.groovy.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/3.4 Bundling.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/4. Using resources.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/4.1 Linking to CSS, JavaScript etc..gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/4.2 Linking to images.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/4.3 Linking to resources explicitly, bypassing modules.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/4.4 Including pieces of JavaScript code generated at runtime.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/5. Overriding resources.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/6. Creating custom mappers.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/6.1 Defining a mapper.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/6.2 Mapper phases and priority.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/6.3 Operation.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/6.4 Processing only the right types of files.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/6.5 Adding response headers and intercepting requests.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/7. Writing plugins that use Resources.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/8. Debugging.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/guide/9. Configuration.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/ref/Mappers/baseurl.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/ref/Mappers/bundle.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/ref/Mappers/csspreprocessor.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/ref/Mappers/cssrewriter.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/ref/Tags/external.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/ref/Tags/img.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/ref/Tags/layoutResources.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/ref/Tags/require.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/ref/Tags/resource.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/ref/Tags/resourceLink.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/ref/Tags/script.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/ref/Tags/stash.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/ref/Tags/style.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/docs/ref/Tags/use.gdoc delete mode 100644 target/work/plugins/resources-1.2.1/src/groovy/org/grails/plugin/resource/AggregatedResourceMeta.groovy delete mode 100644 target/work/plugins/resources-1.2.1/src/groovy/org/grails/plugin/resource/CSSBundleResourceMeta.groovy delete mode 100644 target/work/plugins/resources-1.2.1/src/groovy/org/grails/plugin/resource/CSSLinkProcessor.groovy delete mode 100644 target/work/plugins/resources-1.2.1/src/groovy/org/grails/plugin/resource/DevModeSanityFilter.groovy delete mode 100644 target/work/plugins/resources-1.2.1/src/groovy/org/grails/plugin/resource/JavaScriptBundleResourceMeta.groovy delete mode 100644 target/work/plugins/resources-1.2.1/src/groovy/org/grails/plugin/resource/ProcessingFilter.groovy delete mode 100644 target/work/plugins/resources-1.2.1/src/groovy/org/grails/plugin/resource/ResourceMeta.groovy delete mode 100644 target/work/plugins/resources-1.2.1/src/groovy/org/grails/plugin/resource/ResourceModule.groovy delete mode 100644 target/work/plugins/resources-1.2.1/src/groovy/org/grails/plugin/resource/ResourceProcessor.groovy delete mode 100644 target/work/plugins/resources-1.2.1/src/groovy/org/grails/plugin/resource/ResourceProcessorBatch.groovy delete mode 100644 target/work/plugins/resources-1.2.1/src/groovy/org/grails/plugin/resource/URLUtils.groovy delete mode 100644 target/work/plugins/resources-1.2.1/src/groovy/org/grails/plugin/resource/mapper/MapperPhase.groovy delete mode 100644 target/work/plugins/resources-1.2.1/src/groovy/org/grails/plugin/resource/mapper/ResourceMapper.groovy delete mode 100644 target/work/plugins/resources-1.2.1/src/groovy/org/grails/plugin/resource/mapper/ResourceMappersFactory.groovy delete mode 100644 target/work/plugins/resources-1.2.1/src/groovy/org/grails/plugin/resource/module/ModuleBuilder.groovy delete mode 100644 target/work/plugins/resources-1.2.1/src/groovy/org/grails/plugin/resource/module/ModuleDeclarationsFactory.groovy delete mode 100644 target/work/plugins/resources-1.2.1/src/groovy/org/grails/plugin/resource/module/ModulesBuilder.groovy delete mode 100644 target/work/plugins/resources-1.2.1/src/groovy/org/grails/plugin/resource/util/DispositionsUtils.groovy delete mode 100644 target/work/plugins/resources-1.2.1/src/groovy/org/grails/plugin/resource/util/HalfBakedLegacyLinkGenerator.groovy delete mode 100644 target/work/plugins/resources-1.2.1/src/groovy/org/grails/plugin/resource/util/ResourceMetaStore.groovy delete mode 100644 target/work/plugins/resources-1.2.1/src/groovy/org/grails/plugin/resource/util/StatsManager.groovy delete mode 100644 target/work/plugins/resources-1.2.1/src/java/org/grails/plugin/resources/artefacts/AbstractResourcesArtefactHandler.java delete mode 100644 target/work/plugins/resources-1.2.1/src/java/org/grails/plugin/resources/artefacts/DefaultResourceMapperClass.java delete mode 100644 target/work/plugins/resources-1.2.1/src/java/org/grails/plugin/resources/artefacts/DefaultResourcesClass.java delete mode 100644 target/work/plugins/resources-1.2.1/src/java/org/grails/plugin/resources/artefacts/ResourceMapperArtefactHandler.java delete mode 100644 target/work/plugins/resources-1.2.1/src/java/org/grails/plugin/resources/artefacts/ResourceMapperClass.java delete mode 100644 target/work/plugins/resources-1.2.1/src/java/org/grails/plugin/resources/artefacts/ResourcesArtefactHandler.java delete mode 100644 target/work/plugins/resources-1.2.1/src/java/org/grails/plugin/resources/artefacts/ResourcesClass.java delete mode 100644 target/work/plugins/resources-1.2.1/web-app/GPRESOURCES-207/file1.js delete mode 100644 target/work/plugins/resources-1.2.1/web-app/GPRESOURCES-207/file2.js delete mode 100644 target/work/plugins/resources-1.2.1/web-app/GPRESOURCES-207/file3.js delete mode 100644 target/work/plugins/resources-1.2.1/web-app/GPRESOURCES-207/file4.js delete mode 100644 target/work/plugins/resources-1.2.1/web-app/GPRESOURCES-207/file5.js delete mode 100644 target/work/plugins/resources-1.2.1/web-app/GPRESOURCES-210/file1.js delete mode 100644 target/work/plugins/resources-1.2.1/web-app/GPRESOURCES-210/file2.js delete mode 100644 target/work/plugins/scaffolding-2.0.1/ScaffoldingGrailsPlugin.groovy delete mode 100644 target/work/plugins/scaffolding-2.0.1/application.properties delete mode 100644 target/work/plugins/scaffolding-2.0.1/plugin.xml delete mode 100644 target/work/plugins/scaffolding-2.0.1/scripts/CreateScaffoldController.groovy delete mode 100644 target/work/plugins/scaffolding-2.0.1/scripts/GenerateAll.groovy delete mode 100644 target/work/plugins/scaffolding-2.0.1/scripts/GenerateAsyncController.groovy delete mode 100644 target/work/plugins/scaffolding-2.0.1/scripts/GenerateController.groovy delete mode 100644 target/work/plugins/scaffolding-2.0.1/scripts/GenerateViews.groovy delete mode 100644 target/work/plugins/scaffolding-2.0.1/scripts/_Events.groovy delete mode 100644 target/work/plugins/scaffolding-2.0.1/scripts/_GrailsGenerate.groovy delete mode 100644 target/work/plugins/scaffolding-2.0.1/src/groovy/org/codehaus/groovy/grails/scaffolding/DefaultGrailsTemplateGenerator.groovy delete mode 100644 target/work/plugins/scaffolding-2.0.1/src/java/org/codehaus/groovy/grails/scaffolding/AbstractGrailsTemplateGenerator.java delete mode 100644 target/work/plugins/scaffolding-2.0.1/src/java/org/codehaus/groovy/grails/scaffolding/DomainClassPropertyComparator.java delete mode 100644 target/work/plugins/scaffolding-2.0.1/src/java/org/codehaus/groovy/grails/scaffolding/GrailsTemplateGenerator.java delete mode 100644 target/work/plugins/scaffolding-2.0.1/src/java/org/codehaus/groovy/grails/scaffolding/SimpleDomainClassPropertyComparator.java delete mode 100644 target/work/plugins/scaffolding-2.0.1/src/java/org/codehaus/groovy/grails/scaffolding/view/ScaffoldedGroovyPageView.java delete mode 100644 target/work/plugins/scaffolding-2.0.1/src/java/org/codehaus/groovy/grails/scaffolding/view/ScaffoldingViewResolver.java delete mode 100644 target/work/plugins/scaffolding-2.0.1/src/templates/artifacts/ScaffoldingController.groovy delete mode 100644 target/work/plugins/scaffolding-2.0.1/src/templates/scaffolding/AsyncController.groovy delete mode 100644 target/work/plugins/scaffolding-2.0.1/src/templates/scaffolding/AsyncSpec.groovy delete mode 100644 target/work/plugins/scaffolding-2.0.1/src/templates/scaffolding/Controller.groovy delete mode 100644 target/work/plugins/scaffolding-2.0.1/src/templates/scaffolding/Spec.groovy delete mode 100644 target/work/plugins/scaffolding-2.0.1/src/templates/scaffolding/_form.gsp delete mode 100644 target/work/plugins/scaffolding-2.0.1/src/templates/scaffolding/create.gsp delete mode 100644 target/work/plugins/scaffolding-2.0.1/src/templates/scaffolding/edit.gsp delete mode 100644 target/work/plugins/scaffolding-2.0.1/src/templates/scaffolding/index.gsp delete mode 100644 target/work/plugins/scaffolding-2.0.1/src/templates/scaffolding/renderEditor.template delete mode 100644 target/work/plugins/scaffolding-2.0.1/src/templates/scaffolding/show.gsp delete mode 100644 target/work/plugins/tomcat-7.0.47/LICENSE delete mode 100644 target/work/plugins/tomcat-7.0.47/TomcatGrailsPlugin.groovy delete mode 100644 target/work/plugins/tomcat-7.0.47/application.properties delete mode 100644 target/work/plugins/tomcat-7.0.47/grails-plugin-tomcat-7.0.47.jar delete mode 100644 target/work/plugins/tomcat-7.0.47/plugin.xml delete mode 100644 target/work/plugins/tomcat-7.0.47/scripts/Tomcat.groovy delete mode 100644 target/work/plugins/tomcat-7.0.47/scripts/_Events.groovy delete mode 100644 target/work/plugins/tomcat-7.0.47/src/groovy/org/grails/plugins/tomcat/InlineExplodedTomcatServer.groovy delete mode 100644 target/work/plugins/tomcat-7.0.47/src/groovy/org/grails/plugins/tomcat/TomcatLoader.groovy delete mode 100644 target/work/plugins/tomcat-7.0.47/src/groovy/org/grails/plugins/tomcat/TomcatServer.groovy delete mode 100644 target/work/plugins/tomcat-7.0.47/src/groovy/org/grails/plugins/tomcat/TomcatServerFactory.groovy delete mode 100644 target/work/plugins/tomcat-7.0.47/src/groovy/org/grails/plugins/tomcat/fork/ForkedTomcatServer.groovy delete mode 100644 target/work/plugins/tomcat-7.0.47/src/groovy/org/grails/plugins/tomcat/fork/TomcatDevelopmentRunner.groovy delete mode 100644 target/work/plugins/tomcat-7.0.47/src/groovy/org/grails/plugins/tomcat/fork/TomcatExecutionContext.groovy delete mode 100644 target/work/plugins/tomcat-7.0.47/src/groovy/org/grails/plugins/tomcat/fork/TomcatWarRunner.groovy delete mode 100644 target/work/plugins/tomcat-7.0.47/src/java/org/grails/plugins/tomcat/ParentDelegatingClassLoader.java delete mode 100644 target/work/plugins/tomcat-7.0.47/src/java/org/grails/plugins/tomcat/TomcatKillSwitch.java delete mode 100644 target/work/plugins/webxml-1.4.1/LICENSE.txt delete mode 100644 target/work/plugins/webxml-1.4.1/WebxmlGrailsPlugin.groovy delete mode 100644 target/work/plugins/webxml-1.4.1/application.properties delete mode 100644 target/work/plugins/webxml-1.4.1/dependencies.groovy delete mode 100644 target/work/plugins/webxml-1.4.1/grails-app/conf/DefaultWebXmlConfig.groovy delete mode 100644 target/work/plugins/webxml-1.4.1/plugin.xml delete mode 100644 target/work/plugins/webxml-1.4.1/scripts/CreateWebXmlConfig.groovy delete mode 100644 target/work/plugins/webxml-1.4.1/scripts/_Events.groovy delete mode 100644 target/work/plugins/webxml-1.4.1/src/groovy/grails/plugin/webxml/FilterManager.groovy delete mode 100644 target/work/plugins/webxml-1.4.1/src/samples/_WebXmlConfig.groovy delete mode 100644 target/work/resources/grails-app/i18n/messages.properties delete mode 100644 target/work/resources/grails-app/i18n/messages_cs_CZ.properties delete mode 100644 target/work/resources/grails-app/i18n/messages_da.properties delete mode 100644 target/work/resources/grails-app/i18n/messages_de.properties delete mode 100644 target/work/resources/grails-app/i18n/messages_es.properties delete mode 100644 target/work/resources/grails-app/i18n/messages_fr.properties delete mode 100644 target/work/resources/grails-app/i18n/messages_it.properties delete mode 100644 target/work/resources/grails-app/i18n/messages_ja.properties delete mode 100644 target/work/resources/grails-app/i18n/messages_nb.properties delete mode 100644 target/work/resources/grails-app/i18n/messages_nl.properties delete mode 100644 target/work/resources/grails-app/i18n/messages_pl.properties delete mode 100644 target/work/resources/grails-app/i18n/messages_pt_BR.properties delete mode 100644 target/work/resources/grails-app/i18n/messages_pt_PT.properties delete mode 100644 target/work/resources/grails-app/i18n/messages_ru.properties delete mode 100644 target/work/resources/grails-app/i18n/messages_sv.properties delete mode 100644 target/work/resources/grails-app/i18n/messages_th.properties delete mode 100644 target/work/resources/grails-app/i18n/messages_zh_CN.properties delete mode 100644 target/work/resources/hibernate.cfg.xml delete mode 100644 target/work/resources/plugins/hibernate-3.6.10.6/grails-app/i18n/messages.properties delete mode 100644 target/work/resources/plugins/resources-1.2.1/grails-app/i18n/messages.properties delete mode 100644 target/work/resources/web.xml delete mode 100644 target/work/scriptCache/RunApp$_run_closure1.class delete mode 100644 target/work/scriptCache/RunApp.class delete mode 100644 target/work/scriptCache/Shell$_run_closure1.class delete mode 100644 target/work/scriptCache/Shell$_run_closure2.class delete mode 100644 target/work/scriptCache/Shell$_run_closure2_closure3.class delete mode 100644 target/work/scriptCache/Shell$_run_closure2_closure4.class delete mode 100644 target/work/scriptCache/Shell$_run_closure2_closure4_closure7.class delete mode 100644 target/work/scriptCache/Shell$_run_closure2_closure5.class delete mode 100644 target/work/scriptCache/Shell$_run_closure2_closure6.class delete mode 100644 target/work/scriptCache/Shell.class delete mode 100644 target/work/scriptCache/TestApp$_run_closure1.class delete mode 100644 target/work/scriptCache/TestApp.class delete mode 100644 target/work/scriptCache/_GrailsBootstrap_groovy$_run_closure1.class delete mode 100644 target/work/scriptCache/_GrailsBootstrap_groovy$_run_closure2.class delete mode 100644 target/work/scriptCache/_GrailsBootstrap_groovy$_run_closure3.class delete mode 100644 target/work/scriptCache/_GrailsBootstrap_groovy$_run_closure4.class delete mode 100644 target/work/scriptCache/_GrailsBootstrap_groovy$_run_closure5.class delete mode 100644 target/work/scriptCache/_GrailsBootstrap_groovy$_run_closure6.class delete mode 100644 target/work/scriptCache/_GrailsBootstrap_groovy$_run_closure7.class delete mode 100644 target/work/scriptCache/_GrailsBootstrap_groovy$_run_closure8.class delete mode 100644 target/work/scriptCache/_GrailsBootstrap_groovy.class delete mode 100644 target/work/scriptCache/_GrailsCreateArtifacts_groovy$_run_closure1.class delete mode 100644 target/work/scriptCache/_GrailsCreateArtifacts_groovy$_run_closure1_closure10.class delete mode 100644 target/work/scriptCache/_GrailsCreateArtifacts_groovy$_run_closure1_closure6.class delete mode 100644 target/work/scriptCache/_GrailsCreateArtifacts_groovy$_run_closure1_closure7.class delete mode 100644 target/work/scriptCache/_GrailsCreateArtifacts_groovy$_run_closure1_closure8.class delete mode 100644 target/work/scriptCache/_GrailsCreateArtifacts_groovy$_run_closure1_closure9.class delete mode 100644 target/work/scriptCache/_GrailsCreateArtifacts_groovy$_run_closure2.class delete mode 100644 target/work/scriptCache/_GrailsCreateArtifacts_groovy$_run_closure3.class delete mode 100644 target/work/scriptCache/_GrailsCreateArtifacts_groovy$_run_closure4.class delete mode 100644 target/work/scriptCache/_GrailsCreateArtifacts_groovy$_run_closure5.class delete mode 100644 target/work/scriptCache/_GrailsCreateArtifacts_groovy.class delete mode 100644 target/work/scriptCache/_GrailsTest_groovy$_run_closure1.class delete mode 100644 target/work/scriptCache/_GrailsTest_groovy$_run_closure10.class delete mode 100644 target/work/scriptCache/_GrailsTest_groovy$_run_closure11.class delete mode 100644 target/work/scriptCache/_GrailsTest_groovy$_run_closure12.class delete mode 100644 target/work/scriptCache/_GrailsTest_groovy$_run_closure2.class delete mode 100644 target/work/scriptCache/_GrailsTest_groovy$_run_closure3.class delete mode 100644 target/work/scriptCache/_GrailsTest_groovy$_run_closure4.class delete mode 100644 target/work/scriptCache/_GrailsTest_groovy$_run_closure5.class delete mode 100644 target/work/scriptCache/_GrailsTest_groovy$_run_closure6.class delete mode 100644 target/work/scriptCache/_GrailsTest_groovy$_run_closure7.class delete mode 100644 target/work/scriptCache/_GrailsTest_groovy$_run_closure8.class delete mode 100644 target/work/scriptCache/_GrailsTest_groovy$_run_closure9.class delete mode 100644 target/work/scriptCache/_GrailsTest_groovy.class delete mode 100644 target/work/tomcat/work/Tomcat/localhost/outOfBounds/grails-resources/js/application.js delete mode 100644 target/work/tomcat/work/Tomcat/localhost/outOfBounds/grails-resources/plugins/jquery-1.10.2.2/js/jquery/jquery-1.10.2.js delete mode 100644 target/work/tomcat/work/Tomcat/localhost/outOfBounds/grails-resources/plugins/jquery-1.10.2.2/js/jquery/jquery-1.10.2.min.js delete mode 100644 target/work/web.xml.tmp rename target-eclipse/classes/.gitignore => test/integration/.git_empty_directory (100%) delete mode 100644 test/integration/.gitignore rename target-eclipse/classes/messages.properties => test/unit/.git_empty_directory (100%) delete mode 100644 test/unit/.gitignore rename target/stacktrace.log => web-app/META-INF/.git_empty_directory (100%) delete mode 100644 web-app/META-INF/.gitignore diff --git a/.classpath b/.classpath index 1f57fb3..f664fc3 100644 --- a/.classpath +++ b/.classpath @@ -152,6 +152,5 @@ - diff --git a/.gitignore b/.gitignore index 8ee4623..8eba237 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.class target/ +target-eclipse/ \ No newline at end of file diff --git a/.project b/.project index 181d2d0..2de0b22 100644 --- a/.project +++ b/.project @@ -26,7 +26,7 @@ .link_to_grails_plugins 2 - C:/Users/Jeremie/workspace/outOfBounds/target/work/plugins + target/work/plugins diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs index 0a67d30..17a513a 100644 --- a/.settings/org.eclipse.core.resources.prefs +++ b/.settings/org.eclipse.core.resources.prefs @@ -1,8 +1,4 @@ eclipse.preferences.version=1 -encoding//.link_to_grails_plugins/hibernate-3.6.10.6/grails-app/i18n=UTF-8 -encoding//.link_to_grails_plugins/hibernate-3.6.10.6/grails-app/i18n/messages.properties=UTF-8 -encoding//.link_to_grails_plugins/resources-1.2.1/grails-app/i18n=UTF-8 -encoding//.link_to_grails_plugins/resources-1.2.1/grails-app/i18n/messages.properties=UTF-8 encoding//grails-app/i18n=UTF-8 encoding//grails-app/i18n/messages.properties=UTF-8 encoding//grails-app/i18n/messages_cs_CZ.properties=UTF-8 diff --git a/.settings/org.eclipse.jdt.groovy.core.prefs b/.settings/org.eclipse.jdt.groovy.core.prefs index fa93b48..65c6dc8 100644 --- a/.settings/org.eclipse.jdt.groovy.core.prefs +++ b/.settings/org.eclipse.jdt.groovy.core.prefs @@ -1,2 +1,2 @@ eclipse.preferences.version=1 -groovy.compiler.level=21 +groovy.compiler.level=-1 diff --git a/grails-app/controllers/.gitignore b/grails-app/controllers/.git_empty_directory similarity index 100% rename from grails-app/controllers/.gitignore rename to grails-app/controllers/.git_empty_directory diff --git a/grails-app/domain/.gitignore b/grails-app/domain/.git_empty_directory similarity index 100% rename from grails-app/domain/.gitignore rename to grails-app/domain/.git_empty_directory diff --git a/grails-app/migrations/.gitignore b/grails-app/migrations/.git_empty_directory similarity index 100% rename from grails-app/migrations/.gitignore rename to grails-app/migrations/.git_empty_directory diff --git a/grails-app/services/.gitignore b/grails-app/services/.git_empty_directory similarity index 100% rename from grails-app/services/.gitignore rename to grails-app/services/.git_empty_directory diff --git a/grails-app/taglib/.gitignore b/grails-app/taglib/.git_empty_directory similarity index 100% rename from grails-app/taglib/.gitignore rename to grails-app/taglib/.git_empty_directory diff --git a/grails-app/utils/.gitignore b/grails-app/utils/.git_empty_directory similarity index 100% rename from grails-app/utils/.gitignore rename to grails-app/utils/.git_empty_directory diff --git a/lib/.gitignore b/lib/.git_empty_directory similarity index 100% rename from lib/.gitignore rename to lib/.git_empty_directory diff --git a/scripts/.gitignore b/scripts/.git_empty_directory similarity index 100% rename from scripts/.gitignore rename to scripts/.git_empty_directory diff --git a/src/groovy/.gitignore b/src/groovy/.git_empty_directory similarity index 100% rename from src/groovy/.gitignore rename to src/groovy/.git_empty_directory diff --git a/src/java/.gitignore b/src/java/.git_empty_directory similarity index 100% rename from src/java/.gitignore rename to src/java/.git_empty_directory diff --git a/target-eclipse/classes/dbdoc/_globalnav.gsp b/target-eclipse/classes/dbdoc/_globalnav.gsp deleted file mode 100644 index 639dd04..0000000 --- a/target-eclipse/classes/dbdoc/_globalnav.gsp +++ /dev/null @@ -1,24 +0,0 @@ - - - -Overview - - - - - -Current Tables -
-Authors -
-Change Logs -
-Pending Changes -
-Pending SQL -
-Most Recent Changes -
- - - diff --git a/target-eclipse/classes/dbdoc/_index.gsp b/target-eclipse/classes/dbdoc/_index.gsp deleted file mode 100644 index f24929a..0000000 --- a/target-eclipse/classes/dbdoc/_index.gsp +++ /dev/null @@ -1,22 +0,0 @@ - - - -Database Documentation - - - - - - - - -<h2> -Frame Alert</h2> -<p> -This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. -<br/> -Link to<a href="${createLink(action: 'overview-summary')}">Non-frame version.</a> - - - - diff --git a/target-eclipse/classes/dbdoc/_overview-summary.gsp b/target-eclipse/classes/dbdoc/_overview-summary.gsp deleted file mode 100644 index 8f201a1..0000000 --- a/target-eclipse/classes/dbdoc/_overview-summary.gsp +++ /dev/null @@ -1,11 +0,0 @@ - - - Database Documentation Overview - - - -

Database Documentation

-

This report contains documentation on the database changes made.

-

Use the navigation to the left to navigate the documentation.

- - diff --git a/target-eclipse/classes/dbdoc/_stylesheet.gsp b/target-eclipse/classes/dbdoc/_stylesheet.gsp deleted file mode 100644 index e512032..0000000 --- a/target-eclipse/classes/dbdoc/_stylesheet.gsp +++ /dev/null @@ -1,60 +0,0 @@ -h1 { -} - -.TableHeadingColor { - background: #ccccff; /* Dark mauve */ -} -.TableSubHeadingColor { - background: #eeeeff; /* Light mauve */ -} -.TableRowColor { - background: white; -} - -.NavBarCell1 { - background-color: #eeeeff; /* Light mauve */ -} -.NavBarCell1Rev { - background-color: #00008b; /* Dark Blue */ -} -.NavBarFont1 { - color: black; -} -.NavBarFont1Rev { - color: white; -} - -.NavBarCell2 { - background-color: white; -} -.NavBarCell3 { - background-color: white; -} - -body { - background: #fff; - color: #333; - font: 12px verdana, arial, helvetica, sans-serif; -} - -a:link, a:visited, a:hover { - color: #666; - font-weight: bold; - text-decoration: none; -} - -td, th { - font: 11px verdana, arial, helvetica, sans-serif; - line-height: 12px; - padding: 5px 6px; - text-align: left; - vertical-align: top; -} - -th { - color: #666; - font-size: 11px; - font-weight: bold; - line-height: 17px; - padding: 2px 6px; -} diff --git a/target-eclipse/classes/hibernate.cfg.xml b/target-eclipse/classes/hibernate.cfg.xml deleted file mode 100644 index 05a7d29..0000000 --- a/target-eclipse/classes/hibernate.cfg.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - diff --git a/target/classes/application.properties b/target/classes/application.properties deleted file mode 100644 index e384646..0000000 --- a/target/classes/application.properties +++ /dev/null @@ -1,5 +0,0 @@ -#Grails Metadata file -#Sun Dec 22 19:35:35 CET 2013 -app.grails.version=2.3.4 -app.name=outOfBounds -app.version=0.1 diff --git a/target/classes/outofbounds/AuthentificationService$_serviceMethod_closure1.class b/target/classes/outofbounds/AuthentificationService$_serviceMethod_closure1.class deleted file mode 100644 index 1f9fe3b2eef63c1a8299c38418c733b5a8f86570..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2550 zcmbtVZBrXn6n<`aS=cTR03ME(p}V|T*Jxw7@e2R9ePxDd+;J%|BU{lOXTd7j z45?gGH@sBghJ-*N1+p0irBEOXOIZf?n4x{zv`qIN!*C+Et?%kSgh!j(q?tLtlU&oF zp-V+8x*1yCEz@C`$^DP~QAFJZ(&u8qB4C!m8Di%hGh8Z2Z+>JHchS!3l?uar!UOMA zg=v*bLf_$gws?|ug>E^zkAC%Zou|~*oJ_KrgRU}nS3@rP6HUZ4yn#0*{HqK%Ujw#+ zYlJ86x`jsmXc)j171wctp*Iw)A0WfTe?UbAF(@Y*E=$u9+$3Vg36!*H8pK=O;{n4} zLKbFh{fLSYJ<9?G!wel{CQ$BcNQ<|b(U3$+MFJxX<4w63P(E)6v+Ca8ce!ke*`i*h z!Yg=>p-b|x9tguo6F$BwY7J?Oskn`C4ISw0BuyZ1pR zU%$&Ve1H#COyRC?xQl1+y ziwBY;Uoc!dW&62AD#%k=$fbraWzVmIhTlWX$*O$Ka5>D7U|{<3K9;f@3~jn!uCa?p z_$|KcB+vyKbcUSWafVxAe<%3~rOZzvL(eHBZ%cteL%(E;Wtxo|I5t%jQKFmXRB+k$ zL?7_doV)}d3Sm=MZZQm=%6JmXw(Cp$Xz;4MS`=(EsFb87?l^jxhIixG3oM+or<6=;gFtb>OF7URoBtgPi_fvR z9*d-ouqLY+VnZm?Vto(&udLH7d7o@QG60u{flk)01sebbeE2&@cy>Fod vIyM6fLu5fFI!5Tq2f61k*9ne&1o5Y5xeaZ^F_28ndn(waw@PPHi+=wC3=gtH diff --git a/target/classes/outofbounds/AuthentificationService.class b/target/classes/outofbounds/AuthentificationService.class deleted file mode 100644 index 0b481ecb2783433671dd10f0072f4d97067dc56b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6724 zcmbtZ33wFc8GirlCc9Y%2`d573aE=Do0ug*3>rj3G?1_XB@|p~n+}^vvbfndl|Yg>EU^J#5sPi?6n2}YD&+S=0|_P#HB*!#A%zW*GX2|FQR^E}zv{Qq}<@Av)R zKY8S-`yK$$D&`BErXwvP`rmp4r?X`0&(A_Yk4B9S6(&Ep2CnWkhHmu51gS5}5euz>202RO-kW&=pBU};8HD_Xjd+FHtM>s3=5^r5BG zvW(oWl0~E^V`!2gy!<3fW`kWtK3Ute(IW9kQ5Ptf14VkC61cJ9|AFzWynYXT#*`iF zZ~)R8LkrpjI!+?~iGgX+AIRo)vt($k5nL#+qM6D^#!u(Uq0>2h7nF8wrYbT(G&Iky~jwdW@ zV0u^uHq4F;Uq)pKmdv0~vFv^Eap(kA%^I9a;j$64P7{MU(@NwDWBPSkqE%pxKj;0d zn8I*JK+Y?d2$!I0GTg?q!I9O&x`|-Jv@^`viJ(USQEZaP*;y&yzvSBGAg?cmjo2*E zdLs4xStD1p*6*`4+2}h5)gqfk1Xl^fvZ`rq)3@y_60_}o@12v+@4emXgVLg4EBa%& z8ruYvL5=5_rVgeVS%FJubH-J(vxlv_qVFl#jvZ3)H3AErEIEC0OQEY|7@QF3`Jmrw z$Hr-;=Re5(?zmwLP#ajJ*J7u%o{1)k6Zkk4LM7WY(RnBCvM=XxkGZwhgyW=XhB zYcZ}2pH!E#aXU+v9DYZ-b6TFK#a6%XGiB^lq9H*w2u*rABv3u3=1X+dXE~2ZY5Dnn z#U3ClO{d{x2r&F=KmVyGEigmZAusJ76^P2&K+ZTk)Tf=NjwS^WpKT`qewuHU_rkzzI#k z3-H1i_Txp4;IgR-UMxqI{dfsC2&M9dz?stzs`3txQ_}j2PL4X{uMeE`B6zt#uiyGg zIL?glO5`ZG8Lym!SKt%>;8APD{vX(>I--?Q@dZOZDqR)>dsuV;jqA#L}DaW{IG;5WZ`( zd3)?t@J2cCR^e?57Ga^>en&MRx|WW$-=Lu0S$cPfcPMb=l)#&L{_p0kM>qCG@LqO$ z=TvXu$lc(skI0!z356{5|@e$s` zPV8m`cPW^Q(`2wdCef-{zT>}qqoHbYDd{OWj$BNH#5}QubDf3(Fkny{M&pDKz_u1>UI(h4HUF5`F z-~m%@KNWlljnafK`%KWTFR6Jp^7?=pZR9Pq#vxGfH9RVLzwT2wqM9RJoOtZ(BL}Rg zx1iu#cuZ1%+ebZ=E2#P0eo{xhuL{2Bxbb}sAc-vJ8cXx;j`pQAlE_;NpJJZF4;*zuSH&Xh~`QUw3uWsWagHgnWd@D!em z;lKDFo6i*CX5A*eLL2IqFRiXL4BdzbzMxt*MPpNJ)-8u(ue_i0ok~RTg;k6}>eEb< zub>oB&FU0kQFB~`Jd0(7L^LLlP|yt9D2*kxc&mf5?Kv|?_Ra#!*M8k*;vD8H%-LNS2uinH-~>+NVyWg3zOqG zYXVEt$-_9WuQ@qzFP1m&_yl(Zu?=dZv(#`tR>(CppwX4E6Vxe6X=a~r+NOtqWI>Yp%U24Ug6dT#0U1(tgx(4cJIYo8wir7 zk0P82HT72?MQY zcDs77rT;RLZ8DN4ud?9x)QS1Zvc{E;#=5Y45$Ebz#k|POtRSe2c-5VVCMPg<;2!Kv zH$9Aba&-bXWYPz*x9Ko$l)wN3#PQe_a30xZ@D>qG%QFuld|*d1Lx2*Ta>Zk~2`_aS z;;zP;WD{v5e5Jsf%b8!yyi3pLQuoV}P0dH}sxUk;x0VBR28pEMibHk;uML%{ZY!s+ zQrH{9aCFwnVbQgzo-RlyY8mZK;vjCfNm$8mEt7Onp9Dht1m0eI*^+~J=aOp{;9Z@| z4&pt_t|4Fij<)#w;&&dwM?i2yAR^yE)HZ-9-wxotmnHrt7RG5{&C?R91IH6 zN-s=@%JxjLk7L~1p1_d`>EpQHi{2p|ElUsCL9R(I9mj(n`ym{2_fKaMWcfvsOV1w1 zr#ymB2daO_+kQB3`w?&Z3n&IyXL#0qvD~lxzJ0~p{wf|V8}DG22pY#X?xL9zLEpq< z0n)$YZGSh=wjVgQ#pGyEc0FWcA(D*W5&ucQN5DhbB{+wXkzlEh|D26z6YJ%dlXyJC zA|1zX9cyFqHMvWEApQvz$xL diff --git a/target/test-classes/integration/application.properties b/target/test-classes/integration/application.properties deleted file mode 100644 index e384646..0000000 --- a/target/test-classes/integration/application.properties +++ /dev/null @@ -1,5 +0,0 @@ -#Grails Metadata file -#Sun Dec 22 19:35:35 CET 2013 -app.grails.version=2.3.4 -app.name=outOfBounds -app.version=0.1 diff --git a/target/test-classes/spring/resources.groovy b/target/test-classes/spring/resources.groovy deleted file mode 100644 index fa95006..0000000 --- a/target/test-classes/spring/resources.groovy +++ /dev/null @@ -1,3 +0,0 @@ -// Place your Spring DSL code here -beans = { -} diff --git a/target/test-reports/TESTS-TestSuites.xml b/target/test-reports/TESTS-TestSuites.xml deleted file mode 100644 index 511be84..0000000 --- a/target/test-reports/TESTS-TestSuites.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/target/test-reports/html/all.html b/target/test-reports/html/all.html deleted file mode 100644 index acd9f95..0000000 --- a/target/test-reports/html/all.html +++ /dev/null @@ -1,181 +0,0 @@ - - - - - Unit Test Results - - All tests - - - -
-
- -

- Unit Test Results - - All tests

-

- No tests executed. -

-
- -
-
-
- - - - diff --git a/target/test-reports/html/failed.html b/target/test-reports/html/failed.html deleted file mode 100644 index 8ddf513..0000000 --- a/target/test-reports/html/failed.html +++ /dev/null @@ -1,181 +0,0 @@ - - - - - Unit Test Results - - Failed tests - - - -
-
- -

- Unit Test Results - - Failed tests

-

- No tests executed. -

-
- -
-
-
- - - - diff --git a/target/test-reports/html/index.html b/target/test-reports/html/index.html deleted file mode 100644 index 2cd601c..0000000 --- a/target/test-reports/html/index.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - Unit Test Results - - Package summary - - - -
-
- -

- Unit Test Results - - Summary

-

- No tests executed. -

-
- -
-
-
- - diff --git a/target/test-reports/html/stylesheet.css b/target/test-reports/html/stylesheet.css deleted file mode 100644 index 812bcf6..0000000 --- a/target/test-reports/html/stylesheet.css +++ /dev/null @@ -1,290 +0,0 @@ - - - - /* html5 boilerplate */ - html, body, div, span, object, iframe, - h1, h2, h3, h4, h5, h6, p, blockquote, pre, - abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, - small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li { - margin: 0; - padding: 0; - border: 0; - font-size: 100%; - font: inherit; - vertical-align: baseline; - } - - select, input, textarea, button { font:99% sans-serif; } - pre, code, kbd, samp { font-family: monospace, sans-serif; } - - html { overflow-y: scroll; } - a:hover, a:active { outline: none; } - - ::-moz-selection{ background: #FF9800; color:#fff; text-shadow: none; } - ::selection { background: #FF9800; color:#fff; text-shadow: none; } - a:link { -webkit-tap-highlight-color: #FF9800; } - - h1 { font-size: 2.5em; } - h1, h2, h3, h4, h5, h6 { font-weight: bold; } - body, select, input, textarea { color: #333; } - - /* html5 boilerpalte end */ - - body { - color: #333333; - background-color: #F8F8F8; - font:13px/1.231 ubuntu, sans-serif; *font-size:small; - } - - p.intro { font-size: 1.5em; } - - a { color: #1A4491; text-decoration: none; } - a:hover { } - - pre { - border-radius: 5px; - margin-bottom: 8px; - padding: 15px; - background-color: #FFFFFF; - border: 1px solid #DEDEDE; - font-family: Consolas, Monaco, monospace; - font-size: 0.9em; - white-space: pre; - white-space: pre-wrap; - word-wrap: - break-word; - } - - #report { - border-radius: 8px; - box-shadow: 0 0 8px #F5F5F5; - - background-color: white; - margin: 10px auto; - padding: 10px 15px; - } - - /* Navigation links between the various views - - - - - - - - - - - - - - - - - - - - - - - */ - #navigationlinks { text-align: right; } - #navigationlinks p { padding: 2px; } - #navigationlinks a { font-size: 1.1em; color: #464F38; } - #navigationlinks a:hover { color: #333; } - - /* Test suites - - - - - - - */ - - .testsuite { - border-radius: 5px; - box-shadow: 0 0 4px #F8F8F8; - - background-color: F7F7F7; - background: -moz-linear-gradient(center top , #F7F7F7, #FEFEFE); - - border: 1px solid #EEEEEE; - margin: 20px 0; - text-align: left; - width: 100%; - } - - .testsuite .header { - color: white; - padding: 5px 7px; - text-shadow: 0 0 4px rgba(0, 0, 0, 0.2); - font-size: 1.3em; - - border-radius: 5px 5px 0 0; - box-shadow: 0 0 13px rgba(255, 255, 255, 0.3) inset; - } - - .testsuite.error .header { - background-color: #BC2F2F; - background: -moz-linear-gradient(#BC2F2F, #C96952); - background: -webkit-linear-gradient(#BC2F2F, #C96952); - background: linear-gradient(#BC2F2F, #C96952); - border-bottom: 1px solid #BE5B5B; - } - - .testsuite.failure .header { - background-color: #E69814; - background: -moz-linear-gradient(#FFB75B, #E69814); - background: -webkit-linear-gradient(#FFB75B, #E69814); - background: linear-gradient(#FFB75B, #E69814); - border-bottom: 1px solid #CD912B; - } - - .testsuite.success .header { - background-color: #A6CC3B; - background: -moz-linear-gradient(#A6CC3B, #CBD53B); - background: -webkit-linear-gradient(#A6CC3B, #CBD53B); - background: linear-gradient(#A6CC3B, #CBD53B); - border-bottom: 1px solid #C4D5B6; - } - - .testsuite .header h2, h3 { margin: 0; padding: 0; } - .testsuite .header h3 { font-size: 0.8em; } - - .testsuite .name { - width: 50%; - } - - .testsuite .time { - width: 10%; - } - - .testsuite .testcase { - padding: 5px 0; - } - - /* Link to individual test cases - - - - - - - - - - - - - - - - - - */ - - .packagelink { - border: 1px solid transparent; - float: left; - font-size: 1.1em; - list-style: none outside none; - padding: 2px 7px 4px 7px; - margin: 3px; - } - - .packagelink:hover { - border-radius: 4px; - background-color: #f7f7f7; - border: 1px solid #ddd; - } - - .packagelink a { - color: blue; - text-decoration: none; - display: inline-block; - } - - .packagelink.failure a { - color: #FB6C00 !important; - } - - .packagelink.error a { - color: #DD0707 !important; - } - - .packagelink.success a { - color: #344804 !important; - } - - /* force line break for long test names wihtout white-space */ - .message { word-wrap: break-word; } - - .testcase.success .message { color: #595E51; } - .testcase.error .message { color: #AA0E0E; } - .testcase.failure .message { color: #FB6C00; } - - .testsuite .testcase:nth-of-type(2n) { - background-color: #F4F4F4; - border-bottom: 1px solid #EEEEEE; - border-top: 1px solid #EEEEEE; - } - - .testcase .message { - font-size: 1.1em; - font-weight: bold; - } - - .testcase p.summary { - margin-left: 5px; - font-size: 1em; - color: #444; - } - - .outputinfo p { margin-top: 9px; } - - /* output is parsed using javascript and not visible by default. - I don't think that having a non-javascript fallback is important - as most Grails developers won't be using IE 6 :D */ - - .testsuite .footer { display: none; } - p { padding: 4px; } - - .footer.output { - border-radius: 0 0 5px 5px; - background-color: #F8F8F8; - background: -moz-linear-gradient(center top , #F8F8F8, #F2F2F2); - border-top: 1px solid #EEEEEE; - margin-top: 10px; - } - - .footer.output h2 { padding: 5px 0 0 5px; } - .footer.output .sysout, .syserr { float: left; width: 49%; } - .footer.output pre { margin: 5px; } - - .errorMessage { - color: #AA0E0E; - font-size: 1em; - font-weight: bold; - } - - .errorMessage.failure { color: #FB6C00 !important; } - - .grailslogo { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD8AAABCCAYAAADg4w7AAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sDCQoqFYGk3gMAABq9SURBVHja7Zt5tB5lnec/v+d5qurd7vvePdtNCCEhMawdkE3UMGMrKCIuBG1tu7FbG/SoOKMzjnqca5/pxrax7aPjAkNzXLDbJqLTAiIYSMAFCEYg7IQACVlv7r2527tWPc8zf1S9997cBATaPt3nDHVOnXrrraeq3t++fH8vvLK9sr2yvbL9f7LJ7/lZ7d0Bfu4C773KrqvsugMQEXeE5+lsrT3Ss/6jEC+AyX5gAuAHvVpx3Zqe8dr+AU9rsae11CV+kSjXC1JEIUoQPLFoNabFDJkwt6sjKO1YuXTgmc99+Lq9p751YS3lGIJgMkbZ/0jEt4m2AIsWLRqoJhOnuDg5xyt/kmi7WrT0aYMoIygNSgkokEw/PB5nyXaJldfblVKPFsPyr+ctWvzLKy+/8tGz33b2pB/0SgbFZAx2/57Eq1QtBy0MuoGBgRMnaqMXepVcgOa4IEfO5BRBpHyYU1YHyhkjSABKRFCCEp8SL3hnPTZBXGx10vQqbnripvM+kQOBCn/R37nghiu+eu2t55511ujg4FozOLhJgPjfg3iTEd9auHDhysn6+Ae8jt8d5GVJWISwELgor5IgrwhCUTpSSgeiTCDMSB9SrU9l6KzHW+etxbnYu6SJixuJbtasaladimuuqSW6Z37/oms23/XIehFpLj9vefTULU/F/xoteKnEB4C96MyLotuf/tkfx675CZOTlVGHkkJFJ2FB+zBvdJgXFeQUYV4R5AQdKIwRxKRqL+IRUQip2osD5zwu8SRNR9zwxA1P0rBJs2F9Y9Lp+kSiGjVXNxR+9p/PfvNfX3vV934zeP1gOLhu0L9cLZCXSHh8/PHHL941tP0KArsuV9ZBvqxb+bJRYUHpqKgl6tBEBU2QUwQBoCQlmNTORcD79Kiy2CBkvsCnHs47iFueuG5pVBOaU861qi6pTiSmdjBWzarsWtCz9G/uvevhbwIixx+veOSR1r8V8Rqwi5ctfvVEdf81QZET851BXKgE5Eo6yJU1hYomKirCnEK0kNIyi+hZxJN9VtMBctY6NRMvAWzsiOuW+qSlPuFcbSKxk6NJMHUwsfmg89pHN+/+NDCxbt3xav36l8YAeRHXFWAHli44d6o1+u1cWc0rdgetXEWbQlmrQqchXzGEeTUjSZ9JPHuCylxk+2VtJkh2omYzhRltmF4ngk0czUlL9WDiq+OJmxpN/PhIy0hcvPVbV3730rVrz33urHVnhXevv7vOS5Do75T4wLL+d1ZbB/+x2KO7O/pCW+oNgnJvIB3zDMVuQxipQ3+0EnQmRTVbmpI5u4wgJXKINqhZ96R7tgYwRogKmqioxQRKaa0kCHTcihsrb7z5J2csmb9q45c+96XRRyduix69Z1fyryU+BJLFR/deUEvGv1/sNcWOvtCWuo3u6A8o9wXkSwad2XNKlKBnEaRkRnpKgc44oGdJu72ufV0kPSolKdMEtEq1RwkEoZArKoJQiyhRJlRJy7aO2nDHzWuOP3btHZ/80OfHR0c3m82bn7IvV+1DoLVw2cKzm/Ho+ny3nt/RH9pSl9EdPZpiT0AQCA5BqdSyj6SubZWXOXbNLD8wbSrT98phpjH7HjKNwEN9wnJwKGZyJG4O761HqlG68be/2PtnwNSpp56abNmyJf5dycqR4njr5JNPXtpsHfxKrqLml3tNq6NL6XKfodQbEkSSSRm0EpTiCLvM2Q+9rgWUluddJ+21mYmIEnS2C+n9pS5N7wJDpceEfQsKdR9W3/raN6/474D67nevjLx/YZ+mjnDuvfeya3TbX4Yd/tSOXtMsdpug1BvS0RMQhGmsEnGIcqTyd+k5Lo3heASHwmU5yMw6su9FPOJn3TdnV7j0OeJR4rN7smviIGNOqTOgZ2EolV4Tds+Lksn6vo+/98/Pe+vq1Wtbd9/969zvytbm+oB40dKeD+jIrit1Ba7YFQSlnkDKvSYlXIRA56ZVcLqUy+L0Iap6iNrPqPW0icx2dIeYg2TX/fTatByU6fust+AdSkFHp8E7r73zSZIk5rHt9/3lQw9t23zmmWfuv/766/W6devs7yJeA/EJJxy7bKi667J8WUfFniAudumg3BMQRApBsC5mvDGKF48SNaM+CpSflbTMtuW2EzxSGGPOmox4OSQBan9u+w1PLihhdAh4lIZKj8En3iRxlLQajRWf+PwFH9nw48f+R2lJqQhMvBDx03nFwfrIOp33p5a6gqTQoU2pyxAVFSIKa1tUit2sWX4OSsB5l2ZmaZ56iCQ5gvOCLAc4JM6nX4j46ap92vH59Hr73nZRr5QwdPBxJutDBCbCeYvRikpPQKvhTKsaMLpn3/u/9a2/+udLL/3sw4ODf5obHPx24/mIV0By8smvWjFU2/GeQkWTrwQUu7UUKjqNs0rRaNaZ17WEyy/8OrmwhHUJSukXDCW+rfaHtzayBkea3x9xc+Cdx2crvG3flfDtOz7I8NTT5KMSibWIglxB0dVraFWdb1ST3htu+94ll1762Y+tWLGyBDSer1sigM/36HdiWn9e6QuSjl6jyn2BRAWdqZ7GuZjARJy26i2UC10IHq0MStQRd8mOzDpOf5e91osHLzifEuo8eOtwzmOdw1pH4hw2sVifgIdGa4pfPX4NzWSKQIepE5U0LwgDhffetxpeqhP13i6z6I6L3n3ZULV6d/jrX2+P53p3AexFp1xUsb7xplxZkeswrlDWKldQWZgBpTxhEDBRG2L/6DOHqOGLTSamuex9tjvEpudC+h3epQ0O59I1WeRICx6HUiGjUzsZr+0mH+QBi9KC1qm5mUhR7gqk3BW4IGcXf//mvz8fSHqWrQmPFOoEYH9x+0Ix7uSoqMmVlMqXNCbQKAStFIgjF0Q0mmM8tfe+l91A8D5lWUocONrns8zAy5y1KeucswQq4Km9m2jaSYw2iLhD8gStIF9U0tFlfLGi9FR9+Ayg89OX/Tc3OHhReETih+sja3Tol+WLOskXtQoLCq0URmuM0hgUgQkJTcjWZ+5gdHIPWhmcsy+LcKXU9PnsY/p5Rqeccynh3qFNQD2e4ok9t1EI8yglGBOglUYrk5qgF8JIKJaUlDo0XtVW3nTrPw9Aly1O5YK5xCd+ozexq50WFkRyJWXzRa2CUKjHY1Qbw1RbI1Sbo0w2DmCJeWzHnWzZ9tPsB7tUXC+BASKCcw4ROYwBcz+3o0ViGxSCMo/u+gnPjW7GJnXqrWEarVEa8SiNeIRGPIL1LUSEYllRKGvCnOu7696bVgKufNpCc5i3X39gfU7ELg9yQr4YYXKWfFDi3DUfpKe0kCRpglJ4bynlunl4x8+5+b6vsnrJ2SzqXYV1CVrMi5L6XEnPZkQq5Zk1zjsEoZXUyYcVxur72LD1Ck5YciGvWvQmGvEkStT0c7RWPLzzR+wff4hcVJBiKXFhvpWfnNq7GJCjjjtFe+9FJI2vKfE3fq/PG7skjBS5yKggjHE+Zs3yN7Bq8enEdYcohXOOIFC8euW5XHH92/inTZ/j4xdeR6AjnLPPG/Zm1JnDjm2C28fptZn2x66FlohARdx43yfxWN522t9TyXcRZxbnvEMrwDd4at8GPDFhqCgUlQ8jFdYaY0uB6LiB4/jCF76gsw5wmqKNTw51a/ELwkh5lbOSLxSpNkd4evcD1Gsx440DTNSHmWqOcmB8L4YiH3zjN9i2515+cNfn0opNaaxLnj9mzw7fswhtq/5sE0ht3GNdi0AFlHJlbv7tZ3hs90286/RvkA86GZ0aotYYptYcYaqxj1bSZM/BpxieeJzARCgFuYL2uYKQ2OoAkBsoL5bVq6frmZR4Mb6gtO8IQvFGO4mMRmnFAztuJbENQpNHKY1WIVFQZKpxkIXdq/nQm67hzoe+zfduvxzvErQyWNfCefuCGtDO/OZKXkgZkLgm1jXJBx0EOs+NWz7D5u1Xs+7M/8Mx89fSaI4S6hxKhSgxaAkIdJ7nhn9JPR4iNDk8XoJQiCIF2pbTMr2DUqm7/XKvABLrckpLaAIhCJVY36KS7+bx3Zu498kb6IjKJEmcVnOA0Wm8P2npm/jYW9Zz7xM38NUbL2JobDtGRWkOZps4b4/o0KZj+ByJx7ZJYpsEKqRS6GGsvo/v3PkufrP9H1h31rc5aelFTDWGQWmyLJnY1imEnRwYf4QHdlyL0RotGhFHGBgfhBqFKzYnmxHA1FTSlrxLiY9dSWkwRpwxOsunhXxQ5Ob7/5Zt++6ju6OfxLawLkHQGB0xXjvAqwbW8qm330a1Ns7f/d/z2bj1KurNSYyOpguhdkyfa/vpngYL6xJypkA5343z8Ksnruaa28+l1jzAJefcxOqF5zNZH0aJQdB4HK2kTiHsph6Pcdfj/4tqcw+R6cBLktb92os2oLQLDlarGqBR6VWHePtc3rRUQ6GUiNYeowXvY/JRkXpjlGtvv5SLz76Ck5e+kcnGFHFSRymDkZCJ+jDzKsdy+Vt/yp2PfIuf3/817n3yHzl95Xs4een5dHUMYG08ncAcrgWpduSjMmOTO3hyz+1seea7TNT2csrR7+fMlR8mF5SZah5ASwjisa6BiKJcmMd4bTcbHvoUO0fupBB1pQVB1gs0WrzRoJS2xWLJAazu6fKHEF/Ol8cPTEgVT0EEl5ajCudjirkKE/V9fGfjZew+6cO8ZtUlVAp9tJIGraSOViHVxkFCk+eNJ1/OWavezUM7NnDPE9fyi61fZ+1JH+Ws1ZcgXrBYZFb2lhLuyAUd3P/09Wx85Aqsa3HGsR/m5CVvpyO3kFqrRrU5gpYcTixKDIWoE+dintp/K/c8+SUOTD1GMerGY7OGR1oSe0GUgiA0kx0dYTy3Z2kAunvnTz4zLFMIRQEvs0pS5xOKuTKtpMEtv/0bHt55C8cvPpfjFp9Lf+cxxEkDrQ3WNak2EvaPbWeisQvvG0w1h/nJvZ/G+4TXn/BhkpY9RPWdTyhGFbbu+Bdu3vJJHDGFqJuRiSfYOXwfC7peTWRKKAnxWIwKacVVntj9I3YMb2DnyK9wJBSibvAJCj/dLFEK77ICJFDRBNCCqrRaPf6QNtaKZavGjOgh8Q68eAXTHVYt4HxMaAylXJkD409w02//J9/Z9H6GxrYRBWWsi8mHnWzbeyffvO187njoSiab+ygXesmHHWzc+mV2Dt1PZKK0mBEhsS1ypsyB8e1sfPiv8cpSzvUDCY/tuYH19/4Rmx4dRJRJpUiCVnl+/eQV3Lb1ozw7fAeBNuRNCUWSdniVzPT8RBDnxVkoFop7gdaO4Z2qr6/PZZqXhrr/+pHPjhqtd1rrweMkaxtP99FV2j1BIAoL9JeXMTr1NPc/+0OUCEYFxEmDB579AYHR9JQG0EqR2DqFqJN6a5hHnv3JdE/LuRSeVUp4bNfNjFd3UAoqOJqI8hSjbiqFhTw7vIE9B+9D6zyh6WDf6H08PfRTyoX5FKMetNKIctMEz22COu+V88T5YuceIKkdGGb58uV2bgOzHgalJ10CNklzda3m9NWzlrHH4bEEJmC8+hytpIpRIbXWGGPV54hMHusaKNIfAY4gyLFv/BFarQaQpslKG2JrGZnchlI+7eSKR6czC2iVJmJj1acRFFpCJps7QWKU8njirLmZAhvqELAj1VgbO/Gxqnd1Hv0c4CZsy82aBlGKi9AiknSUuh5KmtCqWYP1rt0+1m3kJFMplYEIgicwESIK5z1GhURBAXCpRLL7RHyqBb6Od8k0NC0IziVY3zgE4FAatKgMrFDkghKQ5vmBKaG1ngZHVBv8UIcDJAI+blm808N/sOK8bUAgNZJZJaNXrE8/HXvsHzyIl+daTadtIk6ynnwbempzVitB4VFK6O1YRqgLJL5JGHbQV16G9y2UVrMkkZIb6hDQOO+m4zt+LmMl1RgRkJhc0EElfzTeO9LE6yjyQSeCzeCu2XjeLAZK2hNp1i2RqTz2+te85bk69SCu5FpZUTOd4XnvvXzpM1c9E0j+gaRpiVveCzOSbuNrqS1pEt8iH3Uw0HsKHsHbhECFDPScmqkiaK1SzTECJBSiHrQO8N5maaxFqYBcVJlls5kUtcK7Bl3FY+gsHoPzLRJbp5JfRlfhGLzELwiSaC0+iZ2q17wtFwfuAya2P/wL9ZqVr2nOzrYV4M/5wjlaRA52dc67tTHlaFUTsM4ZPYOe6Aw1CbQmTsZY0nMqA92n0LLVtLPrEpbNW0t36Sia8VhWXPgMdvYs6j4JJWa6OWFdjBZFf/l4AhOAJGidITISI+JY1n8euaArzRK9JTA5lvS9AXxq96LaiJEcigQpqNcTSVrBnrNPv2wjEObzpebcIQYF+E2bNgFw3us/cpsQbK1NxkGzkSY7ahaaapQmcTWK+V7OOvYvyIcVWnEVEaGZTNBTOprTl/8FaWMuIdB5nK1RinoY6DkN52gPo+Bd2phc1Hka5fwCnG9kHRlFklQZ6H4tqxZeTNNO4n2CRtFojXPsvHezoOt0rKvO8i0zrXCtU6ddHU8ohYs2vO7Vb358x47N+WOOOat6ZLhqE3Zw8KLwkvdesq1cmLe+NmVpTMZYh1e6rfKpnXsfU8r3UMh3gQiFqIdc2EPOdAKecqGPXNCB802MCWnZSeZ1Hkd36Vhi15rO5UVpWskUncXlzO88BU8TlcESSkEp148WhVE5ckE/UdiLUQW0FiqFJSBu2qHOILugtfh6zUltUo+84exPXZcmcroBxLPs/ZC+vb/xxvXee682bdp03Vf/6U/eXJ2Izyx3h3FYlmAGIk2IgiLV+n5+vPkyBnpOpVIYINAFWvEUI9Un2Td2H0KC1hHeN1HiWbHgPHJRhUZzYmb+0AvWtQhNmWX9b+a5kVtTWxZDpErsGLmViQe3019eQy7sQURoxCOMTD7IeONxcqYDxKYMayM7WrBWbHWiaSr5lT84a81bH9u/f2vuqKNOGW7PCD4vRP2JT5yZ/8pX7q5f9pk/fN/wxNZvzlscFvoXR94Eor1v5yipnlnXIEmqIB6FyipBRRR0YJTB6Ihac5i+8ireefp15IJ+mnHqH9pNysTGKBXiHdz+6AfYN/ZL8mFPigSJkLhJnG8iqKzz4NEqJDSlQ8Zd2tMdSut4fLQWDO/OPfDx993/gUIhGK1Wq41isTgmIs0XBCorlbubD+57sHjivBN//N6Prl47eXD0zwrlIO7uM9Nd3vSFnsAUkaCMYLOXpwHXZ6HU+xijNSce9T7yYS/15ljaNfMZMOEdgqbVmiAX9rJi3sWMVrfOJDgCOdOVgZN+mvGSpdvgZzA+QGuVtJqxjAy51quOufjLhUJw4ODBp1VX17La801rHVLlbNqEb5Qe1xeu/VM5Zdk7t9x+3/dOdTSPLuRNEuZEt0FDpcjAhSQrH1167hM0DqMD4mSCntJyzlz1MXJhL9amyZV1MZ4En3l9xGBUSGdxNfsn7qTa2olReZD2tKlNoW5xIAkel4ZDZhyx1nhxJCMH6mFejvvaH19w1Q+b40Om1FmZhKgqIvZFjaU8sOnZpLDkudxb/vC94xNj9qGnnr33HFG2t1A01oSi0gklySaushBDO8vKxs4EjDJYX8fahFzYSxRUCHSFQBcIdREtRZSK8D5hqrmL7UM/YP/EXSmxqp3hyfRgwnQclxmnmCVSXhmJx8fqUWtswU8+8r7brwTs2NRoo1DomzySuv/OaayNP/5K59oLL2989aqP/6cHd9xwXf+A7uqZn7NBKNpbpudl2uNz7SKhnbCkJhBjbY1C1E9XaQUduaMohD1oleb/zXiUWmsPk42nqTZ3olWE0SGeTM3b83vMHV3JMHslXgnJ1GQ9GNnb84sPvWPzJwoFRg82nrZduWVjwORcD/+iiPfeyy8furnz7BPeUv/iN/7kbc/s23h134Aud/eFNghFc9ggoRz2I1VWWlpXz8CEdH5HiUqxuaxdplWYDTyk08iSPUjJkfH8dC4Hr5VKpiYbwcjeyj3vXPvT/7JoUf/e8aFtqtK/YgSoikjysufwvL9e79y5qrxkyQnNL1/zkXOf2n3T/+5dKAt6+3OtMMJ4h0Jm5u1m/bBDpiy01rPA+XanJRtBFUF58OIOG1aaxvvVrMFFEa+1WOe9TI419dRI323vu+DOz5ULwfDQ0MOqv//4g5nE4xcLoL4Q0qI3P76587RVp9V/8MMvnnbPk//w5VJ3c03vvHxSKGrAa++nhTUnBM0yg+mpS5l+q1LtgfqZcMXcia3ZzFTKayXW2tiMDdtWUl/2/Q+962d/B9THx3e4SuWocWBKRF7UJOaLGj/duNEbFt7UufbY85vbtm0buPpHF39e50ff0TtfhZWuKFaiBJz2KbAz05efXXEBXmaQUZnFpdljLNN+Y/p+QUScEnEoq1uNWEb3h7sq4Wu+9p7zr7oeMGNjjyednavGM1V/0SOo8hIARnXTpqu7z1/7IQeov736XRePVrdeVupure7qDiRXNInRyjsrSsQp79MZJZHDZ+/IQpSaw6DpCY7UXLxWYkWLB6ttkqipcaZaU/0b16z+7NfXrDr3kWZzuOCcqufz3ZPwaE3kuN/r7O1hTnDDhvXlM854XVQqzav/5jcblt+y+a/+KPG731GsxMs6ewxRzrggUIknmzx2TtN2C+1JLDUTHWYxxGsRhxKnFB7vtVJWxbGViTGp2Ubn5t7S666/8A1fuh1o7jrwQDjQd/IEUAXqzxfLf+//tHjmmY25iYmD5RNPfHsMuI33/Muq+x+9+rxa8ty5UaF6fKlCsVDSGKPQWjmtlU07BLMqqlTSPguZogVx3hsRR5I4alPetWrBPnG99/aUzrjlgtO/eA9FRpqM50fH9iQLOl81CdTgCy2RwZf1h4OX/R8b77265albSsd2LModM+/EGGBksjXv53d+7qR9ww+c6YPRE01YW4ZOFhULmCgHQZg1HfTMtJXzYGNPqwFJrMfF53aQdG4rmCX3HzPvbVvWrHn7M8AUYPbv36qKxWXVUqlUA+qAe6E4/m/+7yrvN5otWw4UK4vmh8vnv7bdIDTNSbq2PH79/N0HfjtQTXYvcn6iT6RR0SbOO3GBEWWNChrORVXl8+O5oHeop3zSrsX95+xdunTFcEYcgN5Tfxht801dOqY+BM3VRyhPX9le2V7ZXtle2V5g+3/CeelptwmirgAAAABJRU5ErkJggg=="); - width: 63px; height: 66px; - margin: 0 10px 5px 0; - float: left; - } - - /* icons */ - .icon { width: 16px; height: 16px; margin: 6px 4px 0; display: inline-block; } - .icon.failure { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAadQTFRF/5YA/5YC/////+3U/+/Y/5gJ/5YE/5YB/9OX/+7X/+rO/5YD/7RP/6w7/7BE/+/Z/8V3/6Yr/9Wd/5cF/5gI/8Ft/5gK/+vO/+bE/8Nv/50Y/6Mi/8Z3//rz/9ef/6gy/+/a/8qC/5gL/+fF/6kz/75l/7FD//r0/9ad/5kL/6Ac/7JL/+bD/6Eg/7th//Tm/6Qm//Pk/50W/+C2/6o3/+O8/6Af/7dU/6Ae/8qD/6Ab/6Ys/7pc/8Jt/6ct//bo//Hd/8Z4/+rN/8V0/5kI/+zR/8h8//v2/7NM/58d/7JM/608/7xh/+TA/7dW/9Sa/+3W/8Ny/6cu/6cv/7BG/7BF/5cH/5YG/5gM/5gH/8Fu/54Z/9ae/9af//Tl/58e//Db/8h9/7xi/6gw/7xf/7pb/8Br/7RQ/8Rx/7BD/6w8/96x//Dd/5sR/5cG//Ph/6Yu//Lg/8Ju/8uF/7FG/8Bs/8Fs/5kN/82K/+rP/+bC/6k2/5cJ/+XA/50X/8qE/86J/5wO/9ur/8qB/+S//8yF/8uC/9CS//ft/5cI/5sM//ju////XEMRUwAAAI10Uk5T//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8A2F5VawAAAPlJREFUeNosj2Vvw0AAQ30XTsq4csfMzMzMjO2YmZm3+9FL01myZL1PfmCJKLuLjpcRY0Jv9OqzfGFYPq1VkiDlxOaeuzh3jwYzBxNgb2jTbO6fmLT07Zh6rDrYiFQVqSa/P19dWx4fYOB7hfps2lwRWaLdR64yDo4ZbfaV0uJSSt87tG8Zq4JI0P4VCv0GQcTpVnQJEoG98/CYi0Ejog05HglN9xzPcwUZkJwy+H0EKtNVX6P35voWuRzYuvDz0bYF+LxPz85q/UdLYOpgmxAiZbnEuqhxvSQNnof5S9wVviXlVuJ59jPLWE2D9d+WMT78mBpWjPknwABNFkK/nayT6wAAAABJRU5ErkJggg=="); } - .icon.error { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAk9QTFRF////ykY0/5GK/5KK+vb1+eLg+lNG2UYz8OPg/3xz/G1j6riz9drY942E7peN6UYz0UY28kY02EY02kY17kY200c2/1RF/1VHzEY0/5uS9Uk69Onn/5aOz0Y01kg39Ojm/3Rq/nVr30s53Es76Eo6+fLw+21i9Hhw/7ex/GRY67Ks74qC9ray6kYz/v//7rKs30Yz4ltN/GZb+uPh7dPP7WNY9+Lg7VNF7dHM8c/L9FdM90Yz+WRY8VdK9+bk9ldL/nRp32JW6mJW3Ec48tTQ70k68Hxy8t3a75WM8KKb+eHf/Eo7/Pn47NzY3kY170k5+Ovq+WJW7aSb4U89+uDe/Pf2+pOL/3xy3Ew88JGI+Ozr3F1O/a2o31BB10Yz+ubk6Z+X8Hhv6s3J1kY25kg39+Ph1kY17FdK6Uk699PQ/5KL8EY09qih/W5j4oh/3EY079nZ75uS9bWx4IF270Y04l9R79/c1Uo69sTB7mpf4WZZ6JuT77aw/7Ks/nNp7Lex+fPx7lhL9uLg20k64lA+7+Dc+IF44ks67pWM9EY09+Ti5Whe2GVX5Eg67qmg6NTO8m1i/KSe8aWd0kYz9sC86tzY+ezr7kk6/5qS9NrY3UYz7pqQ4YZ89kYz7omB/7Su5p6W7YqB9uPh69vY6Ug4/Uw96NXR/8nE56Oc8HVp22hc1kYz+e7tzkYz4FxO+uHf56Ob73Rp7mZb5ZqS50s94FdJ83pw9tDM6dvX+N/d9uHf/3Rr9Us867izxEY044d99KOc7pSK9t/d8uDc////NUopuQAAAMV0Uk5T/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wA0VseRAAABBElEQVR42mI4AgLrK3SKpoSAmQxAbJwTs1xjfu3EA14QgcywGcxZTEzMMpK820EC8W2cahNydyvUqXOFb2MFCkQaWc2b6cbGlsijba+58AgDq+10p1CGNZWbohh8TF3NdzLUbBFW8mRgmBbAoDep3a9XnyGhWUBo1mxVFpaGQoP8ZOdqhgXl+2RXO7pLyx+uYk+TEN3MUK/MuLbHopWDo8xk1WRGOS0Gs1j26KRlizsO+vYXdMdFHGI4MkclOGgHH7+ux9S+lpRioDvs1vkv2Vgi2Jm9MkNkayrI6S6le+Z6i4kvtZYytIR4risvPVDRwaZx/yKob48caeJesWHvLjATIMAAiZBvi5wj6TUAAAAASUVORK5CYII="); } - .icon.success { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAn9QTFRF////BcEAWfsgGNYCA4YAINsDZPopA4QABaAAC8QAPOsOkP9TBcMABcYABccACMgAEdEAB4YADcwABMEADrcADcwAENAABsgABI8AAIMAAYoAC5gBAYwABJQABYwAApEACJoAEKwBGbMEEK4BDa0BEK0BEbMBFbcCA4gAA4oAGKsEA5MAB50ACqUBDJABD6kBG7EEPL4TLr4LHrYFKb4JM9wMJcoFJdQFN8AQSeMZWNUjDcgAEMIBF8sCG9cCJNMFK+IHMN4KNMQOPOoOPukQQ8EWSPIXS/IXTMgcTNQbT8geUPQaUeocUt8eV/cgWfogXOYmYf4mZuwtav8ta+YybvI0c/Y5d/c6d/g7hPFKivFRk+5clPFemO5jmvRln/BtpOtyreyBrfB/sOqEse2CtOqJWKAqWaErWqEsW6ItXKMuXaQuXqUvX6UwYKYxYacyYqgzY6g0ZKk1Zao2Zqs2Z6s3aKw4aa05aq46a647bK88bbA9brE+b7E/cLJAcbNBcrNCc7RDdLVEdrZFd7ZGeLdHebhIerhJe7lKfLpLfbpNfrtOf7xPgLxQgb1Rgr5Sg79ThL9UhcBVhsFXh8FYicJZisNai8NbjMRcjcRejsVfj8ZgkMZhkcdjkshkk8hllMlmlcpolsppmMtqmcxrmsxtm81unM1vnc5xns9yn89zoNB0odF2otF3pNJ5pdJ6ptN7p9R9qNR+qdV/qtWBq9aCrNeErdeFrtiGsNiIsdmJstqLs9qMtNuOtduPttyRt92SuN2Uut6Vu96XvN+YveCavuCbv+GdwOGeweKgwuKhxOOjxeSlxuSmx+WoyOWpyearyuaty+euzeiwzuiyC5FmAAAAAAF0Uk5TAEDm2GYAAACFSURBVBgZfcGhCsMwEAbg/1FPRMREVETUVRwcFCIiyk3EJRAxs2eIDaNmD7SOMtqK7fuAfwRXMnmcCb+Sw0H4qaoWQAjYzNOaggwWkBBnIHDPqs4CHNce4sK9JnUWwJCpNZFGJXmPD7cUYxrdKwt2/kabyoovl4hIMg5jeTDhbBSDK8JPb8CGNtTmyz9LAAAAAElFTkSuQmCC"); } - - /* 960gs */ - body{min-width:1200px} - .container_8{margin-left:auto;margin-right:auto;width:1200px} - .grid_1,.grid_2,.grid_3,.grid_4,.grid_5,.grid_6,.grid_7,.grid_8{display:inline;float:left;position:relative;margin-left:15px;margin-right:15px} - .push_1,.pull_1,.push_2,.pull_2,.push_3,.pull_3,.push_4,.pull_4,.push_5,.pull_5,.push_6,.pull_6,.push_7,.pull_7,.push_8,.pull_8{position:relative} - .alpha{margin-left:0} - .omega{margin-right:0} - .container_8 .grid_1{width:120px} - .container_8 .grid_2{width:270px} - .container_8 .grid_3{width:420px} - .container_8 .grid_4{width:570px} - .container_8 .grid_5{width:720px} - .container_8 .grid_6{width:870px} - .container_8 .grid_7{width:1020px} - .container_8 .grid_8{width:1170px} - .container_8 .prefix_1{padding-left:150px} - .container_8 .prefix_2{padding-left:300px} - .container_8 .prefix_3{padding-left:450px} - .container_8 .prefix_4{padding-left:600px} - .container_8 .prefix_5{padding-left:750px} - .container_8 .prefix_6{padding-left:900px} - .container_8 .prefix_7{padding-left:1050px} - .container_8 .suffix_1{padding-right:150px} - .container_8 .suffix_2{padding-right:300px} - .container_8 .suffix_3{padding-right:450px} - .container_8 .suffix_4{padding-right:600px} - .container_8 .suffix_5{padding-right:750px} - .container_8 .suffix_6{padding-right:900px} - .container_8 .suffix_7{padding-right:1050px} - .container_8 .push_1{left:150px} - .container_8 .push_2{left:300px} - .container_8 .push_3{left:450px} - .container_8 .push_4{left:600px} - .container_8 .push_5{left:750px} - .container_8 .push_6{left:900px} - .container_8 .push_7{left:1050px} - .container_8 .pull_1{left:-150px} - .container_8 .pull_2{left:-300px} - .container_8 .pull_3{left:-450px} - .container_8 .pull_4{left:-600px} - .container_8 .pull_5{left:-750px} - .container_8 .pull_6{left:-900px} - .container_8 .pull_7{left:-1050px} - .clear{clear:both;display:block;overflow:hidden;visibility:hidden;width:0;height:0} - .clearfix:before,.clearfix:after{content:'\0020';display:block;overflow:hidden;visibility:hidden;width:0;height:0} - .clearfix:after{clear:both} - .clearfix{zoom:1} - - - \ No newline at end of file diff --git a/target/test-reports/plain/.gitignore b/target/test-reports/plain/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/target/work/plugin-provided-classes/.gitignore b/target/work/plugin-provided-classes/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/target/work/plugins/cache-1.1.1/CacheGrailsPlugin.groovy b/target/work/plugins/cache-1.1.1/CacheGrailsPlugin.groovy deleted file mode 100644 index c06771c..0000000 --- a/target/work/plugins/cache-1.1.1/CacheGrailsPlugin.groovy +++ /dev/null @@ -1,207 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import grails.plugin.cache.CacheBeanPostProcessor -import grails.plugin.cache.CacheConfigArtefactHandler -import grails.plugin.cache.ConfigLoader -import grails.plugin.cache.CustomCacheKeyGenerator -import grails.plugin.cache.GrailsConcurrentMapCacheManager -import grails.plugin.cache.web.ProxyAwareMixedGrailsControllerHelper -import grails.plugin.cache.web.filter.DefaultWebKeyGenerator -import grails.plugin.cache.web.filter.ExpressionEvaluator -import grails.plugin.cache.web.filter.NoOpFilter -import grails.plugin.cache.web.filter.simple.MemoryPageFragmentCachingFilter - -import org.codehaus.groovy.grails.commons.GrailsApplication -import org.slf4j.Logger -import org.slf4j.LoggerFactory -import org.springframework.cache.Cache -import org.springframework.core.Ordered -import org.springframework.web.filter.DelegatingFilterProxy - -class CacheGrailsPlugin { - - private final Logger log = LoggerFactory.getLogger('grails.plugin.cache.CacheGrailsPlugin') - - def version = '1.1.1' - def grailsVersion = '2.0 > *' - def observe = ['controllers', 'services'] - def loadAfter = ['controllers', 'services'] - def artefacts = [CacheConfigArtefactHandler] - def watchedResources = [ - 'file:./grails-app/conf/**/*CacheConfig.groovy', - 'file:./plugins/*/grails-app/conf/**/*CacheConfig.groovy' - ] - - def title = 'Cache Plugin' - def author = 'Jeff Brown' - def authorEmail = 'jbrown@vmware.com' - def description = 'Grails Cache Plugin' - def documentation = 'http://grails-plugins.github.com/grails-cache/' - - def license = 'APACHE' - def organization = [name: 'SpringSource', url: 'http://www.springsource.org/'] - def developers = [[name: 'Burt Beckwith', email: 'beckwithb@vmware.com']] - def issueManagement = [system: 'JIRA', url: 'http://jira.grails.org/browse/GPCACHE'] - def scm = [url: 'https://github.com/grails-plugins/grails-cache'] - - def pluginExcludes = [ - '**/com/demo/**', - 'grails-app/conf/TestCacheConfig.groovy', - 'grails-app/views/**', - 'grails-app/i18n/**', - 'web-app/**', - 'docs/**', - 'src/docs/**' - ] - - def getWebXmlFilterOrder() { - def FilterManager = getClass().getClassLoader().loadClass('grails.plugin.webxml.FilterManager') - [grailsCacheFilter: FilterManager.URL_MAPPING_POSITION + 1000] - } - - def doWithWebDescriptor = {xml -> - if (!isEnabled(application)) { - return - } - - def filters = xml.filter - def lastFilter = filters[filters.size() - 1] - lastFilter + { - filter { - 'filter-name'('grailsCacheFilter') - 'filter-class'(DelegatingFilterProxy.name) - 'init-param' { - 'param-name'('targetFilterLifecycle') - 'param-value'('true') - } - } - } - - def filterMappings = xml.'filter-mapping' - def lastMapping = filterMappings[filterMappings.size() - 1] - lastMapping + { - 'filter-mapping' { - 'filter-name'('grailsCacheFilter') - 'url-pattern'('*.dispatch') - 'dispatcher'('FORWARD') - 'dispatcher'('INCLUDE') - } - } - } - - def doWithSpring = { - - if (!isEnabled(application)) { - log.warn 'Cache plugin is disabled' - grailsCacheFilter(NoOpFilter) - return - } - - def cacheConfig = application.config.grails.cache - def proxyTargetClass = cacheConfig.proxyTargetClass - if (!(proxyTargetClass instanceof Boolean)) proxyTargetClass = false - def order = cacheConfig.aopOrder - if (!(order instanceof Number)) order = Ordered.LOWEST_PRECEDENCE - // allow user can to use their own key generator. - def cacheKeyGen = cacheConfig.keyGenerator ?: 'customCacheKeyGenerator' - customCacheKeyGenerator(CustomCacheKeyGenerator) - - xmlns cache: 'http://www.springframework.org/schema/cache' - - // creates 3 beans: org.springframework.cache.config.internalCacheAdvisor (org.springframework.cache.interceptor.BeanFactoryCacheOperationSourceAdvisor), - // org.springframework.cache.annotation.AnnotationCacheOperationSource#0 (org.springframework.cache.annotation.AnnotationCacheOperationSource), - // org.springframework.cache.interceptor.CacheInterceptor#0 (org.springframework.cache.interceptor.CacheInterceptor) - - cache.'annotation-driven'('cache-manager': 'grailsCacheManager' ,'key-generator': cacheKeyGen, - mode: 'proxy', order: order, 'proxy-target-class': proxyTargetClass) - - // updates the AnnotationCacheOperationSource with a custom subclass - // and adds the 'cacheOperationSource' alias - cacheBeanPostProcessor(CacheBeanPostProcessor) - - grailsCacheManager(GrailsConcurrentMapCacheManager) - - grailsCacheConfigLoader(ConfigLoader) - - webCacheKeyGenerator(DefaultWebKeyGenerator) - - webExpressionEvaluator(ExpressionEvaluator) - - grailsCacheFilter(MemoryPageFragmentCachingFilter) { - cacheManager = ref('grailsCacheManager') - cacheOperationSource = ref('cacheOperationSource') - keyGenerator = ref('webCacheKeyGenerator') - expressionEvaluator = ref('webExpressionEvaluator') - } - - grailsControllerHelper(ProxyAwareMixedGrailsControllerHelper) { - grailsApplication = ref('grailsApplication') - } - } - - def doWithApplicationContext = { ctx -> - reloadCaches ctx - - def cacheConfig = ctx.grailsApplication.config.grails.cache - if (cacheConfig.clearAtStartup instanceof Boolean && cacheConfig.clearAtStartup) { - def grailsCacheManager = ctx.grailsCacheManager - for (String cacheName in grailsCacheManager.cacheNames) { - log.info "Clearing cache $cacheName" - Cache cache = grailsCacheManager.getCache(cacheName) - cache.clear() - } - } - } - - def onChange = { event -> - - def application = event.application - if (!isEnabled(application)) { - return - } - - def source = event.source - if (!source) { - return - } - - if (application.isControllerClass(source) || application.isServiceClass(source)) { - event.ctx.cacheOperationSource.reset() - log.debug 'Reset GrailsAnnotationCacheOperationSource cache' - } - else if (application.isCacheConfigClass(source)) { - reloadCaches event.ctx - } - } - - def onConfigChange = { event -> - reloadCaches event.ctx - } - - private void reloadCaches(ctx) { - - if (!isEnabled(ctx.grailsApplication)) { - return - } - - ctx.grailsCacheConfigLoader.reload ctx - log.debug 'Reloaded grailsCacheConfigLoader' - } - - private boolean isEnabled(GrailsApplication application) { - def enabled = application.config.grails.cache.enabled - enabled == null || enabled != false - } -} diff --git a/target/work/plugins/cache-1.1.1/application.properties b/target/work/plugins/cache-1.1.1/application.properties deleted file mode 100644 index e151936..0000000 --- a/target/work/plugins/cache-1.1.1/application.properties +++ /dev/null @@ -1 +0,0 @@ -app.grails.version=2.0.4 diff --git a/target/work/plugins/cache-1.1.1/dependencies.groovy b/target/work/plugins/cache-1.1.1/dependencies.groovy deleted file mode 100644 index a11c68d..0000000 --- a/target/work/plugins/cache-1.1.1/dependencies.groovy +++ /dev/null @@ -1,47 +0,0 @@ -import grails.util.Environment - -grails.project.work.dir = 'target' -grails.project.docs.output.dir = 'docs/manual' // for gh-pages branch -grails.project.source.level = 1.6 - -grails.project.dependency.resolution = { - - inherits 'global' - log 'warn' - - repositories { - grailsCentral() - } - - dependencies { - build('net.sourceforge.nekohtml:nekohtml:1.9.14') { - excludes "xml-apis" - export = false - } - - test 'org.codehaus.gpars:gpars:1.0.0', { - export = false - } - test 'org.codehaus.jsr166-mirror:jsr166y:1.7.0', { - export = false - } - } - - plugins { - build(":tomcat:$grailsVersion") { - export = false - } - runtime(":hibernate:$grailsVersion") { - export = false - } - if (Environment.current != Environment.TEST) { - build ':release:2.2.1', ':rest-client-builder:1.0.3', { - export = false - } - } - test(':functional-test:1.2.7', ':spock:0.6') { - export = false - } - compile ':webxml:1.4.1' - } -} diff --git a/target/work/plugins/cache-1.1.1/grails-app/conf/DefaultCacheConfig.groovy b/target/work/plugins/cache-1.1.1/grails-app/conf/DefaultCacheConfig.groovy deleted file mode 100644 index 1eea192..0000000 --- a/target/work/plugins/cache-1.1.1/grails-app/conf/DefaultCacheConfig.groovy +++ /dev/null @@ -1,8 +0,0 @@ -config = { - cache { - name 'grailsBlocksCache' - } - cache { - name 'grailsTemplatesCache' - } -} diff --git a/target/work/plugins/cache-1.1.1/grails-app/services/grails/plugin/cache/GrailsCacheAdminService.groovy b/target/work/plugins/cache-1.1.1/grails-app/services/grails/plugin/cache/GrailsCacheAdminService.groovy deleted file mode 100644 index d666a9d..0000000 --- a/target/work/plugins/cache-1.1.1/grails-app/services/grails/plugin/cache/GrailsCacheAdminService.groovy +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache - -import grails.plugin.cache.CacheEvict - -class GrailsCacheAdminService { - - static transactional = false - - @CacheEvict(value="grailsBlocksCache", allEntries=true) - def clearBlocksCache() {} - - @CacheEvict(value="grailsTemplatesCache", allEntries=true) - def clearTemplatesCache() {} -} diff --git a/target/work/plugins/cache-1.1.1/grails-app/taglib/grails/plugin/cache/CacheTagLib.groovy b/target/work/plugins/cache-1.1.1/grails-app/taglib/grails/plugin/cache/CacheTagLib.groovy deleted file mode 100644 index 8bc73ae..0000000 --- a/target/work/plugins/cache-1.1.1/grails-app/taglib/grails/plugin/cache/CacheTagLib.groovy +++ /dev/null @@ -1,124 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache - -import grails.plugin.cache.util.ClassUtils - -import org.codehaus.groovy.grails.web.pages.GroovyPageTemplate -import org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequest -import org.codehaus.groovy.grails.web.util.StreamCharBuffer -import org.springframework.web.context.request.RequestContextHolder - -class CacheTagLib { - - static namespace = 'cache' - - def grailsCacheManager - def groovyPagesTemplateRenderer - - /** - * Renders a block of markup and caches the result so the next time the same block - * is rendered, it does not need to be evaluated again. - * - * @attr key An optional cache key allowing the same block to be cached with different content - */ - def block = { attrs, body -> - if (!grailsCacheManager) { - out << body() - return - } - - def cache = grailsCacheManager.getCache('grailsBlocksCache') - def bodyClosure = ClassUtils.getPropertyOrFieldValue(body, 'bodyClosure') - def closureClass = bodyClosure.getClass() - def key = closureClass.getName() - if (attrs.key) { - key += ':' + attrs.key - } - - def content = cache.get(key) - if (content == null) { - content = cloneIfNecessary(body()) - cache.put(key, content) - } - else { - content = content.get() - } - - out << content - } - - /** - * Renders a GSP template and caches the result so the next time the same template - * is rendered, it does not need to be evaluated again. - * - * @attr template REQUIRED The name of the template to apply - * @attr key An optional cache key allowing the same template to be cached with different content - * @attr contextPath the context path to use (relative to the application context path). Defaults to "" or path to the plugin for a plugin view or template. - * @attr bean The bean to apply the template against - * @attr model The model to apply the template against as a java.util.Map - * @attr collection A collection of model objects to apply the template to - * @attr var The variable name of the bean to be referenced in the template - * @attr plugin The plugin to look for the template in - */ - def render = { attrs -> - if (!grailsCacheManager) { - out << g.render(attrs) - return - } - - def key = calculateFullKey(attrs.template, attrs.contextPath, attrs.plugin) - if (attrs.key) { - key += ':' + attrs.key - } - - def cache = grailsCacheManager.getCache('grailsTemplatesCache') - def content = cache.get(key) - if (content == null) { - content = cloneIfNecessary(g.render(attrs)) - cache.put(key, content) - } - else { - content = content.get() - } - out << content - } - - protected String calculateFullKey(String templateName, String contextPath, String pluginName) { - GrailsWebRequest webRequest = RequestContextHolder.currentRequestAttributes() - String uri = webRequest.attributes.getTemplateUri(templateName, webRequest.request) - - GroovyPageTemplate t = groovyPagesTemplateRenderer.findAndCacheTemplate( - webRequest, pageScope, templateName, contextPath, pluginName, uri) - if (!t) { - throwTagError("Template not found for name [$templateName] and path [$uri]") - } - - t.metaInfo.pageClass.name - } - - protected cloneIfNecessary(content) { - if (content instanceof StreamCharBuffer) { - if (content instanceof Cloneable) { - content = content.clone() - } - else { - // pre Grails 2.3 - content = content.toString() - } - } - content - } -} diff --git a/target/work/plugins/cache-1.1.1/plugin.xml b/target/work/plugins/cache-1.1.1/plugin.xml deleted file mode 100644 index b62dddb..0000000 --- a/target/work/plugins/cache-1.1.1/plugin.xml +++ /dev/null @@ -1,41 +0,0 @@ - - Jeff Brown - jbrown@vmware.com - Cache Plugin - Grails Cache Plugin - http://grails-plugins.github.com/grails-cache/ - CacheGrailsPlugin - - DefaultCacheConfig - TestCacheConfig - com.demo.DemoController - com.demo.PersonController - com.demo.Person - com.demo.BasicCachingService - grails.plugin.cache.GrailsCacheAdminService - grails.plugin.cache.CacheTagLib - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/target/work/plugins/cache-1.1.1/src/groovy/grails/plugin/cache/ConfigBuilder.groovy b/target/work/plugins/cache-1.1.1/src/groovy/grails/plugin/cache/ConfigBuilder.groovy deleted file mode 100644 index f341f61..0000000 --- a/target/work/plugins/cache-1.1.1/src/groovy/grails/plugin/cache/ConfigBuilder.groovy +++ /dev/null @@ -1,175 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache - -import grails.util.Environment - -import org.slf4j.Logger -import org.slf4j.LoggerFactory - -/** - * @author Jeff Brown - * @author Burt Beckwith - */ -class ConfigBuilder extends BuilderSupport { - - protected static final List CACHE_PARAM_NAMES = ['env', 'name'] - - List cacheNames = [] - - protected Map _current - protected List _stack = [] - protected List> _caches = [] - protected int _unrecognizedElementDepth = 0 - protected final Logger _log = LoggerFactory.getLogger(getClass()) - - /** - * Convenience method to parse a config closure. - * @param c the closure - */ - void parse(Closure c) { - c.delegate = this - c.resolveStrategy = Closure.DELEGATE_FIRST - c() - - resolveCaches() - } - - void parse(o) { - // if there's no explicit method, the missing method logic kicks in and fails poorly - throw new IllegalArgumentException('parse must be called with a Closure argument') - } - - @Override - protected createNode(name) { - if (_unrecognizedElementDepth) { - _unrecognizedElementDepth++ - _log.warn "ignoring node $name contained in unrecognized parent node" - return - } - - _log.trace "createNode $name" - - switch (name) { - case 'cache': - case 'domain': - _current = [:] - _caches << _current - _stack.push name - return name - } - - _unrecognizedElementDepth++ - _log.warn "Cannot create empty node with name '$name'" - } - - @Override - protected createNode(name, value) { - if (_unrecognizedElementDepth) { - _unrecognizedElementDepth++ - _log.warn "ignoring node $name with value $value contained in unrecognized parent node" - return - } - - _log.trace "createNode $name, value: $value" - - String level = _stack[-1] - _stack.push name - - switch (level) { - case 'domain': - case 'cache': - if (('name' == name || 'cache' == name || 'domain' == name) && value instanceof Class) { - value = value.name - } - - if ('name' == name || 'cache' == name || 'domain' == name || name in CACHE_PARAM_NAMES) { - _current[name] = value - return name - } - - break - } - - _unrecognizedElementDepth++ - _log.warn "Cannot create node with name '$name' and value '$value' for parent '$level'" - } - - @Override - protected createNode(name, Map attributes) { - if (_unrecognizedElementDepth) { - _unrecognizedElementDepth++ - _log.warn "ignoring node $name with attributes $attributes contained in unrecognized parent node" - return - } - - _log.trace "createNode $name + attributes: $attributes" - } - - @Override - protected createNode(name, Map attributes, value) { - if (_unrecognizedElementDepth) { - _unrecognizedElementDepth++ - _log.warn "ignoring node $name with value $value and attributes $attributes contained in unrecognized parent node" - return - } - - _log.trace "createNode $name + value: $value attributes: $attributes" - } - - @Override - protected void setParent(parent, child) { - _log.trace "setParent $parent, child: $child" - // do nothing - } - - @Override - protected void nodeCompleted(parent, node) { - _log.trace "nodeCompleted $parent $node" - - if (_unrecognizedElementDepth) { - _unrecognizedElementDepth-- - } - else { - _stack.pop() - } - } - - protected boolean isValidInEnv(Map data, String env) { - def environments = data.remove('env') ?: [] - if (!(environments instanceof List)) { - environments = [environments] - } - - environments.isEmpty() || environments.contains(env) - } - - protected void resolveCaches() { - String env = Environment.current.name - - for (data in _caches) { - if (!isValidInEnv(data, env)) { - _log.debug "skipping cache $data.name since it's not valid in env '$env'" - continue - } - String name = data.name - if (!name) { - _log.warn 'ignoring cache specified with no name' - continue - } - cacheNames << name - } - } -} diff --git a/target/work/plugins/cache-1.1.1/src/groovy/grails/plugin/cache/ConfigLoader.groovy b/target/work/plugins/cache-1.1.1/src/groovy/grails/plugin/cache/ConfigLoader.groovy deleted file mode 100644 index 65e8f80..0000000 --- a/target/work/plugins/cache-1.1.1/src/groovy/grails/plugin/cache/ConfigLoader.groovy +++ /dev/null @@ -1,131 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache - -import org.codehaus.groovy.grails.commons.GrailsApplication -import org.slf4j.Logger -import org.slf4j.LoggerFactory -import org.springframework.context.ApplicationContext - -import grails.plugin.cache.CacheConfigArtefactHandler.CacheConfigGrailsClass -import grails.util.Environment - -/** - * @author Burt Beckwith - */ -class ConfigLoader { - - static final int DEFAULT_ORDER = 1000 - - protected Logger log = LoggerFactory.getLogger(getClass()) - - /** - * Reload the cache configuration from Config.groovy and *CacheConfig.groovy files. - * - * @param ctx the application context - */ - void reload(ApplicationContext ctx) { - def application = ctx.grailsApplication - List configs = loadOrderedConfigs(application) - reload configs, ctx - } - - /** - * Reload the cache configuration from the specified config objects. - * - * @param configs ordered ConfigObjects, typically from loadOrderedConfigs(); must contain - * a 'config' closure defining cache(s). - * @param ctx the application context - */ - void reload(List configs, ApplicationContext ctx) { - - def configuredCacheNames = [] as LinkedHashSet - for (ConfigObject co : configs) { - ConfigBuilder builder = new ConfigBuilder() - if (co.config instanceof Closure) { - builder.parse co.config - } - configuredCacheNames.addAll builder.cacheNames - } - - GrailsCacheManager cacheManager = ctx.grailsCacheManager - - for (String name in cacheManager.cacheNames) { - if (!configuredCacheNames.contains(name)) { - cacheManager.destroyCache name - } - } - - for (String cacheName in configuredCacheNames) { - cacheManager.getCache cacheName - } - } - - /** - * Retrieve ConfigObject instances from Config.groovy and *CacheConfig.groovy files. - * @param application the application - * @return the configs, ordered by their 'order' value (or the default value of 1000 if not specified) - */ - List loadOrderedConfigs(GrailsApplication application) { - ConfigSlurper slurper = new ConfigSlurper(Environment.current.name) - - List configs = [] - def cacheConfig - for (configClass in application.cacheConfigClasses) { - def config = slurper.parse(configClass.clazz) - cacheConfig = config.config - if ((cacheConfig instanceof Closure) && processConfig(config, configClass)) { - configs << config - log.debug "Including configs from $configClass.name with order $cacheConfig.order" - } - else { - log.debug "Not including configs from $configClass.name" - } - } - - cacheConfig = application.config.grails.cache - - if ((cacheConfig.config instanceof Closure) && processConfig(cacheConfig, null)) { - configs << cacheConfig - log.debug "Including configs from Config.groovy with order $cacheConfig.order" - } - else { - log.debug "Not including configs from Config.groovy" - } - - sortConfigs configs - - configs - } - - protected boolean processConfig(ConfigObject config, CacheConfigGrailsClass configClass) { - if (config.config instanceof Closure) { - def order = config.order - if (!(order instanceof Number)) { - config.order = DEFAULT_ORDER - } - config._sourceClassName = configClass == null ? 'Config' : configClass.clazz.name - return true - } - - false - } - - protected void sortConfigs(List configs) { - configs.sort { c1, c2 -> - c1.order == c2.order ? c1._sourceClassName <=> c2._sourceClassName : c1.order <=> c2.order - } - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/BlockingCache.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/BlockingCache.java deleted file mode 100644 index 50c0bed..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/BlockingCache.java +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache; - -/** - * @author Burt Beckwith - */ -public interface BlockingCache extends GrailsCache { - - CacheConfiguration getCacheConfiguration(); - - boolean isDisabled(); - - void setTimeoutMillis(int blockingTimeoutMillis); -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/CacheBeanPostProcessor.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/CacheBeanPostProcessor.java deleted file mode 100644 index 1e17ce6..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/CacheBeanPostProcessor.java +++ /dev/null @@ -1,94 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.MutablePropertyValues; -import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; -import org.springframework.beans.factory.config.RuntimeBeanReference; -import org.springframework.beans.factory.support.AbstractBeanDefinition; -import org.springframework.beans.factory.support.BeanDefinitionRegistry; -import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor; -import org.springframework.cache.annotation.AnnotationCacheOperationSource; - -/** - * Changes the bean class of the org.springframework.cache.annotation.AnnotationCacheOperationSource#0 - * bean to a custom subclass. - * - * @author Burt Beckwith - */ -public class CacheBeanPostProcessor implements BeanDefinitionRegistryPostProcessor { - - protected Logger log = LoggerFactory.getLogger(getClass()); - - public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) { - log.info("postProcessBeanDefinitionRegistry start"); - - AbstractBeanDefinition beanDef = findBeanDefinition(registry); - if (beanDef == null) { - log.error("Unable to find the AnnotationCacheOperationSource bean definition"); - return; - } - - // change the class to the plugin's subclass - beanDef.setBeanClass(GrailsAnnotationCacheOperationSource.class); - - // wire in the dependency for the grailsApplication - MutablePropertyValues props = beanDef.getPropertyValues(); - if (props == null) { - props = new MutablePropertyValues(); - beanDef.setPropertyValues(props); - } - props.addPropertyValue("grailsApplication", new RuntimeBeanReference("grailsApplication", true)); - - log.debug("updated {}", beanDef); - } - - protected AbstractBeanDefinition findBeanDefinition(BeanDefinitionRegistry registry) { - - AbstractBeanDefinition beanDef = null; - String beanName = null; - - if (registry.containsBeanDefinition(GrailsAnnotationCacheOperationSource.BEAN_NAME)) { - beanDef = (AbstractBeanDefinition)registry.getBeanDefinition( - GrailsAnnotationCacheOperationSource.BEAN_NAME); - beanName = GrailsAnnotationCacheOperationSource.BEAN_NAME; - } - else { - String className = AnnotationCacheOperationSource.class.getName(); - for (String name : registry.getBeanDefinitionNames()) { - if (className.equals(registry.getBeanDefinition(name).getBeanClassName())) { - beanDef = (AbstractBeanDefinition)registry.getBeanDefinition(name); - beanName = name; - break; - } - } - } - - if (beanDef != null) { - // make it easier to work with - if (!"cacheOperationSource".equals(beanName)) { - registry.registerAlias(beanName, "cacheOperationSource"); - } - } - - return beanDef; - } - - public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) { - log.info("postProcessBeanFactory"); - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/CacheConfigArtefactHandler.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/CacheConfigArtefactHandler.java deleted file mode 100644 index a2e206e..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/CacheConfigArtefactHandler.java +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache; - -import groovy.lang.GroovySystem; -import groovy.lang.MetaClass; - -import org.codehaus.groovy.grails.commons.AbstractInjectableGrailsClass; -import org.codehaus.groovy.grails.commons.ArtefactHandlerAdapter; -import org.codehaus.groovy.grails.commons.InjectableGrailsClass; -import org.springframework.beans.factory.config.AutowireCapableBeanFactory; -import org.springframework.context.ConfigurableApplicationContext; - -/** - * Artefact handler for CacheConfig classes. - * - * @author Burt Beckwith - */ -public class CacheConfigArtefactHandler extends ArtefactHandlerAdapter { - - /** The artefact type. */ - public static final String TYPE = "CacheConfig"; - - /** - * Default constructor. - */ - public CacheConfigArtefactHandler() { - super(TYPE, CacheConfigGrailsClass.class, DefaultCacheConfigGrailsClass.class, TYPE); - } - - /** - * GrailsClass interface for CacheConfig definitions. - */ - public static interface CacheConfigGrailsClass extends InjectableGrailsClass { - // no methods - } - - /** - * Default implementation of CacheConfigGrailsClass. - */ - public static class DefaultCacheConfigGrailsClass extends AbstractInjectableGrailsClass - implements CacheConfigGrailsClass { - - /** - * Default constructor. - * @param wrappedClass - */ - public DefaultCacheConfigGrailsClass(Class wrappedClass) { - super(wrappedClass, CacheConfigArtefactHandler.TYPE); - } - - @Override - public MetaClass getMetaClass() { - // Workaround for http://jira.codehaus.org/browse/GRAILS-4542 - return GroovySystem.getMetaClassRegistry().getMetaClass(DefaultCacheConfigGrailsClass.class); - } - - @Override - public Object newInstance() { - Object instance = super.newInstance(); - autowireBeanProperties(instance); - return instance; - } - - protected void autowireBeanProperties(Object instance) { - ConfigurableApplicationContext ctx = (ConfigurableApplicationContext)grailsApplication.getMainContext(); - ctx.getBeanFactory().autowireBeanProperties(instance, - AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false); - } - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/CacheConfiguration.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/CacheConfiguration.java deleted file mode 100644 index f712bb5..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/CacheConfiguration.java +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache; - -/** - * @author Burt Beckwith - */ -public interface CacheConfiguration { - - long getTimeToLiveSeconds(); - - boolean isEternal(); -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/CacheEvict.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/CacheEvict.java deleted file mode 100644 index a83f98d..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/CacheEvict.java +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.codehaus.groovy.transform.GroovyASTTransformationClass; - -/** - * Indicates that a method (or all methods on a class) trigger(s) - * a cache invalidate operation. - * - * @author Jeff Brown - */ -@Target({ElementType.METHOD, ElementType.TYPE}) -@Retention(RetentionPolicy.RUNTIME) -@Inherited -@Documented -@GroovyASTTransformationClass("grails.plugin.cache.compiler.CacheTransformation") -public @interface CacheEvict { - - /** - * Qualifier value for the specified cached operation. - *

May be used to determine the target cache (or caches), matching the qualifier - * value (or the bean name(s)) of (a) specific bean definition. - */ - String[] value(); - - /** - * Spring Expression Language (SpEL) attribute for computing the key dynamically. - *

Default is "", meaning all method parameters are considered as a key. - */ - String key() default ""; - - /** - * Spring Expression Language (SpEL) attribute used for conditioning the method caching. - *

Default is "", meaning the method is always cached. - */ - String condition() default ""; - - /** - * Whether or not all the entries inside the cache(s) are removed or not. By - * default, only the value under the associated key is removed. - *

Note that specifying setting this parameter to true and specifying a - * {@link CacheKey key} is not allowed. - */ - boolean allEntries() default false; - - /** - * Whether the eviction should occur after the method is successfully invoked (default) - * or before. The latter causes the eviction to occur irrespective of the method outcome (whether - * it threw an exception or not) while the former does not. - */ - boolean beforeInvocation() default false; -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/CachePut.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/CachePut.java deleted file mode 100644 index 376a41c..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/CachePut.java +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.codehaus.groovy.transform.GroovyASTTransformationClass; - -/** - * Indicates that a method (or all methods on a class) trigger(s) - * a {@link Cache#put(Object, Object)} operation. As opposed to {@link Cacheable} annotation, - * this annotation does not cause the target method to be skipped - rather it - * always causes the method to be invoked and its result to be placed into the cache. - * - * @author Jeff Brown - */ -@Target({ ElementType.METHOD, ElementType.TYPE }) -@Retention(RetentionPolicy.RUNTIME) -@Inherited -@Documented -@GroovyASTTransformationClass("grails.plugin.cache.compiler.CacheTransformation") -public @interface CachePut { - - /** - * Name of the caches in which the update takes place. - *

May be used to determine the target cache (or caches), matching the - * qualifier value (or the bean name(s)) of (a) specific bean definition. - */ - String[] value(); - - /** - * Spring Expression Language (SpEL) attribute for computing the key dynamically. - *

Default is "", meaning all method parameters are considered as a key. - */ - String key() default ""; - - /** - * Spring Expression Language (SpEL) attribute used for conditioning the cache update. - *

Default is "", meaning the method result is always cached. - */ - String condition() default ""; -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/Cacheable.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/Cacheable.java deleted file mode 100644 index 8117fc0..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/Cacheable.java +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.codehaus.groovy.transform.GroovyASTTransformationClass; - -/** - * Indicates that a method (or all the methods on a class) can be cached. - * - *

The method arguments and signature are used for computing the key while the - * returned instance is used as the cache value. - * - * @author Jeff Brown - */ -@Target({ElementType.METHOD, ElementType.TYPE}) -@Retention(RetentionPolicy.RUNTIME) -@Inherited -@Documented -@GroovyASTTransformationClass("grails.plugin.cache.compiler.CacheTransformation") -public @interface Cacheable { - - /** - * Name of the caches in which the update takes place. - *

May be used to determine the target cache (or caches), matching the - * qualifier value (or the bean name(s)) of (a) specific bean definition. - */ - String[] value(); - - /** - * Spring Expression Language (SpEL) attribute for computing the key dynamically. - *

Default is "", meaning all method parameters are considered as a key. - */ - String key() default ""; - - /** - * Spring Expression Language (SpEL) attribute used for conditioning the method caching. - *

Default is "", meaning the method is always cached. - */ - String condition() default ""; -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/CustomCacheKeyGenerator.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/CustomCacheKeyGenerator.java deleted file mode 100644 index 4d8263b..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/CustomCacheKeyGenerator.java +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright 2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache; - -import org.springframework.aop.framework.AopProxyUtils; -import org.springframework.cache.interceptor.KeyGenerator; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * Generate better cache key, compare to {@link org.springframework.cache.interceptor.DefaultKeyGenerator} - */ -public class CustomCacheKeyGenerator implements KeyGenerator { - - public Object generate(Object target, Method method, Object... params) { - Class objClass = AopProxyUtils.ultimateTargetClass(target); - List cacheKey = new ArrayList(4); - cacheKey.add(objClass.getName().intern()); - cacheKey.add(System.identityHashCode(target)); - cacheKey.add(method.toString().intern()); - if (params != null) { - cacheKey.addAll(Arrays.asList(params)); - } - return cacheKey; - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/GrailsAnnotationCacheOperationSource.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/GrailsAnnotationCacheOperationSource.java deleted file mode 100644 index 3e67bd7..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/GrailsAnnotationCacheOperationSource.java +++ /dev/null @@ -1,283 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache; - -import java.io.Serializable; -import java.lang.reflect.AnnotatedElement; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedHashSet; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -import org.codehaus.groovy.grails.commons.ControllerArtefactHandler; -import org.codehaus.groovy.grails.commons.GrailsApplication; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.cache.annotation.CacheAnnotationParser; -import org.springframework.cache.annotation.SpringCacheAnnotationParser; -import org.springframework.cache.interceptor.CacheOperation; -import org.springframework.cache.interceptor.CacheOperationSource; -import org.springframework.core.BridgeMethodResolver; -import org.springframework.util.ClassUtils; -import org.springframework.util.ObjectUtils; - -/** - * getCacheOperations is called when beans are initialized and also from - * PageFragmentCachingFilter during requests; the filter needs annotations on - * controllers but if the standard lookup includes controllers, the return - * values from the controller method calls are cached unnecessarily. - * - * Based on org.springframework.cache.annotation.AnnotationCacheOperationSource. - * - * @author Costin Leau - * @author Burt Beckwith - */ -public class GrailsAnnotationCacheOperationSource implements CacheOperationSource, Serializable { - - private static final long serialVersionUID = 1; - - public static final String BEAN_NAME = "org.springframework.cache.annotation.AnnotationCacheOperationSource#0"; - - /** - * Canonical value held in cache to indicate no caching attribute was - * found for this method and we don't need to look again. - */ - protected static final Collection NULL_CACHING_ATTRIBUTE = Collections.emptyList(); - - protected GrailsApplication application; - protected boolean publicMethodsOnly = true; - protected Logger logger = LoggerFactory.getLogger(getClass()); - - protected final Set annotationParsers = - new LinkedHashSet(1); - - /** - * Cache of CacheOperations, keyed by DefaultCacheKey (Method + target Class). - */ - protected final Map> attributeCache = - new ConcurrentHashMap>(); - - /** - * Constructor. - */ - public GrailsAnnotationCacheOperationSource() { - annotationParsers.add(new SpringCacheAnnotationParser()); - } - - public Collection getCacheOperations(Method method, Class targetClass, - boolean includeControllers) { - - if (!includeControllers && isControllerClass(targetClass)) { - return null; - } - - // will typically be called with includeControllers = true (i.e. from the filter) - // so controller methods will be considered - return doGetCacheOperations(method, targetClass); - } - - public Collection getCacheOperations(Method method, Class targetClass) { - - // exclude controllers when called directly - - if (isControllerClass(targetClass)) { - return null; - } - - return doGetCacheOperations(method, targetClass); - } - - /** - * Determine the caching attribute for this method invocation. - *

Defaults to the class's caching attribute if no method attribute is found. - * @param method the method for the current invocation (never {@code null}) - * @param targetClass the target class for this invocation (may be {@code null}) - * @return {@link CacheOperation} for this method, or {@code null} if the method - * is not cacheable - */ - protected Collection doGetCacheOperations(Method method, Class targetClass) { - // First, see if we have a cached value. - Object cacheKey = getCacheKey(method, targetClass); - Collection cached = attributeCache.get(cacheKey); - if (cached == null) { - // We need to work it out. - Collection cacheOps = computeCacheOperations(method, targetClass); - // Put it in the cache. - if (cacheOps == null) { - attributeCache.put(cacheKey, NULL_CACHING_ATTRIBUTE); - } - else { - logger.debug("Adding cacheable method '{}' with attribute: {}", method.getName(), cacheOps); - attributeCache.put(cacheKey, cacheOps); - } - return cacheOps; - } - - if (cached == NULL_CACHING_ATTRIBUTE) { - return null; - } - - // Value will either be canonical value indicating there is no caching attribute, - // or an actual caching attribute. - return cached; - } - - /** - * For dev mode when rediscovering annotations is needed. - */ - public void reset() { - attributeCache.clear(); - } - - /** - * Determine a cache key for the given method and target class. - *

Must not produce same key for overloaded methods. - * Must produce same key for different instances of the same method. - * @param method the method (never {@code null}) - * @param targetClass the target class (may be {@code null}) - * @return the cache key (never {@code null}) - */ - protected Object getCacheKey(Method method, Class targetClass) { - return new DefaultCacheKey(method, targetClass); - } - - protected Collection computeCacheOperations(Method method, Class targetClass) { - // Don't allow no-public methods as required. - if (publicMethodsOnly && !Modifier.isPublic(method.getModifiers())) { - return null; - } - - // The method may be on an interface, but we need attributes from the target class. - // If the target class is null, the method will be unchanged. - Method specificMethod = ClassUtils.getMostSpecificMethod(method, targetClass); - // If we are dealing with method with generic parameters, find the original method. - specificMethod = BridgeMethodResolver.findBridgedMethod(specificMethod); - - // First try is the method in the target class. - Collection opDef = findCacheOperations(specificMethod); - if (opDef != null) { - return opDef; - } - - // Second try is the caching operation on the target class. - opDef = findCacheOperations(specificMethod.getDeclaringClass()); - if (opDef != null) { - return opDef; - } - - if (specificMethod != method) { - // Fall back is to look at the original method. - opDef = findCacheOperations(method); - if (opDef != null) { - return opDef; - } - // Last fall back is the class of the original method. - return findCacheOperations(method.getDeclaringClass()); - } - - return null; - } - - protected Collection findCacheOperations(Class clazz) { - return determineCacheOperations(clazz); - } - - protected Collection findCacheOperations(Method method) { - return determineCacheOperations(method); - } - - /** - * Determine the cache operation(s) for the given method or class. - *

This implementation delegates to configured - * {@link CacheAnnotationParser}s for parsing known annotations into - * Spring's metadata attribute class. - *

Can be overridden to support custom annotations that carry - * caching metadata. - * @param ae the annotated method or class - * @return the configured caching operations, or {@code null} if none found - */ - protected Collection determineCacheOperations(AnnotatedElement ae) { - Collection ops = null; - - for (CacheAnnotationParser annotationParser : annotationParsers) { - Collection annOps = annotationParser.parseCacheAnnotations(ae); - if (annOps != null) { - if (ops == null) { - ops = new ArrayList(); - } - ops.addAll(annOps); - } - } - - return ops; - } - - protected boolean isControllerClass(Class targetClass) { - return application.isArtefactOfType(ControllerArtefactHandler.TYPE, targetClass); - } - - /** - * Dependency injection for the grails application. - * @param grailsApplication the app - */ - public void setGrailsApplication(GrailsApplication grailsApplication) { - application = grailsApplication; - } - - /** - * Dependency injection for whether to only consider public methods - * @param allow - */ - public void setAllowPublicMethodsOnly(boolean allow) { - publicMethodsOnly = allow; - } - - /** - * Default cache key for the CacheOperation cache. - */ - protected static class DefaultCacheKey { - - protected final Method method; - protected final Class targetClass; - - public DefaultCacheKey(Method method, Class targetClass) { - this.method = method; - this.targetClass = targetClass; - } - - @Override - public boolean equals(Object other) { - if (this == other) { - return true; - } - if (!(other instanceof DefaultCacheKey)) { - return false; - } - DefaultCacheKey otherKey = (DefaultCacheKey) other; - return method.equals(otherKey.method) && - ObjectUtils.nullSafeEquals(targetClass, otherKey.targetClass); - } - - @Override - public int hashCode() { - return method.hashCode() * 29 + (targetClass == null ? 0 : targetClass.hashCode()); - } - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/GrailsCache.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/GrailsCache.java deleted file mode 100644 index 26ad9f5..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/GrailsCache.java +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache; - -import java.util.Collection; - -import org.springframework.cache.Cache; - -/** - * @author Burt Beckwith - */ -public interface GrailsCache extends Cache { - - Collection getAllKeys(); -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/GrailsCacheManager.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/GrailsCacheManager.java deleted file mode 100644 index b0db24c..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/GrailsCacheManager.java +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache; - -import org.springframework.cache.CacheManager; - -/** - * @author Burt Beckwith - */ -public interface GrailsCacheManager extends CacheManager { - - boolean cacheExists(String name); - - boolean destroyCache(String name); -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/GrailsConcurrentMapCache.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/GrailsConcurrentMapCache.java deleted file mode 100644 index 8db0bd9..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/GrailsConcurrentMapCache.java +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache; - -import java.util.Collection; -import java.util.concurrent.ConcurrentMap; - -import org.springframework.cache.concurrent.ConcurrentMapCache; - -/** - * Extends the default implementation to return GrailsValueWrapper instances instead of - * SimpleValueWrapper. This isn't useful for this implementation but is for others where - * the native wrapper has more useful information that would otherwise be lost (for example - * the TTL in the Ehcache Element class). This implementation exists so that all caches - * consistently return a GrailsValueWrapper. - * - * @author Burt Beckwith - */ -public class GrailsConcurrentMapCache extends ConcurrentMapCache implements GrailsCache { - - public GrailsConcurrentMapCache(String name) { - super(name); - } - - public GrailsConcurrentMapCache(String name, boolean allowNullValues) { - super(name, allowNullValues); - } - - public GrailsConcurrentMapCache(String name, ConcurrentMap store, boolean allowNullValues) { - super(name, store, allowNullValues); - } - - @Override - public GrailsValueWrapper get(Object key) { - Object value = getNativeCache().get(key); - return value == null ? null : new GrailsValueWrapper(fromStoreValue(value), null); - } - - @SuppressWarnings("unchecked") - public Collection getAllKeys() { - return getNativeCache().keySet(); - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/GrailsConcurrentMapCacheManager.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/GrailsConcurrentMapCacheManager.java deleted file mode 100644 index e8d64bb..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/GrailsConcurrentMapCacheManager.java +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache; - -import java.util.Collection; -import java.util.Collections; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -import org.springframework.cache.Cache; - -/** - * Based on org.springframework.cache.concurrent.ConcurrentMapCacheManager. - * - * @author Juergen Hoeller - * @author Burt Beckwith - */ -public class GrailsConcurrentMapCacheManager implements GrailsCacheManager { - - protected final ConcurrentMap cacheMap = new ConcurrentHashMap(); - - public Collection getCacheNames() { - return Collections.unmodifiableSet(cacheMap.keySet()); - } - - public Cache getCache(String name) { - Cache cache = cacheMap.get(name); - if (cache == null) { - cache = createConcurrentMapCache(name); - Cache existing = cacheMap.putIfAbsent(name, cache); - if (existing != null) { - cache = existing; - } - } - return cache; - } - - public boolean cacheExists(String name) { - return getCacheNames().contains(name); - } - - public boolean destroyCache(String name) { - return cacheMap.remove(name) != null; - } - - protected GrailsConcurrentMapCache createConcurrentMapCache(String name) { - return new GrailsConcurrentMapCache(name); - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/GrailsValueWrapper.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/GrailsValueWrapper.java deleted file mode 100644 index 239ea10..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/GrailsValueWrapper.java +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache; - -import org.springframework.cache.support.SimpleValueWrapper; - -/** - * Extends the standard implementation to also include the native wrapper instance. - * - * @author Burt Beckwith - */ -public class GrailsValueWrapper extends SimpleValueWrapper { - - protected Object nativeWrapper; - - public GrailsValueWrapper(Object value, Object nativeWrapper) { - super(value); - this.nativeWrapper = nativeWrapper; - } - - public Object getNativeWrapper() { - return nativeWrapper; - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/SerializableByteArrayOutputStream.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/SerializableByteArrayOutputStream.java deleted file mode 100644 index 9b7d61c..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/SerializableByteArrayOutputStream.java +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.UnsupportedEncodingException; - -/** - * A Serializable version of java.io.ByteArrayOutputStream. - * - * @author Burt Beckwith - */ -public class SerializableByteArrayOutputStream extends SerializableOutputStream { - - private static final long serialVersionUID = 1; - - protected byte[] buf; - protected int count; - - public SerializableByteArrayOutputStream() { - this(32); - } - - public SerializableByteArrayOutputStream(int size) { - if (size < 0) { - throw new IllegalArgumentException("Negative initial size: " + size); - } - buf = new byte[size]; - } - - @Override - public synchronized void write(int b) { - int newcount = count + 1; - if (newcount > buf.length) { - buf = copyOf(Math.max(buf.length << 1, newcount)); - } - buf[count] = (byte)b; - count = newcount; - } - - @Override - public synchronized void write(byte[] b, int off, int len) { - if ((off < 0) || (off > b.length) || (len < 0) || - ((off + len) > b.length) || ((off + len) < 0)) { - throw new IndexOutOfBoundsException(); - } - - if (len == 0) { - return; - } - - int newcount = count + len; - if (newcount > buf.length) { - buf = copyOf(Math.max(buf.length << 1, newcount)); - } - System.arraycopy(b, off, buf, count, len); - count = newcount; - } - - public synchronized void writeTo(OutputStream out) throws IOException { - out.write(buf, 0, count); - } - - public synchronized void reset() { - count = 0; - } - - public synchronized byte[] toByteArray() { - return copyOf(count); - } - - // ByteArrayOutputStream uses Arrays.copyOf which is only in Java 6, that's inlined here. - protected byte[] copyOf(int newLength) { - byte[] copy = new byte[newLength]; - System.arraycopy(buf, 0, copy, 0, Math.min(buf.length, newLength)); - return copy; - } - - public synchronized int size() { - return count; - } - - @Override - public synchronized String toString() { - return new String(buf, 0, count); - } - - public synchronized String toString(String charsetName) throws UnsupportedEncodingException { - return new String(buf, 0, count, charsetName); - } - - @Override - public void close() throws IOException { - // no-op - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/SerializableOutputStream.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/SerializableOutputStream.java deleted file mode 100644 index 10e278b..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/SerializableOutputStream.java +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache; - -import java.io.OutputStream; -import java.io.Serializable; - -/** - * Abstract base class for serializable OutputStream classes. - * - * @author Burt Beckwith - */ -@SuppressWarnings("serial") -public abstract class SerializableOutputStream extends OutputStream implements Serializable { - // no methods -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/Timer.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/Timer.java deleted file mode 100644 index 89be2cb..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/Timer.java +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache; - -import org.apache.commons.lang.time.StopWatch; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Based on grails.plugin.springcache.web.Timer. - * - * @author Rob Fletcher - * @author Burt Beckwith - */ -public class Timer { - - protected final Logger log = LoggerFactory.getLogger(getClass()); - protected final String uri; - protected final StopWatch stopWatch = new StopWatch(); - - public Timer(String uri) { - this.uri = uri; - } - - public void start() { - if (log.isInfoEnabled()) { - stopWatch.start(); - } - } - - public void stop(boolean cached) { - if (log.isInfoEnabled()) { - stopWatch.stop(); - log.info("{} request for {} took {}", - new Object[] { cached ? "Cached" : "Uncached", uri, stopWatch }); - } - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/compiler/CacheTransformation.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/compiler/CacheTransformation.java deleted file mode 100644 index 2912d3d..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/compiler/CacheTransformation.java +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache.compiler; - -import grails.util.CollectionUtils; - -import java.util.Map; - -import org.codehaus.groovy.ast.ASTNode; -import org.codehaus.groovy.ast.AnnotatedNode; -import org.codehaus.groovy.ast.AnnotationNode; -import org.codehaus.groovy.ast.ClassNode; -import org.codehaus.groovy.ast.expr.Expression; -import org.codehaus.groovy.control.CompilePhase; -import org.codehaus.groovy.control.SourceUnit; -import org.codehaus.groovy.transform.ASTTransformation; -import org.codehaus.groovy.transform.GroovyASTTransformation; - -/** - * @author Jeff Brown - */ -@GroovyASTTransformation(phase = CompilePhase.CANONICALIZATION) -public class CacheTransformation implements ASTTransformation { - - @SuppressWarnings("unchecked") - protected static final Map GRAILS_ANNOTATION_CLASS_NODE_TO_SPRING_ANNOTATION_CLASS_NODE = CollectionUtils.newMap( - new ClassNode(grails.plugin.cache.Cacheable.class), new ClassNode(org.springframework.cache.annotation.Cacheable.class), - new ClassNode(grails.plugin.cache.CachePut.class), new ClassNode(org.springframework.cache.annotation.CachePut.class), - new ClassNode(grails.plugin.cache.CacheEvict.class), new ClassNode(org.springframework.cache.annotation.CacheEvict.class)); - - public void visit(final ASTNode[] astNodes, final SourceUnit sourceUnit) { - final ASTNode firstNode = astNodes[0]; - final ASTNode secondNode = astNodes[1]; - if (!(firstNode instanceof AnnotationNode) || !(secondNode instanceof AnnotatedNode)) { - throw new RuntimeException("Internal error: wrong types: " + firstNode.getClass().getName() + - " / " + secondNode.getClass().getName()); - } - - final AnnotationNode grailsCacheAnnotationNode = (AnnotationNode) firstNode; - final AnnotatedNode annotatedNode = (AnnotatedNode) secondNode; - final AnnotationNode springCacheAnnotationNode = getCorrespondingSpringAnnotation( - grailsCacheAnnotationNode); - annotatedNode.addAnnotation(springCacheAnnotationNode); - } - - protected AnnotationNode getCorrespondingSpringAnnotation(final AnnotationNode grailsCacheAnnotationNode) { - final Map grailsAnnotationMembers = grailsCacheAnnotationNode.getMembers(); - - final ClassNode springCacheAnnotationClassNode = GRAILS_ANNOTATION_CLASS_NODE_TO_SPRING_ANNOTATION_CLASS_NODE.get( - grailsCacheAnnotationNode.getClassNode()); - final AnnotationNode springCacheAnnotationNode = new AnnotationNode(springCacheAnnotationClassNode); - for (Map.Entry entry : grailsAnnotationMembers.entrySet()) { - springCacheAnnotationNode.addMember(entry.getKey(), entry.getValue()); - } - return springCacheAnnotationNode; - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/util/ClassUtils.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/util/ClassUtils.java deleted file mode 100644 index 106f4de..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/util/ClassUtils.java +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache.util; - -import grails.util.GrailsNameUtils; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import org.springframework.util.ReflectionUtils; - -/** - * @author Jeff Brown - */ -public class ClassUtils { - - /** - * This method will try to retrieve the value of the named property from the - * object using a corresponding getter method. If no getter method is found - * then this method will look for the corresponding field and return its value. - * - * @param object object to inspect - * @param propertyOrFieldName the name of the field or property to retrieve - * @return the value of the field or property, null if neither is found - */ - public static Object getPropertyOrFieldValue(Object object, String propertyOrFieldName) { - final String getterName = GrailsNameUtils.getGetterName(propertyOrFieldName); - final Class objectClass = object.getClass(); - try { - final Method method = objectClass.getMethod(getterName, new Class[0]); - if (method != null) { - ReflectionUtils.makeAccessible(method); - return method.invoke(object, new Object[0]); - } - } catch (Exception e) { - } - try { - final Field field = ReflectionUtils.findField(objectClass, propertyOrFieldName); - if (field != null) { - ReflectionUtils.makeAccessible(field); - return field.get(object); - } - } catch (Exception e) { - } - return null; - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/AlreadyGzippedException.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/AlreadyGzippedException.java deleted file mode 100644 index bc57e34..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/AlreadyGzippedException.java +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache.web; - -/** - * Based on net.sf.ehcache.constructs.web.AlreadyGzippedException. - * - * @author Greg Luck - * @author Burt Beckwith - */ -public class AlreadyGzippedException extends RuntimeException { - - private static final long serialVersionUID = 1; - - public AlreadyGzippedException(String message) { - super(message); - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/ContentCacheParameters.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/ContentCacheParameters.java deleted file mode 100644 index 6f94284..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/ContentCacheParameters.java +++ /dev/null @@ -1,129 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache.web; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.codehaus.groovy.grails.commons.ControllerArtefactHandler; -import org.codehaus.groovy.grails.commons.GrailsControllerClass; -import org.codehaus.groovy.grails.web.servlet.mvc.GrailsParameterMap; -import org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequest; -import org.springframework.util.StringUtils; - -/** - * Based on grails.plugin.springcache.web.ContentCacheParameters. - * - * @author Rob Fletcher - * @author Burt Beckwith - */ -public class ContentCacheParameters { - - protected final GrailsWebRequest grailsWebRequest; - - /*@Lazy*/ protected GrailsControllerClass controllerClass; - /*@Lazy*/ protected Method method; - protected String actionName; - - public ContentCacheParameters(GrailsWebRequest request) { - grailsWebRequest = request; - // TODO these two were @Lazy in SpringCache - initController(); - initAction(); - } - - public String getControllerName() { - return grailsWebRequest.getControllerName(); - } - - public String getActionName() { - if (actionName == null) { - actionName = grailsWebRequest.getActionName(); - if (!StringUtils.hasLength(actionName) && controllerClass != null) { - actionName = controllerClass.getDefaultAction(); - } - } - return actionName; - } - - public Method getMethod() { - return method; - } - - public GrailsParameterMap getParams() { - return grailsWebRequest.getParams(); - } - - public HttpServletRequest getRequest() { - return grailsWebRequest.getCurrentRequest(); - } - - public Class getControllerClass() { - return controllerClass == null ? null : controllerClass.getClazz(); - } - - protected void initController() { - controllerClass = (GrailsControllerClass) GrailsWebRequest.lookupApplication().getArtefactForFeature( - ControllerArtefactHandler.TYPE, '/' + getControllerName()); - } - - protected void initAction() { - if (controllerClass == null) { - return; - } - - getActionName(); - - List matches = new ArrayList(); - for (Method m : controllerClass.getClazz().getMethods()) { - if (m.getName().equals(actionName)) { - matches.add(m); - } - } - - // if the controller class method has parameters, there will be two methods; one no-arg - // and one with args that gets delegated to by the no-arg method. we need the one with - // args if it exists - if (matches.size() == 1) { - method = matches.get(0); - } - else if (matches.size() > 1) { - if (matches.get(0).getParameterTypes().length > 0) { - method = matches.get(0); - } - else { - method = matches.get(1); - } - } - - if (method == null) { - // TODO scaffolded controller? - } - } - - @Override - public String toString() { - StringBuilder buffer = new StringBuilder("["); - buffer.append("controller=").append(getControllerName()); - if (controllerClass == null) buffer.append("?"); - buffer.append(", action=").append(getActionName()); - if (method == null) buffer.append("?"); - buffer.append("]"); - return buffer.toString(); - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/GenericResponseWrapper.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/GenericResponseWrapper.java deleted file mode 100644 index 7f08351..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/GenericResponseWrapper.java +++ /dev/null @@ -1,317 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache.web; - -import grails.plugin.cache.SerializableOutputStream; -import grails.plugin.cache.web.Header.Type; -import grails.plugin.cache.web.filter.FilterServletOutputStream; - -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; - -import javax.servlet.ServletOutputStream; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpServletResponseWrapper; - -import org.slf4j.LoggerFactory; - -/** - * Provides a wrapper for {@link javax.servlet.http.HttpServletResponseWrapper}. - *

- * It is used to wrap the real Response so that we can modify it after that the - * target of the request has delivered its response. - *

- * It uses the Wrapper pattern. - * - * Based on net.sf.ehcache.constructs.web.GenericResponseWrapper. - * - * @author Greg Luck - * @author Burt Beckwith - */ -@SuppressWarnings("deprecation") -public class GenericResponseWrapper extends HttpServletResponseWrapper implements Serializable { - - private static final long serialVersionUID = 1; - - protected int statusCode = SC_OK; - protected int contentLength; - protected String contentType; - protected final Map> headersMap = new TreeMap>( - String.CASE_INSENSITIVE_ORDER); - protected final List cookies = new ArrayList(); - protected ServletOutputStream out; - protected transient PrintWriter writer; - protected boolean disableFlushBuffer = true; - - /** - * Creates a GenericResponseWrapper - */ - public GenericResponseWrapper(final HttpServletResponse response, final SerializableOutputStream outputStream) { - super(response); - out = new FilterServletOutputStream(outputStream); - } - - @Override - public ServletOutputStream getOutputStream() { - return out; - } - - @Override - public void setStatus(final int code) { - statusCode = code; - super.setStatus(code); - } - - /** - * Send the error. If the response is not ok, most of the logic is bypassed - * and the error is sent raw Also, the content is not cached. - * - * @param code the status code - * @param string the error message - * @throws IOException - */ - @Override - public void sendError(int code, String string) throws IOException { - statusCode = code; - super.sendError(code, string); - } - - /** - * Send the error. If the response is not ok, most of the logic is bypassed - * and the error is sent raw Also, the content is not cached. - * - * @param code the status code - * @throws IOException - */ - @Override - public void sendError(int code) throws IOException { - statusCode = code; - super.sendError(code); - } - - /** - * Send the redirect. If the response is not ok, most of the logic is - * bypassed and the error is sent raw. Also, the content is not cached. - * - * @param string the URL to redirect to - * @throws IOException - */ - @Override - public void sendRedirect(String string) throws IOException { - statusCode = HttpServletResponse.SC_MOVED_TEMPORARILY; - super.sendRedirect(string); - } - - @Override - public void setStatus(final int code, final String msg) { - statusCode = code; - LoggerFactory.getLogger(getClass()).warn("Discarding message because this method is deprecated."); - super.setStatus(code); - } - - // don't add @Override since it's only a method as of Servlet 3.0 - public int getStatus() { - return statusCode; - } - - @Override - public void setContentLength(final int length) { - contentLength = length; - super.setContentLength(length); - } - - public int getContentLength() { - return contentLength; - } - - @Override - public void setContentType(final String type) { - contentType = type; - super.setContentType(type); - } - - @Override - public String getContentType() { - return contentType; - } - - @Override - public PrintWriter getWriter() throws IOException { - if (writer == null) { - writer = new PrintWriter(new OutputStreamWriter(out, getCharacterEncoding()), true); - } - return writer; - } - - @Override - public void addHeader(String name, String value) { - List values = headersMap.get(name); - if (values == null) { - values = new LinkedList(); - headersMap.put(name, values); - } - values.add(value); - - super.addHeader(name, value); - } - - @Override - public void setHeader(String name, String value) { - LinkedList values = new LinkedList(); - values.add(value); - headersMap.put(name, values); - - super.setHeader(name, value); - } - - @Override - public void addDateHeader(String name, long date) { - List values = headersMap.get(name); - if (values == null) { - values = new LinkedList(); - headersMap.put(name, values); - } - values.add(date); - - super.addDateHeader(name, date); - } - - @Override - public void setDateHeader(String name, long date) { - LinkedList values = new LinkedList(); - values.add(date); - headersMap.put(name, values); - - super.setDateHeader(name, date); - } - - @Override - public void addIntHeader(String name, int value) { - List values = headersMap.get(name); - if (values == null) { - values = new LinkedList(); - headersMap.put(name, values); - } - values.add(value); - - super.addIntHeader(name, value); - } - - @Override - public void setIntHeader(String name, int value) { - LinkedList values = new LinkedList(); - values.add(value); - headersMap.put(name, values); - - super.setIntHeader(name, value); - } - - public Collection> getAllHeaders() { - List> headers = new LinkedList>(); - - for (Map.Entry> headerEntry : headersMap.entrySet()) { - String name = headerEntry.getKey(); - for (Serializable value : headerEntry.getValue()) { - Type type = Header.Type.determineType(value.getClass()); - switch (type) { - case STRING: - headers.add(new Header(name, (String)value)); - break; - case DATE: - headers.add(new Header(name, (Long)value)); - break; - case INT: - headers.add(new Header(name, (Integer)value)); - break; - default: - throw new IllegalArgumentException("No mapping for Header.Type: " + type); - } - } - } - - return headers; - } - - @Override - public void addCookie(final Cookie cookie) { - cookies.add(cookie); - super.addCookie(cookie); - } - - public Collection getCookies() { - return cookies; - } - - @Override - public void flushBuffer() throws IOException { - flush(); - - // doing this might leads to response already committed exception when the - // PageInfo has not yet built but the buffer already flushed. Happens in WebLogic - // when a servlet forward to a JSP page and the forward method trigger a flush - // before it forwarded to the JSP disableFlushBuffer for that purpose is 'true' by default - // EHC-447 - if (!disableFlushBuffer) { - super.flushBuffer(); - } - } - - @Override - public void reset() { - super.reset(); - cookies.clear(); - headersMap.clear(); - statusCode = SC_OK; - contentType = null; - contentLength = 0; - } - - /** - * Flushes all the streams for this response. - */ - public void flush() throws IOException { - if (writer != null) { - writer.flush(); - } - out.flush(); - } - - /** - * Is the wrapped reponse's buffer flushing disabled? - * - * @return true if the wrapped reponse's buffer flushing disabled - */ - public boolean isDisableFlushBuffer() { - return disableFlushBuffer; - } - - /** - * Set if the wrapped reponse's buffer flushing should be disabled. - * - * @param disable true if the wrapped reponse's buffer flushing should be disabled - */ - public void setDisableFlushBuffer(boolean disable) { - disableFlushBuffer = disable; - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/Header.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/Header.java deleted file mode 100644 index e080404..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/Header.java +++ /dev/null @@ -1,196 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache.web; - -import java.io.Serializable; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.springframework.util.Assert; - -/** - * Generic implementation of a HTTP header. Handles String, Int and Date typed headers. - * - * Based on net.sf.ehcache.constructs.web.Header. - * - * @author Eric Dalquist - * @author Burt Beckwith - */ -public class Header implements Serializable { - - private static final long serialVersionUID = 1; - - protected final String name; - protected final T value; - protected final Type type; - - /** - * Used to help differentiate the different header types - */ - public enum Type { - /** - * A String Header. - * {@link javax.servlet.http.HttpServletResponse#setHeader(String, String)} - */ - STRING(String.class), - - /** - * A date Header. - * {@link javax.servlet.http.HttpServletResponse#setDateHeader(String, long)} - */ - DATE(Long.class), - - /** - * A int Header. - * {@link javax.servlet.http.HttpServletResponse#setIntHeader(String, int)} - */ - INT(Integer.class); - - private static final Map, Type> TYPE_LOOKUP = new ConcurrentHashMap, Type>(); - private final Class type; - - private Type(Class type) { - this.type = type; - } - - /** - * @return The header type class this Type represents - */ - public Class getTypeClass() { - return type; - } - - /** - * Determines the {@link Type} of the Header. Throws - * IllegalArgumentException if the specified class does not match any of - * the Types - */ - public static Type determineType(Class typeClass) { - Type lookupType = TYPE_LOOKUP.get(typeClass); - if (lookupType != null) { - return lookupType; - } - - for (Type t : Type.values()) { - if (typeClass == t.getTypeClass()) { - // If the class explicitly matches add to the lookup cache - TYPE_LOOKUP.put(typeClass, t); - return t; - } - - if (typeClass.isAssignableFrom(t.getTypeClass())) { - return t; - } - } - - throw new IllegalArgumentException("No Type for class " + typeClass); - } - } - - /** - * Create a new Header - * - * @param name Name of the header, may not be null - * @param value Value of the header, may not be null - */ - public Header(String name, T value) { - Assert.notNull(name, "Header cannnot have a null name"); - Assert.notNull(value, "Header cannnot have a null value"); - this.name = name; - this.value = value; - type = Type.determineType(value.getClass()); - } - - /** - * @return Name of the header, will never be null - */ - public String getName() { - return name; - } - - /** - * @return Value for the header, will never be null - */ - public T getValue() { - return value; - } - - /** - * @return The header type - */ - public Type getType() { - return type; - } - - /** - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((type == null) ? 0 : type.hashCode()); - result = prime * result + ((value == null) ? 0 : value.hashCode()); - return result; - } - - /** - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - Header other = (Header)obj; - if (name == null) { - if (other.name != null) { - return false; - } - } - else if (!name.equals(other.name)) { - return false; - } - if (type == null) { - if (other.type != null) { - return false; - } - } - else if (!type.equals(other.type)) { - return false; - } - if (value == null) { - if (other.value != null) { - return false; - } - } - else if (!value.equals(other.value)) { - return false; - } - return true; - } - - @Override - public String toString() { - return "Header<" + type.getTypeClass().getSimpleName() + "> [name=" + name + ", value=" + value + "]"; - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/HttpDateFormatter.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/HttpDateFormatter.java deleted file mode 100644 index d848da6..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/HttpDateFormatter.java +++ /dev/null @@ -1,100 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache.web; - -import java.io.Serializable; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Locale; -import java.util.TimeZone; - -import org.slf4j.LoggerFactory; - -/** - * RFC 2616 - HTTP/1.1 Protocol - *

- * Section 3.3.1 defines the preferred full date and time as: - * - *

- * HTTP-date    = rfc1123-date
- * rfc1123-date = wkday "," SP date1 SP time SP "GMT"
- * date1        = 2DIGIT SP month SP 4DIGIT
- * ; day month year (e.g., 02 Jun 1982)
- * time         = 2DIGIT ":" 2DIGIT ":" 2DIGIT
- * ; 00:00:00 - 23:59:59
- * wkday        = "Mon" | "Tue" | "Wed"
- * | "Thu" | "Fri" | "Sat" | "Sun"
- * month        = "Jan" | "Feb" | "Mar" | "Apr"
- * | "May" | "Jun" | "Jul" | "Aug"
- * | "Sep" | "Oct" | "Nov" | "Dec"
- * 
- *

- * An example is Sun, 06 Nov 1994 08:49:37 GMT - *

- * These are used in request and response headers. - *

- * - * Based on net.sf.ehcache.constructs.web.HttpDateFormatter. - * - * @author Greg Luck - * @author Burt Beckwith - */ -public class HttpDateFormatter implements Serializable { - - private static final long serialVersionUID = 1; - - protected final SimpleDateFormat httpDateFormat = new SimpleDateFormat( - "EEE, dd MMM yyyy HH:mm:ss z", Locale.US); - - /** - * Constructs a new formatter. - *

- * Note that this class is not thread-safe for use by multiple threads, as - * SimpleDateFormat is not. Each thread should create their own instance of - * this class. - */ - public HttpDateFormatter() { - httpDateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); - } - - /** - * @param date - * @return A date formatted in accordance with Section 3.3.1 of RFC 2616 - */ - public synchronized String formatHttpDate(Date date) { - return httpDateFormat.format(date); - } - - /** - * Parses dates supplied in accordance with Section 3.3.1 of RFC 2616 - * - * @param date - * a date formatted in accordance with Section 3.3.1 of RFC 2616 - * @return the parsed Date. If the date cannot be parsed, the start of POSIX - * time, 1/1/1970 is returned, which will have the effect of expiring - * the content. - */ - public synchronized Date parseDateFromHttpDate(String date) { - try { - return httpDateFormat.parse(date); - } - catch (ParseException e) { - LoggerFactory.getLogger(getClass()).debug( - "ParseException on date {}. 1/1/1970 will be returned", date); - return new Date(0); - } - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/PageInfo.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/PageInfo.java deleted file mode 100644 index 331c3be..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/PageInfo.java +++ /dev/null @@ -1,428 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache.web; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.zip.GZIPInputStream; -import java.util.zip.GZIPOutputStream; - -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import net.sf.cglib.proxy.Callback; - -import org.codehaus.groovy.grails.plugins.web.api.ControllersApi; -import org.codehaus.groovy.grails.web.servlet.GrailsFlashScope; -import org.codehaus.groovy.grails.web.servlet.HttpHeaders; -import org.slf4j.LoggerFactory; -import org.springframework.aop.PointcutAdvisor; -import org.springframework.aop.TargetSource; -import org.springframework.util.Assert; -import org.springframework.util.StringUtils; -import org.springframework.web.servlet.FlashMap; - -/** - * A Serializable representation of a {@link HttpServletResponse}. - * - * Based on net.sf.ehcache.constructs.web.PageInfo and grails.plugin.springcache.web.HeadersCategory. - * - * @author Adam Murdoch - * @author Greg Luck - * @author Rob Fletcher - * @author Burt Beckwith - */ -public class PageInfo implements Serializable { - private static final long serialVersionUID = 1; - - protected static final Pattern PATTERN_CACHE_DIRECTIVE = Pattern.compile("([\\w-]+)(?:=(.+))?"); - protected static final int FOUR_KB = 4196; - protected static final int GZIP_MAGIC_NUMBER_BYTE_1 = 31; - protected static final int GZIP_MAGIC_NUMBER_BYTE_2 = -117; - protected static final long ONE_YEAR_IN_SECONDS = 60 * 60 * 24 * 365; - - protected final HttpDateFormatter httpDateFormatter = new HttpDateFormatter(); - protected final List> responseHeaders = new ArrayList>(); - protected final List serializableCookies = new ArrayList(); - protected Map requestAttributes; - protected String contentType; - protected byte[] gzippedBody; - protected byte[] ungzippedBody; - protected int statusCode; - protected boolean storeGzipped; - protected Date created; - protected long timeToLiveSeconds; - - /** - * Creates a PageInfo object representing the "page". - * - * @param statusCode - * @param contentType - * @param cookies - * @param body - * @param storeGzipped set this to false for images and page fragments which should never - * @param timeToLiveSeconds the time to Live in seconds. 0 means maximum, which is one year per RFC2616. - * @param headers - * @param cookies - * @param requestAttributes - * @throws AlreadyGzippedException - */ - public PageInfo(final int statusCode, final String contentType, final byte[] body, - boolean storeGzipped, long timeToLiveSeconds, final Collection> headers, - @SuppressWarnings("unused") final Collection cookies, - Map requestAttributes) throws AlreadyGzippedException { - - if (headers != null) { - responseHeaders.addAll(headers); - } - setTimeToLiveWithCheckForNeverExpires(timeToLiveSeconds); - - created = new Date(); - this.contentType = contentType; - this.storeGzipped = storeGzipped; - this.statusCode = statusCode; - setCacheableRequestAttributes(requestAttributes); - - // bug 2630970 - // extractCookies(cookies); - - try { - if (storeGzipped) { - // gunzip on demand - ungzippedBody = null; - if (isBodyParameterGzipped()) { - gzippedBody = body; - } - else { - gzippedBody = gzip(body); - } - } - else { - Assert.isTrue(!isBodyParameterGzipped(), "Non gzip content has been gzipped."); - ungzippedBody = body; - } - } - catch (IOException e) { - LoggerFactory.getLogger(getClass()).error("Error ungzipping gzipped body", e); - } - } - - /** - * See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html To mark a - * response as "never expires," an origin server sends an Expires date - * approximately one year from the time the response is sent. HTTP/1.1 - * servers SHOULD NOT send Expires dates more than one year in the future. - * - * @param ttlSeconds - * accepts 0, which means eternal. If the time is 0 or > one year, - * it is set to one year in accordance with the RFC. - *

- * Note: PageInfo does not hold a reference to the Element - * and therefore does not know what the Element ttl is. It would - * normally make most sense to set the TTL to the same as the - * element expiry. - */ - protected void setTimeToLiveWithCheckForNeverExpires(long ttlSeconds) { - // 0 means eternal - if (ttlSeconds == 0 || ttlSeconds > ONE_YEAR_IN_SECONDS) { - timeToLiveSeconds = ONE_YEAR_IN_SECONDS; - } - else { - timeToLiveSeconds = ttlSeconds; - } - } - - /** - * @param ungzipped the bytes to be gzipped - * @return gzipped bytes - */ - protected byte[] gzip(byte[] ungzipped) throws IOException, AlreadyGzippedException { - if (isGzipped(ungzipped)) { - throw new AlreadyGzippedException("The byte[] is already gzipped. It should not be gzipped again."); - } - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - GZIPOutputStream gzipOutputStream = new GZIPOutputStream(bytes); - gzipOutputStream.write(ungzipped); - gzipOutputStream.close(); - return bytes.toByteArray(); - } - - /** - * The response body will be assumed to be gzipped if the GZIP header has been set. - * - * @return true if the body is gzipped - */ - protected boolean isBodyParameterGzipped() { - for (Header header : responseHeaders) { - if ("gzip".equals(header.getValue())) { - return true; - } - } - return false; - } - - /** - * Checks the first two bytes of the candidate byte array for the magic - * number 0x677a. This magic number was obtained from /usr/share/file/magic. - * The line for gzip is: - *

- * - * >>14 beshort 0x677a (gzipped) - * - * - * @param candidate the byte array to check - * @return true if gzipped, false if null, less than two bytes or not gzipped - */ - public static boolean isGzipped(byte[] candidate) { - if (candidate == null || candidate.length < 2) { - return false; - } - return (candidate[0] == GZIP_MAGIC_NUMBER_BYTE_1 && candidate[1] == GZIP_MAGIC_NUMBER_BYTE_2); - } - - /** - * @return the content type of the response. - */ - public String getContentType() { - return contentType; - } - - /** - * @return the gzipped version of the body if the content is storeGzipped, otherwise null - */ - public byte[] getGzippedBody() { - return storeGzipped ? gzippedBody : null; - } - - /** - * @return All of the headers set on the page - */ - public List> getHeaders() { - return responseHeaders; - } - - /** - * Returns the cookies of the response. - */ - public List getSerializableCookies() { - return serializableCookies; - } - - /** - * Returns the status code of the response. - */ - public int getStatusCode() { - return statusCode; - } - - /** - * @return the ungzipped version of the body. This gunzipped on demand when - * storedGzipped, otherwise the ungzipped body is returned. - */ - public byte[] getUngzippedBody() throws IOException { - return storeGzipped ? ungzip(gzippedBody) : ungzippedBody; - } - - /** - * A highly performant ungzip implementation. Do not refactor this without - * taking new timings. See ElementTest for timings - * - * @param gzipped the gzipped content - * @return an ungzipped byte[] - * @throws IOException - */ - protected byte[] ungzip(final byte[] gzipped) throws IOException { - GZIPInputStream inputStream = new GZIPInputStream(new ByteArrayInputStream(gzipped)); - ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(gzipped.length); - byte[] buffer = new byte[FOUR_KB]; - int bytesRead = 0; - while (bytesRead != -1) { - bytesRead = inputStream.read(buffer, 0, FOUR_KB); - if (bytesRead != -1) { - byteArrayOutputStream.write(buffer, 0, bytesRead); - } - } - byte[] ungzipped = byteArrayOutputStream.toByteArray(); - inputStream.close(); - byteArrayOutputStream.close(); - return ungzipped; - } - - /** - * @return true if there is a non null gzipped body - */ - public boolean hasGzippedBody() { - return gzippedBody != null; - } - - /** - * @return true if there is a non null ungzipped body - */ - public boolean hasUngzippedBody() { - return ungzippedBody != null; - } - - /** - * Returns true if the response is Ok. - * - * @return true if the response code is 200. - */ - public boolean isOk() { - return statusCode == HttpServletResponse.SC_OK; - } - - /** - * The Date this PageInfo object was created - */ - public Date getCreated() { - return created; - } - - /** - * The time to live in seconds. - * - * @return the time to live, or 0 if the wrapping element is eternal - */ - public long getTimeToLiveSeconds() { - return timeToLiveSeconds; - } - - public Map getRequestAttributes() { - return Collections.unmodifiableMap(requestAttributes); - } - - public String getHeader(String headerName) { - for (Header header : responseHeaders) { - if (header.getName().equals(headerName)) { - return (String)header.getValue(); - } - } - return null; - } - - public long getDateHeader(String headerName) { - String header = getHeader(headerName); - if (!StringUtils.hasLength(header)) { - return -1; - } - - try { - return Long.valueOf(header); - } - catch (NumberFormatException e) { - return httpDateFormatter.parseDateFromHttpDate(header).getTime(); - } - } - - /** - * Returns true if the page's last-modified header indicates it is newer than - * the copy held by the client as indicated by the request's if-modified-since header. - */ - public boolean isModified(HttpServletRequest request) { - long ifModifiedSince = request.getDateHeader(HttpHeaders.IF_MODIFIED_SINCE); - long lastModified = getDateHeader(HttpHeaders.LAST_MODIFIED); - if (ifModifiedSince == -1 || lastModified == -1) { - return true; - } - return lastModified > ifModifiedSince; - } - - /** - * Returns true if the page's etag header indicates it is the same as the - * copy held by the client as indicated by the request's if-none-match - * header. - */ - public boolean isMatch(HttpServletRequest request) { - String ifNoneMatch = request.getHeader(HttpHeaders.IF_NONE_MATCH); - String etag = getHeader(HttpHeaders.ETAG); - if (!StringUtils.hasLength(ifNoneMatch) || !StringUtils.hasLength(etag)) { - return false; - } - - return ifNoneMatch == etag; - } - - public Map getCacheDirectives() { - String cacheControl = getHeader(HttpHeaders.CACHE_CONTROL); - Map directives = new HashMap(); - if (StringUtils.hasLength(cacheControl)) { - for (String directive : cacheControl.split(",\\s*")) { - Matcher matcher = PATTERN_CACHE_DIRECTIVE.matcher(directive); - if (!matcher.find()) { - continue; - } - - String name = matcher.group(1); - String value = matcher.group(2); - if (StringUtils.hasLength(value)) { - try { - directives.put(name, Integer.valueOf(value)); - } - catch (NumberFormatException e) { - directives.put(name, value); - } - } - else { - directives.put(name, true); - } - } - } - return directives; - } - - protected void setCacheableRequestAttributes(Map attributes) { - requestAttributes = new HashMap(); - - for (Map.Entry entry : attributes.entrySet()) { - Serializable value = entry.getValue(); - - if (value instanceof GrailsFlashScope) { - continue; - } - if (value instanceof FlashMap) { - continue; - } - if (value instanceof HttpServletResponse) { - continue; - } - if (value instanceof ControllersApi) { - continue; - } - if (value instanceof PointcutAdvisor || value instanceof PointcutAdvisor[]) { - continue; - } - if (value instanceof Callback || value instanceof Callback[]) { - continue; - } - if (value instanceof TargetSource) { - continue; - } - - requestAttributes.put(entry.getKey(), value); - } - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/ProxyAwareMixedGrailsControllerHelper.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/ProxyAwareMixedGrailsControllerHelper.java deleted file mode 100644 index 5193a44..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/ProxyAwareMixedGrailsControllerHelper.java +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache.web; - -import grails.web.Action; -import groovy.lang.GroovyObject; - -import java.lang.reflect.Method; - -import javax.servlet.http.HttpServletResponse; - -import org.codehaus.groovy.grails.web.servlet.mvc.MethodGrailsControllerHelper; -import org.codehaus.groovy.grails.web.servlet.mvc.MixedGrailsControllerHelper; -import org.springframework.aop.framework.AopProxyUtils; -import org.springframework.util.ReflectionUtils; - -/** - * The default implementation doesn't expect controllers to be proxied, and this - * causes action methods to be ignored. Registered as the - * "grailsControllerHelper" bean to replace the default. - * - * @author Burt Beckwith - */ -public class ProxyAwareMixedGrailsControllerHelper extends MixedGrailsControllerHelper { - - @Override - protected Object retrieveAction(GroovyObject controller, String actionName, HttpServletResponse response) { - - Method method = ReflectionUtils.findMethod(AopProxyUtils.ultimateTargetClass(controller), - actionName, MethodGrailsControllerHelper.NOARGS); - - if (method != null) { - ReflectionUtils.makeAccessible(method); - if (method.getAnnotation(Action.class) != null) { - return method; - } - } - - return super.retrieveAction(controller, actionName, response); - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/SerializableCookie.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/SerializableCookie.java deleted file mode 100644 index 976f90e..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/SerializableCookie.java +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache.web; - -import java.io.Serializable; - -import javax.servlet.http.Cookie; - -/** - * Based on net.sf.ehcache.constructs.web.SerializableCookie. - * - * @author Greg Luck - * @author Adam Murdoch - * @author Burt Beckwith - */ -public class SerializableCookie implements Serializable { - - private static final long serialVersionUID = 1; - - protected String name; - protected String value; - protected String comment; - protected String domain; - protected int maxAge; - protected String path; - protected boolean secure; - protected int version; - - public SerializableCookie(final Cookie cookie) { - name = cookie.getName(); - value = cookie.getValue(); - comment = cookie.getComment(); - domain = cookie.getDomain(); - maxAge = cookie.getMaxAge(); - path = cookie.getPath(); - secure = cookie.getSecure(); - version = cookie.getVersion(); - } - - public Cookie toCookie() { - Cookie cookie = new Cookie(name, value); - cookie.setComment(comment); - if (domain != null) { - cookie.setDomain(domain); - } - cookie.setMaxAge(maxAge); - cookie.setPath(path); - cookie.setSecure(secure); - cookie.setVersion(version); - return cookie; - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/AbstractFilter.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/AbstractFilter.java deleted file mode 100644 index 63aab70..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/AbstractFilter.java +++ /dev/null @@ -1,232 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache.web.filter; - -import java.io.IOException; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.FilterChain; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.cache.CacheManager; -import org.springframework.context.ApplicationContext; -import org.springframework.util.Assert; -import org.springframework.web.context.support.WebApplicationContextUtils; -import org.springframework.web.filter.GenericFilterBean; - -/** - * Based on net.sf.ehcache.constructs.web.filter.Filter. - * - * @author Greg Luck - * @author Burt Beckwith - */ -public abstract class AbstractFilter extends GenericFilterBean { - - /** - * If a request attribute NO_FILTER is set, then filtering will be skipped - */ - public static final String NO_FILTER = "NO_FILTER"; - - protected final Logger log = LoggerFactory.getLogger(getClass()); - - protected CacheManager cacheManager; - protected Object nativeCacheManager; - protected boolean suppressStackTraces; - - public final void doFilter(final ServletRequest req, final ServletResponse res, final FilterChain chain) - throws ServletException, IOException { - HttpServletRequest request = (HttpServletRequest)req; - HttpServletResponse response = (HttpServletResponse)res; - try { - // NO_FILTER set for RequestDispatcher forwards to avoid double gzipping - if (filterNotDisabled(request)) { - doFilter(request, response, chain); - } - else { - chain.doFilter(req, res); - } - } - catch (Throwable throwable) { - logThrowable(throwable, request); - } - } - - protected abstract void doFilter(final HttpServletRequest httpRequest, final HttpServletResponse httpResponse, - final FilterChain chain) throws Throwable; - - /** - * Filters can be disabled programmatically by adding a {@link #NO_FILTER} - * parameter to the request. This parameter is normally added to make - * RequestDispatcher include and forwards work. - * - * @param httpRequest the request - * @return true if NO_FILTER is not set. - */ - protected boolean filterNotDisabled(final HttpServletRequest request) { - return request.getAttribute(NO_FILTER) == null; - } - - /** - * This method should throw IOExceptions, not wrap them. - */ - protected void logThrowable(final Throwable throwable, final HttpServletRequest httpRequest) - throws ServletException, IOException { - - StringBuilder messageBuffer = new StringBuilder( - "Throwable thrown during doFilter on request with URI: ") - .append(httpRequest.getRequestURI()) - .append(" and Query: ") - .append(httpRequest.getQueryString()) - .append(" : ") - .append(throwable.getMessage()); - - if (suppressStackTraces) { - log.warn(messageBuffer - .append("\nTop StackTraceElement: ") - .append(throwable.getStackTrace()[0]).toString()); - } - else { - log.warn(messageBuffer.toString(), throwable); - } - - if (throwable instanceof IOException) { - throw (IOException)throwable; - } - - throw new ServletException(throwable); - } - - protected CacheManager getCacheManager() { - return cacheManager; - } - - protected Object getNativeCacheManager() { - return nativeCacheManager; - } - - protected boolean acceptsEncoding(final HttpServletRequest request, final String name) { - return headerContains(request, "Accept-Encoding", name); - } - - protected boolean headerContains(final HttpServletRequest request, final String header, final String value) { - - logRequestHeaders(request); - - for (Enumeration accepted = request.getHeaders(header); accepted.hasMoreElements(); ) { - String headerValue = accepted.nextElement(); - if (headerValue.indexOf(value) != -1) { - return true; - } - } - return false; - } - - protected void logRequestHeaders(final HttpServletRequest request) { - if (!log.isDebugEnabled()) { - return; - } - - Map headers = new HashMap(); - StringBuilder logLine = new StringBuilder("Request Headers"); - for (Enumeration enumeration = request.getHeaderNames(); enumeration.hasMoreElements(); ) { - String name = enumeration.nextElement(); - String headerValue = request.getHeader(name); - headers.put(name, headerValue); - logLine.append(": ").append(name).append(" -> ").append(headerValue); - } - log.debug(logLine.toString()); - } - - /** - * Determine whether the user agent accepts GZIP encoding. This feature is - * part of HTTP1.1. If a browser accepts GZIP encoding it will advertise this - * by including in its HTTP header: - *

- * - * Accept-Encoding: gzip - * - *

- * Requests which do not accept GZIP encoding fall into the following - * categories: - *

    - *
  • Old browsers, notably IE 5 on Macintosh. - *
  • Search robots such as yahoo. While there are quite a few bots, they - * only hit individual pages once or twice a day. Note that Googlebot as of - * August 2004 now accepts GZIP. - *
  • Internet Explorer through a proxy. By default HTTP1.1 is enabled but - * disabled when going through a proxy. 90% of non gzip requests are caused - * by this. - *
  • Site monitoring tools - *
- * As of September 2004, about 34% of requests coming from the Internet did - * not accept GZIP encoding. - * - * @param request - * @return true, if the User Agent request accepts GZIP encoding - */ - protected boolean acceptsGzipEncoding(HttpServletRequest request) { - return acceptsEncoding(request, "gzip"); - } - - // TODO remove, use DI - @SuppressWarnings("unchecked") - protected T getBean(String name) { - ApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext( - getServletContext()); - return (T)ctx.getBean(name); - } - - /** - * Dependency injection for the cache manager. - * @param cacheManager the manager - */ - public void setCacheManager(CacheManager manager) { - cacheManager = manager; - } - - /** - * Dependency injection for the native cache manager. - * @param nativeCacheManager the manager - */ - public void setNativeCacheManager(Object manager) { - nativeCacheManager = manager; - } - - /** - * Dependency injection for whether to suppress stacktraces. - * @param suppress if true only log the message - */ - public void setSuppressStackTraces(boolean suppress) { - suppressStackTraces = suppress; - } - - @Override - public void afterPropertiesSet() throws ServletException { - super.afterPropertiesSet(); - Assert.notNull(cacheManager, "cacheManager is required"); -// Assert.notNull(nativeCacheManager, "nativeCacheManager is required"); - if (suppressStackTraces && log.isDebugEnabled()) { - log.debug("Suppression of stack traces enabled for {}", getClass().getName()); - } - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/CacheExpressionRootObject.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/CacheExpressionRootObject.java deleted file mode 100644 index 100c2f5..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/CacheExpressionRootObject.java +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache.web.filter; - -import java.lang.reflect.Method; -import java.util.Collection; - -import org.springframework.cache.Cache; -import org.springframework.util.Assert; - -/** - * Based on package-scope org.springframework.cache.interceptor. - * - * @author Costin Leau - * @author Burt Beckwith - */ -public class CacheExpressionRootObject { - - protected final Collection caches; - protected final Method method; - protected final Class targetClass; - - public CacheExpressionRootObject(Collection caches, Method method, Class targetClass) { - - Assert.notNull(method, "Method is required"); - Assert.notNull(targetClass, "targetClass is required"); - this.method = method; - this.targetClass = targetClass; - this.caches = caches; - } - - public Collection getCaches() { - return caches; - } - - public Method getMethod() { - return method; - } - - public String getMethodName() { - return method.getName(); - } - - public Class getTargetClass() { - return targetClass; - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/CacheOperationContext.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/CacheOperationContext.java deleted file mode 100644 index 1b9e73e..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/CacheOperationContext.java +++ /dev/null @@ -1,82 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache.web.filter; - -import java.lang.reflect.Method; -import java.util.Collection; - -import javax.servlet.http.HttpServletRequest; - -import org.springframework.cache.Cache; -import org.springframework.cache.interceptor.CacheOperation; -import org.springframework.expression.EvaluationContext; -import org.springframework.util.StringUtils; - -/** - * Based on org.springframework.cache.interceptor.CacheAspectSupport.CacheOperationContext - * - * @author Costin Leau - * @author Juergen Hoeller - * @author Chris Beams - * @author Burt Beckwith - */ -public class CacheOperationContext { - - protected final Collection caches; - protected final ExpressionEvaluator evaluator; - protected final WebKeyGenerator keyGenerator; - protected final CacheOperation operation; - protected final Method method; - - // context passed around to avoid multiple creations - protected final EvaluationContext evalContext; - protected final HttpServletRequest request; - - public CacheOperationContext(CacheOperation operation, Method method, Object[] args, - Class targetClass, Collection caches, ExpressionEvaluator evaluator, - WebKeyGenerator keyGenerator, HttpServletRequest request) { - this.operation = operation; - this.caches = caches; - this.method = method; - this.evaluator = evaluator; - this.keyGenerator = keyGenerator; - this.request = request; - - evalContext = evaluator.createEvaluationContext(caches, method, args, targetClass); - } - - protected boolean isConditionPassing() { - if (StringUtils.hasText(operation.getCondition())) { - return evaluator.condition(operation.getCondition(), method, evalContext); - } - return true; - } - - /** - * Computes the key for the given caching operation. - * - * @return generated key (null if none can be generated) - */ - protected Object generateKey() { - if (StringUtils.hasText(operation.getKey())) { - return evaluator.key(operation.getKey(), method, evalContext); - } - return keyGenerator.generate(request); - } - - protected Collection getCaches() { - return caches; - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/DefaultWebKeyGenerator.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/DefaultWebKeyGenerator.java deleted file mode 100644 index 6d541c2..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/DefaultWebKeyGenerator.java +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache.web.filter; - -import javax.servlet.http.HttpServletRequest; - -import org.codehaus.groovy.grails.web.util.WebUtils; -import org.springframework.util.StringUtils; - -/** - * Default implementation. - * - * @author Burt Beckwith - */ -public class DefaultWebKeyGenerator implements WebKeyGenerator { - - protected boolean supportAjax = false; - - public static final String X_REQUESTED_WITH = "X-Requested-With"; - - public String generate(HttpServletRequest request) { - - String uri = WebUtils.getForwardURI(request); - - StringBuilder key = new StringBuilder(); - key.append(request.getMethod().toUpperCase()); - - String format = WebUtils.getFormatFromURI(uri); - if (StringUtils.hasLength(format) && !"all".equals(format)) { - key.append(":format:").append(format); - } - - if (supportAjax) { - String requestedWith = request.getHeader(X_REQUESTED_WITH); - if (StringUtils.hasLength(requestedWith)) { - key.append(':').append(X_REQUESTED_WITH).append(':').append(requestedWith); - } - } - - key.append(':').append(uri); - if (StringUtils.hasLength(request.getQueryString())) { - key.append('?').append(request.getQueryString()); - } - - return key.toString(); - } - - public void setSupportAjax(boolean support) { - supportAjax = support; - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/ExpressionEvaluator.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/ExpressionEvaluator.java deleted file mode 100644 index dbcff13..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/ExpressionEvaluator.java +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache.web.filter; - -import java.lang.reflect.Method; -import java.util.Collection; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.springframework.cache.Cache; -import org.springframework.core.LocalVariableTableParameterNameDiscoverer; -import org.springframework.core.ParameterNameDiscoverer; -import org.springframework.expression.EvaluationContext; -import org.springframework.expression.Expression; -import org.springframework.expression.spel.standard.SpelExpressionParser; - -/** - * Based on package-scope org.springframework.cache.interceptor.ExpressionEvaluator - * - * @author Costin Leau - * @author Burt Beckwith - */ -public class ExpressionEvaluator { - - protected SpelExpressionParser parser = new SpelExpressionParser(); - - // shared param discoverer since it caches data internally - protected ParameterNameDiscoverer paramNameDiscoverer = new LocalVariableTableParameterNameDiscoverer(); - - protected Map conditionCache = new ConcurrentHashMap(); - protected Map keyCache = new ConcurrentHashMap(); - protected Map targetMethodCache = new ConcurrentHashMap(); - - public EvaluationContext createEvaluationContext(Collection caches, Method method, - Object[] args, Class targetClass) { - CacheExpressionRootObject rootObject = new CacheExpressionRootObject(caches, method, targetClass); - return new LazyParamAwareEvaluationContext(rootObject, paramNameDiscoverer, method, - args, targetClass, targetMethodCache); - } - - public boolean condition(String conditionExpression, Method method, EvaluationContext evalContext) { - String key = toString(method, conditionExpression); - Expression condExp = conditionCache.get(key); - if (condExp == null) { - condExp = parser.parseExpression(conditionExpression); - conditionCache.put(key, condExp); - } - return condExp.getValue(evalContext, boolean.class); - } - - public Object key(String keyExpression, Method method, EvaluationContext evalContext) { - String key = toString(method, keyExpression); - Expression keyExp = keyCache.get(key); - if (keyExp == null) { - keyExp = parser.parseExpression(keyExpression); - keyCache.put(key, keyExp); - } - return keyExp.getValue(evalContext); - } - - protected String toString(Method method, String expression) { - return method.getDeclaringClass().getName() + '#' + method + '#' + expression; - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/FilterServletOutputStream.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/FilterServletOutputStream.java deleted file mode 100644 index 276c44d..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/FilterServletOutputStream.java +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache.web.filter; - -import grails.plugin.cache.SerializableOutputStream; - -import java.io.IOException; -import java.io.Serializable; - -import javax.servlet.ServletOutputStream; - -/** - * A custom {@link javax.servlet.ServletOutputStream} for use by our filters. - * - * Based on net.sf.ehcache.constructs.web.filter.FilterServletOutputStream. - * - * @author Greg Luck - * @author Burt Beckwith - */ -public class FilterServletOutputStream extends ServletOutputStream implements Serializable { - - private static final long serialVersionUID = 1; - - protected SerializableOutputStream stream; - - public FilterServletOutputStream(final SerializableOutputStream stream) { - this.stream = stream; - } - - @Override - public void write(final int b) throws IOException { - stream.write(b); - } - - @Override - public void write(final byte[] b) throws IOException { - stream.write(b); - } - - @Override - public void write(final byte[] b, final int off, final int len) throws IOException { - stream.write(b, off, len); - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/LazyParamAwareEvaluationContext.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/LazyParamAwareEvaluationContext.java deleted file mode 100644 index 8b506ee..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/LazyParamAwareEvaluationContext.java +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache.web.filter; - -import java.lang.reflect.Method; -import java.util.Map; - -import org.springframework.aop.support.AopUtils; -import org.springframework.core.ParameterNameDiscoverer; -import org.springframework.expression.spel.support.StandardEvaluationContext; -import org.springframework.util.ObjectUtils; - -/** - * Evaluation context class that adds a method parameters as SpEL - * variables, in a lazy manner. The lazy nature eliminates unneeded - * parsing of classes byte code for parameter discovery. - * - *

To limit the creation of objects, an ugly constructor is used - * (rather then a dedicated 'closure'-like class for deferred execution). - * - * Based on package-scope org.springframework.cache.interceptor - * @author Costin Leau - * @author Burt Beckwith - */ -public class LazyParamAwareEvaluationContext extends StandardEvaluationContext { - - protected final ParameterNameDiscoverer paramDiscoverer; - protected final Method method; - protected final Object[] args; - protected final Class targetClass; - protected final Map methodCache; - protected boolean paramLoaded = false; - - public LazyParamAwareEvaluationContext(Object rootObject, ParameterNameDiscoverer paramDiscoverer, Method method, - Object[] args, Class targetClass, Map methodCache) { - super(rootObject); - - this.paramDiscoverer = paramDiscoverer; - this.method = method; - this.args = args; - this.targetClass = targetClass; - this.methodCache = methodCache; - } - - /** - * Load the param information only when needed. - */ - @Override - public Object lookupVariable(String name) { - Object variable = super.lookupVariable(name); - if (variable != null) { - return variable; - } - - if (!paramLoaded) { - loadArgsAsVariables(); - paramLoaded = true; - variable = super.lookupVariable(name); - } - - return variable; - } - - protected void loadArgsAsVariables() { - // shortcut if no args need to be loaded - if (ObjectUtils.isEmpty(args)) { - return; - } - - String key = toString(method); - Method targetMethod = methodCache.get(key); - if (targetMethod == null) { - targetMethod = AopUtils.getMostSpecificMethod(method, targetClass); - if (targetMethod == null) { - targetMethod = method; - } - methodCache.put(key, targetMethod); - } - - // save arguments as indexed variables - for (int i = 0; i < args.length; i++) { - setVariable("p" + i, args[i]); - } - - String[] parameterNames = paramDiscoverer.getParameterNames(targetMethod); - // save parameter names (if discovered) - if (parameterNames != null) { - for (int i = 0; i < parameterNames.length; i++) { - setVariable(parameterNames[i], args[i]); - } - } - } - - protected String toString(Method m) { - return m.getDeclaringClass().getName() + '#' + m; - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/NoOpFilter.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/NoOpFilter.java deleted file mode 100644 index 4442381..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/NoOpFilter.java +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache.web.filter; - -import java.io.IOException; - -import javax.servlet.FilterChain; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletResponse; - -import org.springframework.web.filter.GenericFilterBean; - -/** - * Based on grails.plugin.springcache.web.NoOpFilter. - * - * @author Rob Fletcher - * @author Burt Beckwith - */ -public class NoOpFilter extends GenericFilterBean { - - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { - ((HttpServletResponse)response).addHeader(PageFragmentCachingFilter.X_CACHED, "disabled"); - chain.doFilter(request, response); - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/PageFragmentCachingFilter.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/PageFragmentCachingFilter.java deleted file mode 100644 index 59187c0..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/PageFragmentCachingFilter.java +++ /dev/null @@ -1,898 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache.web.filter; - -import grails.plugin.cache.GrailsAnnotationCacheOperationSource; -import grails.plugin.cache.SerializableByteArrayOutputStream; -import grails.plugin.cache.Timer; -import grails.plugin.cache.web.ContentCacheParameters; -import grails.plugin.cache.web.GenericResponseWrapper; -import grails.plugin.cache.web.Header; -import grails.plugin.cache.web.PageInfo; -import grails.plugin.cache.web.SerializableCookie; -import grails.util.GrailsNameUtils; - -import java.io.IOException; -import java.io.Serializable; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Stack; -import java.util.TreeSet; - -import javax.servlet.FilterChain; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import net.sf.ehcache.constructs.blocking.LockTimeoutException; - -import org.codehaus.groovy.grails.plugins.web.api.RequestMimeTypesApi; -import org.codehaus.groovy.grails.web.servlet.GrailsApplicationAttributes; -import org.codehaus.groovy.grails.web.servlet.HttpHeaders; -import org.codehaus.groovy.grails.web.servlet.WrappedResponseHolder; -import org.codehaus.groovy.grails.web.servlet.mvc.GrailsParameterMap; -import org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequest; -import org.codehaus.groovy.grails.web.util.WebUtils; -import org.springframework.aop.framework.AopProxyUtils; -import org.springframework.cache.Cache; -import org.springframework.cache.Cache.ValueWrapper; -import org.springframework.cache.interceptor.CacheEvictOperation; -import org.springframework.cache.interceptor.CacheOperation; -import org.springframework.cache.interceptor.CachePutOperation; -import org.springframework.cache.interceptor.CacheableOperation; -import org.springframework.core.LocalVariableTableParameterNameDiscoverer; -import org.springframework.core.ParameterNameDiscoverer; -import org.springframework.util.Assert; -import org.springframework.util.ClassUtils; -import org.springframework.util.CollectionUtils; -import org.springframework.util.ReflectionUtils; -import org.springframework.util.StringUtils; -import org.springframework.web.context.request.RequestContextHolder; - -/** - * A simple page fragment {@link CachingFilter} suitable for most uses. - *

- * The meaning of page fragment is: - *

    - *
  • An include into an outer page. - *
  • A content type suitable for suitable for inclusion into the outer page. - * e.g. text or text/html - *
- * For full page see {@link SimplePageCachingFilter}. - *

Keys

Pages are cached based on their key. The key for this cache is - * the URI followed by the query string. An example is - * /admin/SomePage.jsp?id=1234&name=Beagle. - *

- * This key technique is suitable for a wide range of uses. It is independent of - * hostname and port number, so will work well in situations where there are - * multiple domains which get the same content, or where users access based on - * different port numbers. - *

- * A problem can occur with tracking software, where unique ids are inserted - * into request query strings. Because each request generates a unique key, - * there will never be a cache hit. For these situations it is better to parse - * the request parameters and override - * {@link #calculateKey(javax.servlet.http.HttpServletRequest)} with an - * implementation that takes account of only the significant ones. - *

Configuring Caching with ehcache

A cache entry in ehcache.xml should - * be configured with the name {@link #NAME}. - *

- * Cache attributes including expiry are configured per cache name. To specify a - * different behaviour simply subclass, specify a new name and create a separate - * cache entry for it. - *

Gzipping

Page fragments should never be gzipped. - *

- * Page fragments are stored in the cache ungzipped. - * - * Based on net.sf.ehcache.constructs.web.filter.SimplePageFragmentCachingFilter, - * grails.plugin.springcache.web.GrailsFragmentCachingFilter, and - * org.springframework.cache.interceptor.CacheAspectSupport - * - * @author Greg Luck - * @author Rob Fletcher - * @author Costin Leau - * @author Juergen Hoeller - * @author Chris Beams - * @author Burt Beckwith - */ -public abstract class PageFragmentCachingFilter extends AbstractFilter { - - public static final String X_CACHED = "X-Grails-Cached"; - - protected static final String CACHEABLE = "cacheable"; - protected static final String UPDATE = "cacheupdate"; - protected static final String EVICT = "cacheevict"; - - // TODO share with ExpressionEvaluator - protected ParameterNameDiscoverer paramNameDiscoverer = new LocalVariableTableParameterNameDiscoverer(); - - @SuppressWarnings("unchecked") - protected static final Map, String> TYPE_TO_CONVERSION_METHOD_NAME = grails.util.CollectionUtils., String>newMap( - Boolean.class, "boolean", - Byte.class, "byte", - Character.class, "char", - Double.class, "double", - Float.class, "float", - Integer.class, "int", - Long.class, "long", - Short.class, "short"); - protected static List> PRIMITIVE_CLASSES = grails.util.CollectionUtils.>newList( - boolean.class, - byte.class, - char.class, - double.class, - float.class, - int.class, - long.class, - short.class); - protected static final Map PARAMS_METHODS = new HashMap(); - static { - for (String typeName : TYPE_TO_CONVERSION_METHOD_NAME.values()) { - String methodName = GrailsNameUtils.getGetterName(typeName); - Method method = ClassUtils.getMethod(GrailsParameterMap.class, methodName, String.class); - PARAMS_METHODS.put(typeName, method); - } - } - - protected GrailsAnnotationCacheOperationSource cacheOperationSource; - - protected final ThreadLocal> contextHolder = new ThreadLocal>() { - @Override - protected Stack initialValue() { - return new Stack(); - } - }; - - protected ExpressionEvaluator expressionEvaluator; - protected WebKeyGenerator keyGenerator; - - @Override - protected void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws Exception { -// TODO need blocking cache stuff from CachingFilter - initContext(); - - try { - - Object controller = lookupController(getContext().getControllerClass()); - if (controller == null) { - log.debug("Not a controller request {}:{} {}", - new Object[] { request.getMethod(), request.getRequestURI(), getContext() }); - chain.doFilter(request, response); - return; - } - - Class controllerClass = AopProxyUtils.ultimateTargetClass(controller); - if (controllerClass == null) { - controllerClass = controller.getClass(); - } - Method method = getContext().getMethod(); - if (method == null) { - log.debug("No cacheable method found for {}:{} {}", - new Object[] { request.getMethod(), request.getRequestURI(), getContext() }); - chain.doFilter(request, response); - return; - } - Collection cacheOperations = cacheOperationSource.getCacheOperations( - method, controllerClass, true); - - if (CollectionUtils.isEmpty(cacheOperations)) { - log.debug("No cacheable annotation found for {}:{} {}", - new Object[] { request.getMethod(), request.getRequestURI(), getContext() }); - chain.doFilter(request, response); - return; - } - - Map> operationsByType = createOperationContext( - cacheOperations, method, controllerClass, request); - - // start with evictions - if (inspectBeforeCacheEvicts(operationsByType.get(EVICT))) { - chain.doFilter(request, response); - return; - } - - // follow up with cacheable - CacheStatus status = inspectCacheables(operationsByType.get(CACHEABLE)); - - Map updates = inspectCacheUpdates(operationsByType.get(UPDATE)); - - if (status != null) { - if (status.updateRequired) { - updates.putAll(status.updates); - } - // render cached response - else { - logRequestDetails(request, getContext(), "Caching enabled for request"); - PageInfo pageInfo = buildCachedPageInfo(request, response, status); - writeResponse(request, response, pageInfo); - return; - } - } - - logRequestDetails(request, getContext(), "Caching enabled for request"); - PageInfo pageInfo = buildNewPageInfo(request, response, chain, status, operationsByType); - writeResponse(request, response, pageInfo); - - inspectAfterCacheEvicts(operationsByType.get(EVICT)); - - if (!updates.isEmpty()) { - Collection caches = new ArrayList(); - for (Map.Entry entry : updates.entrySet()) { - for (Cache cache : entry.getKey().getCaches()) { - caches.add(cache); - } - } - update(caches, pageInfo, status, calculateKey(request)); - } - } - finally { - destroyContext(); - } - } - - protected PageInfo buildNewPageInfo(HttpServletRequest request, HttpServletResponse response, - FilterChain chain, CacheStatus cacheStatus, - Map> operationsByType) throws Exception { - - Timer timer = new Timer(getCachedUri(request)); - timer.start(); - - String key = calculateKey(request); - PageInfo pageInfo; - try { - // Page is not cached - build the response, cache it, and send to client - pageInfo = buildPage(request, response, chain); - if (pageInfo.isOk()) { - Object noCache = pageInfo.getCacheDirectives().get("no-cache"); - if (noCache instanceof Boolean && ((Boolean)noCache)) { - log.debug("Response ok but Cache-Control: no-cache is present, not caching"); - releaseCacheLocks(operationsByType, key); - } - else { - Collection caches = new ArrayList(); - for (CacheOperationContext operationContext : operationsByType.get(UPDATE)) { - for (Cache cache : operationContext.getCaches()) { - caches.add(cache); - } - } - update(caches, pageInfo, cacheStatus, key); - } - } - else { - for (CacheOperationContext operationContext : operationsByType.get(UPDATE)) { - for (Cache cache : operationContext.getCaches()) { - log.debug("Response not ok ({}). Putting null into cache {} with key {}", - new Object[] { pageInfo.getStatusCode(), cache.getName(), key } ); - } - } - releaseCacheLocks(operationsByType, key); - } - } - catch (LockTimeoutException e) { - //do not release the lock, because you never acquired it - throw e; - } - catch (Exception e) { - // Must unlock the cache if the above fails. Will be logged at Filter - releaseCacheLocks(operationsByType, key); - throw e; - } - - timer.stop(false); - response.addHeader(X_CACHED, String.valueOf(false)); - return pageInfo; - } - - protected PageInfo buildCachedPageInfo(HttpServletRequest request, HttpServletResponse response, - CacheStatus cacheStatus) throws Exception { - - Timer timer = new Timer(getCachedUri(request)); - timer.start(); - - String key = calculateKey(request); - PageInfo pageInfo; - ValueWrapper element = cacheStatus.valueWrapper; - try { - log.debug("Serving cached content for {}", key); - pageInfo = (PageInfo) element.get(); - - for (Map.Entry entry : pageInfo.getRequestAttributes().entrySet()) { - request.setAttribute(entry.getKey(), entry.getValue()); - } - - // As the page is cached, we need to add an instance of the associated - // controller to the request. This is required by GrailsLayoutDecoratorMapper - // to pick the appropriate layout. - if (StringUtils.hasLength(getContext().getControllerName())) { - Object controller = lookupController(getContext().getControllerClass()); - request.setAttribute(GrailsApplicationAttributes.CONTROLLER, controller); - } - } - catch (LockTimeoutException e) { - //do not release the lock, because you never acquired it - throw e; - } - - timer.stop(true); - response.addHeader(X_CACHED, String.valueOf(true)); - return pageInfo; - } - - protected abstract int getTimeToLive(ValueWrapper element); - - /** - * Store the PageInfo in the cache with the specified ttl. - * @param cache the cache - * @param key the key - * @param pageInfo the info - * @param timeToLive the ttl - */ - protected abstract void put(Cache cache, String key, PageInfo pageInfo, Integer timeToLive); - - protected void releaseCacheLocks(Map> operationsByType, String key) { -// /*Blocking*/Cache cache - // TODO is this needed since inspectBeforeCacheEvicts seems to do the right thing? - - for (CacheOperationContext operationContext : operationsByType.get(EVICT)) { - for (Cache cache : operationContext.getCaches()) { - put(cache, key, null, null); - } - } - } - - protected PageInfo buildPage(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { - // Invoke the next entity in the chain - SerializableByteArrayOutputStream out = new SerializableByteArrayOutputStream(); - GenericResponseWrapper wrapper = new GenericResponseWrapper(response, out); - Map cacheableRequestAttributes = new HashMap(); - - // TODO: split the special include handling out into a separate method - HttpServletResponse originalResponse = null; - boolean isInclude = WebUtils.isIncludeRequest(request); - if (isInclude) { - originalResponse = WrappedResponseHolder.getWrappedResponse(); - WrappedResponseHolder.setWrappedResponse(wrapper); - } - try { - List attributesBefore = toList(request.getAttributeNames()); - chain.doFilter(request, wrapper); - List attributesAfter = toList(request.getAttributeNames()); - attributesAfter.removeAll(attributesBefore); - for (String attrName : attributesAfter) { - Object value = request.getAttribute(attrName); - if (value instanceof Serializable) { - cacheableRequestAttributes.put(attrName, (Serializable)value); - } - } - } - finally { - if (isInclude) { - WrappedResponseHolder.setWrappedResponse(originalResponse); - } - } - wrapper.flush(); - - long timeToLiveSeconds = Integer.MAX_VALUE; // TODO cacheManager.getEhcache(context.cacheName).cacheConfiguration.timeToLiveSeconds; - - String contentType = wrapper.getContentType(); - if (!StringUtils.hasLength(contentType)) { - contentType = response.getContentType(); - } - - return new PageInfo(wrapper.getStatus(), contentType, out.toByteArray(), - false, timeToLiveSeconds, wrapper.getAllHeaders(), wrapper.getCookies(), cacheableRequestAttributes); - } - - protected List toList(Enumeration e) { - List list = new ArrayList(); - while (e.hasMoreElements()) { - list.add(e.nextElement()); - } - return list; - } - - protected String calculateKey(HttpServletRequest request) { - return keyGenerator.generate(request); - } - - /** - * Writes the response from a PageInfo object. - *

- * Headers are set last so that there is an opportunity to override - * - * 1 - only set status, contentType, cookies, etc. if this is the "main" - * request and not an include. 2 - send a status code 304 if appropriate. - * - * @param request - * @param response - * @param pageInfo - * @throws IOException - */ - protected void writeResponse(final HttpServletRequest request, final HttpServletResponse response, - final PageInfo pageInfo) throws IOException { - - if (!WebUtils.isIncludeRequest(request)) { - int statusCode = determineResponseStatus(request, pageInfo); - response.setStatus(statusCode); - setContentType(response, pageInfo); - setCookies(pageInfo, response); - setHeaders(pageInfo, response); - } - writeResponse(response, pageInfo); - } - - protected int determineResponseStatus(HttpServletRequest request, PageInfo pageInfo) { - int statusCode = pageInfo.getStatusCode(); - if (!pageInfo.isModified(request)) { - log.debug("Content not modified since {} sending 304", request.getHeader(HttpHeaders.IF_MODIFIED_SINCE)); - statusCode = HttpServletResponse.SC_NOT_MODIFIED; - } - else if (pageInfo.isMatch(request)) { - log.debug("Content matches entity tag {} sending 304", request.getHeader(HttpHeaders.IF_NONE_MATCH)); - statusCode = HttpServletResponse.SC_NOT_MODIFIED; - } - return statusCode; - } - - protected void setContentType(final HttpServletResponse response, final PageInfo pageInfo) { - String contentType = pageInfo.getContentType(); - if (contentType != null && contentType.length() > 0) { - response.setContentType(contentType); - } - } - - protected void setCookies(final PageInfo pageInfo, final HttpServletResponse response) { - Collection cookies = pageInfo.getSerializableCookies(); - for (SerializableCookie cookie : cookies) { - response.addCookie(cookie.toCookie()); - } - } - - /** - * Set the headers in the response object, excluding the Gzip header - * @param pageInfo - * @param response - */ - protected void setHeaders(final PageInfo pageInfo, final HttpServletResponse response) { - - Collection> headers = pageInfo.getHeaders(); - - // Track which headers have been set so all headers of the same name - // after the first are added - TreeSet setHeaders = new TreeSet(String.CASE_INSENSITIVE_ORDER); - - for (Header header : headers) { - String name = header.getName(); - - switch (header.getType()) { - case STRING: - if (setHeaders.contains(name)) { - response.addHeader(name, (String) header.getValue()); - } - else { - setHeaders.add(name); - response.setHeader(name, (String) header.getValue()); - } - break; - case DATE: - if (setHeaders.contains(name)) { - response.addDateHeader(name, (Long) header.getValue()); - } - else { - setHeaders.add(name); - response.setDateHeader(name, (Long) header.getValue()); - } - break; - case INT: - if (setHeaders.contains(name)) { - response.addIntHeader(name, (Integer) header.getValue()); - } - else { - setHeaders.add(name); - response.setIntHeader(name, (Integer) header.getValue()); - } - break; - default: - throw new IllegalArgumentException("No mapping for Header: " + header); - } - } - } - - protected void initContext() { - GrailsWebRequest requestAttributes = (GrailsWebRequest)RequestContextHolder.getRequestAttributes(); - contextHolder.get().push(new ContentCacheParameters(requestAttributes)); - } - - protected ContentCacheParameters getContext() { - return contextHolder.get().peek(); - } - - protected void destroyContext() { - contextHolder.get().pop(); - if (contextHolder.get().empty()) { - contextHolder.remove(); - } - } - - protected String getCachedUri(HttpServletRequest request) { - if (WebUtils.isIncludeRequest(request)) { - return (String)request.getAttribute(WebUtils.INCLUDE_REQUEST_URI_ATTRIBUTE); - } - return request.getRequestURI(); - } - - protected void logRequestDetails(HttpServletRequest request, ContentCacheParameters cacheParameters, String message) { - if (!log.isDebugEnabled()) { - return; - } - - log.debug("{}...", message); - log.debug(" method = {}", request.getMethod()); - log.debug(" requestURI = {}", request.getRequestURI()); - log.debug(" forwardURI = {}", WebUtils.getForwardURI(request)); - if (WebUtils.isIncludeRequest(request)) { - log.debug(" includeURI = {}", request.getAttribute(WebUtils.INCLUDE_REQUEST_URI_ATTRIBUTE)); - } - log.debug(" controller = {}", cacheParameters.getControllerName()); - log.debug(" action = {}", cacheParameters.getActionName()); - RequestMimeTypesApi requestMimeTypesApi = getBean("requestMimeTypesApi"); - log.debug(" format = {}", requestMimeTypesApi.getFormat(request)); - log.debug(" params = {}", cacheParameters.getParams()); - } - - protected Map> createOperationContext( - Collection cacheOperations, Method method, - Class targetClass, HttpServletRequest request) { - - Map> map = new LinkedHashMap>(3); - - Collection cacheables = new ArrayList(); - Collection evicts = new ArrayList(); - Collection updates = new ArrayList(); - - Object[] args = findArgs(request, method); - - for (CacheOperation cacheOperation : cacheOperations) { - CacheOperationContext opContext = new CacheOperationContext( - cacheOperation, method, args, targetClass, getCaches(cacheOperation), - expressionEvaluator, keyGenerator, request); - - if (cacheOperation instanceof CacheableOperation) { - cacheables.add(opContext); - } - - if (cacheOperation instanceof CacheEvictOperation) { - evicts.add(opContext); - } - - if (cacheOperation instanceof CachePutOperation) { - updates.add(opContext); - } - } - - map.put(CACHEABLE, cacheables); - map.put(EVICT, evicts); - map.put(UPDATE, updates); - - return map; - } - - protected Object[] findArgs(HttpServletRequest request, Method method) { - String[] names = paramNameDiscoverer.getParameterNames(method); - if (names == null) { - log.warn("Unable to lookup parameter names for method " + method); - return null; - } - - List args = new ArrayList(); - Class[] types = method.getParameterTypes(); - for (int i = 0, count = types.length; i < count; i++) { - args.add(findArg(request, types[i], names[i])); - } - return args.toArray(); - } - - protected Object findArg(HttpServletRequest request, Class type, String name) { - - if (String.class.equals(type)) { - return request.getParameter(name); - } - - if (PRIMITIVE_CLASSES.contains(type) || TYPE_TO_CONVERSION_METHOD_NAME.containsKey(type)) { - - String conversionMethodName; - if (TYPE_TO_CONVERSION_METHOD_NAME.containsKey(type)) { - conversionMethodName = TYPE_TO_CONVERSION_METHOD_NAME.get(type); - } - else { - conversionMethodName = type.getName(); - } - - GrailsWebRequest grailsRequest = (GrailsWebRequest)RequestContextHolder.getRequestAttributes(); - GrailsParameterMap params = grailsRequest.getParams(); - - return getParamValue(params, conversionMethodName, name); - } - - log.warn("Unsupported parameter type " + type + " for parameter " + name); - return null; - } - - protected Object getParamValue(GrailsParameterMap params, String conversionMethodName, String paramName) { - Method method = PARAMS_METHODS.get(conversionMethodName); - if (method == null) { - log.warn("No method found for " + conversionMethodName + " in GrailsParameterMap"); - return null; - } - - return ReflectionUtils.invokeMethod(method, params, paramName); - } - - protected Collection getCaches(CacheOperation operation) { - Set cacheNames = operation.getCacheNames(); - Collection caches = new ArrayList(cacheNames.size()); - for (String name : cacheNames) { - Cache cache = getCacheManager().getCache(name); - if (cache == null) { - throw new IllegalArgumentException("Cannot find cache named [" + name + "] for " + operation); - } - caches.add(cache); - } - return caches; - } - - protected boolean inspectBeforeCacheEvicts(Collection evictions) { - return inspectCacheEvicts(evictions, true); - } - - protected boolean inspectAfterCacheEvicts(Collection evictions) { - return inspectCacheEvicts(evictions, false); - } - - protected boolean inspectCacheEvicts(Collection evictions, boolean beforeInvocation) { - if (evictions.isEmpty()) { - return false; - } - - boolean trace = log.isTraceEnabled(); - - boolean atLeastOne = false; - for (CacheOperationContext operationContext : evictions) { - CacheEvictOperation evict = (CacheEvictOperation) operationContext.operation; - - if (beforeInvocation == evict.isBeforeInvocation()) { - if (operationContext.isConditionPassing()) { - atLeastOne = true; - // for each cache - // lazy key initialization - Object key = null; - - for (Cache cache : operationContext.getCaches()) { - // cache-wide flush - if (evict.isCacheWide()) { - cache.clear(); - logRequestDetails(operationContext.request, getContext(), "Flushing request"); - } - else { - // check key - if (key == null) { - key = operationContext.generateKey(); - } - if (trace) { - log.trace("Invalidating cache key {} for operation {} on method {}", - new Object[] { key, evict, operationContext.method }); - } - cache.evict(key); - } - } - } - else { - logRequestDetails(operationContext.request, getContext(), "Not flushing request"); - } - } - } - return atLeastOne; - } - - protected CacheStatus inspectCacheables(Collection cacheables) { - - if (cacheables.isEmpty()) { - return null; - } - - Map cUpdates = new LinkedHashMap(cacheables.size()); - - boolean trace = log.isTraceEnabled(); - boolean updateRequired = false; - boolean atLeastOne = false; - - ValueWrapper valueWrapper = null; - - for (CacheOperationContext context : cacheables) { - if (context.isConditionPassing()) { - atLeastOne = true; - Object key = context.generateKey(); - - if (trace) { - log.trace("Computed cache key {} for operation {}", new Object[] { key, context.operation }); - } - if (key == null) { - throw new IllegalArgumentException( - "Null key returned for cache operation (maybe you are using named params on classes without debug info?) " + - context.operation); - } - - // add op/key (in case an update is discovered later on) - cUpdates.put(context, key); - - boolean localCacheHit = false; - - // check whether the cache needs to be inspected or not (the method will be invoked anyway) - if (!updateRequired) { - for (Cache cache : context.getCaches()) { - ValueWrapper wrapper = cache.get(key); - if (wrapper != null) { - valueWrapper = wrapper; - localCacheHit = true; - break; - } - } - } - - if (!localCacheHit) { - updateRequired = true; - } - } - else { - if (trace) { - log.trace("Cache condition failed on method {} for operation {}", new Object[] { context.method, context.operation }); - } - } - } - - // return a status only if at least one cacheable matched - if (atLeastOne) { - return new CacheStatus(cUpdates, updateRequired, valueWrapper); - } - - return null; - } - - protected Map inspectCacheUpdates(Collection updates) { - - Map cUpdates = new LinkedHashMap(updates.size()); - if (updates.isEmpty()) { - return cUpdates; - } - - boolean trace = log.isTraceEnabled(); - - for (CacheOperationContext context : updates) { - if (context.isConditionPassing()) { - - Object key = context.generateKey(); - - if (trace) { - log.trace("Computed cache key {} for operation {}", - new Object[] { key, context.operation }); - } - if (key == null) { - throw new IllegalArgumentException( - "Null key returned for cache operation (maybe you are using named params on classes without debug info?) " + - context.operation); - } - - // add op/key (in case an update is discovered later on) - cUpdates.put(context, key); - } - else { - if (trace) { - log.trace("Cache condition failed on method {} for operation {}", - new Object[] { context.method, context.operation} ); - } - } - } - - return cUpdates; - } - - /** - * Assembles a response from a cached page include. These responses are never - * gzipped The content length should not be set in the response, because it - * is a fragment of a page. Don't write any headers at all. - */ - protected void writeResponse(final HttpServletResponse response, final PageInfo pageInfo) throws IOException { - byte[] cachedPage = pageInfo.getUngzippedBody(); - String page = new String(cachedPage, response.getCharacterEncoding()); - - String implementationVendor = response.getClass().getPackage().getImplementationVendor(); - if (implementationVendor != null && implementationVendor.equals("\"Evermind\"")) { - response.getOutputStream().print(page); - } - else { - response.getWriter().write(page); - } - } - - protected void update(Collection caches, PageInfo pageInfo, CacheStatus cacheStatus, String key) { - ValueWrapper element = cacheStatus == null ? null : cacheStatus.valueWrapper; - Object maxAge = pageInfo.getCacheDirectives().get("max-age"); - int timeToLive = (maxAge instanceof Integer) ? ((Integer)maxAge) : (int)pageInfo.getTimeToLiveSeconds(); - for (Cache cache : caches) { - log.debug("Response ok. Adding to cache {} with key {} and ttl {}", - new Object[] { cache.getName(), key, getTimeToLive(element) }); - put(cache, key, pageInfo, timeToLive); - } - } - - protected Object lookupController(Class controllerClass) { - if (controllerClass == null) { - return null; - } - return getBean(controllerClass.getName()); - } - - /** - * Dependency injection for GrailsAnnotationCacheOperationSource. - * @param source - */ - public void setCacheOperationSource(GrailsAnnotationCacheOperationSource source) { - cacheOperationSource = source; - } - - /** - * Dependency injection for ExpressionEvaluator. - * @param source - */ - public void setExpressionEvaluator(ExpressionEvaluator evaluator) { - expressionEvaluator = evaluator; - } - - /** - * Dependency injection for WebKeyGenerator. - * @param source - */ - public void setKeyGenerator(WebKeyGenerator generator) { - keyGenerator = generator; - } - - @Override - public void afterPropertiesSet() throws ServletException { - super.afterPropertiesSet(); - Assert.notNull(cacheOperationSource, "cacheOperationSource is required"); - Assert.notNull(expressionEvaluator, "expressionEvaluator is required"); - Assert.notNull(keyGenerator, "keyGenerator is required"); - } - - public static class CacheStatus { - // caches/key - protected final Map updates; - protected final boolean updateRequired; - protected final ValueWrapper valueWrapper; - - protected CacheStatus(Map updates, boolean updateRequired, ValueWrapper valueWrapper) { - this.updates = updates; - this.updateRequired = updateRequired; - this.valueWrapper = valueWrapper; - } - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/WebKeyGenerator.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/WebKeyGenerator.java deleted file mode 100644 index f0d4522..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/WebKeyGenerator.java +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache.web.filter; - -import javax.servlet.http.HttpServletRequest; - -/** - * Generates cache keys for requests. - * - * @author Burt Beckwith - */ -public interface WebKeyGenerator { - String generate(HttpServletRequest request); -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/simple/MemoryBlockingCache.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/simple/MemoryBlockingCache.java deleted file mode 100644 index b7d595f..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/simple/MemoryBlockingCache.java +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache.web.filter.simple; - -import grails.plugin.cache.BlockingCache; -import grails.plugin.cache.CacheConfiguration; - -import java.util.Collection; -import java.util.concurrent.ConcurrentMap; - -import org.springframework.cache.concurrent.ConcurrentMapCache; - -/** - * In-memory-based implementation of BlockingCache. - * - * @author Burt Beckwith - */ -public class MemoryBlockingCache extends ConcurrentMapCache implements BlockingCache { - - protected final CacheConfiguration cacheConfiguration = new MemoryCacheConfiguration(); - - public MemoryBlockingCache(String name, ConcurrentMap store, boolean allowNullValues) { - super(name, store, allowNullValues); - } - - public CacheConfiguration getCacheConfiguration() { - return cacheConfiguration; - } - - public boolean isDisabled() { - // TODO Auto-generated method stub - return false; - } - - public void setTimeoutMillis(int blockingTimeoutMillis) { - // TODO Auto-generated method stub - } - - public Collection getAllKeys() { - // TODO Auto-generated method stub - return null; - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/simple/MemoryCacheConfiguration.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/simple/MemoryCacheConfiguration.java deleted file mode 100644 index 83ff482..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/simple/MemoryCacheConfiguration.java +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache.web.filter.simple; - -import grails.plugin.cache.CacheConfiguration; - -/** - * In-memory-based implementation of CacheConfiguration. - * - * @author Burt Beckwith - */ -public class MemoryCacheConfiguration implements CacheConfiguration { - - public long getTimeToLiveSeconds() { - return Integer.MAX_VALUE; - } - - public boolean isEternal() { - return true; - } -} diff --git a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/simple/MemoryPageFragmentCachingFilter.java b/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/simple/MemoryPageFragmentCachingFilter.java deleted file mode 100644 index 0ac267e..0000000 --- a/target/work/plugins/cache-1.1.1/src/java/grails/plugin/cache/web/filter/simple/MemoryPageFragmentCachingFilter.java +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.cache.web.filter.simple; - -import grails.plugin.cache.web.PageInfo; -import grails.plugin.cache.web.filter.PageFragmentCachingFilter; - -import org.springframework.cache.Cache; -import org.springframework.cache.Cache.ValueWrapper; -import org.springframework.cache.concurrent.ConcurrentMapCacheManager; - -/** - * In-memory-based implementation of PageFragmentCachingFilter. - * - * @author Burt Beckwith - */ -public class MemoryPageFragmentCachingFilter extends PageFragmentCachingFilter { - -// @Override -// protected void replaceCacheWithDecoratedCache(Cache cache, BlockingCache blocking) { -// // TODO -// getNativeCacheManager().replaceCacheWithDecoratedCache( -// (Ehcache)cache.getNativeCache(), (Ehcache)blocking.getNativeCache()); -// } - -// @SuppressWarnings({ "cast", "unchecked" }) -// @Override -// protected BlockingCache createBlockingCache(Cache c) { -// ConcurrentMapCache cache = (ConcurrentMapCache)c; -// return new MemoryBlockingCache(cache.getName(), -// (ConcurrentMap)cache.getNativeCache(), cache.isAllowNullValues()); -// } - - @Override - protected int getTimeToLive(ValueWrapper wrapper) { - // not applicable - return Integer.MAX_VALUE; - } - - @Override - protected ConcurrentMapCacheManager getNativeCacheManager() { - return (ConcurrentMapCacheManager)super.getNativeCacheManager(); - } - - @Override - protected void put(Cache cache, String key, PageInfo pageInfo, Integer timeToLiveSeconds) { - // TTL isn't supported in the in-memory implementation - cache.put(key, pageInfo); - } -} diff --git a/target/work/plugins/database-migration-1.3.8/DatabaseMigrationGrailsPlugin.groovy b/target/work/plugins/database-migration-1.3.8/DatabaseMigrationGrailsPlugin.groovy deleted file mode 100644 index 3cb9ca7..0000000 --- a/target/work/plugins/database-migration-1.3.8/DatabaseMigrationGrailsPlugin.groovy +++ /dev/null @@ -1,139 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import grails.plugin.databasemigration.GormDatabaseSnapshotGenerator -import grails.plugin.databasemigration.GormDatabaseTypeConverter -import grails.plugin.databasemigration.GrailsChange -import grails.plugin.databasemigration.GrailsChangeLogParser -import grails.plugin.databasemigration.GrailsClassLoaderResourceAccessor -import grails.plugin.databasemigration.GrailsDiffStatusListener -import grails.plugin.databasemigration.GrailsPrecondition -import grails.plugin.databasemigration.MigrationRunner -import grails.plugin.databasemigration.MigrationUtils -import grails.plugin.databasemigration.MysqlAwareCreateTableGenerator -import grails.plugin.databasemigration.Slf4jLogger -import liquibase.change.ChangeFactory -import liquibase.database.typeconversion.TypeConverterFactory -import liquibase.logging.LogFactory -import liquibase.logging.Logger -import liquibase.parser.ChangeLogParserFactory -import liquibase.precondition.PreconditionFactory -import liquibase.resource.ClassLoaderResourceAccessor -import liquibase.resource.CompositeResourceAccessor -import liquibase.resource.FileSystemResourceAccessor -import liquibase.resource.ResourceAccessor -import liquibase.servicelocator.ServiceLocator -import liquibase.snapshot.DatabaseSnapshotGeneratorFactory -import liquibase.sqlgenerator.SqlGeneratorFactory -import liquibase.sqlgenerator.core.CreateTableGenerator - -class DatabaseMigrationGrailsPlugin { - - String version = '1.3.8' - String grailsVersion = '2.0 > *' - String author = 'Burt Beckwith' - String authorEmail = 'burt@burtbeckwith.com' - String title = 'Grails Database Migration Plugin' - String description = 'Grails Database Migration Plugin' - String documentation = 'http://grails-plugins.github.io/grails-database-migration/' - - List pluginExcludes = [ - 'grails-app/domain/**', - 'docs/**', - 'src/docs/**', - 'src/groovy/grails/plugin/databasemigration/test/**' - ] - - String license = 'APACHE' - def organization = [name: 'SpringSource', url: 'http://www.springsource.org/'] - def issueManagement = [system: 'JIRA', url: 'http://jira.grails.org/browse/GPDATABASEMIGRATION'] - def scm = [url: 'https://github.com/grails-plugins/grails-database-migration'] - - def doWithSpring = { - - MigrationUtils.application = application - - ResourceAccessor classLoaderResourceAccessor = new ClassLoaderResourceAccessor() - - if (application.warDeployed) { - migrationResourceAccessor(CompositeResourceAccessor, [new GrailsClassLoaderResourceAccessor(), classLoaderResourceAccessor]) - } - else { - String changelogLocation = MigrationUtils.changelogLocation - String changelogLocationPath = new File(changelogLocation).path - migrationResourceAccessor(CompositeResourceAccessor, [new FileSystemResourceAccessor(changelogLocationPath), classLoaderResourceAccessor]) - } - - diffStatusListener(GrailsDiffStatusListener) - } - - def doWithApplicationContext = { ctx -> - - def conf = ctx.grailsApplication.config.grails.plugin.databasemigration - if (conf.databaseChangeLogTableName) { - System.setProperty 'liquibase.databaseChangeLogTableName', conf.databaseChangeLogTableName - } - if (conf.databaseChangeLogLockTableName) { - System.setProperty 'liquibase.databaseChangeLogLockTableName', conf.databaseChangeLogLockTableName - } - - register ctx - - fixLogging() - - MigrationRunner.autoRun ctx.migrationCallbacks - } - - private void register(ctx) { - // adds support for .groovy extension - ChangeLogParserFactory.instance.register new GrailsChangeLogParser(ctx) - - // adds support for Groovy-based changes in DSL changelogs - ChangeFactory.instance.register GrailsChange - - // adds support for Groovy-based preconditions in DSL changelogs - PreconditionFactory.instance.register GrailsPrecondition - - // appends 'ENGINE=InnoDB' to 'create table ...' statements in MySQL if using InnoDB - SqlGeneratorFactory.instance.unregister CreateTableGenerator - SqlGeneratorFactory.instance.register new MysqlAwareCreateTableGenerator() - - if (MigrationUtils.hibernateAvailable()) { - registerHibernate ctx - } - } - - private void registerHibernate(ctx) { - - // used by gorm-diff and generate-gorm-changelog - DatabaseSnapshotGeneratorFactory.instance.register new GormDatabaseSnapshotGenerator() - - // fixes changelog errors generated from the GORM scripts - TypeConverterFactory.instance.register GormDatabaseTypeConverter - } - - private void fixLogging() { - // ensure that classesBySuperclass is populated - LogFactory.getLogger 'NOT_A_REAL_LOGGER_NAME' - - try { - // register the plugin's logger - ServiceLocator.instance.classesBySuperclass[Logger] << Slf4jLogger - } - catch (Throwable t) { - // ignored, fall back to default logging - } - } -} diff --git a/target/work/plugins/database-migration-1.3.8/LICENSE.txt b/target/work/plugins/database-migration-1.3.8/LICENSE.txt deleted file mode 100644 index 261eeb9..0000000 --- a/target/work/plugins/database-migration-1.3.8/LICENSE.txt +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/target/work/plugins/database-migration-1.3.8/application.properties b/target/work/plugins/database-migration-1.3.8/application.properties deleted file mode 100644 index 7bac0ca..0000000 --- a/target/work/plugins/database-migration-1.3.8/application.properties +++ /dev/null @@ -1 +0,0 @@ -app.grails.version=2.1.5 diff --git a/target/work/plugins/database-migration-1.3.8/dependencies.groovy b/target/work/plugins/database-migration-1.3.8/dependencies.groovy deleted file mode 100644 index 06b3550..0000000 --- a/target/work/plugins/database-migration-1.3.8/dependencies.groovy +++ /dev/null @@ -1,31 +0,0 @@ -grails.project.work.dir = 'target' -grails.project.docs.output.dir = 'docs/manual' // for backwards-compatibility, the docs are checked into gh-pages branch - -grails.project.dependency.resolution = { - - inherits 'global' - log 'warn' - - repositories { - grailsCentral() - - mavenLocal() - mavenCentral() - } - - dependencies { - compile('org.liquibase:liquibase-core:2.0.5') { - excludes 'junit', 'easymockclassextension', 'ant', 'servlet-api', 'spring' - } - } - - plugins { - build(':release:2.2.1', ':rest-client-builder:1.0.3') { - export = false - } - - runtime ":hibernate:$grailsVersion", { - export = false - } - } -} diff --git a/target/work/plugins/database-migration-1.3.8/grails-app/conf/DbdocUrlMappings.groovy b/target/work/plugins/database-migration-1.3.8/grails-app/conf/DbdocUrlMappings.groovy deleted file mode 100644 index 1c5ba1b..0000000 --- a/target/work/plugins/database-migration-1.3.8/grails-app/conf/DbdocUrlMappings.groovy +++ /dev/null @@ -1,5 +0,0 @@ -class DbdocUrlMappings { - static mappings = { - "/dbdoc/$section?/$filename?/$table?/$column?"(controller: 'dbdoc') - } -} diff --git a/target/work/plugins/database-migration-1.3.8/grails-app/controllers/grails/plugin/databasemigration/DbdocController.groovy b/target/work/plugins/database-migration-1.3.8/grails-app/controllers/grails/plugin/databasemigration/DbdocController.groovy deleted file mode 100644 index a82e787..0000000 --- a/target/work/plugins/database-migration-1.3.8/grails-app/controllers/grails/plugin/databasemigration/DbdocController.groovy +++ /dev/null @@ -1,154 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration - -import grails.plugin.databasemigration.dbdoc.MemoryDocVisitor -import grails.util.Environment -import liquibase.changelog.ChangeLogIterator -import liquibase.changelog.ChangeLogParameters -import liquibase.changelog.DatabaseChangeLog -import liquibase.changelog.filter.DbmsChangeSetFilter -import liquibase.database.Database -import liquibase.lockservice.LockService -import liquibase.parser.ChangeLogParserFactory - -/** - * @author Burt Beckwith - */ -class DbdocController { - - def migrationResourceAccessor - - def index = { - - // only configure if explicitly enabled or in dev mode if not disabled - def enabled = grailsApplication.config.grails.plugin.databasemigration.dbDocController.enabled - if (!(enabled instanceof Boolean)) { - enabled = Environment.current == Environment.DEVELOPMENT - } - if (!enabled) { - response.sendError 404 - return - } - - String changelogFileName = params.changelogFileName ?: MigrationUtils.changelogFileName - if (!new File(MigrationUtils.changelogLocation, changelogFileName).exists()) { - render "Changelog $changelogFileName not found" - return - } - - String section = params.section - String filename = params.filename - String table = params.table - String column = params.column - - if (!filename && (section == 'index' || !section)) { - render template: 'index', plugin: 'databaseMigration' - return - } - - if (section == 'globalnav') { - render template: 'globalnav', plugin: 'databaseMigration' - return - } - if (section == 'overview-summary') { - render template: 'overview-summary', plugin: 'databaseMigration' - return - } - if (section == 'dbdoc_stylesheet_css' || - filename == 'dbdoc_stylesheet_css' || - column == 'dbdoc_stylesheet_css') { - render template: 'stylesheet', contentType: 'text/css', plugin: 'databaseMigration' - return - } - - String sessionKey = '__DBDOC__' + changelogFileName - def files = session[sessionKey] - if (!files) { - files = generateHTML(changelogFileName) - session[sessionKey] = files - } - - if (!filename) { - if (files.containsKey(section)) { - render files[section] - return - } - render "no content for $section" - return - } - - if (section == 'changelogs' && !filename.toLowerCase().endsWith('.groovy')) { - filename += '.xml' - } - - String key = table && column ? "columns/${table}.${column}" : "$section/$filename" - if (files.containsKey(key)) { - if (key.endsWith('.xml')) { - render text: files[key], contentType: 'text/xml' - } - else if (key.endsWith('.groovy')) { - render text: '
\n' + files[key] + '\n
', contentType: 'text/html' - } - else { - render files[key] - } - return - } - - render "no content for $key" - } - - protected Map generateHTML(String changelogFileName) { - def database - LockService lockService - try { - - database = MigrationUtils.getDatabase() - - lockService = LockService.getInstance(database) - lockService.waitForLock() - - DatabaseChangeLog changeLog = ChangeLogParserFactory.instance.getParser( - changelogFileName, migrationResourceAccessor).parse( - changelogFileName, new ChangeLogParameters(database), migrationResourceAccessor) - - checkDatabaseChangeLogTable changeLog, database - - changeLog.validate database - - ChangeLogIterator logIterator = new ChangeLogIterator( - changeLog, new DbmsChangeSetFilter(database)) - - MemoryDocVisitor visitor = new MemoryDocVisitor(database) - logIterator.run visitor, database - - def files = visitor.generateHTML(migrationResourceAccessor) - files.pending = files['pending/index'] - files.pendingsql = files['pending/sql'] - files.recent = files['recent/index'] - files - } - finally { - try { lockService.releaseLock() } catch (ignored) {} - try { database?.close() } catch (ignored) {} - } - } - - protected void checkDatabaseChangeLogTable(DatabaseChangeLog databaseChangeLog, Database database) { - database.checkDatabaseChangeLogTable false, databaseChangeLog, null - database.checkDatabaseChangeLogLockTable() - } -} diff --git a/target/work/plugins/database-migration-1.3.8/grails-app/views/dbdoc/_globalnav.gsp b/target/work/plugins/database-migration-1.3.8/grails-app/views/dbdoc/_globalnav.gsp deleted file mode 100644 index 639dd04..0000000 --- a/target/work/plugins/database-migration-1.3.8/grails-app/views/dbdoc/_globalnav.gsp +++ /dev/null @@ -1,24 +0,0 @@ - - - -Overview - - - - - -Current Tables -
-Authors -
-Change Logs -
-Pending Changes -
-Pending SQL -
-Most Recent Changes -
- - - diff --git a/target/work/plugins/database-migration-1.3.8/grails-app/views/dbdoc/_index.gsp b/target/work/plugins/database-migration-1.3.8/grails-app/views/dbdoc/_index.gsp deleted file mode 100644 index f24929a..0000000 --- a/target/work/plugins/database-migration-1.3.8/grails-app/views/dbdoc/_index.gsp +++ /dev/null @@ -1,22 +0,0 @@ - - - -Database Documentation - - - - - - - - -<h2> -Frame Alert</h2> -<p> -This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. -<br/> -Link to<a href="${createLink(action: 'overview-summary')}">Non-frame version.</a> - - - - diff --git a/target/work/plugins/database-migration-1.3.8/grails-app/views/dbdoc/_overview-summary.gsp b/target/work/plugins/database-migration-1.3.8/grails-app/views/dbdoc/_overview-summary.gsp deleted file mode 100644 index 8f201a1..0000000 --- a/target/work/plugins/database-migration-1.3.8/grails-app/views/dbdoc/_overview-summary.gsp +++ /dev/null @@ -1,11 +0,0 @@ - - - Database Documentation Overview - - - -

Database Documentation

-

This report contains documentation on the database changes made.

-

Use the navigation to the left to navigate the documentation.

- - diff --git a/target/work/plugins/database-migration-1.3.8/grails-app/views/dbdoc/_stylesheet.gsp b/target/work/plugins/database-migration-1.3.8/grails-app/views/dbdoc/_stylesheet.gsp deleted file mode 100644 index e512032..0000000 --- a/target/work/plugins/database-migration-1.3.8/grails-app/views/dbdoc/_stylesheet.gsp +++ /dev/null @@ -1,60 +0,0 @@ -h1 { -} - -.TableHeadingColor { - background: #ccccff; /* Dark mauve */ -} -.TableSubHeadingColor { - background: #eeeeff; /* Light mauve */ -} -.TableRowColor { - background: white; -} - -.NavBarCell1 { - background-color: #eeeeff; /* Light mauve */ -} -.NavBarCell1Rev { - background-color: #00008b; /* Dark Blue */ -} -.NavBarFont1 { - color: black; -} -.NavBarFont1Rev { - color: white; -} - -.NavBarCell2 { - background-color: white; -} -.NavBarCell3 { - background-color: white; -} - -body { - background: #fff; - color: #333; - font: 12px verdana, arial, helvetica, sans-serif; -} - -a:link, a:visited, a:hover { - color: #666; - font-weight: bold; - text-decoration: none; -} - -td, th { - font: 11px verdana, arial, helvetica, sans-serif; - line-height: 12px; - padding: 5px 6px; - text-align: left; - vertical-align: top; -} - -th { - color: #666; - font-size: 11px; - font-weight: bold; - line-height: 17px; - padding: 2px 6px; -} diff --git a/target/work/plugins/database-migration-1.3.8/plugin.xml b/target/work/plugins/database-migration-1.3.8/plugin.xml deleted file mode 100644 index bc3fea8..0000000 --- a/target/work/plugins/database-migration-1.3.8/plugin.xml +++ /dev/null @@ -1,26 +0,0 @@ - - Burt Beckwith - burt@burtbeckwith.com - Grails Database Migration Plugin - Grails Database Migration Plugin - http://grails-plugins.github.io/grails-database-migration/ - DatabaseMigrationGrailsPlugin - - DbdocUrlMappings - spring.resources - grails.plugin.databasemigration.DbdocController - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmChangelogSync.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmChangelogSync.groovy deleted file mode 100644 index 9571e23..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmChangelogSync.groovy +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmChangelogSync: 'Mark all changes as executed in the database') { - depends dbmInit - - doAndClose { - liquibase.changeLogSync contexts - } -} - -setDefaultTarget dbmChangelogSync diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmChangelogSyncSql.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmChangelogSyncSql.groovy deleted file mode 100644 index 48aa280..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmChangelogSyncSql.groovy +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmChangelogSyncSql: 'Writes SQL to mark all changes as executed in the database to STDOUT') { - depends dbmInit - - if (!okToWrite()) return - - doAndClose { - liquibase.changeLogSync contexts, ScriptUtils.newPrintWriter(argsList) - } -} - -setDefaultTarget dbmChangelogSyncSql diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmChangelogToGroovy.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmChangelogToGroovy.groovy deleted file mode 100644 index cebfaf1..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmChangelogToGroovy.groovy +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmChangelogToGroovy: 'Creates a Groovy DSL changelog from a Liquibase XML file') { - depends dbmInit - - String xml = argsList[0] - if (!xml) { - errorAndDie "Must specify the source XML file path" - } - - String groovy = argsList[1] ?: argsList[0][0..-4] + 'groovy' - - if (!okToWrite(groovy)) return - - printMessage "Converting $xml to $groovy" - - ChangelogXml2Groovy = classLoader.loadClass('grails.plugin.databasemigration.ChangelogXml2Groovy') - new File(groovy).withWriter { it.write ChangelogXml2Groovy.convert(new File(xml).text) } -} - -setDefaultTarget dbmChangelogToGroovy diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmClearChecksums.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmClearChecksums.groovy deleted file mode 100644 index 7a974b0..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmClearChecksums.groovy +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmClearChecksums: 'Removes current checksums from database. On next run checksums will be recomputed') { - depends dbmInit - - doAndClose { - liquibase.clearCheckSums() - } -} - -setDefaultTarget dbmClearChecksums diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmCreateChangelog.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmCreateChangelog.groovy deleted file mode 100644 index 1e016c7..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmCreateChangelog.groovy +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmCreateChangelog: 'Creates an empty changelog file') { - depends dbmInit - - String name = argsList[0] ?: MigrationUtils.getChangelogFileName(dsName) - if (!name.toLowerCase().endsWith('.groovy')) { - name += '.groovy' - } - - try { - def file = new File(MigrationUtils.getChangelogLocation(dsName) + '/' + name) - file.parentFile?.mkdirs() - - if (!okToWrite(file.path)) return - - String user = (System.getProperty('user.name') ?: '').trim() - String author = user ? "$user (generated)" : 'diff-generated' - - ant.copy(file: "$databaseMigrationPluginDir/src/resources/changelog.template", - tofile: file.path, verbose: true, overwrite: true) { - filterset { - filter token: 'author', value: author - filter token: 'id', value: file.name - '.groovy' - } - } - } - catch (e) { - ScriptUtils.printStackTrace e - exit 1 - } -} - -setDefaultTarget dbmCreateChangelog diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmDbDoc.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmDbDoc.groovy deleted file mode 100644 index 7208a80..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmDbDoc.groovy +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmDbDoc: 'Generates Javadoc-like documentation based on current database and change log') { - depends dbmInit - - - doAndClose { - liquibase.generateDocumentation argsList[0] ?: MigrationUtils.getDbDocLocation(dsName), contexts - } -} - -setDefaultTarget dbmDbDoc diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmDiff.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmDiff.groovy deleted file mode 100644 index 871201e..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmDiff.groovy +++ /dev/null @@ -1,148 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License") - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -import grails.util.Environment - -import java.sql.DriverManager - -import javax.sql.DataSource - -import org.springframework.jndi.JndiObjectFactoryBean - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmDiff: 'Writes description of differences to standard out') { - depends dbmInit - - String otherEnv = argsList[0] - if (!otherEnv) { - errorAndDie 'You must specify the environment to diff against' - } - - if (Environment.getEnvironment(otherEnv) == Environment.current || otherEnv == Environment.current.name) { - errorAndDie 'You must specify a different environment than the one the script is running in' - } - - if (!okToWrite(1, true)) return - - def thisDatabase - def otherDatabase - try { - printMessage "Starting $hyphenatedScriptName against environment '$otherEnv'" - - ScriptUtils.executeAndWrite argsList[1], booleanArg('add'), dsName, { PrintStream out -> - MigrationUtils.executeInSession(dsName) { - thisDatabase = MigrationUtils.getDatabase(defaultSchema, dsName) - otherDatabase = buildOtherDatabase(otherEnv) - ScriptUtils.createAndPrintDiff thisDatabase, otherDatabase, otherDatabase, appCtx, diffTypes, out - } - } - - printMessage "Finished $hyphenatedScriptName" - } - catch (e) { - ScriptUtils.printStackTrace e - exit 1 - } - finally { - ScriptUtils.closeConnection thisDatabase?.connection - ScriptUtils.closeConnection otherDatabase?.connection - } -} - -buildOtherDatabase = { String otherEnv -> - - try { - // check if it's a full name - Environment.valueOf otherEnv - } - catch (e) { - // convert it from short name to full (e.g. 'dev' -> 'development') - String fullName = Environment.getEnvironment(otherEnv)?.name - if (fullName) { - otherEnv = fullName - } - } - - def configSlurper = new ConfigSlurper(otherEnv) - configSlurper.binding = binding.variables - def otherDsConfig = configSlurper.parse(classLoader.loadClass('DataSource')).dataSource - - def connection - - if (otherDsConfig.jndiName) { - def factory = new JndiObjectFactoryBean(jndiName: otherDsConfig.jndiName, expectedType: DataSource) - factory.afterPropertiesSet() - connection = factory.object.connection - } - else { - try { - Class.forName otherDsConfig.driverClassName, true, classLoader - } - catch (e) { - errorAndDie "Driver class $otherDsConfig.driverClassName not found" - } - - if (!otherDsConfig.url || !otherDsConfig.username) { - errorAndDie "The comparison DataSource URL and/or username is missing, or the DataSource configuration for environment '$otherEnv' wasn't found" - } - - String password = otherDsConfig.passwordEncryptionCodec ? resolvePassword(otherDsConfig) : otherDsConfig.password ?: null - connection = DriverManager.getConnection(otherDsConfig.url, otherDsConfig.username, password) - } - - MigrationUtils.getDatabase connection, defaultSchema, null -} - -resolvePassword = { ds -> - - Class codecClass - - def encryptionCodec = ds.passwordEncryptionCodec - if (encryptionCodec instanceof Class) { - codecClass = encryptionCodec - } - else { - encryptionCodec = encryptionCodec.toString() - codecClass = grailsApp.codecClasses.find { - it.name.equalsIgnoreCase(encryptionCodec) || it.fullName == encryptionCodec - }?.clazz - - if (!codecClass) { - codecClass = Class.forName(encryptionCodec, true, grailsApp.classLoader) - } - - if (!codecClass) { - throw new RuntimeException("Error decoding dataSource password. Codec class not found for name [$encryptionCodec]") - } - } - - try { - return codecClass.decode(ds.password) - } - catch (ClassNotFoundException e) { - throw new RuntimeException( - "Error decoding dataSource password. Codec class not found for name [$encryptionCodec]: $e.message", e) - } - catch (e) { - throw new RuntimeException("Error decoding dataSource password with codec [$encryptionCodec]: $e.message", e) - } -} - -setDefaultTarget dbmDiff diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmDropAll.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmDropAll.groovy deleted file mode 100644 index 01f05dd..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmDropAll.groovy +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -import liquibase.util.StringUtils - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmDropAll: 'Drops all database objects owned by the user') { - depends dbmInit - - doAndClose { - - String schemas = argsList[0] - List schemaNames = schemas ? StringUtils.splitAndTrim(schemas, ',') : null - if (schemaNames) { - liquibase.dropAll(schemaNames as String[]) - } - else { - liquibase.dropAll() - } - } -} - -setDefaultTarget dbmDropAll diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmFutureRollbackSql.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmFutureRollbackSql.groovy deleted file mode 100644 index d724303..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmFutureRollbackSql.groovy +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmFutureRollbackSql: 'Writes SQL to roll back the database to the current state after the changes in the changeslog have been applied') { - depends dbmInit - - if (!okToWrite()) return - - doAndClose { - liquibase.futureRollbackSQL contexts, ScriptUtils.newPrintWriter(argsList) - } -} - -setDefaultTarget dbmFutureRollbackSql diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmGenerateChangelog.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmGenerateChangelog.groovy deleted file mode 100644 index 3907b46..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmGenerateChangelog.groovy +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmGenerateChangelog: 'Generates an initial changelog XML file') { - depends dbmInit - - if (!okToWrite(0, true)) return - - doAndClose { - ScriptUtils.executeAndWrite argsList[0], booleanArg('add'), dsName, { PrintStream out -> - ScriptUtils.createAndPrintDiff(database, null, database, appCtx, diffTypes, out) - } - } -} - -setDefaultTarget dbmGenerateChangelog diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmGenerateGormChangelog.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmGenerateGormChangelog.groovy deleted file mode 100644 index f53bb06..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmGenerateGormChangelog.groovy +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmGenerateGormChangelog: 'Generates an initial changelog XML file based on the current GORM classes') { - depends dbmInit - - if (!isHibernateInstalled()) return - - if (!okToWrite(0, true)) return - - def configuredSchema = config.grails.plugin.databasemigration.schema - String argSchema = argsMap.schema - String effectiveSchema = argSchema ?: configuredSchema ?: null - - doAndClose { - ScriptUtils.executeAndWrite argsList[0], booleanArg('add'), dsName, { PrintStream out -> - def gormDatabase = ScriptUtils.createGormDatabase(dataSourceSuffix, config, appCtx, null, effectiveSchema) - ScriptUtils.createAndPrintFixedDiff gormDatabase, null, gormDatabase, appCtx, diffTypes, out - } - } -} - -setDefaultTarget dbmGenerateGormChangelog diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmGormDiff.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmGormDiff.groovy deleted file mode 100644 index 115ffa2..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmGormDiff.groovy +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -/** - * Similar to dbm-diff but diffs the current configuration based on the - * application's domain classes with the database configured for the current environment. - * - * Run 'grails dbm-gorm-diff' for the dev environment, or 'grails prod dbm-gorm-diff' for the - * prod environment, or for a custom environment 'grails -Dgrails.env=staging dbm-gorm-diff'. - * - * By default writes to the System.out but if passed a filename parameter will write to - * that, e.g. 'grails prod dbm-gorm-diff grails-app/conf/migrations/current_prod_diff.xml'. - * Doesn't modify any existing files - you need to manually merge the output into the - * changeset along with any necessary modifications. - * - * @author Burt Beckwith - */ - -target(dbmGormDiff: 'Diff GORM classes against database and generate a changelog') { - depends dbmInit - - if (!isHibernateInstalled()) return - - if (!okToWrite(0, true)) return - - def configuredSchema = config.grails.plugin.databasemigration.schema - String argSchema = argsMap.schema - String effectiveSchema = argSchema ?: configuredSchema ?: defaultSchema - - def realDatabase - - try { - printMessage "Starting $hyphenatedScriptName" - - ScriptUtils.executeAndWrite argsList[0], booleanArg('add'), dsName, { PrintStream out -> - MigrationUtils.executeInSession(dsName) { - realDatabase = MigrationUtils.getDatabase(effectiveSchema, dsName) - def gormDatabase = ScriptUtils.createGormDatabase(dataSourceSuffix, config, appCtx, realDatabase, effectiveSchema) - ScriptUtils.createAndPrintFixedDiff(gormDatabase, realDatabase, realDatabase, appCtx, diffTypes, out) - } - } - - printMessage "Finished $hyphenatedScriptName" - } - catch (e) { - ScriptUtils.printStackTrace e - exit 1 - } - finally { - ScriptUtils.closeConnection realDatabase - } -} - -setDefaultTarget dbmGormDiff diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmListLocks.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmListLocks.groovy deleted file mode 100644 index 489df6e..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmListLocks.groovy +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmListLocks: 'Lists who currently has locks on the database changelog') { - depends dbmInit - - if (!okToWrite()) return - - doAndClose { - liquibase.reportLocks ScriptUtils.calculateDestination(argsList) - } -} - -setDefaultTarget dbmListLocks diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmListTags.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmListTags.groovy deleted file mode 100644 index fe13126..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmListTags.groovy +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import liquibase.executor.ExecutorService -import liquibase.statement.core.SelectFromDatabaseChangeLogStatement - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmListTags: "Lists the tags in the current database") { - depends dbmInit - - doAndClose { - - def database = MigrationUtils.getDatabase() - - def tags = [] - def rows = ExecutorService.instance.getExecutor(database).queryForList(new SelectFromDatabaseChangeLogStatement("tag")) - for (row in rows) { - row.each { key, tag -> - if ('tag'.equalsIgnoreCase(key) && tag) { - tags << tag - } - } - } - - if (tags) { - println "\nFound the following tags:" - for (tag in tags) { - println " $tag" - } - } - else { - println "\nNo tags found" - } - } -} - -setDefaultTarget dbmListTags diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmMarkNextChangesetRan.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmMarkNextChangesetRan.groovy deleted file mode 100644 index c456270..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmMarkNextChangesetRan.groovy +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(markNextChangesetRan: 'Mark the next change set as executed in the database') { - depends dbmInit - - doAndClose { - - if (argsList[0] && okToWrite()) { - liquibase.markNextChangeSetRan contexts, ScriptUtils.newPrintWriter(argsList) - } - else { - liquibase.markNextChangeSetRan contexts - } - } -} - -setDefaultTarget markNextChangesetRan diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmPreviousChangesetSql.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmPreviousChangesetSql.groovy deleted file mode 100644 index b7e4933..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmPreviousChangesetSql.groovy +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmPreviousChangesetSql: 'Generates the SQL to apply the previous change sets') { - depends dbmInit - - def count = argsList[0] - if (!count) { - errorAndDie "The $hyphenatedScriptName script requires a change set count argument" - } - - if (!count.isNumber()) { - errorAndDie "The change set count argument '$count' isn't a number" - } - - if (!okToWrite(1)) return - - def skip = argsMap.skip ?: '0' - if (!skip.isNumber()) { - errorAndDie "The skip argument '$skip' isn't a number" - } - - doAndClose { - ScriptUtils.generatePreviousChangesetSql( - database, liquibase, ScriptUtils.newPrintWriter(argsList, 1), count.toInteger(), skip.toInteger(), contexts) - } -} - -setDefaultTarget dbmPreviousChangesetSql diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmRegisterChangelog.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmRegisterChangelog.groovy deleted file mode 100644 index c9f0407..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmRegisterChangelog.groovy +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmRegisterChangelog: 'Adds an include for the specified changelog to the main changelog') { - depends dbmInit - - String filename = argsList[0] - if (!filename) { - errorAndDie "The $hyphenatedScriptName script requires a changelog name argument" - } - - filename = MigrationUtils.getChangelogLocation(dsName) + '/' + filename - if (!new File(filename).exists()) { - errorAndDie "File $filename not found" - } - - ScriptUtils.registerInclude filename, dsName -} - -setDefaultTarget dbmRegisterChangelog diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmReleaseLocks.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmReleaseLocks.groovy deleted file mode 100644 index 144e6aa..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmReleaseLocks.groovy +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmReleaseLocks: 'Releases all locks on the database changelog') { - depends dbmInit - - doAndClose { - liquibase.forceReleaseLocks() - } -} - -setDefaultTarget dbmReleaseLocks diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmRollback.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmRollback.groovy deleted file mode 100644 index 1dfbd5a..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmRollback.groovy +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmRollback: 'Rolls back the database to the state it was in when the tag was applied') { - depends dbmInit - - String tag = argsList[0] - if (!tag) { - errorAndDie "The $hyphenatedScriptName script requires a tag" - } - - doAndClose { - liquibase.rollback tag, contexts - } -} - -setDefaultTarget dbmRollback diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmRollbackCount.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmRollbackCount.groovy deleted file mode 100644 index faa497c..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmRollbackCount.groovy +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmRollbackCount: 'Rolls back the last change sets') { - depends dbmInit - - def count = argsList[0] - if (!count) { - errorAndDie "The $hyphenatedScriptName script requires a change set count argument" - } - - if (!count.isNumber()) { - errorAndDie "The change set count argument '$count' isn't a number" - } - - doAndClose { - liquibase.rollback count.toInteger(), contexts - } -} - -setDefaultTarget dbmRollbackCount diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmRollbackCountSql.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmRollbackCountSql.groovy deleted file mode 100644 index b39d280..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmRollbackCountSql.groovy +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmRollbackCountSql: 'Writes SQL to roll back the last change sets to STDOUT') { - depends dbmInit - - def count = argsList[0] - if (!count) { - errorAndDie "The $hyphenatedScriptName script requires a change set count argument" - } - - if (!count.isNumber()) { - errorAndDie "The change set count argument '$count' isn't a number" - } - - if (!okToWrite(1)) return - - doAndClose { - liquibase.rollback count.toInteger(), contexts, ScriptUtils.newOutputStreamWriter(argsList, 1) - } -} - -setDefaultTarget dbmRollbackCountSql diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmRollbackSql.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmRollbackSql.groovy deleted file mode 100644 index 5b3708e..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmRollbackSql.groovy +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmRollbackSql: 'Writes SQL to roll back the database to the state it was in when the tag was applied to STDOUT') { - depends dbmInit - - String tag = argsList[0] - if (!tag) { - errorAndDie "The $hyphenatedScriptName script requires a tag" - } - - if (!okToWrite(1)) return - - doAndClose { - liquibase.rollback tag, contexts, ScriptUtils.newOutputStreamWriter(argsList, 1) - } -} - -setDefaultTarget dbmRollbackSql diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmRollbackToDate.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmRollbackToDate.groovy deleted file mode 100644 index b060fa0..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmRollbackToDate.groovy +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmRollbackToDate: 'Rolls back the database to the state it was in at the given date/time') { - depends dbmInit - - doAndClose { - liquibase.rollback calculateDate(), contexts - } -} - -setDefaultTarget dbmRollbackToDate diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmRollbackToDateSql.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmRollbackToDateSql.groovy deleted file mode 100644 index 6ee5e10..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmRollbackToDateSql.groovy +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmRollbackToDateSql: 'Writes SQL to roll back the database to the state it was in at the given date/time version to STDOUT') { - depends dbmInit - - doAndClose { - Date date = calculateDate() - PrintWriter pw - if (calculateDateFileNameIndex) { - if (!okToWrite(calculateDateFileNameIndex)) return - pw = new PrintWriter(new PrintStream(argsList[calculateDateFileNameIndex])) - } - else { - pw = new PrintWriter(System.out) - } - liquibase.rollback date, contexts, pw - } -} - -setDefaultTarget dbmRollbackToDateSql diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmStatus.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmStatus.groovy deleted file mode 100644 index 36cd610..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmStatus.groovy +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmStatus: 'Outputs list of unrun change sets') { - depends dbmInit - - if (!okToWrite()) return - - doAndClose { - boolean verbose = argsMap.verbose == null ? true : Boolean.valueOf(argsMap.verbose) - liquibase.reportStatus verbose, contexts, ScriptUtils.newOutputStreamWriter(argsList) - } -} - -setDefaultTarget dbmStatus diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmTag.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmTag.groovy deleted file mode 100644 index aa7772a..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmTag.groovy +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmTag: "'Tags' the current database state for future rollback") { - depends dbmInit - - String tag = argsList[0] - if (!tag) { - errorAndDie "The $hyphenatedScriptName script requires a tag" - } - - doAndClose { - liquibase.tag tag - } -} - -setDefaultTarget dbmTag diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmUpdate.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmUpdate.groovy deleted file mode 100644 index d131a92..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmUpdate.groovy +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmUpdate: 'Updates database to current version') { - depends dbmInit - - doAndClose { - liquibase.update contexts - } -} - -setDefaultTarget dbmUpdate diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmUpdateCount.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmUpdateCount.groovy deleted file mode 100644 index df4af89..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmUpdateCount.groovy +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmUpdateCount: 'Applies the next change sets') { - depends dbmInit - - def count = argsList[0] - if (!count) { - errorAndDie "The $hyphenatedScriptName script requires a change set count argument" - } - - if (!count.isNumber()) { - errorAndDie "The change set count argument '$count' isn't a number" - } - - doAndClose { - liquibase.update count.toInteger(), contexts - } -} - -setDefaultTarget dbmUpdateCount diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmUpdateCountSql.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmUpdateCountSql.groovy deleted file mode 100644 index 0e31b34..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmUpdateCountSql.groovy +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmUpdateCountSql: 'Generates the SQL to apply the next change sets') { - depends dbmInit - - def count = argsList[0] - if (!count) { - errorAndDie "The $hyphenatedScriptName script requires a change set count argument" - } - - if (!count.isNumber()) { - errorAndDie "The change set count argument '$count' isn't a number" - } - - if (!okToWrite(1)) return - - doAndClose { - liquibase.update count.toInteger(), contexts, ScriptUtils.newPrintWriter(argsList, 1) - } -} - -setDefaultTarget dbmUpdateCountSql diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmUpdateSql.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmUpdateSql.groovy deleted file mode 100644 index 749334b..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmUpdateSql.groovy +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmUpdateSql: 'Writes SQL to update database to current version to STDOUT') { - depends dbmInit - - if (!okToWrite()) return - - doAndClose { - liquibase.update contexts, ScriptUtils.newPrintWriter(argsList) - } -} - -setDefaultTarget dbmUpdateSql diff --git a/target/work/plugins/database-migration-1.3.8/scripts/DbmValidate.groovy b/target/work/plugins/database-migration-1.3.8/scripts/DbmValidate.groovy deleted file mode 100644 index 69552fc..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/DbmValidate.groovy +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ -includeTargets << new File("$databaseMigrationPluginDir/scripts/_DatabaseMigrationCommon.groovy") - -target(dbmValidate: 'Checks the changelog for errors') { - depends dbmInit - - doAndClose { - liquibase.validate() - } -} - -setDefaultTarget dbmValidate diff --git a/target/work/plugins/database-migration-1.3.8/scripts/_DatabaseMigrationCommon.groovy b/target/work/plugins/database-migration-1.3.8/scripts/_DatabaseMigrationCommon.groovy deleted file mode 100644 index 28e74b1..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/_DatabaseMigrationCommon.groovy +++ /dev/null @@ -1,138 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @author Burt Beckwith - */ - -import grails.util.GrailsNameUtils - -includeTargets << grailsScript('_GrailsBootstrap') - -target(dbmInit: 'General initialization, also creates a Liquibase instance') { - depends(classpath, checkVersion, configureProxy, enableExpandoMetaClass, compile, bootstrap, loadApp) - - configureApp() - - try { - hyphenatedScriptName = GrailsNameUtils.getScriptName(scriptName) - MigrationUtils = classLoader.loadClass('grails.plugin.databasemigration.MigrationUtils') - ScriptUtils = classLoader.loadClass('grails.plugin.databasemigration.ScriptUtils') - - argsList = argsMap.params - contexts = argsMap.contexts - diffTypes = argsMap.diffTypes - defaultSchema = argsMap.defaultSchema - dataSourceSuffix = argsMap.dataSource - dsName = MigrationUtils.dataSourceNameWithSuffix(dataSourceSuffix) - - mkdir dir: MigrationUtils.changelogLocation - } - catch (e) { - ScriptUtils.printStackTrace e - throw e - } -} - -doAndClose = { Closure c -> - try { - MigrationUtils.executeInSession(dsName) { - database = MigrationUtils.getDatabase(defaultSchema, dsName) - String changeLogFileName = MigrationUtils.getChangelogFileName(dsName) - liquibase = MigrationUtils.getLiquibase(database, changeLogFileName) - - def dsConfig = config."$dsName" - String dbDesc = dsConfig.jndiName ? "JNDI $dsConfig.jndiName" : "$dsConfig.username @ $dsConfig.url" - printMessage "Starting $hyphenatedScriptName for database $dbDesc" - c() - printMessage "Finished $hyphenatedScriptName" - } - } - catch (e) { - ScriptUtils.printStackTrace e - exit 1 - } - finally { - ScriptUtils.closeConnection database - } -} - -booleanArg = { String name -> - argsMap[name] instanceof Boolean ? argsMap[name] : false -} - -errorAndDie = { String message -> - errorMessage "\nERROR: $message" - exit 1 -} - -okToWrite = { destinationOrIndex = 0, boolean relativeToMigrationDir = false -> - - String destination - if (destinationOrIndex instanceof Number) { - destination = argsList[destinationOrIndex] - if (!destination) { - return true // stdout - } - } - else { - destination = destinationOrIndex - } - - if (relativeToMigrationDir) { - destination = MigrationUtils.getChangelogLocation(dsName) + '/' + destination - } - - def file = new File(destination) - if (!file.exists()) { - return true - } - - String propertyName = "file.overwrite.$file.name" - ant.input(addProperty: propertyName, message: "$destination exists, ok to overwrite?", - validargs: 'y,n', defaultvalue: 'y') - - if (ant.antProject.properties."$propertyName" == 'n') { - return false - } - - true -} - -printMessage = { String message -> event('StatusUpdate', [message]) } -errorMessage = { String message -> event('StatusError', [message]) } - -calculateDate = { - Map results = ScriptUtils.calculateDate(argsList) - if (results.error) { - errorAndDie results.error - } - - binding.calculateDateFileNameIndex = results.calculateDateFileNameIndex - - results.date -} - -isHibernateInstalled = { -> - if (!pluginManager.hasGrailsPlugin('hibernate')) { - errorMessage "Hibernate plugin isn't installed; GORM-based scripts are not available" - return false - } - true -} - -target(enableExpandoMetaClass: "Calls ExpandoMetaClass.enableGlobally()") { - ExpandoMetaClass.enableGlobally() -} diff --git a/target/work/plugins/database-migration-1.3.8/scripts/_Events.groovy b/target/work/plugins/database-migration-1.3.8/scripts/_Events.groovy deleted file mode 100644 index cf7457d..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/_Events.groovy +++ /dev/null @@ -1,27 +0,0 @@ -// sets the scriptName so we know if we can automigrate -eventPackageAppEnd = { - try { - def MigrationUtils = classLoader.loadClass('grails.plugin.databasemigration.MigrationUtils') - MigrationUtils.scriptName = binding.variables.scriptName - } - catch (Throwable t) { - println "\nERROR setting MigrationUtils.scriptName, auto-migrate not possible: $e.message\n" - } -} - -// copies migration files to the classpath so they'll be available for automigration -eventCreateWarStart = { name, stagingDir -> - - def conf = config.grails.plugin.databasemigration - String changelogLocation = conf.changelogLocation ?: 'grails-app/migrations' - if (!new File(changelogLocation).exists()) { - return - } - - File classesDir = new File(stagingDir, 'WEB-INF/classes/migrations') - classesDir.mkdirs() - - ant.copy(todir: classesDir.path, verbose: true) { - fileset dir: changelogLocation - } -} diff --git a/target/work/plugins/database-migration-1.3.8/scripts/_Install.groovy b/target/work/plugins/database-migration-1.3.8/scripts/_Install.groovy deleted file mode 100644 index 0e1104d..0000000 --- a/target/work/plugins/database-migration-1.3.8/scripts/_Install.groovy +++ /dev/null @@ -1 +0,0 @@ -ant.mkdir dir: "$basedir/grails-app/migrations" diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/ChangelogXml2Groovy.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/ChangelogXml2Groovy.groovy deleted file mode 100644 index 0b645f2..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/ChangelogXml2Groovy.groovy +++ /dev/null @@ -1,103 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration - -/** - * Generates a Groovy DSL version of a Liquibase XML changelog. - * - * @author Burt Beckwith - */ -class ChangelogXml2Groovy { - - protected static final String NEWLINE = System.getProperty('line.separator') - - /** - * Convert a Liquibase XML changelog to Groovy DSL format. - * @param xml the XML - * @return DSL format - */ - static String convert(String xml) { - def groovy = new StringBuilder('databaseChangeLog = {') - groovy.append NEWLINE - for (node in new XmlParser(false, false).parseText(xml)) { - convertNode node, groovy, 1 - } - groovy.append '}' - groovy.append NEWLINE - groovy.toString() - } - - protected static void convertNode(Node node, StringBuilder groovy, int indentLevel) { - - groovy.append NEWLINE - appendWithIndent indentLevel, groovy, node.name() - - String mixedText - def children = [] - for (child in node.children()) { - if (child instanceof String) { - mixedText = child - } - else { - children << child - } - } - - appendAttrs groovy, node, mixedText - - if (children) { - groovy.append ' {' - for (child in children) { - convertNode child, groovy, indentLevel + 1 - } - appendWithIndent indentLevel, groovy, '}' - groovy.append NEWLINE - } - else { - groovy.append NEWLINE - } - } - - protected static void appendAttrs(StringBuilder groovy, Node node, String text) { - def local = new StringBuilder() - - String delimiter = '' - - if (text) { - local.append '"""' - local.append text.replaceAll(/(\$|\\)/, /\\$1/) - local.append '"""' - delimiter = ', ' - } - - node.attributes().each { name, value -> - local.append delimiter - local.append name - local.append(': "').append(value.replaceAll(/(\$|\\|\\n)/, /\\$1/)).append('"') - delimiter = ', ' - } - - if (local.length()) { - groovy.append '(' - groovy.append local.toString() - groovy.append ')' - } - } - - protected static void appendWithIndent(int indentLevel, StringBuilder groovy, String s) { - indentLevel.times { groovy.append '\t' } - groovy.append s - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/DslBuilder.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/DslBuilder.groovy deleted file mode 100644 index 831b6f8..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/DslBuilder.groovy +++ /dev/null @@ -1,759 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License") - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration - -import java.lang.reflect.Method -import java.util.jar.JarFile - -import liquibase.change.Change -import liquibase.change.ChangeFactory -import liquibase.change.ChangeWithColumns -import liquibase.change.ColumnConfig -import liquibase.change.ConstraintsConfig -import liquibase.change.core.CreateProcedureChange -import liquibase.change.core.CreateViewChange -import liquibase.change.core.DeleteDataChange -import liquibase.change.core.ExecuteShellCommandChange -import liquibase.change.core.InsertDataChange -import liquibase.change.core.LoadDataChange -import liquibase.change.core.LoadDataColumnConfig -import liquibase.change.core.RawSQLChange -import liquibase.change.core.SQLFileChange -import liquibase.change.core.StopChange -import liquibase.change.core.UpdateDataChange -import liquibase.change.custom.CustomChangeWrapper -import liquibase.changelog.ChangeLogParameters -import liquibase.changelog.ChangeSet -import liquibase.changelog.DatabaseChangeLog -import liquibase.exception.ChangeLogParseException -import liquibase.exception.LiquibaseException -import liquibase.exception.MigrationFailedException -import liquibase.parser.ChangeLogParser -import liquibase.parser.ChangeLogParserFactory -import liquibase.precondition.CustomPreconditionWrapper -import liquibase.precondition.Precondition -import liquibase.precondition.PreconditionFactory -import liquibase.precondition.PreconditionLogic -import liquibase.precondition.core.PreconditionContainer -import liquibase.resource.ResourceAccessor -import liquibase.sql.visitor.SqlVisitor -import liquibase.sql.visitor.SqlVisitorFactory -import liquibase.util.ObjectUtil -import liquibase.util.StringUtils -import liquibase.util.file.FilenameUtils - -import org.codehaus.groovy.runtime.InvokerHelper -import org.slf4j.Logger -import org.slf4j.LoggerFactory -import org.springframework.context.ApplicationContext - -/** - * Based on liquibase.parser.core.xml.XMLChangeLogSAXHandler. - * - * @author Burt Beckwith - */ -class DslBuilder extends BuilderSupport { - - protected Logger log = LoggerFactory.getLogger(getClass()) - - protected Change currentChange - protected String currentText - protected ChangeSet currentChangeSet - protected String currentParamName - protected Precondition currentPrecondition - protected PreconditionContainer rootPrecondition - protected List changeSubObjects = [] - protected List preconditionLogicStack = [] - protected boolean inRollback - protected boolean inModifySql - protected boolean modifySqlAppliedOnRollback - protected Set modifySqlDbmsList - protected Set modifySqlContexts - - protected ResourceAccessor resourceAccessor - protected ChangeLogParameters changeLogParameters - protected ApplicationContext ctx - - // set after the parser runs - DatabaseChangeLog databaseChangeLog - - DslBuilder(ChangeLogParameters changeLogParameters, ResourceAccessor resourceAccessor, - String changeLogLocation, ApplicationContext ctx) { - - this.changeLogParameters = changeLogParameters - this.resourceAccessor = resourceAccessor - this.ctx = ctx - - databaseChangeLog = new DatabaseChangeLog() - databaseChangeLog.setPhysicalFilePath changeLogLocation - databaseChangeLog.setChangeLogParameters changeLogParameters - } - - @Override - def invokeMethod(String methodName, args) { - - if (currentChange instanceof GrailsChange && - processGrailsChangeProperty(methodName, args)) { - return - } - - if (currentPrecondition instanceof GrailsPrecondition && - processGrailsPreconditionProperty(methodName, args)) { - return - } - - super.invokeMethod methodName, args - } - - @Override - protected createNode(name, Map attributes, value) { - - attributes = expandExpressions(attributes) - - if ('comment' == name) { - setText value - } - else if ('validCheckSum' == name) { - setText value - } - else if ('logicalFilePath' == name) { - databaseChangeLog.logicalFilePath = value - } - else if ('databaseChangeLog' == name) { - databaseChangeLog.setLogicalFilePath attributes.logicalFilePath - } - else if ('include' == name) { - handleIncludedChangeLog attributes.file.replace('\\', '/'), - Boolean.parseBoolean(attributes.relativeToChangelogFile), - databaseChangeLog.physicalFilePath - } - else if ('includeAll' == name) { - processIncludeAll attributes - } - else if (!currentChangeSet && 'changeSet' == name) { - processChangeSet attributes - } - else if (currentChangeSet && 'rollback' == name) { - setText value - processRollback attributes - } - else if ('preConditions' == name) { - processPreConditions attributes - } - else if (currentPrecondition instanceof CustomPreconditionWrapper && 'param' == name) { - currentPrecondition.setParam attributes.name, attributes.value - } - else if (rootPrecondition) { - currentPrecondition = PreconditionFactory.instance.create(name) - - setPropertiesFromAttributes currentPrecondition, attributes - preconditionLogicStack[-1].addNestedPrecondition currentPrecondition - - if (currentPrecondition instanceof PreconditionLogic) { - preconditionLogicStack << currentPrecondition - } - else if (currentPrecondition instanceof GrailsPrecondition) { - currentPrecondition.ctx = ctx - currentPrecondition.resourceAccessor = resourceAccessor - } - - if ('sqlCheck' == name) { - setText value - } - } - else if ('modifySql' == name) { - processModifySql attributes - } - else if (inModifySql) { - SqlVisitor sqlVisitor = SqlVisitorFactory.instance.create(name) - setPropertiesFromAttributes sqlVisitor, attributes - sqlVisitor.setApplicableDbms modifySqlDbmsList - sqlVisitor.setApplyToRollback modifySqlAppliedOnRollback - sqlVisitor.setContexts modifySqlContexts - currentChangeSet.addSqlVisitor sqlVisitor - } - else if (currentChangeSet && !currentChange) { - processChange name, attributes, value - } - else if (currentChange && 'column' == name) { - processColumn attributes - } - else if (currentChange && 'constraints' == name) { - processConstraints attributes - } - else if ('param' == name) { - processParam attributes - } - else if ('where' == name || 'whereLazy' == name) { - setText value - } - else if ('property' == name) { - processProperty attributes - } - else if (currentChange instanceof ExecuteShellCommandChange && 'arg' == name) { - currentChange.addArg attributes.value - } - else if (currentChange) { - String creatorMethod = 'create' + name[0].toUpperCase() + name[1..-1] - def objectToCreateFrom = changeSubObjects ? changeSubObjects[-1] : currentChange - Method method - try { - method = objectToCreateFrom.getClass().getMethod(creatorMethod) - } - catch (NoSuchMethodException e) { - throw new MigrationFailedException(currentChangeSet, - "Could not find creator method $creatorMethod for tag: $name") - } - def subObject = method.invoke(objectToCreateFrom) - setPropertiesFromAttributes subObject, attributes - changeSubObjects << subObject - } - else { - throw new MigrationFailedException(currentChangeSet, "Unexpected tag: $name") - } - - name - } - - protected Map expandExpressions(Map original) { - def expanded = [:] - original.each { name, value -> - expanded[name] = changeLogParameters.expandExpressions(original[name]?.toString()) - } - expanded - } - - protected boolean processGrailsChangeProperty(String methodName, args) { - args = InvokerHelper.asList(args) - - switch (methodName.toLowerCase()) { - case 'init': - if (args.size() == 1 && args[0] instanceof Closure) { - currentChange.initClosure = args[0] - return true - } - break - - case 'validate': - if (args.size() == 1 && args[0] instanceof Closure) { - currentChange.validateClosure = args[0] - return true - } - break - - case 'change': - if (args.size() == 1 && args[0] instanceof Closure) { - currentChange.changeClosure = args[0] - return true - } - break - - case 'rollback': - if (args.size() == 1 && args[0] instanceof Closure) { - currentChange.rollbackClosure = args[0] - return true - } - break - - case 'confirm': - if (args.size() == 1 && args[0] instanceof CharSequence) { - currentChange.confirmationMessage = args[0].toString() - return true - } - break - - case 'checksum': - if (args.size() == 1 && args[0] instanceof CharSequence) { - currentChange.checksumString = args[0].toString() - return true - } - break - - case 'priority': - if (args.size() == 1 && args[0] instanceof Number) { - currentChange.priority = args[0].intValue() - return true - } - break - } - - false - } - - protected boolean processGrailsPreconditionProperty(String methodName, args) { - args = InvokerHelper.asList(args) - - if ('check' == methodName.toLowerCase() && - args.size() == 1 && args[0] instanceof Closure) { - currentPrecondition.checkClosure = args[0] - return true - } - - false - } - - protected void setText(String value) { - currentText = changeLogParameters.expandExpressions(StringUtils.trimToNull(value)) - } - - protected void processIncludeAll(Map attributes) { - String pathName = attributes.path.replace('\\', '/') - if (!pathName.endsWith('/')) { - pathName += '/' - } - - log.debug "includeAll for $pathName" - log.debug "Using file opener for includeAll: $resourceAccessor" - - if (Boolean.parseBoolean(attributes.relativeToChangelogFile)) { - File changeLogFile = new File(databaseChangeLog.physicalFilePath) - File resourceBase = new File(changeLogFile.parent, pathName) - if (!resourceBase.exists()) { - throw new ChangeLogParseException( - "Resource directory for includeAll does not exist [$resourceBase.path]") - } - pathName = resourceBase.path.replace('\\', '/') + '/' - } - - SortedSet resources = new TreeSet(new Comparator() { - int compare(URL o1, URL o2) { o1.toString() <=> o2.toString() } - }) - resourceAccessor.getResources(pathName).each { resources.add it } - - boolean foundResource = false - Set seenPaths = [] - for (URL fileUrl : resources) { - if (!fileUrl.toExternalForm().startsWith('file:')) { - if (fileUrl.toExternalForm().startsWith('jar:file:') || - fileUrl.toExternalForm().startsWith('wsjar:file:') || - fileUrl.toExternalForm().startsWith('zip:')) { - fileUrl = new File(extractZipFile(fileUrl), pathName).toURI().toURL() - } - else { - log.debug "${fileUrl.toExternalForm()} is not a file path" - continue - } - } - File file = new File(fileUrl.toURI()) - log.debug "includeAll using path $file.canonicalPath" - if (!file.exists()) { - throw new ChangeLogParseException("includeAll path $pathName could not be found. Tried in $file") - } - if (file.isDirectory()) { - log.debug "$file.canonicalPath is a directory" - for (File childFile : new TreeSet(file.listFiles() as List)) { - String path = pathName + childFile.name - if (!seenPaths.add(path)) { - log.debug "already included $path" - continue - } - - if (handleIncludedChangeLog(path, false, databaseChangeLog.physicalFilePath)) { - foundResource = true - } - } - } - else { - String path = pathName + file.name - if (!seenPaths.add(path)) { - log.debug "already included $path" - continue - } - if (handleIncludedChangeLog(path, false, databaseChangeLog.physicalFilePath)) { - foundResource = true - } - } - } - - if (!foundResource) { - throw new ChangeLogParseException("Could not find directory or directory was empty for includeAll '$pathName'") - } - } - - protected File extractZipFile(URL resource) { - String path = resource.file.split('!')[0] - if (path.matches('file:\\/[A-Za-z]:\\/.*')) { - path = path.replaceFirst('file:\\/', '') - } - else { - path = path.replaceFirst('file:', '') - } - - File tempDir = File.createTempFile('liquibase-sax', '.dir') - tempDir.deleteDir() - tempDir.mkdir() - - File zipfile = new File(URLDecoder.decode(path)) - new JarFile(zipfile).entries().each { new File(tempDir, it.name).mkdirs() } - - tempDir - } - - protected void processChangeSet(Map attributes) { - boolean alwaysRun = 'true'.equalsIgnoreCase(attributes.runAlways) - boolean runOnChange = 'true'.equalsIgnoreCase(attributes.runOnChange) - String filePath = attributes.logicalFilePath ?: databaseChangeLog.filePath - - if (attributes.runInTransaction == null) { - attributes.runInTransaction = true // default from XSD - } - - currentChangeSet = new ChangeSet(attributes.id, attributes.author, alwaysRun, runOnChange, - filePath, attributes.context, attributes.dbms,Boolean.valueOf(attributes.runInTransaction)) - - if (StringUtils.trimToNull(attributes.failOnError)) { - currentChangeSet.setFailOnError Boolean.parseBoolean(attributes.failOnError) - } - - if (StringUtils.trimToNull(attributes.onValidationFail)) { - currentChangeSet.setOnValidationFail( - ChangeSet.ValidationFailOption.valueOf(attributes.onValidationFail)) - } - } - - protected void processRollback(Map attributes) { - inRollback = true - String id = attributes.changeSetId - if (id == null) { - return - } - - String path = attributes.changeSetPath - if (path == null) { - path = databaseChangeLog.filePath - } - - String author = attributes.changeSetAuthor - - ChangeSet cs = databaseChangeLog.getChangeSet(path, author, id) - if (!cs) { - throw new ChangeLogParseException("Could not find changeSet to use for rollback: $path:$author:$id") - } - - cs.changes.each { currentChangeSet.addRollbackChange it } - } - - protected void processPreConditions(Map attributes) { - rootPrecondition = new PreconditionContainer() - rootPrecondition.setOnFail StringUtils.trimToNull(attributes.onFail) - rootPrecondition.setOnError StringUtils.trimToNull(attributes.onError) - rootPrecondition.setOnFailMessage StringUtils.trimToNull(attributes.onFailMessage) - rootPrecondition.setOnErrorMessage StringUtils.trimToNull(attributes.onErrorMessage) - rootPrecondition.setOnSqlOutput StringUtils.trimToNull(attributes.onSqlOutput) - preconditionLogicStack << rootPrecondition - } - - protected void processModifySql(Map attributes) { - inModifySql = true - - if (StringUtils.trimToNull(attributes.dbms)) { - modifySqlDbmsList = StringUtils.splitAndTrim(attributes.dbms, ',') as Set - } - - if (StringUtils.trimToNull(attributes.context)) { - modifySqlContexts = StringUtils.splitAndTrim(attributes.context, ',') as Set - } - - if (StringUtils.trimToNull(attributes.applyToRollback)) { - modifySqlAppliedOnRollback = Boolean.valueOf(attributes.applyToRollback) - } - } - - protected void processChange(String name, Map attributes, value) { - setText value - - currentChange = ChangeFactory.instance.create(name) - if (!currentChange) { - throw new ChangeLogParseException("Unknown Liquibase extension: $name. Are you missing a jar from your classpath?") - } - - if (currentChange instanceof RawSQLChange) { - currentChange.setSql currentText - } - else if (currentChange instanceof CreateProcedureChange) { - currentChange.setProcedureBody currentText - } - else if (currentChange instanceof CreateViewChange) { - currentChange.setSelectQuery currentText - } - else if (currentChange instanceof StopChange) { - currentChange.setMessage currentText - } - else if (currentChange instanceof LoadDataChange || currentChange instanceof SQLFileChange) { - if (attributes.encoding == null) { - attributes.encoding = 'UTF-8' // default from XSD - } - } - else if (currentChange instanceof GrailsChange) { - currentChange.ctx = ctx - } - - if (currentChange instanceof CustomChangeWrapper) { - currentChange.setClassLoader resourceAccessor.toClassLoader() - } - - currentChange.setChangeSet currentChangeSet - currentChange.setResourceAccessor resourceAccessor - setPropertiesFromAttributes currentChange, attributes - currentChange.init() - } - - protected void processColumn(Map attributes) { - def column = currentChange instanceof LoadDataChange ? - new LoadDataColumnConfig() : new ColumnConfig() - - setPropertiesFromAttributes column, attributes - - if (currentChange instanceof ChangeWithColumns) { - currentChange.addColumn column - } - else { - throw new ChangeLogParseException("Unexpected column tag for ${currentChange.getClass().name}") - } - } - - protected void processConstraints(Map attributes) { - def constraints = new ConstraintsConfig() - setPropertiesFromAttributes constraints, attributes - - ColumnConfig lastColumn - if (currentChange instanceof ChangeWithColumns) { - if (currentChange.columns) { - lastColumn = currentChange.columns[-1] - } - } - else { - throw new ChangeLogParseException("Unexpected change: ${currentChange.getClass().name}") - } - - if (!lastColumn) { - throw new ChangeLogParseException('Could not determine column to add constraint to') - } - - lastColumn.setConstraints constraints - } - - protected void processParam(Map attributes) { - if (currentChange instanceof CustomChangeWrapper) { - if (attributes.value == null) { - currentParamName = attributes.name - } - else { - currentChange.setParam attributes.name, attributes.value - } - } - else { - throw new MigrationFailedException(currentChangeSet, "'param' unexpected in $name") - } - } - - protected void processProperty(Map attributes) { - String context = StringUtils.trimToNull(attributes.context) - String dbms = StringUtils.trimToNull(attributes.dbms) - if (!StringUtils.trimToNull(attributes.file)) { - changeLogParameters.set attributes.name, attributes.value, context, dbms - } - else { - def props = new Properties() - def propertiesStream = resourceAccessor.getResourceAsStream(attributes.file) - if (!propertiesStream) { - log.info "Could not open properties file $attributes.file" - } - else { - props.load propertiesStream - props.each { propName, propValue -> - changeLogParameters.set propName.toString(), propValue.toString(), context, dbms - } - } - } - } - - @Override - protected createNode(name) { createNode name, [:], null } - - @Override - protected createNode(name, value) { createNode name, [:], value } - - @Override - protected createNode(name, Map attributes) { createNode name, attributes, null } - - @Override - protected void setParent(parent, child) { /*do nothing*/ } - - @Override - protected void nodeCompleted(parent, name) { - if (changeSubObjects) { - changeSubObjects.pop() - } - else if (rootPrecondition) { - if ('preConditions' == name) { - if (!currentChangeSet) { - databaseChangeLog.setPreconditions rootPrecondition - } - else { - currentChangeSet.setPreconditions rootPrecondition - } - rootPrecondition = null - } - else if ('and' == name) { - preconditionLogicStack.pop() - currentPrecondition = null - } - else if ('or' == name) { - preconditionLogicStack.pop() - currentPrecondition = null - } - else if ('not' == name) { - preconditionLogicStack.pop() - currentPrecondition = null - } - else if ('sqlCheck' == name) { - currentPrecondition.setSql currentText - currentPrecondition = null - } - else if ('customPrecondition' == name) { - currentPrecondition.setClassLoader resourceAccessor.toClassLoader() - currentPrecondition = null - } - else if ('grailsPrecondition' == name) { - currentPrecondition = null - } - } - else if (currentChangeSet && 'rollback' == name) { - currentChangeSet.addRollBackSQL currentText - inRollback = false - } - else if (currentChange instanceof RawSQLChange && 'comment' == name) { - currentChange.setComments currentText - currentText = null - } - else if (currentChange && ('where' == name || 'whereLazy' == name)) { - if (currentChange instanceof UpdateDataChange) { - currentChange.setWhereClause currentText - } - else if (currentChange instanceof DeleteDataChange) { - currentChange.setWhereClause currentText - } - else { - throw new ChangeLogParseException("Unexpected change type: ${currentChange.getClass().name}") - } - currentText = null - } - else if (currentChange instanceof CreateProcedureChange && 'comment' == name) { - currentChange.setComments currentText - currentText = null - } - else if (currentChange instanceof CustomChangeWrapper && currentParamName != null && 'param' == name) { - currentChange.setParam currentParamName, currentText - currentText = null - currentParamName = null - } - else if (currentChangeSet && 'comment' == name) { - currentChangeSet.setComments currentText - currentText = null - } - else if (currentChangeSet && 'changeSet' == name) { - databaseChangeLog.addChangeSet currentChangeSet - currentChangeSet = null - } - else if (currentChange && 'column' == name && currentText != null) { - if (currentChange instanceof InsertDataChange || currentChange instanceof UpdateDataChange) { - currentChange.columns[-1].setValue currentText - } - else { - throw new ChangeLogParseException("Unexpected column with text: $currentText") - } - currentText = null - } - else if (currentChange && name == currentChange.changeMetaData.name) { - if (inRollback) { - currentChangeSet.addRollbackChange currentChange - } - else { - currentChangeSet.addChange currentChange - } - currentChange = null - } - else if (currentChangeSet && 'validCheckSum' == name) { - currentChangeSet.addValidCheckSum currentText - currentText = null - } - else if ('modifySql' == name) { - inModifySql = false - modifySqlDbmsList = null - modifySqlContexts = null - modifySqlAppliedOnRollback = false - } - } - - protected void setPropertiesFromAttributes(object, Map attributes) { - attributes.each { name, value -> setPropertyValue object, name, value } - } - - protected void setPropertyValue(object, String name, String value) { - value = changeLogParameters.expandExpressions(value) - if (object instanceof CustomChangeWrapper) { - if ('class' == name) { - object.setClass value - } - else { - object.setParam name, value - } - } - else { - ObjectUtil.setProperty object, name, value - } - } - - protected boolean handleIncludedChangeLog(String fileName, boolean isRelativePath, String relativeBaseFileName) { - String lowerName = fileName.toLowerCase() - - if (lowerName.startsWith('.') || lowerName.equals('cvs')) { - return false - } - - if (isRelativePath) { - // workaround for FilenameUtils.normalize() returning null for relative paths like ../conf/liquibase.xml - String tempFile = FilenameUtils.concat(FilenameUtils.getFullPath(relativeBaseFileName), fileName) - if (tempFile && new File(tempFile).exists()) { - fileName = tempFile - } - else { - fileName = FilenameUtils.getFullPath(relativeBaseFileName) + fileName - } - } - - ChangeLogParser parser - try { - parser = ChangeLogParserFactory.instance.getParser(fileName, resourceAccessor) - } - catch (LiquibaseException e) { - log.error "$relativeBaseFileName/$fileName is not a recognized file type" - return false - } - - DatabaseChangeLog changeLog = parser.parse(fileName, changeLogParameters, resourceAccessor) - PreconditionContainer preconditions = changeLog.preconditions - if (preconditions) { - if (!databaseChangeLog.preconditions) { - databaseChangeLog.setPreconditions new PreconditionContainer() - } - databaseChangeLog.preconditions.addNestedPrecondition preconditions - } - - changeLog.changeSets.each { databaseChangeLog.addChangeSet it } - true - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GormColumn.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GormColumn.groovy deleted file mode 100644 index 98e9e19..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GormColumn.groovy +++ /dev/null @@ -1,119 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License") - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration - -import java.lang.reflect.Method -import java.sql.Types - -import liquibase.database.structure.Column -import liquibase.database.structure.Table - -/** - * @author Burt Beckwith - */ -class GormColumn extends Column { - - protected static final List DECIMAL_TYPES = [Types.FLOAT, Types.REAL, Types.DOUBLE, Types.NUMERIC, Types.DECIMAL] - protected static final List LENGTH_TYPES = [Types.CHAR, Types.DATE, Types.LONGVARCHAR, Types.TIME, Types.TIMESTAMP, Types.VARCHAR] - - protected hibernateColumn - - boolean sqlTypeSet = false - - GormColumn(Table table, /*org.hibernate.mapping.Column*/ hibernateColumn, /*org.hibernate.mapping.Table*/ hibernateTable, - /*org.hibernate.engine.Mapping*/ mapping, /*org.hibernate.dialect.Dialect*/ dialect, /*org.hibernate.cfg.Configuration*/ cfg) { - - this.hibernateColumn = hibernateColumn - - int decimalDigits = hibernateColumn.scale - int dataType = hibernateColumn.getSqlTypeCode(mapping) - if (!typeHasScaleAndPrecision(dataType)) { - decimalDigits = 0 - } - if (!typeHasLength(dataType)) { - decimalDigits = 0 - } - - if (hibernateColumn.sqlType) { - sqlTypeSet = true - } - else { - hibernateColumn.sqlType = hibernateColumn.getSqlType(dialect, mapping) - sqlTypeSet = hibernateColumn.sqlType != null - } - - setName hibernateColumn.name - setDataType dataType - setDecimalDigits decimalDigits - setDefaultValue hibernateColumn.defaultValue - setNullable hibernateColumn.nullable - setPrimaryKey hibernateTable.primaryKey == null ? false : hibernateTable.primaryKey.columns.contains(hibernateColumn) - setTable table - setTypeName hibernateColumn.getSqlType(dialect, mapping).replaceFirst('\\(.*\\)', '') - setUnique hibernateColumn.unique - setAutoIncrement isIdentityColumn(hibernateColumn.value, dialect, cfg) - setCertainDataType hibernateColumn.sqlType != null - setColumnSize isNumeric() ? hibernateColumn.precision : hibernateColumn.length - } - - def getHibernateColumn() { - hibernateColumn - } - - // workaround for changed method signature without backwards compatibility - protected static boolean isIdentityColumn(/*org.hibernate.mapping.Value*/ value, /*org.hibernate.dialect.Dialect*/ dialect, /*org.hibernate.cfg.Configuration*/ cfg) { - Method method = value.getClass().methods.find { it.name == 'isIdentityColumn' } - if (method.getParameterTypes().length == 1) { - // pre-3.6 Hibernate - return value.isIdentityColumn(dialect) - } - - value.isIdentityColumn cfg.identifierGeneratorFactory, dialect - } - - // from org.hibernate.cfg.reveng.JDBCToHibernateTypeHelper - protected static boolean typeHasScaleAndPrecision(int sqlType) { - sqlType in DECIMAL_TYPES - } - - // from org.hibernate.cfg.reveng.JDBCToHibernateTypeHelper - protected static boolean typeHasLength(int sqlType) { - sqlType in LENGTH_TYPES - } - - // have to re-implement since base class does exact class check - @Override - boolean equals(other) { - if (is(other)) return true - if (!(other instanceof Column)) return false - - Column column = other - - name.equalsIgnoreCase(column.name) && column.table == table && column.view == view - } - - // have to re-implement since base class does case-sensitive column-name comparison - @Override - int compareTo(Column o) { - int d - if (table || o.table) { - d = table <=> o.table - } - else { - d = view <=> o.view - } - d ?: name.compareToIgnoreCase(o.name) - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GormDatabase.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GormDatabase.groovy deleted file mode 100644 index 8ccf1d6..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GormDatabase.groovy +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License") - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration - -import liquibase.database.AbstractDatabase -import liquibase.database.DatabaseConnection - -/** - * Used by the gorm-diff script. Doesn't do much - it's mostly a holder for the configuration. - * - * @author Burt Beckwith - */ -class GormDatabase extends AbstractDatabase { - - /*org.hibernate.cfg.Configuration*/ def configuration - /*org.hibernate.dialect.Dialect*/ def dialect - String schema - - GormDatabase(/*org.hibernate.cfg.Configuration*/ configuration, String schema = null) { - this.configuration = configuration - this.schema = schema - - dialect = MigrationUtils.createInstance(configuration.getProperty('hibernate.dialect')) - } - - String getDatabaseProductName() { 'GORM Mapping' } - - String getTypeName() { 'GORM' } - - // unused interface methods - - void setConnection(DatabaseConnection conn) { - throw new UnsupportedOperationException() - } - - boolean isCorrectDatabaseImplementation(DatabaseConnection conn) { - throw new UnsupportedOperationException() - } - - String getDefaultDriver(String url) { - throw new UnsupportedOperationException() - } - - boolean supportsInitiallyDeferrableColumns() { - throw new UnsupportedOperationException() - } - - String getCurrentDateTimeFunction() { - throw new UnsupportedOperationException() - } - - boolean supportsTablespaces() { - throw new UnsupportedOperationException() - } - - int getPriority() { - throw new UnsupportedOperationException() - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GormDatabaseSnapshotGenerator.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GormDatabaseSnapshotGenerator.groovy deleted file mode 100644 index adcfcf6..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GormDatabaseSnapshotGenerator.groovy +++ /dev/null @@ -1,259 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License") - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration - -import java.lang.reflect.Method - -import liquibase.database.Database -import liquibase.database.structure.Column -import liquibase.database.structure.ForeignKey -import liquibase.database.structure.Index -import liquibase.database.structure.PrimaryKey -import liquibase.database.structure.Sequence -import liquibase.database.structure.Table -import liquibase.diff.DiffStatusListener -import liquibase.exception.DatabaseException -import liquibase.snapshot.DatabaseSnapshot -import liquibase.snapshot.DatabaseSnapshotGenerator - -/** - * Used by the gorm-diff script. Registered in DatabaseMigrationGrailsPlugin.doWithApplicationContext(). - * - * Based on liquibase.ext.hibernate.snapshot.HibernateDatabaseSnapshotGenerator. - * - * @author Burt Beckwith - */ -class GormDatabaseSnapshotGenerator implements DatabaseSnapshotGenerator { - - /** - * {@inheritDoc} - * @see liquibase.snapshot.DatabaseSnapshotGenerator#createSnapshot(liquibase.database.Database, - * java.lang.String, java.util.Set) - */ - DatabaseSnapshot createSnapshot(Database db, String requestedSchema, Set listeners) - throws DatabaseException { - - DatabaseSnapshot snapshot = new DatabaseSnapshot(db, requestedSchema) - - try { - def cfg = db.configuration - String dialectName = cfg.getProperty('hibernate.dialect') - def dialect = MigrationUtils.createInstance(dialectName) -// def dialect = new HibernateGenericDialect(dialectName) // TODO - - def mapping = cfg.buildMapping() - String defaultSchema = cfg.getProperty('hibernate.default_schema') - - for (hibernateTable in cfg.tableMappings) { - if (!hibernateTable.physicalTable) { - continue - } - - String tableSchema = hibernateTable.schema ?: defaultSchema - Table table = new Table(hibernateTable.name) - table.schema = tableSchema - table.rawSchemaName = tableSchema - snapshot.tables << table - - def hibernatePrimaryKey = hibernateTable.primaryKey - if (hibernatePrimaryKey) { - PrimaryKey pk = new PrimaryKey(name: hibernatePrimaryKey.name, table: table) - for (hibernateColumn in hibernatePrimaryKey.columns) { - pk.columnNamesAsList << hibernateColumn.name - } - snapshot.primaryKeys << pk - } - - for (/*org.hibernate.mapping.Column*/ hibernateColumn in hibernateTable.columnIterator) { - - table.columns << new GormColumn(table, hibernateColumn, hibernateTable, mapping, dialect, cfg) - - if (hibernateColumn.unique) { - // GrailsDomainBinder doesn't register a unique key for single-column unique - Index index = new Index(table: table, unique: true, - name: hibernateColumn.name + '_uniq_' + System.currentTimeMillis()) - index.columns << hibernateColumn.name - snapshot.indexes << index - } - } - - for (hibernateIndex in hibernateTable.indexIterator) { - Index index = new Index(table: table, name: hibernateIndex.name) - for (hibernateColumn in hibernateIndex.columnIterator) { - index.columns << hibernateColumn.name - } - snapshot.indexes << index - } - - for (hiberateUnique in hibernateTable.uniqueKeyIterator) { - Index index = new Index(table: table, name: hiberateUnique.name.replaceAll('-', '_'), unique: true) - for (hibernateColumn in hiberateUnique.columnIterator) { - index.columns << hibernateColumn.name - } - snapshot.indexes << index - } - } - - for (hibernateTable in cfg.tableMappings) { - if (!hibernateTable.physicalTable) { - continue - } - - for (hibernateForeignKey in hibernateTable.foreignKeyIterator) { - if (!hibernateForeignKey.table || !hibernateForeignKey.referencedTable || - !hibernateForeignKey.physicalConstraint) { - continue - } - - ForeignKey fk = new ForeignKey(name: hibernateForeignKey.name) - fk.foreignKeyTable = snapshot.tables.find { it.name.equalsIgnoreCase(hibernateForeignKey.table.name) } - fk.foreignKeyColumns = hibernateForeignKey.columns*.name.join(', ') - - fk.primaryKeyTable = snapshot.tables.find { it.name.equalsIgnoreCase(hibernateForeignKey.referencedTable.name) } - - List fkColumns = hibernateForeignKey.referencedColumns*.name ?: - hibernateForeignKey.referencedTable.primaryKey.columns*.name - - fk.primaryKeyColumns = fkColumns.join(', ') - snapshot.foreignKeys << fk - if (MigrationUtils.instanceOf(dialect, 'org.hibernate.dialect.MySQLDialect')) { - addMysqlFkIndex snapshot, fk.foreignKeyTable, hibernateForeignKey - } - } - } - - if (db.supportsSequences()) { - Map generators = [:] - for (/*org.hibernate.mapping.PersistentClass*/ pc in cfg.classes.values()) { - if (pc.isInherited()) { - continue - } - - def identifierGenerator = createIdentifierGenerator(dialect, pc, cfg) - if (MigrationUtils.instanceOf(identifierGenerator, 'org.hibernate.id.SequenceGenerator')) { - generators.put(identifierGenerator.generatorKey(), identifierGenerator) - } - } - - for (/*org.hibernate.id.SequenceGenerator*/ generator in generators.values()) { - String schema = requestedSchema ?: '' - snapshot.sequences << new Sequence( - name: generator.sequenceName, - schema: db.convertRequestedSchemaToSchema(schema)) - } - } - } - catch (e) { - throw new DatabaseException(e) - } - - if (db.schema) { - filterSnapshot(snapshot, db.schema) - } - - snapshot - } - - /** - * Filters snapshot removing objects not belonging to schema or referencing objects outside schema. - */ - protected void filterSnapshot(DatabaseSnapshot snapshot, String schema) { - - def removeNotInSchema = { Collection things, Closure getSchema -> - things.removeAll things.findAll { getSchema(it) != schema } - } - - removeNotInSchema snapshot.primaryKeys, { PrimaryKey pk -> pk.table.schema } - - removeNotInSchema snapshot.indexes, { Index index -> index.table.schema } - - removeNotInSchema snapshot.foreignKeys, { ForeignKey fk -> fk.foreignKeyTable.schema } - - removeNotInSchema snapshot.tables, { Table table -> table.schema } - } - - // another workaround for changed method signature without backwards compatibility - protected /*org.hibernate.id.IdentifierGenerator*/ createIdentifierGenerator(/*org.hibernate.dialect.Dialect*/ dialect, - /*org.hibernate.mapping.PersistentClass*/ pc, /*org.hibernate.cfg.Configuration*/ cfg) { - - Method method = pc.identifier.getClass().getMethods().find { it.name == 'createIdentifierGenerator' } - if (method.getParameterTypes().length == 4) { - // pre-3.6 Hibernate - return pc.identifier.createIdentifierGenerator(dialect, null, null, pc) - } - - pc.identifier.createIdentifierGenerator cfg.identifierGeneratorFactory, dialect, null, null, pc - } - - // MySQL is unique in that the Dialect adds an index to each FK but it's - // not exposed in the object model. so we add it here to be consistent - protected void addMysqlFkIndex(DatabaseSnapshot snapshot, Table table, hibernateForeignKey) { - Index index = new Index(table: table, name: hibernateForeignKey.name) - for (hibernateColumn in hibernateForeignKey.columnIterator) { - index.columns << hibernateColumn.name - } - snapshot.indexes << index - } - - boolean supports(Database db) { db instanceof GormDatabase } - - int getPriority(Database db) { PRIORITY_DATABASE } - - // unused interface methods - - Table getDatabaseChangeLogTable(Database db) { - throw new UnsupportedOperationException() - } - - Table getDatabaseChangeLogLockTable(Database db) { - throw new UnsupportedOperationException() - } - - boolean hasDatabaseChangeLogTable(Database db) { - throw new UnsupportedOperationException() - } - - boolean hasDatabaseChangeLogLockTable(Database db) { - throw new UnsupportedOperationException() - } - - boolean hasTable(String schema, String table, Database db) { - throw new UnsupportedOperationException() - } - - Table getTable(String schema, String table, Database db) { - throw new UnsupportedOperationException() - } - - Column getColumn(String schema, String table, String column, Database db) { - throw new UnsupportedOperationException() - } - - boolean hasIndex(String schema, String table, String index, Database db, String columns) { - throw new UnsupportedOperationException() - } - - ForeignKey getForeignKeyByForeignKeyTable(String schema, String fkTable, String fk, Database db) { - throw new UnsupportedOperationException() - } - - List getForeignKeys(String schema, String foreignKeyTable, Database db) { - throw new UnsupportedOperationException() - } - - boolean hasView(String schemaName, String viewName, Database database) { - throw new UnsupportedOperationException() - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GormDatabaseTypeConverter.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GormDatabaseTypeConverter.groovy deleted file mode 100644 index 0ebd811..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GormDatabaseTypeConverter.groovy +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License") - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration - -import liquibase.database.Database -import liquibase.database.structure.Column -import liquibase.database.typeconversion.core.DefaultTypeConverter - -/** - * Fixes changelog errors generated from the GORM scripts. - * - * @author Burt Beckwith - */ -class GormDatabaseTypeConverter extends DefaultTypeConverter { - - protected static final List NAMES = [ - 'longtext', 'mediumtext', 'text', 'tinytext', - 'tinyblob', 'blob', 'mediumblob', 'longblob'] - - @Override - String convertToDatabaseTypeString(Column referenceColumn, Database database) { - - if (referenceColumn instanceof GormColumn) { - return referenceColumn.hibernateColumn.sqlType - } - - String referenceColumnTypeName = referenceColumn.typeName.toLowerCase() - for (name in NAMES) { - if (referenceColumnTypeName.startsWith(name)) { - return name - } - } - - super.convertToDatabaseTypeString referenceColumn, database - } - - @Override - int getPriority() { PRIORITY_DATABASE } - - @Override - boolean supports(Database database) { database instanceof GormDatabase } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GormDiff.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GormDiff.groovy deleted file mode 100644 index 13dbd4f..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GormDiff.groovy +++ /dev/null @@ -1,164 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License") - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration - -import java.lang.reflect.Field - -import liquibase.database.Database -import liquibase.database.structure.Column -import liquibase.diff.Diff -import liquibase.diff.DiffResult -import liquibase.exception.DatabaseException -import liquibase.snapshot.DatabaseSnapshot - -import org.slf4j.Logger -import org.slf4j.LoggerFactory -import org.springframework.util.ReflectionUtils - -/** - * @author Burt Beckwith - */ -class GormDiff extends Diff { - - protected Logger log = LoggerFactory.getLogger(getClass()) - protected /*org.hibernate.dialect.Dialect*/ dialect - - GormDiff(GormDatabase referenceDatabase, Database targetDatabase) { - super(referenceDatabase, targetDatabase) - dialect = referenceDatabase.dialect - } - - @Override - DiffResult compare() throws DatabaseException { - DiffResult diffResult = super.compare() - - DatabaseSnapshot referenceSnapshot = getFieldValue('referenceSnapshot') - DatabaseSnapshot targetSnapshot = getFieldValue('targetSnapshot') - - for (Column baseColumn : referenceSnapshot.getColumns()) { - Collection targetSnapshotColumns = targetSnapshot.getColumns() - if (!targetSnapshotColumns.contains(baseColumn) && - (baseColumn.getTable() == null || !diffResult.getMissingTables().contains(baseColumn.getTable())) && - (baseColumn.getView() == null || !diffResult.getMissingViews().contains(baseColumn.getView()))) { - diffResult.addMissingColumn baseColumn - } - } - - for (Column targetColumn : targetSnapshot.getColumns()) { - Set referenceSnapshotColumns = referenceSnapshot.getColumns() - if (!contains(referenceSnapshotColumns, targetColumn) && - (targetColumn.getTable() == null || !diffResult.getUnexpectedTables().contains(targetColumn.getTable())) && - (targetColumn.getView() == null || !diffResult.getUnexpectedViews().contains(targetColumn.getView()))) { - diffResult.addUnexpectedColumn targetColumn - } - else if (targetColumn.getTable() != null && !diffResult.getUnexpectedTables().contains(targetColumn.getTable())) { - Column baseColumn = referenceSnapshot.getColumn(targetColumn.getTable().getName(), targetColumn.getName()) - if (baseColumn == null || isDifferent(targetColumn, baseColumn)) { - diffResult.addChangedColumn targetColumn - } - } - } - - return diffResult - } - - protected boolean contains(Set columns, Column column) { - // can't trust HashSet.contains() since the Liquibase Column.equals() checks for exact class match - - if (columns.contains(column)) { - return true - } - - int hash = column.hashCode() - for (Column c in columns) { - if (c.hashCode() != hash) { - continue - } - if (c == column) { - return true - } - } - - false - } - - protected getFieldValue(String name) { - Field field = ReflectionUtils.findField(getClass().superclass, name) - field.accessible = true - field.get(this) - } - - protected boolean isDifferent(Column targetColumn, Column baseColumn) { - if (targetColumn.isNullabilityDifferent(baseColumn)) { - log.debug "$targetColumn.name nullability different: $targetColumn.nullable / $baseColumn.nullable" - return true - } - - if (!targetColumn.isCertainDataType() || !baseColumn.isCertainDataType()) { - log.debug "$targetColumn.name certainDataType different: $targetColumn.certainDataType / $baseColumn.certainDataType" - return true - } - - if (areEquivalent(targetColumn, baseColumn)) { - return false - } - - if (targetColumn.getDataType() != baseColumn.getDataType()) { - log.debug "$targetColumn.name data type different: $targetColumn.dataType / $baseColumn.dataType" - return true - } - - if (targetColumn.getLengthSemantics() != baseColumn.getLengthSemantics()) { - log.debug "$targetColumn.name LengthSemantics different: $targetColumn.lengthSemantics / $baseColumn.lengthSemantics" - return true - } - - if (targetColumn.getColumnSize() != baseColumn.getColumnSize()) { - log.debug "$targetColumn.name column size different: $targetColumn.columnSize / $baseColumn.columnSize" - return true - } - - if (targetColumn.getDecimalDigits() != baseColumn.getDecimalDigits()) { - log.debug "$targetColumn.name decimal digits different: $targetColumn.decimalDigits / $baseColumn.decimalDigits" - return true - } - - return false - } - - protected boolean areEquivalent(Column targetColumn, Column baseColumn) { - if (baseColumn.sqlTypeSet && baseColumn.typeName.equalsIgnoreCase(targetColumn.typeName)) { - return true - } - - log.debug """Comparing target column $targetColumn($targetColumn.dataType, $targetColumn.columnSize, $targetColumn.columnSize, $targetColumn.decimalDigits, $targetColumn.typeName) -with base column $baseColumn($baseColumn.dataType, $baseColumn.columnSize, $baseColumn.columnSize, $baseColumn.decimalDigits, $baseColumn.typeName, $baseColumn.sqlTypeSet)""" - try { - String targetTypeName = dialect.getTypeName(targetColumn.dataType, targetColumn.columnSize, targetColumn.columnSize, targetColumn.decimalDigits) - String baseTypeName = dialect.getTypeName(baseColumn.dataType, baseColumn.columnSize, baseColumn.columnSize, baseColumn.decimalDigits) - return targetTypeName == baseTypeName - } - catch (e) { - log.warn "Failed to compare type... We will continue with the comparison", e - return false - } - } - - @Override - boolean shouldDiffColumns() { - // return false so we can do the work in compare() - can't override since it's private - false - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GrailsChange.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GrailsChange.groovy deleted file mode 100644 index 1e6ecaa..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GrailsChange.groovy +++ /dev/null @@ -1,283 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License") - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration - -import groovy.sql.Sql - -import java.sql.Connection - -import liquibase.change.AbstractChange -import liquibase.change.ChangeMetaData -import liquibase.change.ChangeProperty -import liquibase.change.CheckSum -import liquibase.database.Database -import liquibase.database.DatabaseConnection -import liquibase.exception.SetupException -import liquibase.exception.ValidationErrors -import liquibase.exception.Warnings -import liquibase.executor.ExecutorService -import liquibase.executor.LoggingExecutor -import liquibase.statement.SqlStatement - -import org.codehaus.groovy.grails.commons.GrailsApplication -import org.springframework.context.ApplicationContext - -/** - * Custom Groovy-based change. - * - * @author Burt Beckwith - */ -class GrailsChange extends AbstractChange { - - @ChangeProperty(includeInSerialization=false) - protected boolean validateClosureCalled - - @ChangeProperty(includeInSerialization=false) - protected ValidationErrors validationErrors = new ValidationErrors() - - @ChangeProperty(includeInSerialization=false) - protected Warnings warnings = new Warnings() - - @ChangeProperty(includeInSerialization=false) - protected List allStatements = [] - - @ChangeProperty(includeInSerialization=false) - protected boolean shouldRun = true - - @ChangeProperty(includeInSerialization=false) - Database database - - @ChangeProperty(includeInSerialization=false) - Sql sql - - @ChangeProperty(includeInSerialization=false) - ApplicationContext ctx - - @ChangeProperty(includeInSerialization=false) - Closure initClosure - - @ChangeProperty(includeInSerialization=false) - Closure validateClosure - - @ChangeProperty(includeInSerialization=false) - Closure changeClosure - - @ChangeProperty(includeInSerialization=false) - Closure rollbackClosure - - /** - * @see liquibase.change.Change#getConfirmationMessage() - */ - @ChangeProperty(includeInSerialization=false) - String confirmationMessage = 'Executed GrailsChange' - - @ChangeProperty(includeInSerialization=false) - String checksumString - - /** - * Constructor. - */ - GrailsChange() { - super('grailsChange', 'Grails Change', ChangeMetaData.PRIORITY_DEFAULT) - } - - @Override - void init() throws SetupException { - if (!initClosure) { - return - } - - initClosure.delegate = this - try { - initClosure() - } - catch (e) { - throw new SetupException(e) - } - } - - @Override - Warnings warn(Database database) { - initDatabase database - if (shouldRun) { - callValidateClosure() - } - - warnings - } - - @Override - ValidationErrors validate(Database database) { - initDatabase database - if (shouldRun) { - callValidateClosure() - } - - validationErrors - } - - /** - * Called by the validate closure. Adds a validation error. - * - * @param message the error message - */ - void error(String message) { - validationErrors.addError message - } - - /** - * Called by the validate closure. Adds a warning message. - * - * @param warning the warning message - */ - void warn(String warning) { - warnings.addWarning warning - } - - /** - * {@inheritDoc} - * @see liquibase.change.Change#generateStatements(liquibase.database.Database) - */ - @Override - SqlStatement[] generateStatements(Database database) { - initDatabase database - - if (shouldRun && changeClosure) { - changeClosure.delegate = this - changeClosure() - } - - allStatements as SqlStatement[] - } - - /** - * {@inheritDoc} - * @see liquibase.change.AbstractChange#generateRollbackStatements(liquibase.database.Database) - */ - @Override - SqlStatement[] generateRollbackStatements(Database database) { - initDatabase database - - if (shouldRun && rollbackClosure) { - rollbackClosure.delegate = this - rollbackClosure() - } - - allStatements as SqlStatement[] - } - - /** - * Called by the change or rollback closure. Adds a statement to be executed. - * - * @param statement the statement - */ - void sqlStatement(SqlStatement statement) { - if (shouldRun && statement) allStatements << statement - } - - /** - * Called by the change or rollback closure. Adds multiple statements to be executed. - * - * @param statement the statement - */ - void sqlStatements(statements) { - if (shouldRun && statements) allStatements.addAll (statements as List) - } - - /** - * Called by the change or rollback closure. Overrides the confirmation message. - * - * @param message the confirmation message - */ - void confirm(String message) { confirmationMessage = message } - - /** - * {@inheritDoc} - * @see liquibase.change.AbstractChange#supportsRollback(liquibase.database.Database) - */ - @Override - boolean supportsRollback(Database database) { shouldRun } - - /** - * {@inheritDoc} - * @see liquibase.change.AbstractChange#generateCheckSum() - */ - @Override - CheckSum generateCheckSum() { -// if (checksumString) { -// return CheckSum.compute(checksumString) -// } -// CheckSum.compute new GroovyAwareStringChangeLogSerializer().serialize(this) - - CheckSum.compute checksumString ?: 'Grails Change' - } - - /** - * Called from the change or rollback closure. Creates a Sql instance from the current connection. - * - * @return the sql instance - */ - Sql getSql() { - if (!connection) return null - - if (!sql) { - sql = new Sql(connection) { - protected void closeResources(Connection c) { - // do nothing, let Liquibase close the connection - } - } - } - - sql - } - - /** - * Called from the change or rollback closure. Shortcut to get the (wrapper) database connection. - * - * @return the connection or null if the database isn't set yet - */ - DatabaseConnection getDatabaseConnection() { database?.connection } - - /** - * Called from the change or rollback closure. Shortcut to get the real database connection. - * - * @return the connection or null if the database isn't set yet - */ - Connection getConnection() { database?.connection?.wrappedConnection } - - /** - * Called from the change or rollback closure. Shortcut for the current application. - * - * @return the application - */ - GrailsApplication getApplication() { ctx.grailsApplication } - - // warn is called then validate, but both are handled by - // the 'warnings' closure, so we only want to run it once - protected void callValidateClosure() { - if (!shouldRun || !validateClosure || validateClosureCalled) { - return - } - - validateClosure.delegate = this - validateClosure() - validationErrors - } - - protected void initDatabase(Database database) { - this.database = database - shouldRun = !(ExecutorService.getInstance().getExecutor(database) instanceof LoggingExecutor) - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GrailsChangeLogParser.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GrailsChangeLogParser.groovy deleted file mode 100644 index e1b08b8..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GrailsChangeLogParser.groovy +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License") - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration - -import grails.util.GrailsUtil -import liquibase.changelog.ChangeLogParameters -import liquibase.changelog.DatabaseChangeLog -import liquibase.exception.ChangeLogParseException -import liquibase.parser.ChangeLogParser -import liquibase.resource.ResourceAccessor - -import org.codehaus.groovy.control.CompilerConfiguration -import org.slf4j.Logger -import org.slf4j.LoggerFactory -import org.springframework.context.ApplicationContext - -/** - * Loads a DSL script and invokes the builder. Registered in - * DatabaseMigrationGrailsPlugin.doWithApplicationContext(). - * - * @author Burt Beckwith - */ -class GrailsChangeLogParser implements ChangeLogParser { - - protected Logger log = LoggerFactory.getLogger(getClass()) - - protected ApplicationContext ctx - - /** - * Constructor. - * @param ctx the Spring app context - */ - GrailsChangeLogParser(ApplicationContext ctx) { - this.ctx = ctx - } - - /** - * {@inheritDoc} - * @see liquibase.parser.ChangeLogParser#parse(java.lang.String, liquibase.changelog.ChangeLogParameters, - * liquibase.resource.ResourceAccessor) - */ - DatabaseChangeLog parse(String physicalChangeLogLocation, - ChangeLogParameters changeLogParameters, - ResourceAccessor resourceAccessor) throws ChangeLogParseException { - - try { - log.debug "parsing $physicalChangeLogLocation" - - def inputStream = resourceAccessor.getResourceAsStream(physicalChangeLogLocation) - if (!inputStream) { - throw new ChangeLogParseException("$physicalChangeLogLocation not found") - } - - CompilerConfiguration config = new CompilerConfiguration(CompilerConfiguration.DEFAULT) - if (config.metaClass.respondsTo(config, 'setDisabledGlobalASTTransformations')) { - Set disabled = config.disabledGlobalASTTransformations ?: [] - disabled << 'org.grails.datastore.gorm.query.transform.GlobalDetachedCriteriaASTTransformation' - config.disabledGlobalASTTransformations = disabled - } - - GroovyClassLoader cl = new GroovyClassLoader(Thread.currentThread().contextClassLoader, config, false) - Script script = new GroovyShell(cl, new Binding(MigrationUtils.changelogProperties), config).parse(inputStream.text) - script.run() - - setChangelogProperties changeLogParameters - - def builder = new DslBuilder(changeLogParameters, resourceAccessor, - physicalChangeLogLocation, ctx) - - def root = script.databaseChangeLog - root.delegate = builder - root() - - builder.databaseChangeLog - } - catch(e) { - println "problem parsing $physicalChangeLogLocation: $e.message (re-run with --verbose to see the stacktrace)" - throw GrailsUtil.deepSanitize(e) - } - } - - boolean supports(String changeLogFile, ResourceAccessor resourceAccessor) { - changeLogFile.toLowerCase().endsWith 'groovy' - } - - int getPriority() { PRIORITY_DEFAULT } - - protected void setChangelogProperties(ChangeLogParameters changeLogParameters) { - - MigrationUtils.changelogProperties.each { name, value -> - - String contexts - String databases - if (value instanceof Map) { - contexts = value.contexts - databases = value.databases - value = value.value - } - - changeLogParameters.set name, value, contexts, databases - } - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GrailsClassLoaderResourceAccessor.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GrailsClassLoaderResourceAccessor.groovy deleted file mode 100644 index cb03546..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GrailsClassLoaderResourceAccessor.groovy +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration - -import liquibase.resource.ResourceAccessor - -import org.springframework.util.ClassUtils - -/** - * @author Burt Beckwith - */ -class GrailsClassLoaderResourceAccessor implements ResourceAccessor { - - InputStream getResourceAsStream(String file) throws IOException { - toClassLoader().getResourceAsStream 'migrations/' + file - } - - Enumeration getResources(String packageName) throws IOException { - toClassLoader().getResources 'migrations/' + packageName - } - - ClassLoader toClassLoader() { - ClassUtils.defaultClassLoader - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GrailsDiffStatusListener.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GrailsDiffStatusListener.groovy deleted file mode 100644 index 3889c9a..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GrailsDiffStatusListener.groovy +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration - -import liquibase.diff.DiffStatusListener - -import org.slf4j.Logger -import org.slf4j.LoggerFactory - -/** - * @author Burt Beckwith - */ -class GrailsDiffStatusListener implements DiffStatusListener { - - protected Logger log = LoggerFactory.getLogger(getClass()) - - void statusUpdate(String message) { - log.info message - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GrailsPrecondition.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GrailsPrecondition.groovy deleted file mode 100644 index b1b1945..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GrailsPrecondition.groovy +++ /dev/null @@ -1,173 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration - -import groovy.sql.Sql - -import java.sql.Connection - -import liquibase.changelog.ChangeSet -import liquibase.changelog.DatabaseChangeLog -import liquibase.database.Database -import liquibase.database.DatabaseConnection -import liquibase.exception.DatabaseException -import liquibase.exception.PreconditionErrorException -import liquibase.exception.PreconditionFailedException -import liquibase.exception.ValidationErrors -import liquibase.exception.Warnings -import liquibase.precondition.Precondition -import liquibase.resource.ResourceAccessor -import liquibase.snapshot.DatabaseSnapshot -import liquibase.snapshot.DatabaseSnapshotGenerator -import liquibase.snapshot.DatabaseSnapshotGeneratorFactory - -import org.codehaus.groovy.grails.commons.GrailsApplication -import org.springframework.context.ApplicationContext - -/** - * Custom Groovy-based precondition. - * - * @author Burt Beckwith - */ -class GrailsPrecondition implements Precondition { - - Closure checkClosure - - // fields accessible to the check closure - Database database - DatabaseChangeLog changeLog - ChangeSet changeSet - ApplicationContext ctx - ResourceAccessor resourceAccessor - - /** - * {@inheritDoc} - * @see liquibase.precondition.Precondition#check(liquibase.database.Database, - * liquibase.changelog.DatabaseChangeLog, liquibase.changelog.ChangeSet) - */ - void check(Database database, DatabaseChangeLog changeLog, ChangeSet changeSet) { - this.database = database - this.changeLog = changeLog - this.changeSet = changeSet - - if (checkClosure) { - checkClosure.delegate = this - - try { - checkClosure() - } - catch (PreconditionFailedException e) { - throw e - } - catch (AssertionError e) { - throw new PreconditionFailedException(e.message, changeLog, this) - } - catch (e) { - throw new PreconditionErrorException(e, changeLog, this) - } - } - } - - /** - * Called from the check closure as a shortcut to throw a PreconditionFailedException. - * - * @param message the failure message - */ - void fail(String message) { - throw new PreconditionFailedException(message, changeLog, this) - } - - /** - * Called from the check closure. - * - * @return the generator for the current database - */ - DatabaseSnapshotGenerator createDatabaseSnapshotGenerator() { - DatabaseSnapshotGeneratorFactory.instance.getGenerator database - } - - /** - * Called from the check closure. - * - * @param schemaName the schema name - * @return a snapshot for the current database and schema name - */ - DatabaseSnapshot createDatabaseSnapshot(String schemaName = null) { - try { - return DatabaseSnapshotGeneratorFactory.instance.createSnapshot(database, schemaName, null) - } - catch (DatabaseException e) { - throw new PreconditionErrorException(e, changeLog, this) - } - } - - /** - * Called from the check closure. Creates a Sql instance from the current connection. - * - * @return the sql instance - */ - Sql getSql() { - if (!connection) return null - - if (!sql) { - sql = new Sql(connection) { - protected void closeResources(Connection c) { - // do nothing, let Liquibase close the connection - } - } - } - - sql - } - - /** - * Called from the check closure. Shortcut to get the (wrapper) database connection. - * - * @return the connection or null if the database isn't set yet - */ - DatabaseConnection getDatabaseConnection() { database?.connection } - - /** - * Called from the check closure. Shortcut to get the real database connection. - * - * @return the connection or null if the database isn't set yet - */ - Connection getConnection() { database?.connection?.wrappedConnection } - - /** - * Called from the check closure. Shortcut for the current application. - * - * @return the application - */ - GrailsApplication getApplication() { ctx.grailsApplication } - - /** - * {@inheritDoc} - * @see liquibase.precondition.Precondition#warn(liquibase.database.Database) - */ - Warnings warn(Database database) { new Warnings() } - - /** - * {@inheritDoc} - * @see liquibase.precondition.Precondition#validate(liquibase.database.Database) - */ - ValidationErrors validate(Database database) { new ValidationErrors() } - - /** - * {@inheritDoc} - * @see liquibase.precondition.Precondition#getName() - */ - String getName() { 'grailsPrecondition' } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GroovyAwareStringChangeLogSerializer.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GroovyAwareStringChangeLogSerializer.groovy deleted file mode 100644 index f6fc1a8..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/GroovyAwareStringChangeLogSerializer.groovy +++ /dev/null @@ -1,156 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration - -import java.lang.reflect.Field - -import liquibase.change.Change -import liquibase.change.ChangeProperty -import liquibase.change.ColumnConfig -import liquibase.change.ConstraintsConfig -import liquibase.change.custom.CustomChange -import liquibase.exception.UnexpectedLiquibaseException -import liquibase.serializer.core.string.StringChangeLogSerializer -import liquibase.sql.visitor.SqlVisitor -import liquibase.util.StringUtils - -/** - * Custom Groovy-based change. - * - * @author Burt Beckwith - */ -class GroovyAwareStringChangeLogSerializer extends StringChangeLogSerializer { - - protected static final int INDENT_LENGTH = 4 - - String serialize(Change change) { - change.changeMetaData.name + ':' + serializeObject(change, 1) - } - - String serialize(SqlVisitor visitor) { - visitor.name + ':' + serializeObject(visitor, 1) - } - - protected String serializeObject(objectToSerialize, int indent) { - try { - StringBuilder buffer = new StringBuilder('[') - - SortedSet values = new TreeSet() - Class classToCheck = objectToSerialize.getClass() - while (!classToCheck.equals(Object)) { - for (Field field : classToCheck.declaredFields) { - field.accessible = true - ChangeProperty changePropertyAnnotation = field.getAnnotation(ChangeProperty) - if (changePropertyAnnotation && !changePropertyAnnotation.includeInSerialization()) { - continue - } - - String propertyName = field.name - if (propertyName in ['serialVersionUID', 'metaClass'] || - propertyName.contains('$') || propertyName.contains('__timeStamp')) { - continue - } - - def value = field.get(objectToSerialize) - if (value instanceof ColumnConfig) { - values.add(indentTimes(indent) + - serializeColumnConfig(field.get(objectToSerialize), indent + 1)) - } - else if (value instanceof ConstraintsConfig) { - values.add(indentTimes(indent) + - serializeConstraintsConfig(field.get(objectToSerialize), indent + 1)) - } - else if (value instanceof CustomChange) { - values.add(indentTimes(indent) + - serializeCustomChange(field.get(objectToSerialize), indent + 1)) - } - else { - if (value != null) { - if (value instanceof Map || value instanceof Collection) { - values.add(indentTimes(indent) + propertyName + '=' + serializeObject(value, indent + 1)) - } - else { - values.add(indentTimes(indent) + propertyName + '=\'' + value + '\'') - } - } - } - } - classToCheck = classToCheck.superclass - } - - if (values) { - buffer.append('\n') - buffer.append(StringUtils.join(values, '\n')) - buffer.append('\n') - } - buffer.append(indentTimes(indent - 1)).append(']') - return buffer.toString().replace('\r\n', '\n').replace('\r', '\n') - } - catch (Exception e) { - throw new UnexpectedLiquibaseException(e) - } - } - - protected String indentTimes(int indent) { - StringUtils.repeat ' ', INDENT_LENGTH * indent - } - - protected String serializeObject(Collection collection, int indent) { - if (!collection) { - return '[]' - } - - String returnString = '[\n' - for (object in collection) { - if (object instanceof ColumnConfig) { - returnString += indentTimes(indent) + serializeColumnConfig(object, indent + 1) + ',\n' - } - else { - returnString += indentTimes(indent) + object + ',\n' - } - } - returnString = returnString.replaceFirst(',$', '') - returnString += indentTimes(indent - 1) + ']' - - returnString - } - - protected String serializeObject(Map collection, int indent) { - if (!collection) { - return '[]' - } - - String returnString = '{\n' - for (key in new TreeSet(collection.keySet())) { - returnString += indentTimes(indent) + key + '=\'' + collection.get(key) + '\',\n' - } - returnString = returnString.replaceFirst(',$', '') - returnString += indentTimes(indent - 1) + '}' - - returnString - } - - protected String serializeColumnConfig(ColumnConfig columnConfig, int indent) { - 'column:' + serializeObject(columnConfig, indent) - } - - protected String serializeConstraintsConfig(ConstraintsConfig constraintsConfig, int indent) { - 'constraints:' + serializeObject(constraintsConfig, indent) - } - - protected String serializeCustomChange(CustomChange customChange, int indent) { - 'customChange:' + serializeObject(customChange, indent) - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/HibernateAwareTypeConverter.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/HibernateAwareTypeConverter.groovy deleted file mode 100644 index 3a0c404..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/HibernateAwareTypeConverter.groovy +++ /dev/null @@ -1,92 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License") - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration - -import java.text.ParseException - -import liquibase.change.ColumnConfig -import liquibase.database.Database -import liquibase.database.structure.Column -import liquibase.database.structure.type.BigIntType -import liquibase.database.structure.type.BlobType -import liquibase.database.structure.type.BooleanType -import liquibase.database.structure.type.CharType -import liquibase.database.structure.type.ClobType -import liquibase.database.structure.type.CurrencyType -import liquibase.database.structure.type.DataType -import liquibase.database.structure.type.DateTimeType -import liquibase.database.structure.type.DateType -import liquibase.database.structure.type.DoubleType -import liquibase.database.structure.type.FloatType -import liquibase.database.structure.type.IntType -import liquibase.database.structure.type.TextType -import liquibase.database.structure.type.TimeType -import liquibase.database.structure.type.TinyIntType -import liquibase.database.structure.type.UUIDType -import liquibase.database.structure.type.VarcharType -import liquibase.database.typeconversion.TypeConverter -import liquibase.servicelocator.PrioritizedService - -/** - * Uses pre-computed SQL type strings from the Hibernate Dialect which is much better at - * creating valid SQL types. The strings that Liquibase generates often include size information - * that the database doesn't support. - * - * @author Burt Beckwith - */ -class HibernateAwareTypeConverter implements TypeConverter { - - protected TypeConverter realConverter - - HibernateAwareTypeConverter(TypeConverter realConverter) { - this.realConverter = realConverter - } - - int getPriority() { PrioritizedService.PRIORITY_DATABASE + 10 } - - boolean supports(Database database) { true } - - String convertToDatabaseTypeString(Column referenceColumn, Database database) { - if (referenceColumn instanceof GormColumn) { - return referenceColumn.hibernateColumn.sqlType - } - return realConverter.convertToDatabaseTypeString(referenceColumn, database) - } - - Object convertDatabaseValueToObject(Object defaultValue, int dataType, int firstParameter, - int secondParameter, Database database) throws ParseException { - return realConverter.convertDatabaseValueToObject(defaultValue, dataType, firstParameter, secondParameter, database) - } - DataType getDataType(Object object) { realConverter.getDataType(object) } - DataType getDataType(String columnTypeString, Boolean autoIncrement) { realConverter.getDataType(columnTypeString, autoIncrement) } - DataType getDataType(ColumnConfig columnConfig) { realConverter.getDataType(columnConfig) } - CharType getCharType() { realConverter.getCharType() } - VarcharType getVarcharType() { realConverter.getVarcharType() } - BooleanType getBooleanType() { realConverter.getBooleanType() } - CurrencyType getCurrencyType() { realConverter.getCurrencyType() } - UUIDType getUUIDType() { realConverter.getUUIDType() } - TextType getTextType() { realConverter.getTextType() } - ClobType getClobType() { realConverter.getClobType() } - BlobType getBlobType() { realConverter.getBlobType() } - BlobType getLongBlobType() { realConverter.getLongBlobType() } - DateType getDateType() { realConverter.getDateType() } - FloatType getFloatType() { realConverter.getFloatType() } - DoubleType getDoubleType() { realConverter.getDoubleType() } - IntType getIntType() { realConverter.getIntType() } - TinyIntType getTinyIntType() { realConverter.getTinyIntType() } - DateTimeType getDateTimeType() { realConverter.getDateTimeType() } - TimeType getTimeType() { realConverter.getTimeType() } - BigIntType getBigIntType() { realConverter.getBigIntType() } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/MigrationRunner.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/MigrationRunner.groovy deleted file mode 100644 index 298eaed..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/MigrationRunner.groovy +++ /dev/null @@ -1,102 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration - -import grails.util.GrailsUtil -import liquibase.Liquibase -import liquibase.database.Database - -import org.slf4j.Logger -import org.slf4j.LoggerFactory - -/** - * Based on the class of the same name from Mike Hugo's liquibase-runner plugin. - * - * @author Mike Hugo - * @author Burt Beckwith - */ -class MigrationRunner { - - protected static Logger LOG = LoggerFactory.getLogger(this) - - static void autoRun(migrationCallbacks = null) { - - def dataSourceConfigs = MigrationUtils.getDataSourceConfigs() - dataSourceConfigs.dataSource = MigrationUtils.application.config.dataSource - - for (configAndName in dataSourceConfigs) { - String dsConfigName = configAndName.key - ConfigObject configObject = configAndName.value - - if (!MigrationUtils.canAutoMigrate(dsConfigName)) { - LOG.warn "Not running auto migrate for DataSource '$dsConfigName'" - continue - } - - def config = MigrationUtils.getConfig(dsConfigName) - - if (!config.updateOnStart) { - LOG.info "updateOnStart disabled for $dsConfigName; not running migrations" - continue - } - - try { - MigrationUtils.executeInSession(dsConfigName) { - Database database = MigrationUtils.getDatabase(MigrationUtils.getConfig(dsConfigName).updateOnStartDefaultSchema ?: null, dsConfigName) - - if (config.dropOnStart) { - LOG.warn "Dropping tables..." - MigrationUtils.getLiquibase(database).dropAll() - } - - Map liquibases = [:] - for (String changelogName in config.updateOnStartFileNames) { - Liquibase liquibase = MigrationUtils.getLiquibase(database, changelogName) - if (liquibase.listUnrunChangeSets(config.updateOnStartContexts ?: config.contexts ?: null)) { - liquibases[changelogName] = liquibase - } - } - - if (liquibases) { - - LOG.info "Outstanding migrations detected for DataSource '$dsConfigName': ${liquibases.keySet()}" - - try { migrationCallbacks?.beforeStartMigration database } - catch (MissingMethodException ignored) {} - - liquibases.each { String changelogName, Liquibase liquibase -> - LOG.info "Running script '$changelogName'" - - try { migrationCallbacks?.onStartMigration database, liquibase, changelogName } - catch (MissingMethodException ignored) {} - - liquibase.update config.updateOnStartContexts ?: config.contexts ?: null - } - - try { migrationCallbacks?.afterMigrations database } - catch (MissingMethodException ignored) {} - } - else { - LOG.info "No migrations to run for DataSource '$dsConfigName'" - } - } - } - catch (e) { - GrailsUtil.deepSanitize e - throw e - } - } - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/MigrationUtils.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/MigrationUtils.groovy deleted file mode 100644 index 74fec4f..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/MigrationUtils.groovy +++ /dev/null @@ -1,376 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration - -import java.sql.Connection - -import liquibase.Liquibase -import liquibase.database.Database -import liquibase.database.DatabaseFactory -import liquibase.database.jvm.JdbcConnection -import liquibase.database.structure.Index -import liquibase.database.structure.UniqueConstraint -import liquibase.diff.DiffResult - -import org.codehaus.groovy.grails.commons.GrailsApplication -import org.springframework.transaction.support.TransactionSynchronizationManager - -/** - * @author Burt Beckwith - */ -class MigrationUtils { - - protected MigrationUtils() { - // static only - } - - /** Set at startup. */ - static GrailsApplication application - - /** Set from _Events.groovy in eventPackageAppEnd. */ - static String scriptName - - static Database getDatabase(Connection connection, String defaultSchema, String dialectName) { - def database = DatabaseFactory.instance.findCorrectDatabaseImplementation( - new JdbcConnection(connection)) - - if (defaultSchema) { - database.defaultSchemaName = defaultSchema - } -// database.defaultSchemaName = connection.catalog // TODO - - if (dialectName) { - // add in a per-instance getDialect() method, mostly needed in - // MysqlAwareCreateTableGenerator for MySQL InnoDB - def dialect = createInstance(dialectName) - def emc = new ExpandoMetaClass(database.getClass(), false) - emc.getDialect = { -> dialect } - emc.initialize() - database.metaClass = emc - } - - database - } - - static Map getDatabases() { - Map databaseMap = [:] - - databaseMap.dataSource = getDatabase(getConfig().updateOnStartDefaultSchema ?: null) - - getDataSourceConfigs().each { String dsName, dsConfig -> - String dataSourceSuffix = extractSuffix(dsName) - def connection = findSessionFactory(dataSourceSuffix).currentSession.connection() - - def dialect = application.config."dataSource$dataSourceSuffix".dialect - if (dialect && dialect instanceof Class) { - dialect = dialect.name - } - else { - dialect = application.mainContext.dialectDetector - } - - String defaultSchema = config."$dsName".updateOnStartDefaultSchema ?: null - databaseMap[dsName] == getDatabase(connection, defaultSchema, dialect.toString()) - } - - databaseMap - } - - static Map getDataSourceConfigs() { - def dsConfigs = [:] - application.config.each { String name, value -> - if (name.startsWith('dataSource_') && value instanceof ConfigObject) { - dsConfigs[name] = value - } - } - - dsConfigs - } - - static Database getDatabase(String defaultSchema = null, String dsName = 'dataSource') { - String dataSourceSuffix = extractSuffix(dsName) - def connection = findSessionFactory(dataSourceSuffix).currentSession.connection() - - def dialect = application.config."$dsName".dialect - if (dialect) { - if (dialect instanceof Class) { - dialect = dialect.name - } - } - else { - dialect = application.mainContext.dialectDetector - } - - getDatabase connection, defaultSchema, dialect.toString() - } - - static Liquibase getLiquibase(Database database) { - getLiquibase database, getChangelogFileName() - } - - static Liquibase getLiquibase(Database database, String changelogFileName) { - def resourceAccessor = application.mainContext.migrationResourceAccessor - new Liquibase(changelogFileName, resourceAccessor, database) - } - - static void executeInSession(String dsName = 'dataSource', Closure c) { - String dataSourceSuffix = extractSuffix(dsName) - boolean participate = initSession(dataSourceSuffix) - try { - c() - } - finally { - if (!participate) { - flushAndClose(dataSourceSuffix) - } - } - } - - protected static boolean initSession(String dataSourceSuffix) { - def sessionFactory = findSessionFactory(dataSourceSuffix) - if (TransactionSynchronizationManager.hasResource(sessionFactory)) { - return true - } - - def SessionFactoryUtils = MigrationUtils.classForName('org.springframework.orm.hibernate3.SessionFactoryUtils') - def FlushMode = MigrationUtils.classForName('org.hibernate.FlushMode') - def SessionHolder = MigrationUtils.classForName('org.springframework.orm.hibernate3.SessionHolder') - - /*org.hibernate.Session*/ def session = SessionFactoryUtils.getSession(sessionFactory, true) - session.flushMode = FlushMode.AUTO - TransactionSynchronizationManager.bindResource sessionFactory, SessionHolder.newInstance(session) - false - } - - protected static void flushAndClose(String dataSourceSuffix) { - def SessionFactoryUtils = MigrationUtils.classForName('org.springframework.orm.hibernate3.SessionFactoryUtils') - def FlushMode = MigrationUtils.classForName('org.hibernate.FlushMode') - - def sessionFactory = findSessionFactory(dataSourceSuffix) - def session = TransactionSynchronizationManager.unbindResource(sessionFactory).session - if (!FlushMode.MANUAL == session.flushMode) { - session.flush() - } - SessionFactoryUtils.closeSession session - } - - protected static findSessionFactory(String dataSourceSuffix = '') { - - def factoryBean = application.mainContext.getBean('&sessionFactory' + dataSourceSuffix) - if (factoryBean.getClass().simpleName == 'DelayedSessionFactoryBean') { - // get the un-proxied version since at this point it's ok to get a connection; - // only an issue during plugin tests - return factoryBean.realSessionFactory - } - - application.mainContext."sessionFactory$dataSourceSuffix" - } - - protected static extractSuffix(String dataSourceName) { - dataSourceName == 'dataSource' ? '' : dataSourceName[10..-1] - } - - static String dataSourceNameWithSuffix(String dataSourceSuffix = '') { - dataSourceSuffix ? 'dataSource_' + dataSourceSuffix : 'dataSource' - } - - protected static extractSuffixWithOutUnderbar(dataSourceName) { - dataSourceName == 'dataSource' ? '' : dataSourceName[11..-1] - } - - static boolean canAutoMigrate(String dsName = 'dataSource') { - - // in a war - if (application.warDeployed || getConfig()?.forceAutoMigrate) { - return true - } - - if (Boolean.getBoolean('grails.fork.active') && !scriptName) { - // scriptName gets set in the initial JVM and not this one, - // so infer that it's run-app based on being in forked mode - scriptName = 'RunApp' - } - - if (!scriptName) { - // not run-app, so it won't make sense to auto-migrate - return - } - - // in run-app - if (getAutoMigrateScripts(dsName).contains(scriptName)) { - return true - } - - false - } - - static createInstance(String className) { - application.classLoader.loadClass(className).newInstance() - } - - static ConfigObject getConfig(String dsName = 'dataSource') { - boolean isDefault = dsName == 'dataSource' - if (isDefault) { - return application.config.grails.plugin.databasemigration - } - - String dataSourceSuffix = extractSuffixWithOutUnderbar(dsName) - return application.config.grails.plugin.databasemigration."$dataSourceSuffix" - } - - static String getDbDocLocation(String dsName = 'dataSource') { - getConfig(dsName).dbDocLocation ?: 'target/dbdoc' - } - - static String getAutoMigrateScripts(String dsName = 'dataSource') { - getConfig(dsName).autoMigrateScripts ?: ['RunApp'] - } - - static String getChangelogFileName(String dsName = 'dataSource') { - boolean isDefault = dsName == 'dataSource' - if (isDefault) { - return getConfig().changelogFileName ?: 'changelog.groovy' - } - - String dataSourceSuffix = extractSuffixWithOutUnderbar(dsName) - return getConfig(dsName).changelogFileName ?: "changelog-${dataSourceSuffix}.groovy" - } - - static String getChangelogLocation(String dsName = 'dataSource') { - getConfig(dsName).changelogLocation ?: 'grails-app/migrations' - } - - static ConfigObject getChangelogProperties(String dsName = 'dataSource') { - getConfig(dsName).changelogProperties ?: [:] - } - - static DiffResult fixDiffResult(DiffResult diffResult) { - removeRedundantUnexpectedUnique diffResult - removeEquivalentIndexes diffResult - removeIgnoredObjects diffResult - - for (Iterator iter = diffResult.unexpectedIndexes.iterator(); iter.hasNext(); ) { - Index index = iter.next() - if (index.associatedWith.contains(Index.MARK_PRIMARY_KEY) || - index.associatedWith.contains(Index.MARK_FOREIGN_KEY) || - index.associatedWith.contains(Index.MARK_UNIQUE_CONSTRAINT)) { - continue - } - - for (Index targetIndex in diffResult.referenceSnapshot.indexes) { - if (index.columns.size() == targetIndex.columns.size() && - index.columns.containsAll(targetIndex.columns) && - index.table.name.equalsIgnoreCase(targetIndex.table.name) && - index.unique == targetIndex.unique) { - iter.remove() - break - } - } - } - - diffResult - } - - static void removeRedundantUnexpectedUnique(DiffResult diffResult) { - for (Iterator iter = diffResult.unexpectedUniqueConstraints.iterator(); iter.hasNext(); ) { - UniqueConstraint uniqueConstraint = iter.next() - List constraintColumnNames = uniqueConstraint.columns*.toLowerCase() - for (Index index in diffResult.targetSnapshot.indexes) { - List indexColumnNames = index.columns*.toLowerCase() - if (index.unique && - indexColumnNames.size() == constraintColumnNames.size() && - indexColumnNames.containsAll(constraintColumnNames) && - index.table.name.equalsIgnoreCase(uniqueConstraint.table.name)) { - iter.remove() - break - } - } - } - } - - static void removeEquivalentIndexes(DiffResult diffResult) { - for (Iterator iter = diffResult.missingIndexes.iterator(); iter.hasNext(); ) { - Index index = iter.next() - List indexColumnNames = index.columns*.toLowerCase() - for (Iterator targetIter = diffResult.targetSnapshot.indexes.iterator(); targetIter.hasNext(); ) { - Index targetIndex = targetIter.next() - List targetIndexColumnNames = targetIndex.columns*.toLowerCase() - if (indexColumnNames.size() == targetIndexColumnNames.size() && - indexColumnNames.containsAll(targetIndexColumnNames) && - index.table.name.equalsIgnoreCase(targetIndex.table.name)) { - iter.remove() - targetIter.remove() - diffResult.unexpectedIndexes.remove targetIndex - break - } - } - } - } - - static void removeIgnoredObjects(DiffResult diffResult) { - def ignoredObjects = application.config.grails.plugin.databasemigration.ignoredObjects - if (!ignoredObjects) return - - diffResult.missingTables.removeAll(diffResult.missingTables.findAll { ignoredObjects.contains(it.name) }) - diffResult.missingPrimaryKeys.removeAll(diffResult.missingPrimaryKeys.findAll { ignoredObjects.contains(it.name) }) - - // convenience to automatically ignore ignored tables' generated primary keys - diffResult.missingPrimaryKeys.removeAll(diffResult.missingPrimaryKeys.findAll { ignoredObjects.contains(it.table.name) }) - - // ignore missing foreign keys that are for ignored tables - diffResult.missingForeignKeys.removeAll(diffResult.missingForeignKeys.findAll { ignoredObjects.contains(it.foreignKeyTable.name) }) - diffResult.unexpectedTables.removeAll(diffResult.unexpectedTables.findAll { ignoredObjects.contains(it.name) }) - diffResult.unexpectedViews.removeAll(diffResult.unexpectedViews.findAll { ignoredObjects.contains(it.name) }) - diffResult.unexpectedForeignKeys.removeAll(diffResult.unexpectedForeignKeys.findAll { ignoredObjects.contains(it.name) }) - - // ignore unexpected foreign keys that are for ignored tables - diffResult.unexpectedForeignKeys.removeAll(diffResult.unexpectedForeignKeys.findAll { ignoredObjects.contains(it.foreignKeyTable.name) }) - diffResult.unexpectedIndexes.removeAll(diffResult.unexpectedIndexes.findAll { ignoredObjects.contains(it.table.name) }) - diffResult.unexpectedIndexes.removeAll(diffResult.unexpectedIndexes.findAll { ignoredObjects.contains(it.name) }) - diffResult.unexpectedPrimaryKeys.removeAll(diffResult.unexpectedPrimaryKeys.findAll { ignoredObjects.contains(it.name) }) - - // ignore unexpected primary keys that are for ignored tables - diffResult.unexpectedPrimaryKeys.removeAll(diffResult.unexpectedPrimaryKeys.findAll { ignoredObjects.contains(it.table.name) }) - diffResult.unexpectedUniqueConstraints.removeAll(diffResult.unexpectedUniqueConstraints.findAll { ignoredObjects.contains(it.name) }) - diffResult.unexpectedSequences.removeAll(diffResult.unexpectedSequences.findAll { ignoredObjects.contains(it.name) }) - - //list of regex expressions matching columns - def ignoredColumns = application.config.grails.plugin.databasemigration.ignoredColumns ?: [] - if (ignoredColumns) { - diffResult.unexpectedColumns.removeAll(diffResult.unexpectedColumns.findAll { column -> - ignoredColumns.find { pattern -> "${column.table.name}.$column.name" ==~ pattern } != null - }) - } - - diffResult.missingViews.removeAll(diffResult.missingViews.findAll { ignoredObjects.contains(it.name) }) - } - - static boolean hibernateAvailable() { - null != classForName('org.hibernate.cfg.Configuration') - } - - static Class classForName(String name) { - try { - return Class.forName(name, false, Thread.currentThread().contextClassLoader) - } - catch (ClassNotFoundException e) { - return null - } - } - - static boolean instanceOf(o, String className) { - classForName(className).isAssignableFrom(o.getClass()) - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/MySQLCompatibleChangeLogSerializer.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/MySQLCompatibleChangeLogSerializer.groovy deleted file mode 100644 index 1a3fcf6..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/MySQLCompatibleChangeLogSerializer.groovy +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright 2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration - -import liquibase.change.Change -import liquibase.change.core.AddForeignKeyConstraintChange -import liquibase.changelog.ChangeSet -import liquibase.serializer.core.xml.XMLChangeLogSerializer - -/** - * Reorder ChangeSets with Foreign Key changes to the end of changes.

- * - * MySQL need the Indexes created before a Foreign Key with the same name, elsewhere it throws an ERROR 1280 (42000): Incorrect index name '*INDEXNAME*' - * @see http://bugs.mysql.com/bug.php?id=55465 - */ -class MySQLCompatibleChangeLogSerializer extends XMLChangeLogSerializer { - - @Override - void write(List changeSets, OutputStream out) throws IOException { - super.write reorderForeignKeysToEnd(changeSets), out - } - - protected static List reorderForeignKeysToEnd(List changeSets) { - List foreignKeyChangeSets = [] - List newChangeSets = [] - - for (ChangeSet changeSet in changeSets) { - if (hasForeignKeyConstraintChange(changeSet)) { - foreignKeyChangeSets << changeSet - } - else { - newChangeSets << changeSet - } - } - - newChangeSets + foreignKeyChangeSets - } - - protected static boolean hasForeignKeyConstraintChange(ChangeSet changeSet) { - changeSet.changes.find { Change change -> change instanceof AddForeignKeyConstraintChange } - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/MysqlAwareCreateTableGenerator.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/MysqlAwareCreateTableGenerator.groovy deleted file mode 100644 index 4898719..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/MysqlAwareCreateTableGenerator.groovy +++ /dev/null @@ -1,75 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration - -import liquibase.database.Database -import liquibase.database.structure.DatabaseObject -import liquibase.exception.ValidationErrors -import liquibase.exception.Warnings -import liquibase.sql.Sql -import liquibase.sql.UnparsedSql -import liquibase.sqlgenerator.SqlGenerator -import liquibase.sqlgenerator.SqlGeneratorChain -import liquibase.sqlgenerator.core.CreateTableGenerator -import liquibase.statement.SqlStatement - -/** - * Adds 'ENGINE=InnoDB' if using an InnoDB dialect.

- * - * Funky implementation using composition because of a Groovy bug when subclassing - * CreateTableGenerator to just override generateSql: - * 'Method "generateSql" in class grails/plugin/databasemigration/MysqlAwareCreateTableGenerator has illegal signature "L[Lliquibase/sql/Sql;;"'. - * - * @author Burt Beckwith - */ -class MysqlAwareCreateTableGenerator implements SqlGenerator { - - protected CreateTableGenerator _super = new CreateTableGenerator() - - Sql[] generateSql(SqlStatement statement, Database database, SqlGeneratorChain chain) { - Sql[] statements = _super.generateSql(statement, database, chain) - if (statements && statements.length == 1 && (statements[0] instanceof UnparsedSql)) { - statements = updateSql(statements, database) - } - statements - } - - // no-op in most cases but adds 'ENGINE=InnoDB' if using InnoDB - protected Sql[] updateSql(Sql[] statements, Database database) { - UnparsedSql newSql = new UnparsedSql(statements[0].toSql() + database.dialect.tableTypeString, - statements[0].endDelimiter, statements[0].affectedDatabaseObjects as DatabaseObject[]) - [newSql] as Sql[] - } - - ValidationErrors validate(SqlStatement statement, Database database, SqlGeneratorChain chain) { - _super.validate statement, database, chain - } - - int getPriority() { - _super.priority - } - - boolean supports(SqlStatement statement, Database database) { - _super.supports statement, database - } - - boolean requiresUpdatedDatabaseMetadata(Database database) { - _super.requiresUpdatedDatabaseMetadata database - } - - Warnings warn(SqlStatement statementType, Database database, SqlGeneratorChain chain) { - _super.warn statementType, database, chain - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/NoopVisitor.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/NoopVisitor.groovy deleted file mode 100644 index f1568a5..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/NoopVisitor.groovy +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright 2012-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration - -import liquibase.changelog.ChangeSet -import liquibase.changelog.DatabaseChangeLog -import liquibase.changelog.visitor.ChangeSetVisitor -import liquibase.changelog.visitor.ChangeSetVisitor.Direction -import liquibase.database.Database - -/** - * Used in ScriptUtils.generatePreviousChangesetSql. - * - * @author Burt Beckwith - */ -class NoopVisitor implements ChangeSetVisitor { - - protected Database database - - NoopVisitor(Database db) { - database = db - } - - Direction getDirection() { Direction.FORWARD } - - void visit(ChangeSet changeSet, DatabaseChangeLog databaseChangeLog, Database database) { - changeSet.execute databaseChangeLog, database - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/ScriptUtils.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/ScriptUtils.groovy deleted file mode 100644 index 958a2bb..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/ScriptUtils.groovy +++ /dev/null @@ -1,283 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration - -import grails.util.GrailsUtil -import liquibase.exception.ValidationFailedException - -import java.text.SimpleDateFormat - -import liquibase.Liquibase -import liquibase.changelog.ChangeLogIterator -import liquibase.changelog.DatabaseChangeLog -import liquibase.changelog.filter.ContextChangeSetFilter -import liquibase.changelog.filter.CountChangeSetFilter -import liquibase.changelog.filter.DbmsChangeSetFilter -import liquibase.database.Database -import liquibase.database.typeconversion.TypeConverter -import liquibase.database.typeconversion.TypeConverterFactory -import liquibase.diff.Diff -import liquibase.executor.Executor -import liquibase.executor.ExecutorService -import liquibase.executor.LoggingExecutor -import liquibase.lockservice.LockService -import liquibase.parser.ChangeLogParserFactory -import liquibase.util.StringUtils - -import org.slf4j.Logger -import org.slf4j.LoggerFactory -import org.springframework.context.ApplicationContext - -/** - * @author Burt Beckwith - */ -class ScriptUtils { - - static final String DAY_DATE_FORMAT = 'yyyy-MM-dd' - static final String FULL_DATE_FORMAT = DAY_DATE_FORMAT + ' HH:mm:ss' - - protected Logger log = LoggerFactory.getLogger('grails.plugin.databasemigration.Scripts') - - static void printStackTrace(ValidationFailedException e) { - e.printDescriptiveError System.out - } - - static void printStackTrace(Throwable e) { - GrailsUtil.deepSanitize e - e.printStackTrace(System.out) - } - - static PrintStream calculateDestination(List argsList, Integer argIndex = 0, boolean relativeToMigrationDir = false) { - if (!argsList[argIndex]) { - return System.out - } - - String destination = argsList[argIndex] - if (relativeToMigrationDir) { - destination = MigrationUtils.changelogLocation + '/' + destination - } - - new PrintStream(destination) - } - - static PrintWriter newPrintWriter(List argsList, Integer argIndex = 0, boolean relativeToMigrationDir = false) { - new PrintWriter(calculateDestination(argsList, argIndex, relativeToMigrationDir)) - } - - static OutputStreamWriter newOutputStreamWriter(List argsList, Integer argIndex = 0, boolean relativeToMigrationDir = false) { - new OutputStreamWriter(calculateDestination(argsList, argIndex, relativeToMigrationDir)) - } - - // run a script (called by the closure) which generates changelog XML, and - // write it to STDOUT if no filename was specified, to an XML file if the - // extension is .xml, and convert to the Groovy DSL and write to a Groovy - // file if the extension is .groovy - static void executeAndWrite(String filename, boolean add, String dsName, Closure c) { - PrintStream out - ByteArrayOutputStream baos - if (filename) { - filename = MigrationUtils.changelogLocation + '/' + filename - if (filename.toLowerCase().endsWith('groovy')) { - baos = new ByteArrayOutputStream() - out = new PrintStream(baos) - } - else { - out = new PrintStream(filename) - } - } - else { - out = System.out - } - - c(out) - - if (baos) { - String xml = new String(baos.toString('UTF-8')) - String groovy = ChangelogXml2Groovy.convert(xml) - new File(filename).withWriter { it.write groovy } - } - - if (add) { - registerInclude filename, dsName - } - } - - static void registerInclude(String filename, String dsName) { - String fullPath = new File(filename).absolutePath - String fullMigrationFolderPath = new File(MigrationUtils.changelogLocation).absolutePath - String relativePath = (fullPath - fullMigrationFolderPath).substring(1) - appendToChangelog new File(filename), relativePath, dsName - } - - static void appendToChangelog(File sourceFile, String includeName, String dsName) { - - File changelog = new File(MigrationUtils.changelogLocation, MigrationUtils.getChangelogFileName(dsName)) - if (changelog.absolutePath.equals(sourceFile.absolutePath)) { - return - } - - boolean xml = changelog.name.toLowerCase().endsWith('.xml') - String includeStatement = xml ? "\n \n" : "\n\tinclude file: '$includeName'" - - def asLines = changelog.text.readLines() - int count = asLines.size() - int index = -1 - for (int i = count - 1; i > -1; i--) { - if ((xml && asLines[i].trim() == '') || asLines[i].trim() == '}') { - index = i - break - } - } - - if (index == -1) { - // TODO - return - } - - // TODO backup - changelog.withWriter { - index.times { i -> it.write asLines[i]; it.newLine() } - - it.write includeStatement; it.newLine() - - (count - index).times { i -> it.write asLines[index + i]; it.newLine() } - } - } - - static void closeConnection(it) { try { it?.close() } catch (ignored) {} } - - // returns a Map; the rendered date String is under the 'date' key, - // calculateDateFileNameIndex is under 'calculateDateFileNameIndex', - // and any exception message is under 'error' - static Map calculateDate(List argsList) { - - def results = [:] - - String dateFormat - String dateString - - switch (argsList.size()) { - case 1: - dateFormat = DAY_DATE_FORMAT - dateString = argsList[0].trim() - break - case 2: - dateFormat = FULL_DATE_FORMAT - dateString = argsList[0] + ' ' + argsList[1] - try { - new SimpleDateFormat(dateFormat).parse(dateString) - } - catch (e) { - // assume that 2nd param is filename - dateFormat = DAY_DATE_FORMAT - dateString = argsList[0] - results.calculateDateFileNameIndex = 1 - } - break - case 3: - dateFormat = FULL_DATE_FORMAT - dateString = argsList[0] + ' ' + argsList[1] - results.calculateDateFileNameIndex = 2 - } - - if (dateString) { - try { - results.date = new SimpleDateFormat(dateFormat).parse(dateString) - } - catch (e) { - results.error = "Problem parsing '$dateString' as a Date: $e.message" - } - return results - } - - results.error = 'Date must be specified as two strings with the format "yyyy-MM-dd HH:mm:ss"' + - 'or as one strings with the format "yyyy-MM-dd"' - - results - } - - static GormDatabase createGormDatabase(String dataSourceSuffix, config, appCtx, Database realDatabase, String schema = null) { - - if (realDatabase) { - // register a HibernateAwareTypeConverter with the real converter as its delegate - TypeConverter realConverter = TypeConverterFactory.getInstance().findTypeConverter(realDatabase) - TypeConverterFactory.getInstance().register new HibernateAwareTypeConverter(realConverter) - } - - String name = dataSourceSuffix ? '&sessionFactory_' + dataSourceSuffix : '&sessionFactory' - new GormDatabase(appCtx.getBean(name).configuration, schema) - } - - static Diff createDiff(Database referenceDatabase, Database targetDatabase, - ApplicationContext appCtx, String diffTypes) { - - Diff diff = (referenceDatabase instanceof GormDatabase) ? - new GormDiff(referenceDatabase, targetDatabase) : - new Diff(referenceDatabase, targetDatabase) - diff.diffTypes = diffTypes - diff.addStatusListener appCtx.diffStatusListener - diff - } - - static void createAndPrintDiff(Database referenceDatabase, Database targetDatabase, Database printDatabase, - ApplicationContext appCtx, String diffTypes, PrintStream out) { - - createDiff(referenceDatabase, targetDatabase, appCtx, diffTypes).compare().printChangeLog( - out, printDatabase, new MySQLCompatibleChangeLogSerializer()) - } - - static void createAndPrintFixedDiff(Database referenceDatabase, Database targetDatabase, Database printDatabase, - ApplicationContext appCtx, String diffTypes, PrintStream out) { - - MigrationUtils.fixDiffResult(createDiff(referenceDatabase, targetDatabase, appCtx, diffTypes).compare()).printChangeLog( - out, printDatabase, new MySQLCompatibleChangeLogSerializer()) - } - - static void generatePreviousChangesetSql(Database database, Liquibase liquibase, Writer output, int changesetCount, int skip, String contexts) { - String changeLogFile = liquibase.changeLogFile - - liquibase.changeLogParameters.contexts = StringUtils.splitAndTrim(contexts, ",") - - Executor oldTemplate = ExecutorService.instance.getExecutor(database) - LoggingExecutor loggingExecutor = new LoggingExecutor(ExecutorService.instance.getExecutor(database), output, database) - ExecutorService.instance.setExecutor database, loggingExecutor - - LockService lockService = LockService.getInstance(database) - lockService.waitForLock() - - try { - DatabaseChangeLog changeLog = ChangeLogParserFactory.instance.getParser(changeLogFile, liquibase.resourceAccessor).parse( - changeLogFile, liquibase.changeLogParameters, liquibase.resourceAccessor) - changeLog.changeSets.reverse true - skip.times { changeLog.changeSets.remove(0) } - - liquibase.checkDatabaseChangeLogTable true, changeLog, contexts - changeLog.validate liquibase.database, contexts - - ChangeLogIterator logIterator = new ChangeLogIterator(changeLog, - new ContextChangeSetFilter(contexts), - new DbmsChangeSetFilter(database), - new CountChangeSetFilter(changesetCount)) - - logIterator.run new NoopVisitor(database), database - - output.flush() - } - finally { - lockService.releaseLock() - ExecutorService.instance.setExecutor database, oldTemplate - } - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/Slf4jLogger.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/Slf4jLogger.groovy deleted file mode 100644 index 99b82dd..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/Slf4jLogger.groovy +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration - -import liquibase.logging.LogLevel - -import org.slf4j.Logger -import org.slf4j.LoggerFactory - -/** - * Logger that uses Grails Slf4j loggers and configuration. - * - * @author Burt Beckwith - */ -class Slf4jLogger implements liquibase.logging.Logger { - - protected Logger log - - void severe(String message) { log.error message } - - void severe(String message, Throwable e) { log.error message, e } - - void warning(String message) { log.warn message } - - void warning(String message, Throwable e) { log.warn message, e } - - void info(String message) { log.info message } - - void info(String message, Throwable e) { log.info message, e } - - void debug(String message) { log.debug message } - - void debug(String message, Throwable e) { log.debug message, e } - - int getPriority() { 10 } - - void setName(String name) { - log = LoggerFactory.getLogger(name) - } - - void setLogLevel(String logLevel, String logFile) { - // only used from Liquibase commandline - throw new UnsupportedOperationException() - } - - void setLogLevel(String ignored) { - // ignored, use standard log4j configuration - } - - void setLogLevel(LogLevel ignored) { - // ignored, use standard log4j configuration - } - - LogLevel getLogLevel() { - // only used from Liquibase commandline - throw new UnsupportedOperationException() - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/AuthorListWriter.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/AuthorListWriter.groovy deleted file mode 100644 index dce8a78..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/AuthorListWriter.groovy +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration.dbdoc - -/** - * @author Burt Beckwith - */ -class AuthorListWriter extends HTMLListWriter { - - AuthorListWriter(Map files) { - super('All Authors', 'authors', 'authors', files) - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/AuthorWriter.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/AuthorWriter.groovy deleted file mode 100644 index 7d56094..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/AuthorWriter.groovy +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration.dbdoc - -import liquibase.change.Change -import liquibase.database.Database - -/** - * @author Burt Beckwith - */ -class AuthorWriter extends HTMLWriter { - - AuthorWriter(Map files, Database database) { - super(files, 'authors', database) - } - - @Override - protected String createTitle(object) { "Changes created by author $object" } - - @Override - protected void writeCustomHTML(StringBuilder content, object, List changes) { - // do nothing - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/ChangeLogListWriter.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/ChangeLogListWriter.groovy deleted file mode 100644 index 675d760..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/ChangeLogListWriter.groovy +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration.dbdoc - -/** - * @author Burt Beckwith - */ -class ChangeLogListWriter extends HTMLListWriter { - ChangeLogListWriter(Map files) { - super('All Change Logs', 'changelogs', 'changelogs', files) - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/ChangeLogWriter.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/ChangeLogWriter.groovy deleted file mode 100644 index 57e4f97..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/ChangeLogWriter.groovy +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration.dbdoc - -import liquibase.resource.ResourceAccessor - -/** - * @author Burt Beckwith - */ -class ChangeLogWriter { - protected ResourceAccessor resourceAccessor - protected Map files - - ChangeLogWriter(ResourceAccessor resourceAccessor, Map files) { - this.files = files - this.resourceAccessor = resourceAccessor - } - - void writeChangeLog(String changeLog, String physicalFilePath) { - files["changelogs/$physicalFilePath".toString()] = resourceAccessor.getResourceAsStream(physicalFilePath).text - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/ColumnWriter.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/ColumnWriter.groovy deleted file mode 100644 index a7931cc..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/ColumnWriter.groovy +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration.dbdoc - -import liquibase.change.Change -import liquibase.database.Database - -/** - * @author Burt Beckwith - */ -class ColumnWriter extends HTMLWriter { - - ColumnWriter(Map files, Database database) { - super(files, 'columns', database) - } - - @Override - protected String createTitle(object) { """Changes affecting column "$object" """ } - - @Override - protected void writeCustomHTML(StringBuilder content, object, List changes) { - // do nothing - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/HTMLListWriter.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/HTMLListWriter.groovy deleted file mode 100644 index 5eda3ee..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/HTMLListWriter.groovy +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration.dbdoc - -/** - * @author Burt Beckwith - */ -class HTMLListWriter { - - protected String directory - protected String filename - protected String title - protected Map files - - HTMLListWriter(String title, String filename, String subdir, Map files) { - this.title = title - this.filename = filename - this.directory = subdir - this.files = files - } - - void writeHTML(SortedSet objects) { - StringBuilder content = new StringBuilder() - content.append """\ - - - -$title - - - - - -$title -
- - - -
-""" - - for (object in objects) { - String s = object.toString() - String hrefName = s.toLowerCase().endsWith('.xml') ? s[0..-5] : s - content.append """""" - content.append s - content.append "
\n" - } - - content.append '''\ -
- - -''' - - files[filename] = content.toString() - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/HTMLWriter.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/HTMLWriter.groovy deleted file mode 100644 index 5cee806..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/HTMLWriter.groovy +++ /dev/null @@ -1,187 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License") - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration.dbdoc - -import java.text.DateFormat - -import liquibase.change.Change -import liquibase.changelog.ChangeSet -import liquibase.database.Database -import liquibase.util.LiquibaseUtil -import liquibase.util.StringUtils - -/** - * @author Burt Beckwith - */ -abstract class HTMLWriter { - - protected Database database - protected Map files - protected String subdir - - protected HTMLWriter(Map files, String subdir, Database database) { - this.files = files - this.subdir = subdir - this.database = database - } - - protected abstract void writeCustomHTML(StringBuilder content, object, List changes) - - void writeHTML(object, List ranChanges, List changesToRun, String changeLog) { - StringBuilder content = new StringBuilder() - - content.append("") - writeHeader(object, content) - content.append('') - - content.append("

").append(createTitle(object)).append("

\n") - - writeBody content, object, ranChanges, changesToRun - - writeFooter content, changeLog - - content.append("") - content.append("") - files["$subdir/${object.toString().toLowerCase()}".toString()] = content.toString() - } - - protected void writeFooter(StringBuilder content, String changeLog) { - content.append("
Generated: ") - content.append(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(new Date())) - content.append("
Against: ") - content.append(database) - content.append("
Change Log: ") - content.append(changeLog) - content.append("

Generated By: ") - content.append("LiquiBase ") - content.append(LiquibaseUtil.getBuildVersion()).append("") - } - - protected void writeBody(StringBuilder content, object, List ranChanges, List changesToRun) { - writeCustomHTML content, object, ranChanges - writeChanges 'Pending Changes', content, changesToRun - writeChanges 'Past Changes', content, ranChanges - } - - protected void writeTable(String title, List> cells, StringBuilder content) { - content.append('

') - int colspan = 0 - if (cells) { - colspan = cells[0].size() - } - else { - colspan = 0 - } - content.append("""\n""") - .append("""\n""").append("\n").append("\n") - - for (List row : cells) { - content.append("""\n""") - for (String cell : row) { - writeTD(content, cell) - } - content.append("\n") - } - content.append("
\n""").append("").append(title) - .append("
\n") - } - - protected void writeTD(StringBuilder content, String filePath) { - content.append('\n') - content.append(filePath) - content.append("\n") - } - - protected void writeHeader(object, StringBuilder content) { - String title = createTitle(object) - content.append("\n").append("").append(title).append("\n") - .append('\n') - .append('\n") - .append("\n") - } - - protected abstract String createTitle(object) - - protected void writeChanges(String title, StringBuilder content, List changes, boolean relative = true) { - content.append('

\n') - content.append('\n') - content.append('\n') - content.append('\n') - - String pathStart = relative ? '../' : '' - - ChangeSet lastChangeSet - if (!changes) { - content.append('') - } - else { - for (Change change : changes) { - if (!change.changeSet.equals(lastChangeSet)) { - lastChangeSet = change.changeSet - content.append('\n') - - String hrefName = change.changeSet.filePath.toLowerCase().endsWith('.xml') ? change.changeSet.filePath[0..-5] : change.changeSet.filePath - writeTD(content, "" - + change.changeSet.filePath + "") - writeTD(content, change.changeSet.id) - writeTD(content, "" - + change.changeSet.author.toLowerCase() + "") - - ChangeSet.RunStatus runStatus = database.getRunStatus(change.changeSet) - if (runStatus.equals(ChangeSet.RunStatus.NOT_RAN)) { - String anchor = change.changeSet.toString(false).replaceAll("\\W", "_") - writeTD(content, "NOT YET RAN [SQL]") - } - else if (runStatus.equals(ChangeSet.RunStatus.INVALID_MD5SUM)) { - writeTD(content, "INVALID MD5SUM") - } - else if (runStatus.equals(ChangeSet.RunStatus.ALREADY_RAN)) { - writeTD(content, "Executed " + - DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format( - database.getRanDate(change.changeSet))) - } - else if (runStatus.equals(ChangeSet.RunStatus.RUN_AGAIN)) { - writeTD(content, "Executed, WILL RUN AGAIN") - } - else { - throw new RuntimeException("Unknown run status: " + runStatus) - } - - content.append("") - - if (StringUtils.trimToNull(change.changeSet.comments)) { - content.append("") - } - - } - - content.append('\n') - content.append("") - } - } - - content.append("
\n') - content.append("") - content.append(title) - content.append('
None Found
") - .append(change.changeSet.comments).append("
          ") - .append(change.confirmationMessage).append("
") - content.append(" 

") - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/MemoryDocVisitor.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/MemoryDocVisitor.groovy deleted file mode 100644 index 0b80515..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/MemoryDocVisitor.groovy +++ /dev/null @@ -1,127 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration.dbdoc - -import java.lang.reflect.Field - -import liquibase.change.Change -import liquibase.changelog.ChangeSet -import liquibase.changelog.DatabaseChangeLog -import liquibase.changelog.visitor.DBDocVisitor -import liquibase.database.Database -import liquibase.database.structure.Column -import liquibase.database.structure.DatabaseObject -import liquibase.database.structure.Table -import liquibase.resource.ResourceAccessor -import liquibase.snapshot.DatabaseSnapshot -import liquibase.snapshot.DatabaseSnapshotGeneratorFactory - -import org.springframework.util.ReflectionUtils - -/** - * @author Burt Beckwith - */ -class MemoryDocVisitor extends DBDocVisitor { - - protected static final int MAX_RECENT_CHANGE = 50 - - protected Database database - protected SortedSet changeLogs - protected Map> changesByAuthor - protected Map> changesByObject - protected Map> changesToRunByObject - protected Map> changesToRunByAuthor - protected List changesToRun - protected List recentChanges - - protected String rootChangeLogName - protected DatabaseChangeLog rootChangeLog - - MemoryDocVisitor(Database database) { - super(database) - this.database = database - - changeLogs = getFieldValue('changeLogs') - changesByAuthor = getFieldValue('changesByAuthor') - changesByObject = getFieldValue('changesByObject') - changesToRunByObject = getFieldValue('changesToRunByObject') - changesToRunByAuthor = getFieldValue('changesToRunByAuthor') - changesToRun = getFieldValue('changesToRun') - recentChanges = getFieldValue('recentChanges') - } - - void visit(ChangeSet changeSet, DatabaseChangeLog databaseChangeLog, Database database) { - if (rootChangeLogName == null) { - rootChangeLogName = changeSet.getFilePath() - } - - if (rootChangeLog == null) { - rootChangeLog = databaseChangeLog - } - - super.visit changeSet, databaseChangeLog, database - } - - Map generateHTML(ResourceAccessor resourceAccessor) { - - DatabaseSnapshot snapshot = DatabaseSnapshotGeneratorFactory.instance.createSnapshot( - database, null, null) - Map files = [:] - - new ChangeLogListWriter(files).writeHTML(changeLogs) - new TableListWriter(files).writeHTML(new TreeSet(snapshot.getTables())) - new AuthorListWriter(files).writeHTML(new TreeSet(changesByAuthor.keySet())) - - HTMLWriter authorWriter = new AuthorWriter(files, database) - for (String author : changesByAuthor.keySet()) { - authorWriter.writeHTML(author, changesByAuthor.get(author), changesToRunByAuthor.get(author), rootChangeLogName) - } - - HTMLWriter tableWriter = new TableWriter(files, database) - for (Table table : snapshot.getTables()) { - tableWriter.writeHTML(table, changesByObject.get(table), changesToRunByObject.get(table), rootChangeLogName) - } - - HTMLWriter columnWriter = new ColumnWriter(files, database) - for (Column column : snapshot.getColumns()) { - columnWriter.writeHTML(column, changesByObject.get(column), changesToRunByObject.get(column), rootChangeLogName) - } - - ChangeLogWriter changeLogWriter = new ChangeLogWriter(resourceAccessor, files) - for (changeLog in changeLogs) { - changeLogWriter.writeChangeLog(changeLog.logicalPath, changeLog.physicalPath) - } - - HTMLWriter pendingChangesWriter = new PendingChangesWriter(files, database) - pendingChangesWriter.writeHTML('index', null, changesToRun, rootChangeLogName) - - HTMLWriter pendingSQLWriter = new PendingSQLWriter(files, database, rootChangeLog) - pendingSQLWriter.writeHTML('sql', null, changesToRun, rootChangeLogName) - - HTMLWriter recentChangesWriter = new RecentChangesWriter(files, database) - if (recentChanges.size() > MAX_RECENT_CHANGE) { - recentChanges = recentChanges.subList(0, MAX_RECENT_CHANGE) - } - recentChangesWriter.writeHTML('index', recentChanges, null, rootChangeLogName) - - files - } - - protected getFieldValue(String name) { - Field field = ReflectionUtils.findField(getClass().superclass, name) - field.accessible = true - ReflectionUtils.getField field, this - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/PendingChangesWriter.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/PendingChangesWriter.groovy deleted file mode 100644 index bc7fcad..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/PendingChangesWriter.groovy +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration.dbdoc - -import liquibase.change.Change -import liquibase.database.Database - -/** - * @author Burt Beckwith - */ -class PendingChangesWriter extends HTMLWriter { - - PendingChangesWriter(Map files, Database database) { - super(files, 'pending', database) - } - - @Override - protected String createTitle(object) { 'Pending Changes' } - - @Override - protected void writeBody(StringBuilder content, object, List ranChanges, List changesToRun) { - writeCustomHTML(content, object, ranChanges) - writeChanges('Pending Changes', content, changesToRun) - } - - @Override - protected void writeCustomHTML(StringBuilder content, object, List changes) { - // do nothing - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/PendingSQLWriter.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/PendingSQLWriter.groovy deleted file mode 100644 index 33f9dee..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/PendingSQLWriter.groovy +++ /dev/null @@ -1,73 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License") - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration.dbdoc - -import liquibase.change.Change -import liquibase.changelog.ChangeSet -import liquibase.changelog.DatabaseChangeLog -import liquibase.database.Database -import liquibase.exception.MigrationFailedException - -/** - * @author Burt Beckwith - */ -class PendingSQLWriter extends HTMLWriter { - - protected DatabaseChangeLog databaseChangeLog - - PendingSQLWriter(Map files, Database database, DatabaseChangeLog databaseChangeLog) { - super(files, 'pending', database) - this.databaseChangeLog = databaseChangeLog - } - - @Override - protected String createTitle(object) { 'Pending SQL' } - - protected void writeBody(StringBuilder content, object, List ranChanges, List changesToRun) { - if (!changesToRun) { - content.append 'NONE' - } - - content.append '
'
-
-		ChangeSet lastRunChangeSet
-
-		for (Change change : changesToRun) {
-			ChangeSet thisChangeSet = change.changeSet
-			if (thisChangeSet.equals(lastRunChangeSet)) {
-				continue
-			}
-			lastRunChangeSet = thisChangeSet
-			String anchor = thisChangeSet.toString(false).replaceAll('\\W', '_')
-			content.append("")
-			try {
-				thisChangeSet.execute databaseChangeLog, database
-			}
-			catch (MigrationFailedException e) {
-				content.append 'EXECUTION ERROR: '
-				content.append change.changeMetaData.description
-				content.append ': '
-				content.append e.message
-				content.append '\n\n'
-			}
-		}
-		content.append '
' - } - - @Override - protected void writeCustomHTML(StringBuilder content, object, List changes) { - // do nothing - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/RecentChangesWriter.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/RecentChangesWriter.groovy deleted file mode 100644 index 26edd57..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/RecentChangesWriter.groovy +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration.dbdoc - -import liquibase.change.Change -import liquibase.database.Database - -/** - * @author Burt Beckwith - */ -class RecentChangesWriter extends HTMLWriter { - - RecentChangesWriter(Map files, Database database) { - super(files, 'recent', database) - } - - @Override - protected String createTitle(object) { 'Recent Changes' } - - @Override - protected void writeBody(StringBuilder content, object, List ranChanges, List changesToRun) { - writeCustomHTML(content, object, ranChanges) - writeChanges('Most Recent Changes', content, ranChanges, false) - } - - @Override - protected void writeCustomHTML(StringBuilder content, object, List changes) { - // do nothing - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/TableListWriter.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/TableListWriter.groovy deleted file mode 100644 index 8ce721f..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/TableListWriter.groovy +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration.dbdoc - -/** - * @author Burt Beckwith - */ -class TableListWriter extends HTMLListWriter { - - TableListWriter(Map files) { - super('Current Tables', 'currenttables', 'tables', files) - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/TableWriter.groovy b/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/TableWriter.groovy deleted file mode 100644 index 4652724..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/groovy/grails/plugin/databasemigration/dbdoc/TableWriter.groovy +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright 2010-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License") - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.databasemigration.dbdoc - -import liquibase.change.Change -import liquibase.database.Database -import liquibase.database.typeconversion.TypeConverterFactory - -/** - * @author Burt Beckwith - */ -class TableWriter extends HTMLWriter { - - TableWriter(Map files, Database database) { - super(files, 'tables', database) - } - - @Override - protected String createTitle(object) { """Changes affecting table "$object" """ } - - @Override - protected void writeCustomHTML(StringBuilder content, table, List changes) { - List> cells = table.columns.collect { - [TypeConverterFactory.instance.findTypeConverter(database).convertToDatabaseTypeString(it, database), - """$it.name""".toString()] - } - writeTable 'Current Columns', cells, content - } -} diff --git a/target/work/plugins/database-migration-1.3.8/src/resources/changelog.template b/target/work/plugins/database-migration-1.3.8/src/resources/changelog.template deleted file mode 100644 index db4015f..0000000 --- a/target/work/plugins/database-migration-1.3.8/src/resources/changelog.template +++ /dev/null @@ -1,6 +0,0 @@ -databaseChangeLog = { - - changeSet(author: "@author@", id: "@id@") { - // TODO add changes and preconditions here - } -} diff --git a/target/work/plugins/hibernate-3.6.10.6/HibernateGrailsPlugin.groovy b/target/work/plugins/hibernate-3.6.10.6/HibernateGrailsPlugin.groovy deleted file mode 100644 index b728096..0000000 --- a/target/work/plugins/hibernate-3.6.10.6/HibernateGrailsPlugin.groovy +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright 2004-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import grails.plugin.hibernate3.HibernatePluginSupport - -import org.codehaus.groovy.grails.commons.AnnotationDomainClassArtefactHandler - -/** - * Handles the configuration of Hibernate within Grails. - * - * @author Graeme Rocher - */ -class HibernateGrailsPlugin { - def author = "Graeme Rocher" - def title = "Hibernate 3 for Grails" - def description = "Provides integration between Grails and Hibernate 3 through GORM" - - def grailsVersion = "2.3.2 > *" - def version = "3.6.10.6" - def observe = ['domainClass'] - def loadAfter = ['controllers', 'domainClass'] - def watchedResources = ["file:./grails-app/conf/hibernate/**.xml"] - def artefacts = [AnnotationDomainClassArtefactHandler] - def pluginExcludes = ['src/templates/**'] - - def license = 'APACHE' - def organization = [name: 'SpringSource', url: 'http://www.springsource.org/'] - def issueManagement = [system: 'JIRA', url: 'http://jira.grails.org/browse/GPHIB'] - def scm = [url: 'https://github.com/grails-plugins/grails-hibernate-plugin'] - - def doWithSpring = HibernatePluginSupport.doWithSpring - - def doWithDynamicMethods = HibernatePluginSupport.doWithDynamicMethods - - def onChange = HibernatePluginSupport.onChange -} diff --git a/target/work/plugins/hibernate-3.6.10.6/LICENSE b/target/work/plugins/hibernate-3.6.10.6/LICENSE deleted file mode 100644 index 6f85a66..0000000 --- a/target/work/plugins/hibernate-3.6.10.6/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright 2004-2005 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ diff --git a/target/work/plugins/hibernate-3.6.10.6/application.properties b/target/work/plugins/hibernate-3.6.10.6/application.properties deleted file mode 100644 index f10c3e6..0000000 --- a/target/work/plugins/hibernate-3.6.10.6/application.properties +++ /dev/null @@ -1,5 +0,0 @@ -#Grails Metadata file -#Fri Oct 18 07:57:19 CDT 2013 -app.grails.version=2.3.4 -app.name=hibernate -app.servlet.version=2.5 diff --git a/target/work/plugins/hibernate-3.6.10.6/grails-app/i18n/messages.properties b/target/work/plugins/hibernate-3.6.10.6/grails-app/i18n/messages.properties deleted file mode 100644 index e69de29..0000000 diff --git a/target/work/plugins/hibernate-3.6.10.6/plugin.xml b/target/work/plugins/hibernate-3.6.10.6/plugin.xml deleted file mode 100644 index ef11e23..0000000 --- a/target/work/plugins/hibernate-3.6.10.6/plugin.xml +++ /dev/null @@ -1,7 +0,0 @@ - - Graeme Rocher - Hibernate 3 for Grails - Provides integration between Grails and Hibernate 3 through GORM - HibernateGrailsPlugin - - \ No newline at end of file diff --git a/target/work/plugins/hibernate-3.6.10.6/scripts/CreateHibernateCfgXml.groovy b/target/work/plugins/hibernate-3.6.10.6/scripts/CreateHibernateCfgXml.groovy deleted file mode 100644 index dd991bd..0000000 --- a/target/work/plugins/hibernate-3.6.10.6/scripts/CreateHibernateCfgXml.groovy +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2004-2010 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Gant script that creates a Hibernate cfg.xml file. - * - * @author Burt Beckwith - */ - -import org.codehaus.groovy.grails.io.support.FileSystemResource - -includeTargets << grailsScript('_GrailsInit') - -target (createHibernateCfgXml: 'Creates a hibernate.cfg.xml file') { - depends(checkVersion) - - cfgFile = new File("$basedir/grails-app/conf/hibernate/hibernate.cfg.xml") - ant.mkdir dir: cfgFile.parent - - if (cfgFile.exists() && !confirmInput('hibernate.cfg.xml already exists. Overwrite?', 'overwrite.hibernate_cfg_xml')) { - return - } - - // first check for presence of template in application - templateFile = new FileSystemResource("$basedir/src/templates/artifacts/hibernate.cfg.xml") - if (!templateFile.exists()) { - // now check for template provided by plugins - def pluginTemplateFiles = resolveResources("file:$pluginsHome/*/src/templates/artifacts/hibernate.cfg.xml") - if (pluginTemplateFiles) { - templateFile = pluginTemplateFiles[0] - } - else { - // template not found in application, use default template - templateFile = new FileSystemResource("$hibernatePluginDir/src/java/hibernate.cfg.xml") - } - } - - copyGrailsResource cfgFile.path, templateFile - - event 'CreatedFile', [cfgFile.path] -} - -setDefaultTarget 'createHibernateCfgXml' diff --git a/target/work/plugins/hibernate-3.6.10.6/scripts/SchemaExport.groovy b/target/work/plugins/hibernate-3.6.10.6/scripts/SchemaExport.groovy deleted file mode 100644 index a4ace05..0000000 --- a/target/work/plugins/hibernate-3.6.10.6/scripts/SchemaExport.groovy +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2004-2005 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import grails.util.GrailsUtil - -import org.hibernate.tool.hbm2ddl.SchemaExport as HibernateSchemaExport - -includeTargets << grailsScript('_GrailsBootstrap') - -/** - * @author Burt Beckwith - */ - -target(schemaExport: 'Run Hibernate SchemaExport') { - depends checkVersion, configureProxy, enableExpandoMetaClass, compile, bootstrap - - String filename = "${grailsSettings.projectTargetDir}/ddl.sql" - boolean export = false - boolean stdout = false - - for (arg in argsMap.params) { - switch(arg) { - case 'export': export = true; break - case 'generate': export = false; break - case 'stdout': stdout = true; break - default: filename = arg - } - } - - String datasourceSuffix = argsMap.datasource ? '_' + argsMap.datasource : '' - - def file = new File(filename) - ant.mkdir dir: file.parentFile - - def sessionFactory = appCtx.getBean('&sessionFactory' + datasourceSuffix) - def configuration = sessionFactory.configuration - - def schemaExport = new HibernateSchemaExport(configuration, sessionFactory.dataSource.connection) - .setHaltOnError(true) - .setOutputFile(file.path) - .setDelimiter(';') - - String action = export ? "Exporting" : "Generating script to ${file.path}" - String ds = argsMap.datasource ? "for DataSource '$argsMap.datasource'" : "for the default DataSource" - println "$action in environment '$grailsEnv' $ds" - - schemaExport.execute stdout, export, false, false - - if (schemaExport.exceptions) { - def e = schemaExport.exceptions[0] - GrailsUtil.deepSanitize e - e.printStackTrace() - } -} - -setDefaultTarget schemaExport diff --git a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/attach.gdoc b/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/attach.gdoc deleted file mode 100644 index 631c09d..0000000 --- a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/attach.gdoc +++ /dev/null @@ -1,20 +0,0 @@ - -h1. attach - -h2. Purpose - - - -h2. Examples - -{code:java} -foo.attach() -{code} - -h2. Description - - - -Arguments: - -[] diff --git a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/delete.gdoc b/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/delete.gdoc deleted file mode 100644 index 00f4cd3..0000000 --- a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/delete.gdoc +++ /dev/null @@ -1,20 +0,0 @@ - -h1. delete - -h2. Purpose - - - -h2. Examples - -{code:java} -foo.delete() -{code} - -h2. Description - - - -Arguments: - -[] diff --git a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/discard.gdoc b/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/discard.gdoc deleted file mode 100644 index 95da3ed..0000000 --- a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/discard.gdoc +++ /dev/null @@ -1,20 +0,0 @@ - -h1. discard - -h2. Purpose - - - -h2. Examples - -{code:java} -foo.discard() -{code} - -h2. Description - - - -Arguments: - -[] diff --git a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/getDirtyPropertyNames.gdoc b/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/getDirtyPropertyNames.gdoc deleted file mode 100644 index b8c175d..0000000 --- a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/getDirtyPropertyNames.gdoc +++ /dev/null @@ -1,20 +0,0 @@ - -h1. getDirtyPropertyNames - -h2. Purpose - - - -h2. Examples - -{code:java} -foo.getDirtyPropertyNames() -{code} - -h2. Description - - - -Arguments: - -[] diff --git a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/getPersistentValue.gdoc b/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/getPersistentValue.gdoc deleted file mode 100644 index db4427c..0000000 --- a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/getPersistentValue.gdoc +++ /dev/null @@ -1,21 +0,0 @@ - -h1. getPersistentValue - -h2. Purpose - - - -h2. Examples - -{code:java} -foo.getPersistentValue(string) -{code} - -h2. Description - - - -Arguments: - -[* @string@ -] diff --git a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/instanceOf.gdoc b/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/instanceOf.gdoc deleted file mode 100644 index 9ecd8d7..0000000 --- a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/instanceOf.gdoc +++ /dev/null @@ -1,21 +0,0 @@ - -h1. instanceOf - -h2. Purpose - - - -h2. Examples - -{code:java} -foo.instanceOf(class) -{code} - -h2. Description - - - -Arguments: - -[* @class@ -] diff --git a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/isAttached.gdoc b/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/isAttached.gdoc deleted file mode 100644 index 0e05403..0000000 --- a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/isAttached.gdoc +++ /dev/null @@ -1,20 +0,0 @@ - -h1. isAttached - -h2. Purpose - - - -h2. Examples - -{code:java} -foo.isAttached() -{code} - -h2. Description - - - -Arguments: - -[] diff --git a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/isDirty.gdoc b/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/isDirty.gdoc deleted file mode 100644 index 7f3b714..0000000 --- a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/isDirty.gdoc +++ /dev/null @@ -1,20 +0,0 @@ - -h1. isDirty - -h2. Purpose - - - -h2. Examples - -{code:java} -foo.isDirty() -{code} - -h2. Description - - - -Arguments: - -[] diff --git a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/lock.gdoc b/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/lock.gdoc deleted file mode 100644 index 6418e23..0000000 --- a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/lock.gdoc +++ /dev/null @@ -1,20 +0,0 @@ - -h1. lock - -h2. Purpose - - - -h2. Examples - -{code:java} -foo.lock() -{code} - -h2. Description - - - -Arguments: - -[] diff --git a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/merge.gdoc b/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/merge.gdoc deleted file mode 100644 index 9bb3cf5..0000000 --- a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/merge.gdoc +++ /dev/null @@ -1,21 +0,0 @@ - -h1. merge - -h2. Purpose - - - -h2. Examples - -{code:java} -foo.merge(map) -{code} - -h2. Description - - - -Arguments: - -[* @map@ -] diff --git a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/methodMissing.gdoc b/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/methodMissing.gdoc deleted file mode 100644 index 65f4754..0000000 --- a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/methodMissing.gdoc +++ /dev/null @@ -1,22 +0,0 @@ - -h1. methodMissing - -h2. Purpose - - - -h2. Examples - -{code:java} -foo.methodMissing(string,object) -{code} - -h2. Description - - - -Arguments: - -[* @string@ -, * @object@ -] diff --git a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/refresh.gdoc b/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/refresh.gdoc deleted file mode 100644 index b932ca0..0000000 --- a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/refresh.gdoc +++ /dev/null @@ -1,20 +0,0 @@ - -h1. refresh - -h2. Purpose - - - -h2. Examples - -{code:java} -foo.refresh() -{code} - -h2. Description - - - -Arguments: - -[] diff --git a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/save.gdoc b/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/save.gdoc deleted file mode 100644 index 8396b57..0000000 --- a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/save.gdoc +++ /dev/null @@ -1,21 +0,0 @@ - -h1. save - -h2. Purpose - - - -h2. Examples - -{code:java} -foo.save(boolean) -{code} - -h2. Description - - - -Arguments: - -[* @boolean@ -] diff --git a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/validate.gdoc b/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/validate.gdoc deleted file mode 100644 index 2904a8e..0000000 --- a/target/work/plugins/hibernate-3.6.10.6/src/docs/ref/Domain/validate.gdoc +++ /dev/null @@ -1,20 +0,0 @@ - -h1. validate - -h2. Purpose - - - -h2. Examples - -{code:java} -foo.validate() -{code} - -h2. Description - - - -Arguments: - -[] diff --git a/target/work/plugins/hibernate-3.6.10.6/src/groovy/grails/plugin/hibernate3/HibernatePluginSupport.groovy b/target/work/plugins/hibernate-3.6.10.6/src/groovy/grails/plugin/hibernate3/HibernatePluginSupport.groovy deleted file mode 100644 index c7ea47d..0000000 --- a/target/work/plugins/hibernate-3.6.10.6/src/groovy/grails/plugin/hibernate3/HibernatePluginSupport.groovy +++ /dev/null @@ -1,465 +0,0 @@ -/* - * Copyright 2004-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.hibernate3 - -import org.codehaus.groovy.grails.commons.GrailsApplication -import org.codehaus.groovy.grails.commons.GrailsDomainClass -import org.codehaus.groovy.grails.commons.GrailsDomainClassProperty -import org.codehaus.groovy.grails.commons.spring.DefaultRuntimeSpringConfiguration -import org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator -import org.codehaus.groovy.grails.commons.spring.RuntimeSpringConfiguration -import org.codehaus.groovy.grails.orm.hibernate.ConfigurableLocalSessionFactoryBean -import org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateTransactionManager -import org.codehaus.groovy.grails.orm.hibernate.HibernateDatastore -import org.codehaus.groovy.grails.orm.hibernate.HibernateEventListeners -import org.codehaus.groovy.grails.orm.hibernate.SessionFactoryHolder -import org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder -import org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsHibernateUtil -import org.codehaus.groovy.grails.orm.hibernate.cfg.HibernateUtils -import org.codehaus.groovy.grails.orm.hibernate.events.PatchedDefaultFlushEventListener -import org.codehaus.groovy.grails.orm.hibernate.proxy.HibernateProxyHandler -import org.codehaus.groovy.grails.orm.hibernate.support.AggregatePersistenceContextInterceptor -import org.codehaus.groovy.grails.orm.hibernate.support.ClosureEventTriggeringInterceptor -import org.codehaus.groovy.grails.orm.hibernate.support.FlushOnRedirectEventListener -import org.codehaus.groovy.grails.orm.hibernate.support.GrailsOpenSessionInViewInterceptor -import org.codehaus.groovy.grails.orm.hibernate.support.HibernateDialectDetectorFactoryBean -import org.codehaus.groovy.grails.orm.hibernate.support.SpringLobHandlerDetectorFactoryBean -import org.codehaus.groovy.grails.orm.hibernate.validation.HibernateConstraintsEvaluator -import org.codehaus.groovy.grails.orm.hibernate.validation.HibernateDomainClassValidator -import org.codehaus.groovy.grails.orm.hibernate.validation.PersistentConstraintFactory -import org.codehaus.groovy.grails.orm.hibernate.validation.UniqueConstraint -import org.codehaus.groovy.grails.validation.ConstrainedProperty -import org.codehaus.groovy.grails.validation.ConstraintsEvaluator -import org.grails.datastore.mapping.model.MappingContext -import org.hibernate.EmptyInterceptor -import org.hibernate.cfg.ImprovedNamingStrategy -import org.slf4j.Logger -import org.slf4j.LoggerFactory -import org.springframework.beans.factory.config.BeanDefinition -import org.springframework.beans.factory.config.PropertiesFactoryBean -import org.springframework.beans.factory.support.DefaultListableBeanFactory -import org.springframework.beans.factory.xml.XmlBeanDefinitionReader -import org.springframework.context.ApplicationContext -import org.springframework.jdbc.support.nativejdbc.CommonsDbcpNativeJdbcExtractor -import org.springframework.orm.hibernate3.HibernateAccessor -import org.springframework.validation.Validator - -/** - * Implements the core parts of GORM. - * - * @author Graeme Rocher - * @since 1.1 - */ -class HibernatePluginSupport { - - static final Logger LOG = LoggerFactory.getLogger(this) - static final int RELOAD_RETRY_LIMIT = 3 - - static GrailsDomainBinder grailsDomainBinder = new GrailsDomainBinder() - - static doWithSpring = { - - if (getSpringConfig().containsBean(ConstraintsEvaluator.BEAN_NAME)) { - delegate."${ConstraintsEvaluator.BEAN_NAME}".constraintsEvaluatorClass = HibernateConstraintsEvaluator - } - - def vendorToDialect = new Properties() - def hibernateDialects = application.classLoader.getResource("hibernate-dialects.properties") - if (hibernateDialects) { - def p = new Properties() - p.load(hibernateDialects.openStream()) - for (entry in p) { - vendorToDialect[entry.value] = "org.hibernate.dialect.${entry.key}".toString() - } - } - - def datasourceNames = [] - def persistenceInterceptorDatasourceNames = [] - if (getSpringConfig().containsBean('dataSource')) { - datasourceNames << GrailsDomainClassProperty.DEFAULT_DATA_SOURCE - persistenceInterceptorDatasourceNames << GrailsDomainClassProperty.DEFAULT_DATA_SOURCE - } - - for (name in application.config.keySet()) { - if (name.startsWith('dataSource_')) { - datasourceNames << name - 'dataSource_' - if (application.config[name].persistenceInterceptor) { - persistenceInterceptorDatasourceNames << name - 'dataSource_' - } - } - } - - ConstrainedProperty.registerNewConstraint(UniqueConstraint.UNIQUE_CONSTRAINT, - new PersistentConstraintFactory(getSpringConfig().getUnrefreshedApplicationContext(), - UniqueConstraint)) - - proxyHandler(HibernateProxyHandler) - - eventTriggeringInterceptor(ClosureEventTriggeringInterceptor) - - nativeJdbcExtractor(CommonsDbcpNativeJdbcExtractor) - - hibernateEventListeners(HibernateEventListeners) - - persistenceInterceptor(AggregatePersistenceContextInterceptor) { - dataSourceNames = persistenceInterceptorDatasourceNames - } - - for (String datasourceName in datasourceNames) { - LOG.debug "processing DataSource $datasourceName" - boolean isDefault = datasourceName == GrailsDomainClassProperty.DEFAULT_DATA_SOURCE - String suffix = isDefault ? '' : '_' + datasourceName - String prefix = isDefault ? '' : datasourceName + '_' - - for (GrailsDomainClass dc in application.domainClasses) { - - if (!dc.abstract && GrailsHibernateUtil.isMappedWithHibernate(dc) && GrailsHibernateUtil.usesDatasource(dc, datasourceName)) { - "${dc.fullName}Validator$suffix"(HibernateDomainClassValidator) { - messageSource = ref("messageSource") - domainClass = ref("${dc.fullName}DomainClass") - grailsApplication = ref("grailsApplication", true) - sessionFactory = ref("sessionFactory$suffix") - } - } - } - - def ds = application.config["dataSource$suffix"] - if (isDefault) { - BeanDefinition externalDefinition = checkExternalBeans(application) - if (externalDefinition && !ds) { - ds = new ConfigObject() - application.config.dataSource = ds - } - } - - def hibConfig = application.config["hibernate$suffix"] ?: application.config.hibernate - - def hibConfigClass = ds?.configClass - def hibProps = [:] - - if (ds.loggingSql || ds.logSql) { - hibProps."hibernate.show_sql" = "true" - } - if (ds.formatSql) { - hibProps."hibernate.format_sql" = "true" - } - - if (ds.dialect) { - if (ds.dialect instanceof Class) { - hibProps."hibernate.dialect" = ds.dialect.name - } - else { - hibProps."hibernate.dialect" = ds.dialect.toString() - } - } - else { - "dialectDetector$suffix"(HibernateDialectDetectorFactoryBean) { - dataSource = ref("dataSource$suffix") - vendorNameDialectMappings = vendorToDialect - } - hibProps."hibernate.dialect" = ref("dialectDetector$suffix") - } - - hibProps."hibernate.hbm2ddl.auto" = ds.dbCreate ?: '' - - LOG.info "Set db generation strategy to '${hibProps.'hibernate.hbm2ddl.auto'}' for datasource $datasourceName" - - if (hibConfig) { - def cacheProvider = hibConfig.cache?.provider_class - if (cacheProvider) { - if (cacheProvider.contains('OSCacheProvider')) { - try { - def cacheClass = getClass().classLoader.loadClass(cacheProvider) - } - catch (Throwable t) { - hibConfig.cache.region.factory_class='net.sf.ehcache.hibernate.EhCacheRegionFactory' - log.error """WARNING: Your cache provider is set to '${cacheProvider}' in DataSource.groovy, however the class for this provider cannot be found. -Using Grails' default cache region factory: 'net.sf.ehcache.hibernate.EhCacheRegionFactory'""" - } - } else if (!(hibConfig.cache.useCacheProvider) && (cacheProvider=='org.hibernate.cache.EhCacheProvider' || cacheProvider=='net.sf.ehcache.hibernate.EhCacheProvider')) { - hibConfig.cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' - hibConfig.cache.remove('provider_class') - if (hibConfig.cache.provider_configuration_file_resource_path) { - hibProps.'net.sf.ehcache.configurationResourceName' = hibConfig.cache.provider_configuration_file_resource_path - hibConfig.cache.remove('provider_configuration_file_resource_path') - } - } - } - - def namingStrategy = hibConfig.naming_strategy ?: ImprovedNamingStrategy - try { - grailsDomainBinder.configureNamingStrategy datasourceName, namingStrategy - } - catch (Throwable t) { - log.error """WARNING: You've configured a custom Hibernate naming strategy '$namingStrategy' in DataSource.groovy, however the class cannot be found. -Using Grails' default naming strategy: '${ImprovedNamingStrategy.name}'""" - grailsDomainBinder.configureNamingStrategy datasourceName, ImprovedNamingStrategy - } - - // allow adding hibernate properties that don't start with "hibernate." - if (hibConfig.get('properties') instanceof ConfigObject) { - def hibernateProperties = hibConfig.remove('properties') - hibProps.putAll(hibernateProperties.flatten().toProperties()) - } - - hibProps.putAll(hibConfig.flatten().toProperties('hibernate')) - hibProps.remove('hibernate.reload') - - // move net.sf.ehcache.configurationResourceName to "top level" if it exists - if (hibProps.'hibernate.net.sf.ehcache.configurationResourceName') { - hibProps.'net.sf.ehcache.configurationResourceName' = hibProps.remove('hibernate.net.sf.ehcache.configurationResourceName') - } - } - - "hibernateProperties$suffix"(PropertiesFactoryBean) { bean -> - bean.scope = "prototype" - properties = hibProps - } - - "lobHandlerDetector$suffix"(SpringLobHandlerDetectorFactoryBean) { - dataSource = ref("dataSource$suffix") - pooledConnection = ds.pooled ?: false - nativeJdbcExtractor = ref("nativeJdbcExtractor") - } - - "entityInterceptor$suffix"(EmptyInterceptor) - - "abstractSessionFactoryBeanConfig$suffix" { - dataSource = ref("dataSource$suffix") - dataSourceName = datasourceName - sessionFactoryBeanName = "sessionFactory$suffix" - - List hibConfigLocations = [] - if (application.classLoader.getResource(prefix + 'hibernate.cfg.xml')) { - hibConfigLocations << 'classpath:' + prefix + 'hibernate.cfg.xml' - } - def explicitLocations = hibConfig?.config?.location - if (explicitLocations) { - if (explicitLocations instanceof Collection) { - hibConfigLocations.addAll(explicitLocations.collect { it.toString() }) - } - else { - hibConfigLocations << hibConfig.config.location.toString() - } - } - configLocations = hibConfigLocations - - if (hibConfigClass) { - configClass = ds.configClass - } - - hibernateProperties = ref("hibernateProperties$suffix") - - grailsApplication = ref("grailsApplication", true) - - lobHandler = ref("lobHandlerDetector$suffix") - - entityInterceptor = ref("entityInterceptor$suffix") - - eventListeners = ['flush': new PatchedDefaultFlushEventListener(), - 'save': eventTriggeringInterceptor, - 'save-update': eventTriggeringInterceptor, - 'pre-load': eventTriggeringInterceptor, - 'post-load': eventTriggeringInterceptor, - 'pre-insert': eventTriggeringInterceptor, - 'post-insert': eventTriggeringInterceptor, - 'pre-update': eventTriggeringInterceptor, - 'post-update': eventTriggeringInterceptor, - 'pre-delete': eventTriggeringInterceptor, - 'post-delete': eventTriggeringInterceptor] - - hibernateEventListeners = ref('hibernateEventListeners') - } - - if (grails.util.Environment.current.isReloadEnabled()) { - "${SessionFactoryHolder.BEAN_ID}$suffix"(SessionFactoryHolder) - } - "sessionFactory$suffix"(ConfigurableLocalSessionFactoryBean) { bean -> - bean.parent = 'abstractSessionFactoryBeanConfig' + suffix - } - - "transactionManager$suffix"(GrailsHibernateTransactionManager) { - sessionFactory = ref("sessionFactory$suffix") - } - - "hibernateDatastore$suffix"(HibernateDatastore, ref('grailsDomainClassMappingContext'), ref("sessionFactory$suffix"), application.config) - - if (manager?.hasGrailsPlugin("controllers")) { - "flushingRedirectEventListener$suffix"(FlushOnRedirectEventListener, ref("sessionFactory$suffix")) - - "openSessionInViewInterceptor$suffix"(GrailsOpenSessionInViewInterceptor) { - - if (Boolean.TRUE.equals(ds.readOnly)) { - flushMode = HibernateAccessor.FLUSH_NEVER - } - else if (hibConfig.flush.mode instanceof String) { - switch(hibConfig.flush.mode) { - case "manual": flushMode = HibernateAccessor.FLUSH_NEVER; break - case "always": flushMode = HibernateAccessor.FLUSH_ALWAYS; break - case "commit": flushMode = HibernateAccessor.FLUSH_COMMIT; break - default: flushMode = HibernateAccessor.FLUSH_AUTO - } - } - else { - flushMode = HibernateAccessor.FLUSH_AUTO - } - sessionFactory = ref("sessionFactory$suffix") - } - - if (getSpringConfig().containsBean("controllerHandlerMappings")) { - controllerHandlerMappings.interceptors << ref("openSessionInViewInterceptor$suffix") - } - if (getSpringConfig().containsBean("annotationHandlerMapping")) { - if (annotationHandlerMapping.interceptors) { - annotationHandlerMapping.interceptors << ref("openSessionInViewInterceptor$suffix") - } - else { - annotationHandlerMapping.interceptors = [ref("openSessionInViewInterceptor$suffix")] - } - } - } - } - } - - static final onChange = { event -> - LOG.debug "onChange() started" - - def allDatasourceNames = [GrailsDomainClassProperty.DEFAULT_DATA_SOURCE] as Set - for (name in application.config.keySet()) { - if (name.startsWith('dataSource_')) { - allDatasourceNames << name - 'dataSource_' - } - } - - def datasourceNames - if (event.source instanceof Class) { - GrailsDomainClass dc = application.getDomainClass(event.source.name) - if (!dc || !GrailsHibernateUtil.isMappedWithHibernate(dc)) { - return - } - grailsDomainBinder.clearMappingCache(event.source) - def dcMappingDsNames = GrailsHibernateUtil.getDatasourceNames(dc) as Set - datasourceNames = [] as Set - for(name in allDatasourceNames) { - if (name in dcMappingDsNames || dcMappingDsNames.contains(GrailsDomainClassProperty.ALL_DATA_SOURCES)) { - datasourceNames << name - } - } - } else { - grailsDomainBinder.clearMappingCache() - datasourceNames = allDatasourceNames - } - - def beans = beans { - for (String datasourceName in datasourceNames) { - LOG.debug "processing DataSource $datasourceName" - boolean isDefault = datasourceName == GrailsDomainClassProperty.DEFAULT_DATA_SOURCE - String suffix = isDefault ? '' : '_' + datasourceName - def hibConfig = application.config["hibernate$suffix"] - def sessionFactoryReload = hibConfig?.containsKey('reload') ? hibConfig.reload : true - - if (sessionFactoryReload) { - "${SessionFactoryHolder.BEAN_ID}$suffix"(SessionFactoryHolder) { - sessionFactory = bean(ConfigurableLocalSessionFactoryBean) { bean -> - bean.parent = ref("abstractSessionFactoryBeanConfig$suffix") - proxyIfReloadEnabled = false - } - } - } - - if (event.source instanceof Class) { - GrailsDomainClass dc = application.getDomainClass(event.source.name) - if (!dc.abstract && GrailsHibernateUtil.usesDatasource(dc, datasourceName)) { - "${dc.fullName}Validator$suffix"(HibernateDomainClassValidator) { - messageSource = ref("messageSource") - domainClass = ref("${dc.fullName}DomainClass") - sessionFactory = ref("sessionFactory$suffix") - grailsApplication = ref("grailsApplication", true) - } - } - } - } - } - - ApplicationContext ctx = event.ctx - beans.registerBeans(ctx) - - if (event.source instanceof Class) { - def mappingContext = ctx.getBean("grailsDomainClassMappingContext", MappingContext) - def entity = mappingContext.addPersistentEntity(event.source, true) - } - - int retryCount = 0 - - def enhanceAndTest = { - // Re-enhance the given class - HibernateUtils.enhanceSessionFactories(ctx, application, event.source) - - // Due to quantum tunneling and other class loader race conditions, attempts to - // enhance the entities may not work. Check a few static and non-static methods to see if it worked. - boolean hasMethods = event.source.metaClass.methods.any { MetaMethod method -> - method.name.startsWith("addTo") || - method.name.startsWith("list") || - method.name.startsWith("get") || - method.name.startsWith("count") - } - - if (!hasMethods) { - if (++retryCount < RELOAD_RETRY_LIMIT) { - LOG.debug("Attempt ${retryCount} at enhancing ${event.source.name} failed, waiting and trying again") - sleep(retryCount * 1000) - enhanceAndTest() - } - } - } - - // Enhance the reloaded GORM objects - enhanceAndTest() - - LOG.info "onChange() complete" - } - - static final doWithDynamicMethods = { ApplicationContext ctx -> - def grailsApplication = application - HibernateUtils.enhanceSessionFactories(ctx, grailsApplication) - } - - private static checkExternalBeans(GrailsApplication application) { - ApplicationContext parent = application.parentContext - try { - def resourcesXml = parent?.getResource(GrailsRuntimeConfigurator.SPRING_RESOURCES_XML) - if (resourcesXml && resourcesXml.exists()) { - def xmlBeans = new DefaultListableBeanFactory() - new XmlBeanDefinitionReader(xmlBeans).loadBeanDefinitions(resourcesXml) - if (xmlBeans.containsBean("dataSource")) { - LOG.info("Using dataSource bean definition from ${GrailsRuntimeConfigurator.SPRING_RESOURCES_XML}") - return xmlBeans.getMergedBeanDefinition("dataSource") - } - } - } catch (FileNotFoundException fnfe) { - // that's ok external resources file not required - } - - // Check resources.groovy - RuntimeSpringConfiguration springConfig = new DefaultRuntimeSpringConfiguration(parent,application.classLoader) - GrailsRuntimeConfigurator.loadExternalSpringConfig(springConfig, application) - if (springConfig.containsBean("dataSource")) { - LOG.info("Using dataSource bean definition from ${GrailsRuntimeConfigurator.SPRING_RESOURCES_GROOVY}") - return springConfig.getBeanDefinition("dataSource") - } - return null - } -} diff --git a/target/work/plugins/hibernate-3.6.10.6/src/java/hibernate.cfg.xml b/target/work/plugins/hibernate-3.6.10.6/src/java/hibernate.cfg.xml deleted file mode 100644 index 05a7d29..0000000 --- a/target/work/plugins/hibernate-3.6.10.6/src/java/hibernate.cfg.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - diff --git a/target/work/plugins/jquery-1.10.2.2/JqueryGrailsPlugin.groovy b/target/work/plugins/jquery-1.10.2.2/JqueryGrailsPlugin.groovy deleted file mode 100644 index 26a85db..0000000 --- a/target/work/plugins/jquery-1.10.2.2/JqueryGrailsPlugin.groovy +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2007-2009 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import grails.util.Environment - -import org.codehaus.groovy.grails.plugins.jquery.JQueryConfig -import org.codehaus.groovy.grails.plugins.jquery.JQueryProvider -import org.codehaus.groovy.grails.plugins.web.taglib.JavascriptTagLib - -class JqueryGrailsPlugin { - // Only change the point release. Edit o.c.g.g.o.j.JQueryConfig.SHIPPED_VERSION when changing jQuery resource version - // This should match JQueryConfig.SHIPPED_VERSION but must be a literal here due to how AstPluginDescriptorReader parses this file - def version = "1.10.2.2" - - static SHIPPED_SRC_DIR = 'jquery' - - def grailsVersion = "1.3 > *" - - def pluginExcludes = [ - 'docs/**', - 'src/docs/**' - ] - - def title = "jQuery for Grails" - def description = "Provides integration for the jQuery library with Grails JavascriptProvider" - def documentation = "http://grails.org/plugin/jquery" - def license = "APACHE" - def issueManagement = [ system: "JIRA", url: "http://jira.grails.org/browse/GPJQUERY" ] - def scm = [ url: "https://github.com/gpc/grails-jquery" ] - def organization = [ name: "Grails Plugin Collective", url: "http://github.com/gpc" ] - def developers = [ - [name: "Sergey Nebolsin", email: "nebolsin@gmail.com"], - [name: "Craig Jones", email: "craigjones@maximsc.com"], - [name: "Marc Palmer", email: "marc@grailsrocks.com"], - [name: "Finn Herpich", email: "finn.herpich@marfinn-software.de"] - ] - - static jQueryVersion - static jQuerySources - - def doWithSpring = { - jQueryConfig(JQueryConfig) - } - - private void loadConfig(application) { - GroovyClassLoader classLoader = new GroovyClassLoader(getClass().getClassLoader()) - def confClass - try { - confClass = classLoader.loadClass('JQueryConfig') - } catch (Exception e) { - // - } - ConfigObject config = confClass ? new ConfigSlurper(Environment.current.name).parse(confClass).merge(application.config) : application.config - - JqueryGrailsPlugin.jQueryVersion = config.jquery.version instanceof String ? config.jquery.version : JQueryConfig.SHIPPED_VERSION - JqueryGrailsPlugin.jQuerySources = config.jquery.sources instanceof String ? config.jquery.sources : JqueryGrailsPlugin.SHIPPED_SRC_DIR - } - - def doWithApplicationContext = { applicationContext -> - // We need to init our own config first - loadConfig(application) - - if (Environment.isDevelopmentMode()) { - JavascriptTagLib.LIBRARY_MAPPINGS.jquery = ["${JqueryGrailsPlugin.jQuerySources}/jquery-${JqueryGrailsPlugin.jQueryVersion}"] - } else { - JavascriptTagLib.LIBRARY_MAPPINGS.jquery = ["${JqueryGrailsPlugin.jQuerySources}/jquery-${JqueryGrailsPlugin.jQueryVersion}.min"] - } - - def jQueryConfig = applicationContext.jQueryConfig - jQueryConfig.init() - - if (jQueryConfig.defaultPlugins) { - jQueryConfig.defaultPlugins.each { pluginName -> - jQueryConfig.plugins."$pluginName".each {fileName -> - JavascriptTagLib.LIBRARY_MAPPINGS.jquery += ["${JqueryGrailsPlugin.jQuerySources}/${fileName}"[0..-4]] - } - } - } - - JavascriptTagLib.PROVIDER_MAPPINGS.jquery = JQueryProvider - } -} diff --git a/target/work/plugins/jquery-1.10.2.2/LICENSE.txt b/target/work/plugins/jquery-1.10.2.2/LICENSE.txt deleted file mode 100644 index 1228124..0000000 --- a/target/work/plugins/jquery-1.10.2.2/LICENSE.txt +++ /dev/null @@ -1,54 +0,0 @@ -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: -You must give any other recipients of the Work or Derivative Works a copy of this License; and - -You must cause any modified files to carry prominent notices stating that You changed the files; and - -You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - -If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. -You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/target/work/plugins/jquery-1.10.2.2/application.properties b/target/work/plugins/jquery-1.10.2.2/application.properties deleted file mode 100644 index e9920ce..0000000 --- a/target/work/plugins/jquery-1.10.2.2/application.properties +++ /dev/null @@ -1 +0,0 @@ -app.grails.version=2.2.0 diff --git a/target/work/plugins/jquery-1.10.2.2/dependencies.groovy b/target/work/plugins/jquery-1.10.2.2/dependencies.groovy deleted file mode 100644 index 4175167..0000000 --- a/target/work/plugins/jquery-1.10.2.2/dependencies.groovy +++ /dev/null @@ -1,18 +0,0 @@ -grails.project.work.dir = 'target' - -grails.project.dependency.resolution = { - - inherits 'global' - log 'warn' - - repositories { - grailsCentral() - mavenCentral() - } - - plugins { - build ':release:2.2.1', ':rest-client-builder:1.0.3', { - export = false - } - } -} diff --git a/target/work/plugins/jquery-1.10.2.2/grails-app/conf/JQueryConfig.groovy b/target/work/plugins/jquery-1.10.2.2/grails-app/conf/JQueryConfig.groovy deleted file mode 100644 index fb607c1..0000000 --- a/target/work/plugins/jquery-1.10.2.2/grails-app/conf/JQueryConfig.groovy +++ /dev/null @@ -1,4 +0,0 @@ -jquery { - sources = 'jquery' // Holds the value where to store jQuery-js files /web-app/js/ - version = org.codehaus.groovy.grails.plugins.jquery.JQueryConfig.SHIPPED_VERSION // The jQuery version in use -} diff --git a/target/work/plugins/jquery-1.10.2.2/grails-app/conf/JQueryPluginResources.groovy b/target/work/plugins/jquery-1.10.2.2/grails-app/conf/JQueryPluginResources.groovy deleted file mode 100644 index 43399df..0000000 --- a/target/work/plugins/jquery-1.10.2.2/grails-app/conf/JQueryPluginResources.groovy +++ /dev/null @@ -1,16 +0,0 @@ -// Resource declarations for Resources plugin -def jqver = org.codehaus.groovy.grails.plugins.jquery.JQueryConfig.SHIPPED_VERSION - -modules = { - 'jquery' { - resource id: 'js', - url: [plugin: 'jquery', dir: 'js/jquery', file: "jquery-${jqver}.min.js"], - disposition: 'head', nominify: true - } - - 'jquery-dev' { - resource id: 'js', - url: [plugin: 'jquery', dir: 'js/jquery', file: "jquery-${jqver}.js"], - disposition:'head' - } -} diff --git a/target/work/plugins/jquery-1.10.2.2/grails-app/services/JQueryService.groovy b/target/work/plugins/jquery-1.10.2.2/grails-app/services/JQueryService.groovy deleted file mode 100644 index 9f48f37..0000000 --- a/target/work/plugins/jquery-1.10.2.2/grails-app/services/JQueryService.groovy +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2007-2009 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import grails.util.Environment - -import org.springframework.beans.factory.InitializingBean - -class JQueryService implements InitializingBean { - - static transactional = false - - String jsFolder - String cssFolder - String cssDefault - String coreSuffix - String minFolder - String minExt - - def grailsApplication - - def pathChecked = [] - def pathWhichDoNotExist = [] - - void afterPropertiesSet() { - ConfigObject config = new ConfigSlurper(Environment.current.name).parse(grailsApplication.classLoader.loadClass('JQueryConfig')) - - jsFolder = config?.jquery?.sources ?: 'js/jquery' - coreSuffix = config?.jquery?.coreSuffix?: 'core' - - cssFolder = config?.jquery?.cssFolder ?: 'theme' - cssDefault = config?.jquery?.cssDefault ?: 'base' - minFolder = config?.jquery?.minFolder ?: 'minified' - minExt = config?.jquery?.minExtentsion ?: 'min' - - // to be sure we're talking about the same thing' - if (!jsFolder.startsWith('js')) { - jsFolder = 'js/' + jsFolder - } - - // clean or prepare the folder path - jsFolder = cleanPath(jsFolder) - cssFolder = cleanPath(cssFolder) - minFolder = cleanPath(minFolder) - } - - // all this is to avoid checking the filesystem too often - def exist = { String dirPath, String filePath -> - existPath(dirPath) && existPath(dirPath + '/' + filePath) - } - - def existPath = { String path -> - if (!pathChecked.contains(path)) { - checkPath path - } - - !pathWhichDoNotExist.contains(path) - } - - def checkPath = {path -> - if (!grailsApplication.mainContext.getResource(path).exists()) { - pathWhichDoNotExist << path - } - pathChecked << path - } - - def cleanPath = { path -> - if (path && !path?.endsWith('/')) { - path += '/' - } - path - } -} diff --git a/target/work/plugins/jquery-1.10.2.2/grails-app/taglib/JQueryResourceTagLib.groovy b/target/work/plugins/jquery-1.10.2.2/grails-app/taglib/JQueryResourceTagLib.groovy deleted file mode 100644 index 066861d..0000000 --- a/target/work/plugins/jquery-1.10.2.2/grails-app/taglib/JQueryResourceTagLib.groovy +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2007-2009 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import grails.util.Environment - -import org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException - -class JQueryResourceTagLib { - - static namespace = "jq" - - JQueryService jQueryService - - def pluginManager - - /** - * Alternative to using g:javascript library tag. - * Will just pull in the resources, from the plugin instead of from the app. - * As of 1.4.2.2 you must run install-jquery script to install the files into your app - * instead of using the plugin versions. You may need to do this for Grails ajax tag integration, - * but for normal jQuery usage you should use this jq:resources tag. - */ - def resources = { attrs -> - def plugin = pluginManager.getGrailsPlugin('jquery') - def jqver = plugin.instance.getClass().jQueryVersion - - def flavour = Environment.isDevelopmentMode() ? '' : '.min' - def fn = "jquery-${jqver}${flavour}.js" - // Let user specify local="true" to stop us loading from the plugin, instead from the app - def local = attrs.remove('local')?.toString() - def pluginName = local?.toBoolean() ? null : 'jquery' - out << """""" - } - - /** - * Include JavaScript and CSS resources in the head. - * -- attrs.components = comma separated list of ui components to include - * -- attrs.effects = comma separated list of effects to include - * -- attrs.theme = css theme to use, defaults to 'base' - * -- attrs.mode = javascript packing to use. Can be 'min' (default), - * 'packed' or 'normal' - */ - def resource = { attrs -> - def components = attrs.remove('components') - if (components instanceof String) { - components = components.split(/[,;]/).collect {it.trim()} - } - if (!components) throw new GrailsTagException("The resources tag must have a 'components' attribute") - - def jsFolder = jQueryService.jsFolder - def coreSuffix = jQueryService.coreSuffix - - def cssFolder = jQueryService.cssFolder - def cssDefault = jQueryService.cssDefault - def minFolder = jQueryService.minFolder - def minExt = jQueryService.minExt - - // initialise the 2 closure we'll need - def exist = jQueryService.exist - def cleanPath = jQueryService.cleanPath - - def mode = Environment.isDevelopmentMode() ? 'normal' : 'min' - def bundle = attrs.remove('bundle') ?: '' - def theme = cleanPath(attrs.remove('theme') ?: cssDefault) - - def js = [] - def css = [] - def subdir = '' - switch (mode) { - case 'min': - subdir = minFolder - mode = '.' + minExt - break - case 'packed': - subdir = 'packed/' - mode = '.packed' - break - case 'normal': - mode = '' - break - } - - if (bundle) bundle += '.' - - components.each { component -> - addResource "${subdir}${bundle}${component}${mode}.js", js - addResource "${theme}${bundle}${component}.css", css - } - - if (js) addResource "${subdir}${bundle}${coreSuffix}${mode}.js", js - if (css) { - addResource "${theme}${bundle}${coreSuffix}.css", css - addResource "${theme}${bundle}theme.css", css - } - - js.findAll(exist.curry(jsFolder)).each {file -> - def src = resource(jsFolder, file:file) - //def src = createLinkTo(dir: "${pluginContextPath}/js/jquery", file: file) - out << """\n""" - } - - css.findAll(exist.curry(cssFolder)).each {file -> - def href = resource(dir:cssFolder, file:file) - //def href = createLinkTo(dir: "${pluginContextPath}/themes", file: file) - out << """\n""" - } - } - - def addResource = {resource, list -> - if (!list.contains(resource)) { - //println "add ${resource}" - list << resource - } - } -} diff --git a/target/work/plugins/jquery-1.10.2.2/grails-app/taglib/JQueryTagLib.groovy b/target/work/plugins/jquery-1.10.2.2/grails-app/taglib/JQueryTagLib.groovy deleted file mode 100644 index fd73579..0000000 --- a/target/work/plugins/jquery-1.10.2.2/grails-app/taglib/JQueryTagLib.groovy +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright 2007-2009 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import org.springframework.context.ApplicationContext -import org.springframework.context.ApplicationContextAware - - /** - * @author Sergey Nebolsin (nebolsin@prophotos.ru) - * @author Finn Herpich (finn.herpich marfinn-software de) - */ -class JQueryTagLib implements ApplicationContextAware { - - static namespace = "jq" - - def jQueryConfig - - def pluginManager - - /** - * Includes a plugin javascript file - * - * @param attrs A plugin to use - */ - def plugin = { attrs, body -> - if (!attrs.name) { - return - } - - def plugin = pluginManager.getGrailsPlugin('jquery') - - // TODO kick this damn need for the config-file - jQueryConfig.plugins."${attrs.name}".each { - out << '' - } - } - - /** - * Adds the jQuery().ready function to the code - * - * @param attrs No use - * @param body The javascript code to execute - */ - def jquery = { attrs, body -> - out << '' - } - - /** - * Simple tag to make an element toggleable - * - * @param attrs List with the arguments - * sourceId -> link-element which fires the toggle action - * targetId -> id of the element to toggle - * event -> event to fire the toggle action on (OPTIONAL) - * speed -> effect-speed (OPTIONAL) - */ - def toggle = { attrs -> - // Default values - if (!attrs.event) attrs.event = 'click' - if (!attrs.speed) attrs.speed = 'normal' - - // out - out << /jQuery("#${attrs['sourceId']}").${attrs['event']}(function(){jQuery("#${attrs['targetId']}").toggle("${attrs['speed']}"); return false; });/ - } - - /** - * Creates a jQuery-function which returns the value of the specified element - * - * @param attrs Must contain either an attribute selector or elementId that specifies the target element - */ - def fieldValue = { attrs -> - def selector - - if (attrs.selector) { - selector = attrs['selector'] - } else if (attrs.elementId) { - selector = /#${attrs['elementId']}/ - } - - out << /jQuery('${selector}').fieldValue()[0]/ - } - - void setApplicationContext(ApplicationContext applicationContext) { - jQueryConfig = applicationContext.jQueryConfig - } - - def toggleelement = { attrs -> - log.info('toggleelement is deprecated, please use toggle instead') - out << /jQuery("#${attrs['linkId']}").${attrs['event']}(function(){ jQuery("#${attrs['elementId']}").toggle("${attrs['speed']}"); return false; });/ - } -} diff --git a/target/work/plugins/jquery-1.10.2.2/plugin.xml b/target/work/plugins/jquery-1.10.2.2/plugin.xml deleted file mode 100644 index ce19bd2..0000000 --- a/target/work/plugins/jquery-1.10.2.2/plugin.xml +++ /dev/null @@ -1,21 +0,0 @@ - - jQuery for Grails - Provides integration for the jQuery library with Grails JavascriptProvider - http://grails.org/plugin/jquery - JqueryGrailsPlugin - - JQueryConfig - JQueryPluginResources - JQueryService - JQueryResourceTagLib - JQueryTagLib - - - - - - - - - - \ No newline at end of file diff --git a/target/work/plugins/jquery-1.10.2.2/scripts/InstallJQuery.groovy b/target/work/plugins/jquery-1.10.2.2/scripts/InstallJQuery.groovy deleted file mode 100644 index c7aec43..0000000 --- a/target/work/plugins/jquery-1.10.2.2/scripts/InstallJQuery.groovy +++ /dev/null @@ -1,22 +0,0 @@ -// Hard coded for installation purpose -def jQueryVersion = '1.10.2' -def jQuerySources = 'jquery' - -includeTargets << grailsScript("_GrailsEvents") - -target(installJQuery: "Downloads jQuery from code.jquery.com") { - - event("StatusUpdate", ["Downloading jQuery ${jQueryVersion}"]) - - mkdir(dir:"${basedir}/web-app/js/${jQuerySources}") - - ["jquery-${jQueryVersion}.js", "jquery-${jQueryVersion}.min.js"].each { - get(dest: "${basedir}/web-app/js/${jQuerySources}/${it}", - src: "http://code.jquery.com/${it}", - verbose: true) - } - - event("StatusFinal", ["JQuery ${jQueryVersion} installed successfully"]) -} - -setDefaultTarget 'installJQuery' diff --git a/target/work/plugins/jquery-1.10.2.2/src/groovy/org/codehaus/groovy/grails/plugins/jquery/JQueryConfig.groovy b/target/work/plugins/jquery-1.10.2.2/src/groovy/org/codehaus/groovy/grails/plugins/jquery/JQueryConfig.groovy deleted file mode 100644 index d4ef179..0000000 --- a/target/work/plugins/jquery-1.10.2.2/src/groovy/org/codehaus/groovy/grails/plugins/jquery/JQueryConfig.groovy +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2007-2009 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.codehaus.groovy.grails.plugins.jquery - -/** - * @author Sergey Nebolsin (nebolsin@prophotos.ru) - */ -class JQueryConfig { - def defaultPlugins - def plugins = [:] - - static SHIPPED_VERSION = '1.10.2' - - def init() { - - def application = org.codehaus.groovy.grails.commons.ApplicationHolder.application - application.metadata.findAll { key, value -> - key.startsWith('jquery.plugins') - }.each {key, value -> - // wtf? - def pluginName = (key.length() >= 16)? key[15..-1] : "(ungrouped)" - plugins."$pluginName" = value.split(",") as List - } - - defaultPlugins = application.config.jquery?.defaultPlugins - } -} diff --git a/target/work/plugins/jquery-1.10.2.2/src/groovy/org/codehaus/groovy/grails/plugins/jquery/JQueryProvider.groovy b/target/work/plugins/jquery-1.10.2.2/src/groovy/org/codehaus/groovy/grails/plugins/jquery/JQueryProvider.groovy deleted file mode 100644 index a1de5e2..0000000 --- a/target/work/plugins/jquery-1.10.2.2/src/groovy/org/codehaus/groovy/grails/plugins/jquery/JQueryProvider.groovy +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright 2007-2009 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.codehaus.groovy.grails.plugins.jquery - -import org.codehaus.groovy.grails.plugins.web.taglib.JavascriptProvider - -/** - * @author Sergey Nebolsin (nebolsin@prophotos.ru) - * @author Finn Herpich (finn.herpich marfinn-software de) - */ -class JQueryProvider implements JavascriptProvider { - - /** - * doRemoteFunction creates a jQuery-AJAX-Call - * - * @param taglib - * @param attrs - * @param out - * - * @return the jQuery-like formatted code for an AJAX-request - */ - def doRemoteFunction(taglib, attrs, out) { - // Optional, onLoad - if (attrs.onLoading) { - out << "${attrs.onLoading};" - } - - // Start ajax - out << /jQuery.ajax({/ - - // Method - def method = (attrs.method ? attrs.remove('method') : 'POST') - out << "type:'$method'" - - // Optional, synchron call - if ("false" == attrs.asynchronous) { - out << ",async:false" - attrs.remove('asynchronous') - } - - // Optional, dataType to use - if (attrs.dataType) { - out << ",dataType:'${attrs.remove('dataType')}'" - } - - // Additional attributes - if (attrs.params || attrs.jsParams) { - if (!(attrs?.params instanceof Map)) { - // tags like remoteField don't deliver a map - out << ",data:${attrs.remove('params')}" - } else { - out << ",data:{" - - boolean hasParams = false - - if (attrs?.params instanceof Map) { - hasParams = true - out << attrs.remove('params').collect { k, v -> - "\'" + - "${k}".encodeAsJavaScript() + - "\': \'" + - "${v}".encodeAsJavaScript() + - "\'" - }.join(",") - } - - if (attrs?.jsParams instanceof Map) { - if (hasParams) { - out << "," - } - - out << attrs.remove('jsParams').collect { k, v -> - "\'" + - "${k}".encodeAsJavaScript() + - "\': \'" + - "${v}".encodeAsJavaScript() + - "\'" - }.join(",") - } - - out << "}" - } - } - - // build url - def url = attrs.url ? taglib.createLink(attrs.remove('url')) : taglib.createLink(attrs); - out << ", url:'${url}'" - - // Add callback - buildCallback(attrs, out) - - // find all onX callback events - def callbacks = attrs.findAll { k, v -> - k ==~ /on(\p{Upper}|\d){1}\w+/ - } - - // remove all onX callback events - callbacks.each { k, v -> - attrs.remove(k) - } - - out << "});" - - // Yeah, I know, return is not needed, but I like it - return out - } - - /** - * Helper method to create callback object - * - * @param attrs Attributes to use for the callback - * @param out Variable to attache the output - */ - def buildCallback(attrs, out) { - // TODO check for strlen - if (out) { - out << ',' - } - - //*** success - out << 'success:function(data,textStatus){' - - if (attrs.onLoaded) { - out << "${attrs.onLoaded};" - } - - if (attrs.update instanceof Map) { - if (attrs.update?.success) { - out << "jQuery('#${attrs.update.success}').html(data);" - } - } else if (attrs.update) { - out << "jQuery('#${attrs.update}').html(data);" - } - - if (attrs.onSuccess) { - out << "${attrs.onSuccess};" - } - - out << '}' - - //*** failure - out << ',error:function(XMLHttpRequest,textStatus,errorThrown){' - - if (attrs.update instanceof Map) { - if (attrs.update?.failure) { - // Applied to GRAILSPLUGINS-1919 - out << "jQuery('#${attrs.update?.failure}').html(XMLHttpRequest.responseText);" - } - } - - if (attrs.onFailure) { - out << "${attrs.onFailure};" - } - - out << '}' - - if (attrs.onComplete) { - out << ",complete:function(XMLHttpRequest,textStatus){${attrs.onComplete}}" - } - } - - /** - * Serializes the surrounding form. - * - * @param attrs attrs.params to serialize - */ - def prepareAjaxForm(attrs) { - // Fix for http://jira.codehaus.org/browse/GRAILSPLUGINS-1865 - if (attrs.forSubmitTag) { - attrs.params = "jQuery(this).parents('form:first').serialize()".toString() - } - else { - attrs.params = "jQuery(this).serialize()".toString() - } - } -} diff --git a/target/work/plugins/jquery-1.10.2.2/web-app/js/jquery/jquery-1.10.2.js b/target/work/plugins/jquery-1.10.2.2/web-app/js/jquery/jquery-1.10.2.js deleted file mode 100644 index c5c6482..0000000 --- a/target/work/plugins/jquery-1.10.2.2/web-app/js/jquery/jquery-1.10.2.js +++ /dev/null @@ -1,9789 +0,0 @@ -/*! - * jQuery JavaScript Library v1.10.2 - * http://jquery.com/ - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * - * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors - * Released under the MIT license - * http://jquery.org/license - * - * Date: 2013-07-03T13:48Z - */ -(function( window, undefined ) { - -// Can't do this because several apps including ASP.NET trace -// the stack via arguments.caller.callee and Firefox dies if -// you try to trace through "use strict" call chains. (#13335) -// Support: Firefox 18+ -//"use strict"; -var - // The deferred used on DOM ready - readyList, - - // A central reference to the root jQuery(document) - rootjQuery, - - // Support: IE<10 - // For `typeof xmlNode.method` instead of `xmlNode.method !== undefined` - core_strundefined = typeof undefined, - - // Use the correct document accordingly with window argument (sandbox) - location = window.location, - document = window.document, - docElem = document.documentElement, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // [[Class]] -> type pairs - class2type = {}, - - // List of deleted data cache ids, so we can reuse them - core_deletedIds = [], - - core_version = "1.10.2", - - // Save a reference to some core methods - core_concat = core_deletedIds.concat, - core_push = core_deletedIds.push, - core_slice = core_deletedIds.slice, - core_indexOf = core_deletedIds.indexOf, - core_toString = class2type.toString, - core_hasOwn = class2type.hasOwnProperty, - core_trim = core_version.trim, - - // Define a local copy of jQuery - jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, - - // Used for matching numbers - core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, - - // Used for splitting on whitespace - core_rnotwhite = /\S+/g, - - // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) - rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, - - // A simple way to check for HTML strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - // Strict HTML recognition (#11290: must start with <) - rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, - - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, - rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g, - - // Matches dashed string for camelizing - rmsPrefix = /^-ms-/, - rdashAlpha = /-([\da-z])/gi, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return letter.toUpperCase(); - }, - - // The ready event handler - completed = function( event ) { - - // readyState === "complete" is good enough for us to call the dom ready in oldIE - if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { - detach(); - jQuery.ready(); - } - }, - // Clean-up method for dom ready events - detach = function() { - if ( document.addEventListener ) { - document.removeEventListener( "DOMContentLoaded", completed, false ); - window.removeEventListener( "load", completed, false ); - - } else { - document.detachEvent( "onreadystatechange", completed ); - window.detachEvent( "onload", completed ); - } - }; - -jQuery.fn = jQuery.prototype = { - // The current version of jQuery being used - jquery: core_version, - - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem; - - // HANDLE: $(""), $(null), $(undefined), $(false) - if ( !selector ) { - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = rquickExpr.exec( selector ); - } - - // Match html or make sure no context is specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - - // scripts is true for back-compat - jQuery.merge( this, jQuery.parseHTML( - match[1], - context && context.nodeType ? context.ownerDocument || context : document, - true - ) ); - - // HANDLE: $(html, props) - if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { - for ( match in context ) { - // Properties of context are called as methods if possible - if ( jQuery.isFunction( this[ match ] ) ) { - this[ match ]( context[ match ] ); - - // ...and otherwise set as attributes - } else { - this.attr( match, context[ match ] ); - } - } - } - - return this; - - // HANDLE: $(#id) - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(DOMElement) - } else if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The default length of a jQuery object is 0 - length: 0, - - toArray: function() { - return core_slice.call( this ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems ) { - - // Build a new jQuery matched element set - var ret = jQuery.merge( this.constructor(), elems ); - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - ret.context = this.context; - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Add the callback - jQuery.ready.promise().done( fn ); - - return this; - }, - - slice: function() { - return this.pushStack( core_slice.apply( this, arguments ) ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - eq: function( i ) { - var len = this.length, - j = +i + ( i < 0 ? len : 0 ); - return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: core_push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - var src, copyIsArray, copy, name, options, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ), - - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - - // Abort if there are pending holds or we're already ready - if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { - return; - } - - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger("ready").off("ready"); - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - isWindow: function( obj ) { - /* jshint eqeqeq: false */ - return obj != null && obj == obj.window; - }, - - isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); - }, - - type: function( obj ) { - if ( obj == null ) { - return String( obj ); - } - return typeof obj === "object" || typeof obj === "function" ? - class2type[ core_toString.call(obj) ] || "object" : - typeof obj; - }, - - isPlainObject: function( obj ) { - var key; - - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !core_hasOwn.call(obj, "constructor") && - !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Support: IE<9 - // Handle iteration over inherited properties before own properties. - if ( jQuery.support.ownLast ) { - for ( key in obj ) { - return core_hasOwn.call( obj, key ); - } - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - for ( key in obj ) {} - - return key === undefined || core_hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - var name; - for ( name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw new Error( msg ); - }, - - // data: string of html - // context (optional): If specified, the fragment will be created in this context, defaults to document - // keepScripts (optional): If true, will include scripts passed in the html string - parseHTML: function( data, context, keepScripts ) { - if ( !data || typeof data !== "string" ) { - return null; - } - if ( typeof context === "boolean" ) { - keepScripts = context; - context = false; - } - context = context || document; - - var parsed = rsingleTag.exec( data ), - scripts = !keepScripts && []; - - // Single tag - if ( parsed ) { - return [ context.createElement( parsed[1] ) ]; - } - - parsed = jQuery.buildFragment( [ data ], context, scripts ); - if ( scripts ) { - jQuery( scripts ).remove(); - } - return jQuery.merge( [], parsed.childNodes ); - }, - - parseJSON: function( data ) { - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - if ( data === null ) { - return data; - } - - if ( typeof data === "string" ) { - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - if ( data ) { - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return ( new Function( "return " + data ) )(); - } - } - } - - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - parseXML: function( data ) { - var xml, tmp; - if ( !data || typeof data !== "string" ) { - return null; - } - try { - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && jQuery.trim( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - }, - - // args is for internal usage only - each: function( obj, callback, args ) { - var value, - i = 0, - length = obj.length, - isArray = isArraylike( obj ); - - if ( args ) { - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback.apply( obj[ i ], args ); - - if ( value === false ) { - break; - } - } - } else { - for ( i in obj ) { - value = callback.apply( obj[ i ], args ); - - if ( value === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback.call( obj[ i ], i, obj[ i ] ); - - if ( value === false ) { - break; - } - } - } else { - for ( i in obj ) { - value = callback.call( obj[ i ], i, obj[ i ] ); - - if ( value === false ) { - break; - } - } - } - } - - return obj; - }, - - // Use native String.trim function wherever possible - trim: core_trim && !core_trim.call("\uFEFF\xA0") ? - function( text ) { - return text == null ? - "" : - core_trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - ( text + "" ).replace( rtrim, "" ); - }, - - // results is for internal usage only - makeArray: function( arr, results ) { - var ret = results || []; - - if ( arr != null ) { - if ( isArraylike( Object(arr) ) ) { - jQuery.merge( ret, - typeof arr === "string" ? - [ arr ] : arr - ); - } else { - core_push.call( ret, arr ); - } - } - - return ret; - }, - - inArray: function( elem, arr, i ) { - var len; - - if ( arr ) { - if ( core_indexOf ) { - return core_indexOf.call( arr, elem, i ); - } - - len = arr.length; - i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; - - for ( ; i < len; i++ ) { - // Skip accessing in sparse arrays - if ( i in arr && arr[ i ] === elem ) { - return i; - } - } - } - - return -1; - }, - - merge: function( first, second ) { - var l = second.length, - i = first.length, - j = 0; - - if ( typeof l === "number" ) { - for ( ; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var retVal, - ret = [], - i = 0, - length = elems.length; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( ; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, - i = 0, - length = elems.length, - isArray = isArraylike( elems ), - ret = []; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( i in elems ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return core_concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - var args, proxy, tmp; - - if ( typeof context === "string" ) { - tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - args = core_slice.call( arguments, 2 ); - proxy = function() { - return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || jQuery.guid++; - - return proxy; - }, - - // Multifunctional method to get and set values of a collection - // The value/s can optionally be executed if it's a function - access: function( elems, fn, key, value, chainable, emptyGet, raw ) { - var i = 0, - length = elems.length, - bulk = key == null; - - // Sets many values - if ( jQuery.type( key ) === "object" ) { - chainable = true; - for ( i in key ) { - jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); - } - - // Sets one value - } else if ( value !== undefined ) { - chainable = true; - - if ( !jQuery.isFunction( value ) ) { - raw = true; - } - - if ( bulk ) { - // Bulk operations run against the entire set - if ( raw ) { - fn.call( elems, value ); - fn = null; - - // ...except when executing function values - } else { - bulk = fn; - fn = function( elem, key, value ) { - return bulk.call( jQuery( elem ), value ); - }; - } - } - - if ( fn ) { - for ( ; i < length; i++ ) { - fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); - } - } - } - - return chainable ? - elems : - - // Gets - bulk ? - fn.call( elems ) : - length ? fn( elems[0], key ) : emptyGet; - }, - - now: function() { - return ( new Date() ).getTime(); - }, - - // A method for quickly swapping in/out CSS properties to get correct calculations. - // Note: this method belongs to the css module but it's needed here for the support module. - // If support gets modularized, this method should be moved back to the css module. - swap: function( elem, options, callback, args ) { - var ret, name, - old = {}; - - // Remember the old values, and insert the new ones - for ( name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } - - ret = callback.apply( elem, args || [] ); - - // Revert the old values - for ( name in options ) { - elem.style[ name ] = old[ name ]; - } - - return ret; - } -}); - -jQuery.ready.promise = function( obj ) { - if ( !readyList ) { - - readyList = jQuery.Deferred(); - - // Catch cases where $(document).ready() is called after the browser event has already occurred. - // we once tried to use readyState "interactive" here, but it caused issues like the one - // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - setTimeout( jQuery.ready ); - - // Standards-based browsers support DOMContentLoaded - } else if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", completed, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", completed, false ); - - // If IE event model is used - } else { - // Ensure firing before onload, maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", completed ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", completed ); - - // If IE and not a frame - // continually check to see if the document is ready - var top = false; - - try { - top = window.frameElement == null && document.documentElement; - } catch(e) {} - - if ( top && top.doScroll ) { - (function doScrollCheck() { - if ( !jQuery.isReady ) { - - try { - // Use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - top.doScroll("left"); - } catch(e) { - return setTimeout( doScrollCheck, 50 ); - } - - // detach all dom ready events - detach(); - - // and execute any waiting functions - jQuery.ready(); - } - })(); - } - } - } - return readyList.promise( obj ); -}; - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -function isArraylike( obj ) { - var length = obj.length, - type = jQuery.type( obj ); - - if ( jQuery.isWindow( obj ) ) { - return false; - } - - if ( obj.nodeType === 1 && length ) { - return true; - } - - return type === "array" || type !== "function" && - ( length === 0 || - typeof length === "number" && length > 0 && ( length - 1 ) in obj ); -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); -/*! - * Sizzle CSS Selector Engine v1.10.2 - * http://sizzlejs.com/ - * - * Copyright 2013 jQuery Foundation, Inc. and other contributors - * Released under the MIT license - * http://jquery.org/license - * - * Date: 2013-07-03 - */ -(function( window, undefined ) { - -var i, - support, - cachedruns, - Expr, - getText, - isXML, - compile, - outermostContext, - sortInput, - - // Local document vars - setDocument, - document, - docElem, - documentIsHTML, - rbuggyQSA, - rbuggyMatches, - matches, - contains, - - // Instance-specific data - expando = "sizzle" + -(new Date()), - preferredDoc = window.document, - dirruns = 0, - done = 0, - classCache = createCache(), - tokenCache = createCache(), - compilerCache = createCache(), - hasDuplicate = false, - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - return 0; - } - return 0; - }, - - // General-purpose constants - strundefined = typeof undefined, - MAX_NEGATIVE = 1 << 31, - - // Instance methods - hasOwn = ({}).hasOwnProperty, - arr = [], - pop = arr.pop, - push_native = arr.push, - push = arr.push, - slice = arr.slice, - // Use a stripped-down indexOf if we can't use a native one - indexOf = arr.indexOf || function( elem ) { - var i = 0, - len = this.length; - for ( ; i < len; i++ ) { - if ( this[i] === elem ) { - return i; - } - } - return -1; - }, - - booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", - - // Regular expressions - - // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace - whitespace = "[\\x20\\t\\r\\n\\f]", - // http://www.w3.org/TR/css3-syntax/#characters - characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", - - // Loosely modeled on CSS identifier characters - // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors - // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier - identifier = characterEncoding.replace( "w", "w#" ), - - // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors - attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + - "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", - - // Prefer arguments quoted, - // then not containing pseudos/brackets, - // then attribute selectors/non-parenthetical expressions, - // then anything else - // These preferences are here to reduce the number of selectors - // needing tokenize in the PSEUDO preFilter - pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", - - // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), - - rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), - - rsibling = new RegExp( whitespace + "*[+~]" ), - rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*)" + whitespace + "*\\]", "g" ), - - rpseudo = new RegExp( pseudos ), - ridentifier = new RegExp( "^" + identifier + "$" ), - - matchExpr = { - "ID": new RegExp( "^#(" + characterEncoding + ")" ), - "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), - "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + - "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + - "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), - // For use in libraries implementing .is() - // We use this for POS matching in `select` - "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + - whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) - }, - - rnative = /^[^{]+\{\s*\[native \w/, - - // Easily-parseable/retrievable ID or TAG or CLASS selectors - rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, - - rinputs = /^(?:input|select|textarea|button)$/i, - rheader = /^h\d$/i, - - rescape = /'|\\/g, - - // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters - runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), - funescape = function( _, escaped, escapedWhitespace ) { - var high = "0x" + escaped - 0x10000; - // NaN means non-codepoint - // Support: Firefox - // Workaround erroneous numeric interpretation of +"0x" - return high !== high || escapedWhitespace ? - escaped : - // BMP codepoint - high < 0 ? - String.fromCharCode( high + 0x10000 ) : - // Supplemental Plane codepoint (surrogate pair) - String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); - }; - -// Optimize for push.apply( _, NodeList ) -try { - push.apply( - (arr = slice.call( preferredDoc.childNodes )), - preferredDoc.childNodes - ); - // Support: Android<4.0 - // Detect silently failing push.apply - arr[ preferredDoc.childNodes.length ].nodeType; -} catch ( e ) { - push = { apply: arr.length ? - - // Leverage slice if possible - function( target, els ) { - push_native.apply( target, slice.call(els) ); - } : - - // Support: IE<9 - // Otherwise append directly - function( target, els ) { - var j = target.length, - i = 0; - // Can't trust NodeList.length - while ( (target[j++] = els[i++]) ) {} - target.length = j - 1; - } - }; -} - -function Sizzle( selector, context, results, seed ) { - var match, elem, m, nodeType, - // QSA vars - i, groups, old, nid, newContext, newSelector; - - if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { - setDocument( context ); - } - - context = context || document; - results = results || []; - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { - return []; - } - - if ( documentIsHTML && !seed ) { - - // Shortcuts - if ( (match = rquickExpr.exec( selector )) ) { - // Speed-up: Sizzle("#ID") - if ( (m = match[1]) ) { - if ( nodeType === 9 ) { - elem = context.getElementById( m ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE, Opera, and Webkit return items - // by name instead of ID - if ( elem.id === m ) { - results.push( elem ); - return results; - } - } else { - return results; - } - } else { - // Context is not a document - if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && - contains( context, elem ) && elem.id === m ) { - results.push( elem ); - return results; - } - } - - // Speed-up: Sizzle("TAG") - } else if ( match[2] ) { - push.apply( results, context.getElementsByTagName( selector ) ); - return results; - - // Speed-up: Sizzle(".CLASS") - } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) { - push.apply( results, context.getElementsByClassName( m ) ); - return results; - } - } - - // QSA path - if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { - nid = old = expando; - newContext = context; - newSelector = nodeType === 9 && selector; - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - groups = tokenize( selector ); - - if ( (old = context.getAttribute("id")) ) { - nid = old.replace( rescape, "\\$&" ); - } else { - context.setAttribute( "id", nid ); - } - nid = "[id='" + nid + "'] "; - - i = groups.length; - while ( i-- ) { - groups[i] = nid + toSelector( groups[i] ); - } - newContext = rsibling.test( selector ) && context.parentNode || context; - newSelector = groups.join(","); - } - - if ( newSelector ) { - try { - push.apply( results, - newContext.querySelectorAll( newSelector ) - ); - return results; - } catch(qsaError) { - } finally { - if ( !old ) { - context.removeAttribute("id"); - } - } - } - } - } - - // All others - return select( selector.replace( rtrim, "$1" ), context, results, seed ); -} - -/** - * Create key-value caches of limited size - * @returns {Function(string, Object)} Returns the Object data after storing it on itself with - * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) - * deleting the oldest entry - */ -function createCache() { - var keys = []; - - function cache( key, value ) { - // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) - if ( keys.push( key += " " ) > Expr.cacheLength ) { - // Only keep the most recent entries - delete cache[ keys.shift() ]; - } - return (cache[ key ] = value); - } - return cache; -} - -/** - * Mark a function for special use by Sizzle - * @param {Function} fn The function to mark - */ -function markFunction( fn ) { - fn[ expando ] = true; - return fn; -} - -/** - * Support testing using an element - * @param {Function} fn Passed the created div and expects a boolean result - */ -function assert( fn ) { - var div = document.createElement("div"); - - try { - return !!fn( div ); - } catch (e) { - return false; - } finally { - // Remove from its parent by default - if ( div.parentNode ) { - div.parentNode.removeChild( div ); - } - // release memory in IE - div = null; - } -} - -/** - * Adds the same handler for all of the specified attrs - * @param {String} attrs Pipe-separated list of attributes - * @param {Function} handler The method that will be applied - */ -function addHandle( attrs, handler ) { - var arr = attrs.split("|"), - i = attrs.length; - - while ( i-- ) { - Expr.attrHandle[ arr[i] ] = handler; - } -} - -/** - * Checks document order of two siblings - * @param {Element} a - * @param {Element} b - * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b - */ -function siblingCheck( a, b ) { - var cur = b && a, - diff = cur && a.nodeType === 1 && b.nodeType === 1 && - ( ~b.sourceIndex || MAX_NEGATIVE ) - - ( ~a.sourceIndex || MAX_NEGATIVE ); - - // Use IE sourceIndex if available on both nodes - if ( diff ) { - return diff; - } - - // Check if b follows a - if ( cur ) { - while ( (cur = cur.nextSibling) ) { - if ( cur === b ) { - return -1; - } - } - } - - return a ? 1 : -1; -} - -/** - * Returns a function to use in pseudos for input types - * @param {String} type - */ -function createInputPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for buttons - * @param {String} type - */ -function createButtonPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for positionals - * @param {Function} fn - */ -function createPositionalPseudo( fn ) { - return markFunction(function( argument ) { - argument = +argument; - return markFunction(function( seed, matches ) { - var j, - matchIndexes = fn( [], seed.length, argument ), - i = matchIndexes.length; - - // Match elements found at the specified indexes - while ( i-- ) { - if ( seed[ (j = matchIndexes[i]) ] ) { - seed[j] = !(matches[j] = seed[j]); - } - } - }); - }); -} - -/** - * Detect xml - * @param {Element|Object} elem An element or a document - */ -isXML = Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = elem && (elem.ownerDocument || elem).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -// Expose support vars for convenience -support = Sizzle.support = {}; - -/** - * Sets document-related variables once based on the current document - * @param {Element|Object} [doc] An element or document object to use to set the document - * @returns {Object} Returns the current document - */ -setDocument = Sizzle.setDocument = function( node ) { - var doc = node ? node.ownerDocument || node : preferredDoc, - parent = doc.defaultView; - - // If no document and documentElement is available, return - if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { - return document; - } - - // Set our document - document = doc; - docElem = doc.documentElement; - - // Support tests - documentIsHTML = !isXML( doc ); - - // Support: IE>8 - // If iframe document is assigned to "document" variable and if iframe has been reloaded, - // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 - // IE6-8 do not support the defaultView property so parent will be undefined - if ( parent && parent.attachEvent && parent !== parent.top ) { - parent.attachEvent( "onbeforeunload", function() { - setDocument(); - }); - } - - /* Attributes - ---------------------------------------------------------------------- */ - - // Support: IE<8 - // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans) - support.attributes = assert(function( div ) { - div.className = "i"; - return !div.getAttribute("className"); - }); - - /* getElement(s)By* - ---------------------------------------------------------------------- */ - - // Check if getElementsByTagName("*") returns only elements - support.getElementsByTagName = assert(function( div ) { - div.appendChild( doc.createComment("") ); - return !div.getElementsByTagName("*").length; - }); - - // Check if getElementsByClassName can be trusted - support.getElementsByClassName = assert(function( div ) { - div.innerHTML = "
"; - - // Support: Safari<4 - // Catch class over-caching - div.firstChild.className = "i"; - // Support: Opera<10 - // Catch gEBCN failure to find non-leading classes - return div.getElementsByClassName("i").length === 2; - }); - - // Support: IE<10 - // Check if getElementById returns elements by name - // The broken getElementById methods don't pick up programatically-set names, - // so use a roundabout getElementsByName test - support.getById = assert(function( div ) { - docElem.appendChild( div ).id = expando; - return !doc.getElementsByName || !doc.getElementsByName( expando ).length; - }); - - // ID find and filter - if ( support.getById ) { - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== strundefined && documentIsHTML ) { - var m = context.getElementById( id ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - }; - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - return elem.getAttribute("id") === attrId; - }; - }; - } else { - // Support: IE6/7 - // getElementById is not reliable as a find shortcut - delete Expr.find["ID"]; - - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); - return node && node.value === attrId; - }; - }; - } - - // Tag - Expr.find["TAG"] = support.getElementsByTagName ? - function( tag, context ) { - if ( typeof context.getElementsByTagName !== strundefined ) { - return context.getElementsByTagName( tag ); - } - } : - function( tag, context ) { - var elem, - tmp = [], - i = 0, - results = context.getElementsByTagName( tag ); - - // Filter out possible comments - if ( tag === "*" ) { - while ( (elem = results[i++]) ) { - if ( elem.nodeType === 1 ) { - tmp.push( elem ); - } - } - - return tmp; - } - return results; - }; - - // Class - Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { - if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) { - return context.getElementsByClassName( className ); - } - }; - - /* QSA/matchesSelector - ---------------------------------------------------------------------- */ - - // QSA and matchesSelector support - - // matchesSelector(:active) reports false when true (IE9/Opera 11.5) - rbuggyMatches = []; - - // qSa(:focus) reports false when true (Chrome 21) - // We allow this because of a bug in IE8/9 that throws an error - // whenever `document.activeElement` is accessed on an iframe - // So, we allow :focus to pass through QSA all the time to avoid the IE error - // See http://bugs.jquery.com/ticket/13378 - rbuggyQSA = []; - - if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { - // Build QSA regex - // Regex strategy adopted from Diego Perini - assert(function( div ) { - // Select is set to empty string on purpose - // This is to test IE's treatment of not explicitly - // setting a boolean content attribute, - // since its presence should be enough - // http://bugs.jquery.com/ticket/12359 - div.innerHTML = ""; - - // Support: IE8 - // Boolean attributes and "value" are not treated correctly - if ( !div.querySelectorAll("[selected]").length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); - } - - // Webkit/Opera - :checked should return selected option elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - // IE8 throws error here and will not see later tests - if ( !div.querySelectorAll(":checked").length ) { - rbuggyQSA.push(":checked"); - } - }); - - assert(function( div ) { - - // Support: Opera 10-12/IE8 - // ^= $= *= and empty values - // Should not select anything - // Support: Windows 8 Native Apps - // The type attribute is restricted during .innerHTML assignment - var input = doc.createElement("input"); - input.setAttribute( "type", "hidden" ); - div.appendChild( input ).setAttribute( "t", "" ); - - if ( div.querySelectorAll("[t^='']").length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); - } - - // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) - // IE8 throws error here and will not see later tests - if ( !div.querySelectorAll(":enabled").length ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Opera 10-11 does not throw on post-comma invalid pseudos - div.querySelectorAll("*,:x"); - rbuggyQSA.push(",.*:"); - }); - } - - if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector || - docElem.mozMatchesSelector || - docElem.oMatchesSelector || - docElem.msMatchesSelector) )) ) { - - assert(function( div ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9) - support.disconnectedMatch = matches.call( div, "div" ); - - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( div, "[s!='']:x" ); - rbuggyMatches.push( "!=", pseudos ); - }); - } - - rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); - rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); - - /* Contains - ---------------------------------------------------------------------- */ - - // Element contains another - // Purposefully does not implement inclusive descendent - // As in, an element does not contain itself - contains = rnative.test( docElem.contains ) || docElem.compareDocumentPosition ? - function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, - bup = b && b.parentNode; - return a === bup || !!( bup && bup.nodeType === 1 && ( - adown.contains ? - adown.contains( bup ) : - a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 - )); - } : - function( a, b ) { - if ( b ) { - while ( (b = b.parentNode) ) { - if ( b === a ) { - return true; - } - } - } - return false; - }; - - /* Sorting - ---------------------------------------------------------------------- */ - - // Document order sorting - sortOrder = docElem.compareDocumentPosition ? - function( a, b ) { - - // Flag for duplicate removal - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - var compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b ); - - if ( compare ) { - // Disconnected nodes - if ( compare & 1 || - (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { - - // Choose the first element that is related to our preferred document - if ( a === doc || contains(preferredDoc, a) ) { - return -1; - } - if ( b === doc || contains(preferredDoc, b) ) { - return 1; - } - - // Maintain original order - return sortInput ? - ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : - 0; - } - - return compare & 4 ? -1 : 1; - } - - // Not directly comparable, sort on existence of method - return a.compareDocumentPosition ? -1 : 1; - } : - function( a, b ) { - var cur, - i = 0, - aup = a.parentNode, - bup = b.parentNode, - ap = [ a ], - bp = [ b ]; - - // Exit early if the nodes are identical - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Parentless nodes are either documents or disconnected - } else if ( !aup || !bup ) { - return a === doc ? -1 : - b === doc ? 1 : - aup ? -1 : - bup ? 1 : - sortInput ? - ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : - 0; - - // If the nodes are siblings, we can do a quick check - } else if ( aup === bup ) { - return siblingCheck( a, b ); - } - - // Otherwise we need full lists of their ancestors for comparison - cur = a; - while ( (cur = cur.parentNode) ) { - ap.unshift( cur ); - } - cur = b; - while ( (cur = cur.parentNode) ) { - bp.unshift( cur ); - } - - // Walk down the tree looking for a discrepancy - while ( ap[i] === bp[i] ) { - i++; - } - - return i ? - // Do a sibling check if the nodes have a common ancestor - siblingCheck( ap[i], bp[i] ) : - - // Otherwise nodes in our document sort first - ap[i] === preferredDoc ? -1 : - bp[i] === preferredDoc ? 1 : - 0; - }; - - return doc; -}; - -Sizzle.matches = function( expr, elements ) { - return Sizzle( expr, null, null, elements ); -}; - -Sizzle.matchesSelector = function( elem, expr ) { - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - // Make sure that attribute selectors are quoted - expr = expr.replace( rattributeQuotes, "='$1']" ); - - if ( support.matchesSelector && documentIsHTML && - ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && - ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { - - try { - var ret = matches.call( elem, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || support.disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9 - elem.document && elem.document.nodeType !== 11 ) { - return ret; - } - } catch(e) {} - } - - return Sizzle( expr, document, null, [elem] ).length > 0; -}; - -Sizzle.contains = function( context, elem ) { - // Set document vars if needed - if ( ( context.ownerDocument || context ) !== document ) { - setDocument( context ); - } - return contains( context, elem ); -}; - -Sizzle.attr = function( elem, name ) { - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - var fn = Expr.attrHandle[ name.toLowerCase() ], - // Don't get fooled by Object.prototype properties (jQuery #13807) - val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? - fn( elem, name, !documentIsHTML ) : - undefined; - - return val === undefined ? - support.attributes || !documentIsHTML ? - elem.getAttribute( name ) : - (val = elem.getAttributeNode(name)) && val.specified ? - val.value : - null : - val; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Document sorting and removing duplicates - * @param {ArrayLike} results - */ -Sizzle.uniqueSort = function( results ) { - var elem, - duplicates = [], - j = 0, - i = 0; - - // Unless we *know* we can detect duplicates, assume their presence - hasDuplicate = !support.detectDuplicates; - sortInput = !support.sortStable && results.slice( 0 ); - results.sort( sortOrder ); - - if ( hasDuplicate ) { - while ( (elem = results[i++]) ) { - if ( elem === results[ i ] ) { - j = duplicates.push( i ); - } - } - while ( j-- ) { - results.splice( duplicates[ j ], 1 ); - } - } - - return results; -}; - -/** - * Utility function for retrieving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -getText = Sizzle.getText = function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; - - if ( !nodeType ) { - // If no nodeType, this is expected to be an array - for ( ; (node = elem[i]); i++ ) { - // Do not traverse comment nodes - ret += getText( node ); - } - } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - // Use textContent for elements - // innerText usage removed for consistency of new lines (see #11153) - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - // Traverse its children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - // Do not include comment or processing instruction nodes - - return ret; -}; - -Expr = Sizzle.selectors = { - - // Can be adjusted by the user - cacheLength: 50, - - createPseudo: markFunction, - - match: matchExpr, - - attrHandle: {}, - - find: {}, - - relative: { - ">": { dir: "parentNode", first: true }, - " ": { dir: "parentNode" }, - "+": { dir: "previousSibling", first: true }, - "~": { dir: "previousSibling" } - }, - - preFilter: { - "ATTR": function( match ) { - match[1] = match[1].replace( runescape, funescape ); - - // Move the given value to match[3] whether quoted or unquoted - match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); - - if ( match[2] === "~=" ) { - match[3] = " " + match[3] + " "; - } - - return match.slice( 0, 4 ); - }, - - "CHILD": function( match ) { - /* matches from matchExpr["CHILD"] - 1 type (only|nth|...) - 2 what (child|of-type) - 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) - 4 xn-component of xn+y argument ([+-]?\d*n|) - 5 sign of xn-component - 6 x of xn-component - 7 sign of y-component - 8 y of y-component - */ - match[1] = match[1].toLowerCase(); - - if ( match[1].slice( 0, 3 ) === "nth" ) { - // nth-* requires argument - if ( !match[3] ) { - Sizzle.error( match[0] ); - } - - // numeric x and y parameters for Expr.filter.CHILD - // remember that false/true cast respectively to 0/1 - match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); - match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); - - // other types prohibit arguments - } else if ( match[3] ) { - Sizzle.error( match[0] ); - } - - return match; - }, - - "PSEUDO": function( match ) { - var excess, - unquoted = !match[5] && match[2]; - - if ( matchExpr["CHILD"].test( match[0] ) ) { - return null; - } - - // Accept quoted arguments as-is - if ( match[3] && match[4] !== undefined ) { - match[2] = match[4]; - - // Strip excess characters from unquoted arguments - } else if ( unquoted && rpseudo.test( unquoted ) && - // Get excess from tokenize (recursively) - (excess = tokenize( unquoted, true )) && - // advance to the next closing parenthesis - (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { - - // excess is a negative index - match[0] = match[0].slice( 0, excess ); - match[2] = unquoted.slice( 0, excess ); - } - - // Return only captures needed by the pseudo filter method (type and argument) - return match.slice( 0, 3 ); - } - }, - - filter: { - - "TAG": function( nodeNameSelector ) { - var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); - return nodeNameSelector === "*" ? - function() { return true; } : - function( elem ) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; - }; - }, - - "CLASS": function( className ) { - var pattern = classCache[ className + " " ]; - - return pattern || - (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && - classCache( className, function( elem ) { - return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" ); - }); - }, - - "ATTR": function( name, operator, check ) { - return function( elem ) { - var result = Sizzle.attr( elem, name ); - - if ( result == null ) { - return operator === "!="; - } - if ( !operator ) { - return true; - } - - result += ""; - - return operator === "=" ? result === check : - operator === "!=" ? result !== check : - operator === "^=" ? check && result.indexOf( check ) === 0 : - operator === "*=" ? check && result.indexOf( check ) > -1 : - operator === "$=" ? check && result.slice( -check.length ) === check : - operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : - operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : - false; - }; - }, - - "CHILD": function( type, what, argument, first, last ) { - var simple = type.slice( 0, 3 ) !== "nth", - forward = type.slice( -4 ) !== "last", - ofType = what === "of-type"; - - return first === 1 && last === 0 ? - - // Shortcut for :nth-*(n) - function( elem ) { - return !!elem.parentNode; - } : - - function( elem, context, xml ) { - var cache, outerCache, node, diff, nodeIndex, start, - dir = simple !== forward ? "nextSibling" : "previousSibling", - parent = elem.parentNode, - name = ofType && elem.nodeName.toLowerCase(), - useCache = !xml && !ofType; - - if ( parent ) { - - // :(first|last|only)-(child|of-type) - if ( simple ) { - while ( dir ) { - node = elem; - while ( (node = node[ dir ]) ) { - if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { - return false; - } - } - // Reverse direction for :only-* (if we haven't yet done so) - start = dir = type === "only" && !start && "nextSibling"; - } - return true; - } - - start = [ forward ? parent.firstChild : parent.lastChild ]; - - // non-xml :nth-child(...) stores cache data on `parent` - if ( forward && useCache ) { - // Seek `elem` from a previously-cached index - outerCache = parent[ expando ] || (parent[ expando ] = {}); - cache = outerCache[ type ] || []; - nodeIndex = cache[0] === dirruns && cache[1]; - diff = cache[0] === dirruns && cache[2]; - node = nodeIndex && parent.childNodes[ nodeIndex ]; - - while ( (node = ++nodeIndex && node && node[ dir ] || - - // Fallback to seeking `elem` from the start - (diff = nodeIndex = 0) || start.pop()) ) { - - // When found, cache indexes on `parent` and break - if ( node.nodeType === 1 && ++diff && node === elem ) { - outerCache[ type ] = [ dirruns, nodeIndex, diff ]; - break; - } - } - - // Use previously-cached element index if available - } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { - diff = cache[1]; - - // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) - } else { - // Use the same loop as above to seek `elem` from the start - while ( (node = ++nodeIndex && node && node[ dir ] || - (diff = nodeIndex = 0) || start.pop()) ) { - - if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { - // Cache the index of each encountered element - if ( useCache ) { - (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; - } - - if ( node === elem ) { - break; - } - } - } - } - - // Incorporate the offset, then check against cycle size - diff -= last; - return diff === first || ( diff % first === 0 && diff / first >= 0 ); - } - }; - }, - - "PSEUDO": function( pseudo, argument ) { - // pseudo-class names are case-insensitive - // http://www.w3.org/TR/selectors/#pseudo-classes - // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters - // Remember that setFilters inherits from pseudos - var args, - fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - Sizzle.error( "unsupported pseudo: " + pseudo ); - - // The user may use createPseudo to indicate that - // arguments are needed to create the filter function - // just as Sizzle does - if ( fn[ expando ] ) { - return fn( argument ); - } - - // But maintain support for old signatures - if ( fn.length > 1 ) { - args = [ pseudo, pseudo, "", argument ]; - return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? - markFunction(function( seed, matches ) { - var idx, - matched = fn( seed, argument ), - i = matched.length; - while ( i-- ) { - idx = indexOf.call( seed, matched[i] ); - seed[ idx ] = !( matches[ idx ] = matched[i] ); - } - }) : - function( elem ) { - return fn( elem, 0, args ); - }; - } - - return fn; - } - }, - - pseudos: { - // Potentially complex pseudos - "not": markFunction(function( selector ) { - // Trim the selector passed to compile - // to avoid treating leading and trailing - // spaces as combinators - var input = [], - results = [], - matcher = compile( selector.replace( rtrim, "$1" ) ); - - return matcher[ expando ] ? - markFunction(function( seed, matches, context, xml ) { - var elem, - unmatched = matcher( seed, null, xml, [] ), - i = seed.length; - - // Match elements unmatched by `matcher` - while ( i-- ) { - if ( (elem = unmatched[i]) ) { - seed[i] = !(matches[i] = elem); - } - } - }) : - function( elem, context, xml ) { - input[0] = elem; - matcher( input, null, xml, results ); - return !results.pop(); - }; - }), - - "has": markFunction(function( selector ) { - return function( elem ) { - return Sizzle( selector, elem ).length > 0; - }; - }), - - "contains": markFunction(function( text ) { - return function( elem ) { - return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; - }; - }), - - // "Whether an element is represented by a :lang() selector - // is based solely on the element's language value - // being equal to the identifier C, - // or beginning with the identifier C immediately followed by "-". - // The matching of C against the element's language value is performed case-insensitively. - // The identifier C does not have to be a valid language name." - // http://www.w3.org/TR/selectors/#lang-pseudo - "lang": markFunction( function( lang ) { - // lang value must be a valid identifier - if ( !ridentifier.test(lang || "") ) { - Sizzle.error( "unsupported lang: " + lang ); - } - lang = lang.replace( runescape, funescape ).toLowerCase(); - return function( elem ) { - var elemLang; - do { - if ( (elemLang = documentIsHTML ? - elem.lang : - elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { - - elemLang = elemLang.toLowerCase(); - return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; - } - } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); - return false; - }; - }), - - // Miscellaneous - "target": function( elem ) { - var hash = window.location && window.location.hash; - return hash && hash.slice( 1 ) === elem.id; - }, - - "root": function( elem ) { - return elem === docElem; - }, - - "focus": function( elem ) { - return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); - }, - - // Boolean properties - "enabled": function( elem ) { - return elem.disabled === false; - }, - - "disabled": function( elem ) { - return elem.disabled === true; - }, - - "checked": function( elem ) { - // In CSS3, :checked should return both checked and selected elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - var nodeName = elem.nodeName.toLowerCase(); - return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); - }, - - "selected": function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - // Contents - "empty": function( elem ) { - // http://www.w3.org/TR/selectors/#empty-pseudo - // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), - // not comment, processing instructions, or others - // Thanks to Diego Perini for the nodeName shortcut - // Greater than "@" means alpha characters (specifically not starting with "#" or "?") - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) { - return false; - } - } - return true; - }, - - "parent": function( elem ) { - return !Expr.pseudos["empty"]( elem ); - }, - - // Element/input types - "header": function( elem ) { - return rheader.test( elem.nodeName ); - }, - - "input": function( elem ) { - return rinputs.test( elem.nodeName ); - }, - - "button": function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === "button" || name === "button"; - }, - - "text": function( elem ) { - var attr; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && - elem.type === "text" && - ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type ); - }, - - // Position-in-collection - "first": createPositionalPseudo(function() { - return [ 0 ]; - }), - - "last": createPositionalPseudo(function( matchIndexes, length ) { - return [ length - 1 ]; - }), - - "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { - return [ argument < 0 ? argument + length : argument ]; - }), - - "even": createPositionalPseudo(function( matchIndexes, length ) { - var i = 0; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "odd": createPositionalPseudo(function( matchIndexes, length ) { - var i = 1; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; --i >= 0; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; ++i < length; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }) - } -}; - -Expr.pseudos["nth"] = Expr.pseudos["eq"]; - -// Add button/input type pseudos -for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { - Expr.pseudos[ i ] = createInputPseudo( i ); -} -for ( i in { submit: true, reset: true } ) { - Expr.pseudos[ i ] = createButtonPseudo( i ); -} - -// Easy API for creating new setFilters -function setFilters() {} -setFilters.prototype = Expr.filters = Expr.pseudos; -Expr.setFilters = new setFilters(); - -function tokenize( selector, parseOnly ) { - var matched, match, tokens, type, - soFar, groups, preFilters, - cached = tokenCache[ selector + " " ]; - - if ( cached ) { - return parseOnly ? 0 : cached.slice( 0 ); - } - - soFar = selector; - groups = []; - preFilters = Expr.preFilter; - - while ( soFar ) { - - // Comma and first run - if ( !matched || (match = rcomma.exec( soFar )) ) { - if ( match ) { - // Don't consume trailing commas as valid - soFar = soFar.slice( match[0].length ) || soFar; - } - groups.push( tokens = [] ); - } - - matched = false; - - // Combinators - if ( (match = rcombinators.exec( soFar )) ) { - matched = match.shift(); - tokens.push({ - value: matched, - // Cast descendant combinators to space - type: match[0].replace( rtrim, " " ) - }); - soFar = soFar.slice( matched.length ); - } - - // Filters - for ( type in Expr.filter ) { - if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || - (match = preFilters[ type ]( match ))) ) { - matched = match.shift(); - tokens.push({ - value: matched, - type: type, - matches: match - }); - soFar = soFar.slice( matched.length ); - } - } - - if ( !matched ) { - break; - } - } - - // Return the length of the invalid excess - // if we're just parsing - // Otherwise, throw an error or return tokens - return parseOnly ? - soFar.length : - soFar ? - Sizzle.error( selector ) : - // Cache the tokens - tokenCache( selector, groups ).slice( 0 ); -} - -function toSelector( tokens ) { - var i = 0, - len = tokens.length, - selector = ""; - for ( ; i < len; i++ ) { - selector += tokens[i].value; - } - return selector; -} - -function addCombinator( matcher, combinator, base ) { - var dir = combinator.dir, - checkNonElements = base && dir === "parentNode", - doneName = done++; - - return combinator.first ? - // Check against closest ancestor/preceding element - function( elem, context, xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - return matcher( elem, context, xml ); - } - } - } : - - // Check against all ancestor/preceding elements - function( elem, context, xml ) { - var data, cache, outerCache, - dirkey = dirruns + " " + doneName; - - // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching - if ( xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - if ( matcher( elem, context, xml ) ) { - return true; - } - } - } - } else { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - outerCache = elem[ expando ] || (elem[ expando ] = {}); - if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) { - if ( (data = cache[1]) === true || data === cachedruns ) { - return data === true; - } - } else { - cache = outerCache[ dir ] = [ dirkey ]; - cache[1] = matcher( elem, context, xml ) || cachedruns; - if ( cache[1] === true ) { - return true; - } - } - } - } - } - }; -} - -function elementMatcher( matchers ) { - return matchers.length > 1 ? - function( elem, context, xml ) { - var i = matchers.length; - while ( i-- ) { - if ( !matchers[i]( elem, context, xml ) ) { - return false; - } - } - return true; - } : - matchers[0]; -} - -function condense( unmatched, map, filter, context, xml ) { - var elem, - newUnmatched = [], - i = 0, - len = unmatched.length, - mapped = map != null; - - for ( ; i < len; i++ ) { - if ( (elem = unmatched[i]) ) { - if ( !filter || filter( elem, context, xml ) ) { - newUnmatched.push( elem ); - if ( mapped ) { - map.push( i ); - } - } - } - } - - return newUnmatched; -} - -function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { - if ( postFilter && !postFilter[ expando ] ) { - postFilter = setMatcher( postFilter ); - } - if ( postFinder && !postFinder[ expando ] ) { - postFinder = setMatcher( postFinder, postSelector ); - } - return markFunction(function( seed, results, context, xml ) { - var temp, i, elem, - preMap = [], - postMap = [], - preexisting = results.length, - - // Get initial elements from seed or context - elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), - - // Prefilter to get matcher input, preserving a map for seed-results synchronization - matcherIn = preFilter && ( seed || !selector ) ? - condense( elems, preMap, preFilter, context, xml ) : - elems, - - matcherOut = matcher ? - // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, - postFinder || ( seed ? preFilter : preexisting || postFilter ) ? - - // ...intermediate processing is necessary - [] : - - // ...otherwise use results directly - results : - matcherIn; - - // Find primary matches - if ( matcher ) { - matcher( matcherIn, matcherOut, context, xml ); - } - - // Apply postFilter - if ( postFilter ) { - temp = condense( matcherOut, postMap ); - postFilter( temp, [], context, xml ); - - // Un-match failing elements by moving them back to matcherIn - i = temp.length; - while ( i-- ) { - if ( (elem = temp[i]) ) { - matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); - } - } - } - - if ( seed ) { - if ( postFinder || preFilter ) { - if ( postFinder ) { - // Get the final matcherOut by condensing this intermediate into postFinder contexts - temp = []; - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) ) { - // Restore matcherIn since elem is not yet a final match - temp.push( (matcherIn[i] = elem) ); - } - } - postFinder( null, (matcherOut = []), temp, xml ); - } - - // Move matched elements from seed to results to keep them synchronized - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) && - (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { - - seed[temp] = !(results[temp] = elem); - } - } - } - - // Add elements to results, through postFinder if defined - } else { - matcherOut = condense( - matcherOut === results ? - matcherOut.splice( preexisting, matcherOut.length ) : - matcherOut - ); - if ( postFinder ) { - postFinder( null, results, matcherOut, xml ); - } else { - push.apply( results, matcherOut ); - } - } - }); -} - -function matcherFromTokens( tokens ) { - var checkContext, matcher, j, - len = tokens.length, - leadingRelative = Expr.relative[ tokens[0].type ], - implicitRelative = leadingRelative || Expr.relative[" "], - i = leadingRelative ? 1 : 0, - - // The foundational matcher ensures that elements are reachable from top-level context(s) - matchContext = addCombinator( function( elem ) { - return elem === checkContext; - }, implicitRelative, true ), - matchAnyContext = addCombinator( function( elem ) { - return indexOf.call( checkContext, elem ) > -1; - }, implicitRelative, true ), - matchers = [ function( elem, context, xml ) { - return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( - (checkContext = context).nodeType ? - matchContext( elem, context, xml ) : - matchAnyContext( elem, context, xml ) ); - } ]; - - for ( ; i < len; i++ ) { - if ( (matcher = Expr.relative[ tokens[i].type ]) ) { - matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; - } else { - matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); - - // Return special upon seeing a positional matcher - if ( matcher[ expando ] ) { - // Find the next relative operator (if any) for proper handling - j = ++i; - for ( ; j < len; j++ ) { - if ( Expr.relative[ tokens[j].type ] ) { - break; - } - } - return setMatcher( - i > 1 && elementMatcher( matchers ), - i > 1 && toSelector( - // If the preceding token was a descendant combinator, insert an implicit any-element `*` - tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) - ).replace( rtrim, "$1" ), - matcher, - i < j && matcherFromTokens( tokens.slice( i, j ) ), - j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), - j < len && toSelector( tokens ) - ); - } - matchers.push( matcher ); - } - } - - return elementMatcher( matchers ); -} - -function matcherFromGroupMatchers( elementMatchers, setMatchers ) { - // A counter to specify which element is currently being matched - var matcherCachedRuns = 0, - bySet = setMatchers.length > 0, - byElement = elementMatchers.length > 0, - superMatcher = function( seed, context, xml, results, expandContext ) { - var elem, j, matcher, - setMatched = [], - matchedCount = 0, - i = "0", - unmatched = seed && [], - outermost = expandContext != null, - contextBackup = outermostContext, - // We must always have either seed elements or context - elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), - // Use integer dirruns iff this is the outermost matcher - dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1); - - if ( outermost ) { - outermostContext = context !== document && context; - cachedruns = matcherCachedRuns; - } - - // Add elements passing elementMatchers directly to results - // Keep `i` a string if there are no elements so `matchedCount` will be "00" below - for ( ; (elem = elems[i]) != null; i++ ) { - if ( byElement && elem ) { - j = 0; - while ( (matcher = elementMatchers[j++]) ) { - if ( matcher( elem, context, xml ) ) { - results.push( elem ); - break; - } - } - if ( outermost ) { - dirruns = dirrunsUnique; - cachedruns = ++matcherCachedRuns; - } - } - - // Track unmatched elements for set filters - if ( bySet ) { - // They will have gone through all possible matchers - if ( (elem = !matcher && elem) ) { - matchedCount--; - } - - // Lengthen the array for every element, matched or not - if ( seed ) { - unmatched.push( elem ); - } - } - } - - // Apply set filters to unmatched elements - matchedCount += i; - if ( bySet && i !== matchedCount ) { - j = 0; - while ( (matcher = setMatchers[j++]) ) { - matcher( unmatched, setMatched, context, xml ); - } - - if ( seed ) { - // Reintegrate element matches to eliminate the need for sorting - if ( matchedCount > 0 ) { - while ( i-- ) { - if ( !(unmatched[i] || setMatched[i]) ) { - setMatched[i] = pop.call( results ); - } - } - } - - // Discard index placeholder values to get only actual matches - setMatched = condense( setMatched ); - } - - // Add matches to results - push.apply( results, setMatched ); - - // Seedless set matches succeeding multiple successful matchers stipulate sorting - if ( outermost && !seed && setMatched.length > 0 && - ( matchedCount + setMatchers.length ) > 1 ) { - - Sizzle.uniqueSort( results ); - } - } - - // Override manipulation of globals by nested matchers - if ( outermost ) { - dirruns = dirrunsUnique; - outermostContext = contextBackup; - } - - return unmatched; - }; - - return bySet ? - markFunction( superMatcher ) : - superMatcher; -} - -compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { - var i, - setMatchers = [], - elementMatchers = [], - cached = compilerCache[ selector + " " ]; - - if ( !cached ) { - // Generate a function of recursive functions that can be used to check each element - if ( !group ) { - group = tokenize( selector ); - } - i = group.length; - while ( i-- ) { - cached = matcherFromTokens( group[i] ); - if ( cached[ expando ] ) { - setMatchers.push( cached ); - } else { - elementMatchers.push( cached ); - } - } - - // Cache the compiled function - cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); - } - return cached; -}; - -function multipleContexts( selector, contexts, results ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - Sizzle( selector, contexts[i], results ); - } - return results; -} - -function select( selector, context, results, seed ) { - var i, tokens, token, type, find, - match = tokenize( selector ); - - if ( !seed ) { - // Try to minimize operations if there is only one group - if ( match.length === 1 ) { - - // Take a shortcut and set the context if the root selector is an ID - tokens = match[0] = match[0].slice( 0 ); - if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && - support.getById && context.nodeType === 9 && documentIsHTML && - Expr.relative[ tokens[1].type ] ) { - - context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; - if ( !context ) { - return results; - } - selector = selector.slice( tokens.shift().value.length ); - } - - // Fetch a seed set for right-to-left matching - i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; - while ( i-- ) { - token = tokens[i]; - - // Abort if we hit a combinator - if ( Expr.relative[ (type = token.type) ] ) { - break; - } - if ( (find = Expr.find[ type ]) ) { - // Search, expanding context for leading sibling combinators - if ( (seed = find( - token.matches[0].replace( runescape, funescape ), - rsibling.test( tokens[0].type ) && context.parentNode || context - )) ) { - - // If seed is empty or no tokens remain, we can return early - tokens.splice( i, 1 ); - selector = seed.length && toSelector( tokens ); - if ( !selector ) { - push.apply( results, seed ); - return results; - } - - break; - } - } - } - } - } - - // Compile and execute a filtering function - // Provide `match` to avoid retokenization if we modified the selector above - compile( selector, match )( - seed, - context, - !documentIsHTML, - results, - rsibling.test( selector ) - ); - return results; -} - -// One-time assignments - -// Sort stability -support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; - -// Support: Chrome<14 -// Always assume duplicates if they aren't passed to the comparison function -support.detectDuplicates = hasDuplicate; - -// Initialize against the default document -setDocument(); - -// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) -// Detached nodes confoundingly follow *each other* -support.sortDetached = assert(function( div1 ) { - // Should return 1, but returns 4 (following) - return div1.compareDocumentPosition( document.createElement("div") ) & 1; -}); - -// Support: IE<8 -// Prevent attribute/property "interpolation" -// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !assert(function( div ) { - div.innerHTML = ""; - return div.firstChild.getAttribute("href") === "#" ; -}) ) { - addHandle( "type|href|height|width", function( elem, name, isXML ) { - if ( !isXML ) { - return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); - } - }); -} - -// Support: IE<9 -// Use defaultValue in place of getAttribute("value") -if ( !support.attributes || !assert(function( div ) { - div.innerHTML = ""; - div.firstChild.setAttribute( "value", "" ); - return div.firstChild.getAttribute( "value" ) === ""; -}) ) { - addHandle( "value", function( elem, name, isXML ) { - if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { - return elem.defaultValue; - } - }); -} - -// Support: IE<9 -// Use getAttributeNode to fetch booleans when getAttribute lies -if ( !assert(function( div ) { - return div.getAttribute("disabled") == null; -}) ) { - addHandle( booleans, function( elem, name, isXML ) { - var val; - if ( !isXML ) { - return (val = elem.getAttributeNode( name )) && val.specified ? - val.value : - elem[ name ] === true ? name.toLowerCase() : null; - } - }); -} - -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.pseudos; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})( window ); -// String to Object options format cache -var optionsCache = {}; - -// Convert String-formatted options into Object-formatted ones and store in cache -function createOptions( options ) { - var object = optionsCache[ options ] = {}; - jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) { - object[ flag ] = true; - }); - return object; -} - -/* - * Create a callback list using the following parameters: - * - * options: an optional list of space-separated options that will change how - * the callback list behaves or a more traditional option object - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible options: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( options ) { - - // Convert options from String-formatted to Object-formatted if needed - // (we check in cache first) - options = typeof options === "string" ? - ( optionsCache[ options ] || createOptions( options ) ) : - jQuery.extend( {}, options ); - - var // Flag to know if list is currently firing - firing, - // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list was already fired - fired, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // First callback to fire (used internally by add and fireWith) - firingStart, - // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = !options.once && [], - // Fire callbacks - fire = function( data ) { - memory = options.memory && data; - fired = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - firing = true; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { - memory = false; // To prevent further calls using add - break; - } - } - firing = false; - if ( list ) { - if ( stack ) { - if ( stack.length ) { - fire( stack.shift() ); - } - } else if ( memory ) { - list = []; - } else { - self.disable(); - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - // First, we save the current length - var start = list.length; - (function add( args ) { - jQuery.each( args, function( _, arg ) { - var type = jQuery.type( arg ); - if ( type === "function" ) { - if ( !options.unique || !self.has( arg ) ) { - list.push( arg ); - } - } else if ( arg && arg.length && type !== "string" ) { - // Inspect recursively - add( arg ); - } - }); - })( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away - } else if ( memory ) { - firingStart = start; - fire( memory ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - jQuery.each( arguments, function( _, arg ) { - var index; - while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { - list.splice( index, 1 ); - // Handle firing indexes - if ( firing ) { - if ( index <= firingLength ) { - firingLength--; - } - if ( index <= firingIndex ) { - firingIndex--; - } - } - } - }); - } - return this; - }, - // Check if a given callback is in the list. - // If no argument is given, return whether or not list has callbacks attached. - has: function( fn ) { - return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); - }, - // Remove all callbacks from the list - empty: function() { - list = []; - firingLength = 0; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( list && ( !fired || stack ) ) { - args = args || []; - args = [ context, args.slice ? args.slice() : args ]; - if ( firing ) { - stack.push( args ); - } else { - fire( args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; -jQuery.extend({ - - Deferred: function( func ) { - var tuples = [ - // action, add listener, listener list, final state - [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], - [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], - [ "notify", "progress", jQuery.Callbacks("memory") ] - ], - state = "pending", - promise = { - state: function() { - return state; - }, - always: function() { - deferred.done( arguments ).fail( arguments ); - return this; - }, - then: function( /* fnDone, fnFail, fnProgress */ ) { - var fns = arguments; - return jQuery.Deferred(function( newDefer ) { - jQuery.each( tuples, function( i, tuple ) { - var action = tuple[ 0 ], - fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; - // deferred[ done | fail | progress ] for forwarding actions to newDefer - deferred[ tuple[1] ](function() { - var returned = fn && fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise() - .done( newDefer.resolve ) - .fail( newDefer.reject ) - .progress( newDefer.notify ); - } else { - newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); - } - }); - }); - fns = null; - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - return obj != null ? jQuery.extend( obj, promise ) : promise; - } - }, - deferred = {}; - - // Keep pipe for back-compat - promise.pipe = promise.then; - - // Add list-specific methods - jQuery.each( tuples, function( i, tuple ) { - var list = tuple[ 2 ], - stateString = tuple[ 3 ]; - - // promise[ done | fail | progress ] = list.add - promise[ tuple[1] ] = list.add; - - // Handle state - if ( stateString ) { - list.add(function() { - // state = [ resolved | rejected ] - state = stateString; - - // [ reject_list | resolve_list ].disable; progress_list.lock - }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); - } - - // deferred[ resolve | reject | notify ] - deferred[ tuple[0] ] = function() { - deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); - return this; - }; - deferred[ tuple[0] + "With" ] = list.fireWith; - }); - - // Make the deferred a promise - promise.promise( deferred ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( subordinate /* , ..., subordinateN */ ) { - var i = 0, - resolveValues = core_slice.call( arguments ), - length = resolveValues.length, - - // the count of uncompleted subordinates - remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, - - // the master Deferred. If resolveValues consist of only a single Deferred, just use that. - deferred = remaining === 1 ? subordinate : jQuery.Deferred(), - - // Update function for both resolve and progress values - updateFunc = function( i, contexts, values ) { - return function( value ) { - contexts[ i ] = this; - values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; - if( values === progressValues ) { - deferred.notifyWith( contexts, values ); - } else if ( !( --remaining ) ) { - deferred.resolveWith( contexts, values ); - } - }; - }, - - progressValues, progressContexts, resolveContexts; - - // add listeners to Deferred subordinates; treat others as resolved - if ( length > 1 ) { - progressValues = new Array( length ); - progressContexts = new Array( length ); - resolveContexts = new Array( length ); - for ( ; i < length; i++ ) { - if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { - resolveValues[ i ].promise() - .done( updateFunc( i, resolveContexts, resolveValues ) ) - .fail( deferred.reject ) - .progress( updateFunc( i, progressContexts, progressValues ) ); - } else { - --remaining; - } - } - } - - // if we're not waiting on anything, resolve the master - if ( !remaining ) { - deferred.resolveWith( resolveContexts, resolveValues ); - } - - return deferred.promise(); - } -}); -jQuery.support = (function( support ) { - - var all, a, input, select, fragment, opt, eventName, isSupported, i, - div = document.createElement("div"); - - // Setup - div.setAttribute( "className", "t" ); - div.innerHTML = "
a"; - - // Finish early in limited (non-browser) environments - all = div.getElementsByTagName("*") || []; - a = div.getElementsByTagName("a")[ 0 ]; - if ( !a || !a.style || !all.length ) { - return support; - } - - // First batch of tests - select = document.createElement("select"); - opt = select.appendChild( document.createElement("option") ); - input = div.getElementsByTagName("input")[ 0 ]; - - a.style.cssText = "top:1px;float:left;opacity:.5"; - - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) - support.getSetAttribute = div.className !== "t"; - - // IE strips leading whitespace when .innerHTML is used - support.leadingWhitespace = div.firstChild.nodeType === 3; - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - support.tbody = !div.getElementsByTagName("tbody").length; - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - support.htmlSerialize = !!div.getElementsByTagName("link").length; - - // Get the style information from getAttribute - // (IE uses .cssText instead) - support.style = /top/.test( a.getAttribute("style") ); - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - support.hrefNormalized = a.getAttribute("href") === "/a"; - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - support.opacity = /^0.5/.test( a.style.opacity ); - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - support.cssFloat = !!a.style.cssFloat; - - // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) - support.checkOn = !!input.value; - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - support.optSelected = opt.selected; - - // Tests for enctype support on a form (#6743) - support.enctype = !!document.createElement("form").enctype; - - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - support.html5Clone = document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>"; - - // Will be defined later - support.inlineBlockNeedsLayout = false; - support.shrinkWrapBlocks = false; - support.pixelPosition = false; - support.deleteExpando = true; - support.noCloneEvent = true; - support.reliableMarginRight = true; - support.boxSizingReliable = true; - - // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Support: IE<9 - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - - // Check if we can trust getAttribute("value") - input = document.createElement("input"); - input.setAttribute( "value", "" ); - support.input = input.getAttribute( "value" ) === ""; - - // Check if an input maintains its value after becoming a radio - input.value = "t"; - input.setAttribute( "type", "radio" ); - support.radioValue = input.value === "t"; - - // #11217 - WebKit loses check when the name is after the checked attribute - input.setAttribute( "checked", "t" ); - input.setAttribute( "name", "t" ); - - fragment = document.createDocumentFragment(); - fragment.appendChild( input ); - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - support.appendChecked = input.checked; - - // WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Support: IE<9 - // Opera does not clone events (and typeof div.attachEvent === undefined). - // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() - if ( div.attachEvent ) { - div.attachEvent( "onclick", function() { - support.noCloneEvent = false; - }); - - div.cloneNode( true ).click(); - } - - // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event) - // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) - for ( i in { submit: true, change: true, focusin: true }) { - div.setAttribute( eventName = "on" + i, "t" ); - - support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false; - } - - div.style.backgroundClip = "content-box"; - div.cloneNode( true ).style.backgroundClip = ""; - support.clearCloneStyle = div.style.backgroundClip === "content-box"; - - // Support: IE<9 - // Iteration over object's inherited properties before its own. - for ( i in jQuery( support ) ) { - break; - } - support.ownLast = i !== "0"; - - // Run tests that need a body at doc ready - jQuery(function() { - var container, marginDiv, tds, - divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;", - body = document.getElementsByTagName("body")[0]; - - if ( !body ) { - // Return for frameset docs that don't have a body - return; - } - - container = document.createElement("div"); - container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; - - body.appendChild( container ).appendChild( div ); - - // Support: IE8 - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - div.innerHTML = "
t
"; - tds = div.getElementsByTagName("td"); - tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; - isSupported = ( tds[ 0 ].offsetHeight === 0 ); - - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; - - // Support: IE8 - // Check if empty table cells still have offsetWidth/Height - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - - // Check box-sizing and margin behavior. - div.innerHTML = ""; - div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; - - // Workaround failing boxSizing test due to offsetWidth returning wrong value - // with some non-1 values of body zoom, ticket #13543 - jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() { - support.boxSizing = div.offsetWidth === 4; - }); - - // Use window.getComputedStyle because jsdom on node.js will break without it. - if ( window.getComputedStyle ) { - support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; - support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; - - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. (#3333) - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - marginDiv = div.appendChild( document.createElement("div") ); - marginDiv.style.cssText = div.style.cssText = divReset; - marginDiv.style.marginRight = marginDiv.style.width = "0"; - div.style.width = "1px"; - - support.reliableMarginRight = - !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); - } - - if ( typeof div.style.zoom !== core_strundefined ) { - // Support: IE<8 - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - div.innerHTML = ""; - div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; - support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); - - // Support: IE6 - // Check if elements with layout shrink-wrap their children - div.style.display = "block"; - div.innerHTML = "
"; - div.firstChild.style.width = "5px"; - support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); - - if ( support.inlineBlockNeedsLayout ) { - // Prevent IE 6 from affecting layout for positioned elements #11048 - // Prevent IE from shrinking the body in IE 7 mode #12869 - // Support: IE<8 - body.style.zoom = 1; - } - } - - body.removeChild( container ); - - // Null elements to avoid leaks in IE - container = div = tds = marginDiv = null; - }); - - // Null elements to avoid leaks in IE - all = select = fragment = opt = a = input = null; - - return support; -})({}); - -var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, - rmultiDash = /([A-Z])/g; - -function internalData( elem, name, data, pvt /* Internal Use Only */ ){ - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var ret, thisCache, - internalKey = jQuery.expando, - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; - - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) { - return; - } - - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - id = elem[ internalKey ] = core_deletedIds.pop() || jQuery.guid++; - } else { - id = internalKey; - } - } - - if ( !cache[ id ] ) { - // Avoid exposing jQuery metadata on plain JS objects when the object - // is serialized using JSON.stringify - cache[ id ] = isNode ? {} : { toJSON: jQuery.noop }; - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ] = jQuery.extend( cache[ id ], name ); - } else { - cache[ id ].data = jQuery.extend( cache[ id ].data, name ); - } - } - - thisCache = cache[ id ]; - - // jQuery data() is stored in a separate object inside the object's internal data - // cache in order to avoid key collisions between internal data and user-defined - // data. - if ( !pvt ) { - if ( !thisCache.data ) { - thisCache.data = {}; - } - - thisCache = thisCache.data; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( typeof name === "string" ) { - - // First Try to find as-is property data - ret = thisCache[ name ]; - - // Test for null|undefined property data - if ( ret == null ) { - - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; - } - - return ret; -} - -function internalRemoveData( elem, name, pvt ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, i, - isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - id = isNode ? elem[ jQuery.expando ] : jQuery.expando; - - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } - - if ( name ) { - - thisCache = pvt ? cache[ id ] : cache[ id ].data; - - if ( thisCache ) { - - // Support array or space separated string names for data keys - if ( !jQuery.isArray( name ) ) { - - // try the string as a key before any manipulation - if ( name in thisCache ) { - name = [ name ]; - } else { - - // split the camel cased version by spaces unless a key with the spaces exists - name = jQuery.camelCase( name ); - if ( name in thisCache ) { - name = [ name ]; - } else { - name = name.split(" "); - } - } - } else { - // If "name" is an array of keys... - // When data is initially created, via ("key", "val") signature, - // keys will be converted to camelCase. - // Since there is no way to tell _how_ a key was added, remove - // both plain key and camelCase key. #12786 - // This will only penalize the array argument path. - name = name.concat( jQuery.map( name, jQuery.camelCase ) ); - } - - i = name.length; - while ( i-- ) { - delete thisCache[ name[i] ]; - } - - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) { - return; - } - } - } - - // See jQuery.data for more information - if ( !pvt ) { - delete cache[ id ].data; - - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject( cache[ id ] ) ) { - return; - } - } - - // Destroy the cache - if ( isNode ) { - jQuery.cleanData( [ elem ], true ); - - // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) - /* jshint eqeqeq: false */ - } else if ( jQuery.support.deleteExpando || cache != cache.window ) { - /* jshint eqeqeq: true */ - delete cache[ id ]; - - // When all else fails, null - } else { - cache[ id ] = null; - } -} - -jQuery.extend({ - cache: {}, - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "applet": true, - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" - }, - - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); - }, - - data: function( elem, name, data ) { - return internalData( elem, name, data ); - }, - - removeData: function( elem, name ) { - return internalRemoveData( elem, name ); - }, - - // For internal use only. - _data: function( elem, name, data ) { - return internalData( elem, name, data, true ); - }, - - _removeData: function( elem, name ) { - return internalRemoveData( elem, name, true ); - }, - - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - // Do not set data on non-element because it will not be cleared (#8335). - if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) { - return false; - } - - var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; - - // nodes accept data unless otherwise specified; rejection can be conditional - return !noData || noData !== true && elem.getAttribute("classid") === noData; - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var attrs, name, - data = null, - i = 0, - elem = this[0]; - - // Special expections of .data basically thwart jQuery.access, - // so implement the relevant behavior ourselves - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = jQuery.data( elem ); - - if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { - attrs = elem.attributes; - for ( ; i < attrs.length; i++ ) { - name = attrs[i].name; - - if ( name.indexOf("data-") === 0 ) { - name = jQuery.camelCase( name.slice(5) ); - - dataAttr( elem, name, data[ name ] ); - } - } - jQuery._data( elem, "parsedAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - return arguments.length > 1 ? - - // Sets one value - this.each(function() { - jQuery.data( this, key, value ); - }) : - - // Gets one value - // Try to fetch any internally stored data first - elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null; - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - // Only convert to a number if it doesn't change the string - +data + "" === data ? +data : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); - - } else { - data = undefined; - } - } - - return data; -} - -// checks a cache object for emptiness -function isEmptyDataObject( obj ) { - var name; - for ( name in obj ) { - - // if the public data object is empty, the private is still empty - if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { - continue; - } - if ( name !== "toJSON" ) { - return false; - } - } - - return true; -} -jQuery.extend({ - queue: function( elem, type, data ) { - var queue; - - if ( elem ) { - type = ( type || "fx" ) + "queue"; - queue = jQuery._data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !queue || jQuery.isArray(data) ) { - queue = jQuery._data( elem, type, jQuery.makeArray(data) ); - } else { - queue.push( data ); - } - } - return queue || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - startLength = queue.length, - fn = queue.shift(), - hooks = jQuery._queueHooks( elem, type ), - next = function() { - jQuery.dequeue( elem, type ); - }; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - startLength--; - } - - if ( fn ) { - - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - // clear up the last queue stop function - delete hooks.stop; - fn.call( elem, next, hooks ); - } - - if ( !startLength && hooks ) { - hooks.empty.fire(); - } - }, - - // not intended for public consumption - generates a queueHooks object, or returns the current one - _queueHooks: function( elem, type ) { - var key = type + "queueHooks"; - return jQuery._data( elem, key ) || jQuery._data( elem, key, { - empty: jQuery.Callbacks("once memory").add(function() { - jQuery._removeData( elem, type + "queue" ); - jQuery._removeData( elem, key ); - }) - }); - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[0], type ); - } - - return data === undefined ? - this : - this.each(function() { - var queue = jQuery.queue( this, type, data ); - - // ensure a hooks for this queue - jQuery._queueHooks( this, type ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = setTimeout( next, time ); - hooks.stop = function() { - clearTimeout( timeout ); - }; - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, obj ) { - var tmp, - count = 1, - defer = jQuery.Deferred(), - elements = this, - i = this.length, - resolve = function() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - }; - - if ( typeof type !== "string" ) { - obj = type; - type = undefined; - } - type = type || "fx"; - - while( i-- ) { - tmp = jQuery._data( elements[ i ], type + "queueHooks" ); - if ( tmp && tmp.empty ) { - count++; - tmp.empty.add( resolve ); - } - } - resolve(); - return defer.promise( obj ); - } -}); -var nodeHook, boolHook, - rclass = /[\t\r\n\f]/g, - rreturn = /\r/g, - rfocusable = /^(?:input|select|textarea|button|object)$/i, - rclickable = /^(?:a|area)$/i, - ruseDefault = /^(?:checked|selected)$/i, - getSetAttribute = jQuery.support.getSetAttribute, - getSetInput = jQuery.support.input; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, - - addClass: function( value ) { - var classes, elem, cur, clazz, j, - i = 0, - len = this.length, - proceed = typeof value === "string" && value; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call( this, j, this.className ) ); - }); - } - - if ( proceed ) { - // The disjunction here is for better compressibility (see removeClass) - classes = ( value || "" ).match( core_rnotwhite ) || []; - - for ( ; i < len; i++ ) { - elem = this[ i ]; - cur = elem.nodeType === 1 && ( elem.className ? - ( " " + elem.className + " " ).replace( rclass, " " ) : - " " - ); - - if ( cur ) { - j = 0; - while ( (clazz = classes[j++]) ) { - if ( cur.indexOf( " " + clazz + " " ) < 0 ) { - cur += clazz + " "; - } - } - elem.className = jQuery.trim( cur ); - - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classes, elem, cur, clazz, j, - i = 0, - len = this.length, - proceed = arguments.length === 0 || typeof value === "string" && value; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call( this, j, this.className ) ); - }); - } - if ( proceed ) { - classes = ( value || "" ).match( core_rnotwhite ) || []; - - for ( ; i < len; i++ ) { - elem = this[ i ]; - // This expression is here for better compressibility (see addClass) - cur = elem.nodeType === 1 && ( elem.className ? - ( " " + elem.className + " " ).replace( rclass, " " ) : - "" - ); - - if ( cur ) { - j = 0; - while ( (clazz = classes[j++]) ) { - // Remove *all* instances - while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { - cur = cur.replace( " " + clazz + " ", " " ); - } - } - elem.className = value ? jQuery.trim( cur ) : ""; - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value; - - if ( typeof stateVal === "boolean" && type === "string" ) { - return stateVal ? this.addClass( value ) : this.removeClass( value ); - } - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - classNames = value.match( core_rnotwhite ) || []; - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space separated list - if ( self.hasClass( className ) ) { - self.removeClass( className ); - } else { - self.addClass( className ); - } - } - - // Toggle whole class name - } else if ( type === core_strundefined || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } - - // If the element has a class name or if we're passed "false", - // then remove the whole classname (if there was one, the above saved it). - // Otherwise bring back whatever was previously saved (if anything), - // falling back to the empty string if nothing was stored. - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var ret, hooks, isFunction, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return; - } - - isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, jQuery( this ).val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // Use proper attribute retrieval(#6932, #12072) - var val = jQuery.find.attr( elem, "value" ); - return val != null ? - val : - elem.text; - } - }, - select: { - get: function( elem ) { - var value, option, - options = elem.options, - index = elem.selectedIndex, - one = elem.type === "select-one" || index < 0, - values = one ? null : [], - max = one ? index + 1 : options.length, - i = index < 0 ? - max : - one ? index : 0; - - // Loop through all the selected options - for ( ; i < max; i++ ) { - option = options[ i ]; - - // oldIE doesn't update selected after form reset (#2551) - if ( ( option.selected || i === index ) && - // Don't return options that are disabled or in a disabled optgroup - ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && - ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - return values; - }, - - set: function( elem, value ) { - var optionSet, option, - options = elem.options, - values = jQuery.makeArray( value ), - i = options.length; - - while ( i-- ) { - option = options[ i ]; - if ( (option.selected = jQuery.inArray( jQuery(option).val(), values ) >= 0) ) { - optionSet = true; - } - } - - // force browsers to behave consistently when non-matching value is set - if ( !optionSet ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - attr: function( elem, name, value ) { - var hooks, ret, - nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === core_strundefined ) { - return jQuery.prop( elem, name, value ); - } - - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || - ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - - } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, value + "" ); - return value; - } - - } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - ret = jQuery.find.attr( elem, name ); - - // Non-existent attributes return null, we normalize to undefined - return ret == null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, value ) { - var name, propName, - i = 0, - attrNames = value && value.match( core_rnotwhite ); - - if ( attrNames && elem.nodeType === 1 ) { - while ( (name = attrNames[i++]) ) { - propName = jQuery.propFix[ name ] || name; - - // Boolean attributes get special treatment (#10870) - if ( jQuery.expr.match.bool.test( name ) ) { - // Set corresponding property to false - if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { - elem[ propName ] = false; - // Support: IE<9 - // Also clear defaultChecked/defaultSelected (if appropriate) - } else { - elem[ jQuery.camelCase( "default-" + name ) ] = - elem[ propName ] = false; - } - - // See #9699 for explanation of this approach (setting first, then removal) - } else { - jQuery.attr( elem, name, "" ); - } - - elem.removeAttribute( getSetAttribute ? name : propName ); - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to default in case type is set after value during creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - } - }, - - propFix: { - "for": "htmlFor", - "class": "className" - }, - - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ? - ret : - ( elem[ name ] = value ); - - } else { - return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ? - ret : - elem[ name ]; - } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - // Use proper attribute retrieval(#12072) - var tabindex = jQuery.find.attr( elem, "tabindex" ); - - return tabindex ? - parseInt( tabindex, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - -1; - } - } - } -}); - -// Hooks for boolean attributes -boolHook = { - set: function( elem, value, name ) { - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { - // IE<8 needs the *property* name - elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); - - // Use defaultChecked and defaultSelected for oldIE - } else { - elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; - } - - return name; - } -}; -jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { - var getter = jQuery.expr.attrHandle[ name ] || jQuery.find.attr; - - jQuery.expr.attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ? - function( elem, name, isXML ) { - var fn = jQuery.expr.attrHandle[ name ], - ret = isXML ? - undefined : - /* jshint eqeqeq: false */ - (jQuery.expr.attrHandle[ name ] = undefined) != - getter( elem, name, isXML ) ? - - name.toLowerCase() : - null; - jQuery.expr.attrHandle[ name ] = fn; - return ret; - } : - function( elem, name, isXML ) { - return isXML ? - undefined : - elem[ jQuery.camelCase( "default-" + name ) ] ? - name.toLowerCase() : - null; - }; -}); - -// fix oldIE attroperties -if ( !getSetInput || !getSetAttribute ) { - jQuery.attrHooks.value = { - set: function( elem, value, name ) { - if ( jQuery.nodeName( elem, "input" ) ) { - // Does not return so that setAttribute is also used - elem.defaultValue = value; - } else { - // Use nodeHook if defined (#1954); otherwise setAttribute is fine - return nodeHook && nodeHook.set( elem, value, name ); - } - } - }; -} - -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !getSetAttribute ) { - - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = { - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - elem.setAttributeNode( - (ret = elem.ownerDocument.createAttribute( name )) - ); - } - - ret.value = value += ""; - - // Break association with cloned elements by also using setAttribute (#9646) - return name === "value" || value === elem.getAttribute( name ) ? - value : - undefined; - } - }; - jQuery.expr.attrHandle.id = jQuery.expr.attrHandle.name = jQuery.expr.attrHandle.coords = - // Some attributes are constructed with empty-string values when not defined - function( elem, name, isXML ) { - var ret; - return isXML ? - undefined : - (ret = elem.getAttributeNode( name )) && ret.value !== "" ? - ret.value : - null; - }; - jQuery.valHooks.button = { - get: function( elem, name ) { - var ret = elem.getAttributeNode( name ); - return ret && ret.specified ? - ret.value : - undefined; - }, - set: nodeHook.set - }; - - // Set contenteditable to false on removals(#10429) - // Setting to empty string throws an error as an invalid value - jQuery.attrHooks.contenteditable = { - set: function( elem, value, name ) { - nodeHook.set( elem, value === "" ? false : value, name ); - } - }; - - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }; - }); -} - - -// Some attributes require a special call on IE -// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !jQuery.support.hrefNormalized ) { - // href/src property should get the full normalized URL (#10299/#12915) - jQuery.each([ "href", "src" ], function( i, name ) { - jQuery.propHooks[ name ] = { - get: function( elem ) { - return elem.getAttribute( name, 4 ); - } - }; - }); -} - -if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Note: IE uppercases css property names, but if we were to .toLowerCase() - // .cssText, that would destroy case senstitivity in URL's, like in "background" - return elem.style.cssText || undefined; - }, - set: function( elem, value ) { - return ( elem.style.cssText = value + "" ); - } - }; -} - -// Safari mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = { - get: function( elem ) { - var parent = elem.parentNode; - - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - return null; - } - }; -} - -jQuery.each([ - "tabIndex", - "readOnly", - "maxLength", - "cellSpacing", - "cellPadding", - "rowSpan", - "colSpan", - "useMap", - "frameBorder", - "contentEditable" -], function() { - jQuery.propFix[ this.toLowerCase() ] = this; -}); - -// IE6/7 call enctype encoding -if ( !jQuery.support.enctype ) { - jQuery.propFix.enctype = "encoding"; -} - -// Radios and checkboxes getter/setter -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } - } - }; - if ( !jQuery.support.checkOn ) { - jQuery.valHooks[ this ].get = function( elem ) { - // Support: Webkit - // "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - }; - } -}); -var rformElems = /^(?:input|select|textarea)$/i, - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; - -function returnTrue() { - return true; -} - -function returnFalse() { - return false; -} - -function safeActiveElement() { - try { - return document.activeElement; - } catch ( err ) { } -} - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - global: {}, - - add: function( elem, types, handler, data, selector ) { - var tmp, events, t, handleObjIn, - special, eventHandle, handleObj, - handlers, type, namespaces, origType, - elemData = jQuery._data( elem ); - - // Don't attach events to noData or text/comment nodes (but allow plain objects) - if ( !elemData ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - if ( !(events = elemData.events) ) { - events = elemData.events = {}; - } - if ( !(eventHandle = elemData.handle) ) { - eventHandle = elemData.handle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - types = ( types || "" ).match( core_rnotwhite ) || [""]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[t] ) || []; - type = origType = tmp[1]; - namespaces = ( tmp[2] || "" ).split( "." ).sort(); - - // There *must* be a type, no attaching namespace-only handlers - if ( !type ) { - continue; - } - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: origType, - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - needsContext: selector && jQuery.expr.match.needsContext.test( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - if ( !(handlers = events[ type ]) ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener/attachEvent if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - var j, handleObj, tmp, - origCount, t, events, - special, handlers, type, - namespaces, origType, - elemData = jQuery.hasData( elem ) && jQuery._data( elem ); - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = ( types || "" ).match( core_rnotwhite ) || [""]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[t] ) || []; - type = origType = tmp[1]; - namespaces = ( tmp[2] || "" ).split( "." ).sort(); - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector ? special.delegateType : special.bindType ) || type; - handlers = events[ type ] || []; - tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); - - // Remove matching events - origCount = j = handlers.length; - while ( j-- ) { - handleObj = handlers[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !tmp || tmp.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - handlers.splice( j, 1 ); - - if ( handleObj.selector ) { - handlers.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( origCount && !handlers.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - delete elemData.handle; - - // removeData also checks for emptiness and clears the expando if empty - // so use it instead of delete - jQuery._removeData( elem, "events" ); - } - }, - - trigger: function( event, data, elem, onlyHandlers ) { - var handle, ontype, cur, - bubbleType, special, tmp, i, - eventPath = [ elem || document ], - type = core_hasOwn.call( event, "type" ) ? event.type : event, - namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; - - cur = tmp = elem = elem || document; - - // Don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf(".") >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - ontype = type.indexOf(":") < 0 && "on" + type; - - // Caller can pass in a jQuery.Event object, Object, or just an event type string - event = event[ jQuery.expando ] ? - event : - new jQuery.Event( type, typeof event === "object" && event ); - - // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) - event.isTrigger = onlyHandlers ? 2 : 3; - event.namespace = namespaces.join("."); - event.namespace_re = event.namespace ? - new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : - null; - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data == null ? - [ event ] : - jQuery.makeArray( data, [ event ] ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - if ( !rfocusMorph.test( bubbleType + type ) ) { - cur = cur.parentNode; - } - for ( ; cur; cur = cur.parentNode ) { - eventPath.push( cur ); - tmp = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( tmp === (elem.ownerDocument || document) ) { - eventPath.push( tmp.defaultView || tmp.parentWindow || window ); - } - } - - // Fire handlers on the event path - i = 0; - while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { - - event.type = i > 1 ? - bubbleType : - special.bindType || type; - - // jQuery handler - handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - - // Native handler - handle = ontype && cur[ ontype ]; - if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { - event.preventDefault(); - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && - jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. - // Don't do default actions on window, that's where global variables be (#6170) - if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - tmp = elem[ ontype ]; - - if ( tmp ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - try { - elem[ type ](); - } catch ( e ) { - // IE<9 dies on focus/blur to hidden element (#1486,#12518) - // only reproducible on winXP IE8 native, not IE9 in IE8 mode - } - jQuery.event.triggered = undefined; - - if ( tmp ) { - elem[ ontype ] = tmp; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event ); - - var i, ret, handleObj, matched, j, - handlerQueue = [], - args = core_slice.call( arguments ), - handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], - special = jQuery.event.special[ event.type ] || {}; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers - handlerQueue = jQuery.event.handlers.call( this, event, handlers ); - - // Run delegates first; they may want to stop propagation beneath us - i = 0; - while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { - event.currentTarget = matched.elem; - - j = 0; - while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { - - // Triggered event must either 1) have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { - - event.handleObj = handleObj; - event.data = handleObj.data; - - ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) - .apply( matched.elem, args ); - - if ( ret !== undefined ) { - if ( (event.result = ret) === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - handlers: function( event, handlers ) { - var sel, handleObj, matches, i, - handlerQueue = [], - delegateCount = handlers.delegateCount, - cur = event.target; - - // Find delegate handlers - // Black-hole SVG instance trees (#13180) - // Avoid non-left-click bubbling in Firefox (#3861) - if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { - - /* jshint eqeqeq: false */ - for ( ; cur != this; cur = cur.parentNode || this ) { - /* jshint eqeqeq: true */ - - // Don't check non-elements (#13208) - // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { - matches = []; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - - // Don't conflict with Object.prototype properties (#13203) - sel = handleObj.selector + " "; - - if ( matches[ sel ] === undefined ) { - matches[ sel ] = handleObj.needsContext ? - jQuery( sel, this ).index( cur ) >= 0 : - jQuery.find( sel, this, null, [ cur ] ).length; - } - if ( matches[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, handlers: matches }); - } - } - } - } - - // Add the remaining (directly-bound) handlers - if ( delegateCount < handlers.length ) { - handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); - } - - return handlerQueue; - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, copy, - type = event.type, - originalEvent = event, - fixHook = this.fixHooks[ type ]; - - if ( !fixHook ) { - this.fixHooks[ type ] = fixHook = - rmouseEvent.test( type ) ? this.mouseHooks : - rkeyEvent.test( type ) ? this.keyHooks : - {}; - } - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = new jQuery.Event( originalEvent ); - - i = copy.length; - while ( i-- ) { - prop = copy[ i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Support: IE<9 - // Fix target property (#1925) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Support: Chrome 23+, Safari? - // Target should not be a text node (#504, #13143) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // Support: IE<9 - // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) - event.metaKey = !!event.metaKey; - - return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var body, eventDoc, doc, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - special: { - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - focus: { - // Fire native event if possible so blur/focus sequence is correct - trigger: function() { - if ( this !== safeActiveElement() && this.focus ) { - try { - this.focus(); - return false; - } catch ( e ) { - // Support: IE<9 - // If we error on focus to hidden element (#1486, #12518), - // let .trigger() run the handlers - } - } - }, - delegateType: "focusin" - }, - blur: { - trigger: function() { - if ( this === safeActiveElement() && this.blur ) { - this.blur(); - return false; - } - }, - delegateType: "focusout" - }, - click: { - // For checkbox, fire native event so checked state will be right - trigger: function() { - if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { - this.click(); - return false; - } - }, - - // For cross-browser consistency, don't fire native .click() on links - _default: function( event ) { - return jQuery.nodeName( event.target, "a" ); - } - }, - - beforeunload: { - postDispatch: function( event ) { - - // Even when returnValue equals to undefined Firefox will still show alert - if ( event.result !== undefined ) { - event.originalEvent.returnValue = event.result; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { - type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - var name = "on" + type; - - if ( elem.detachEvent ) { - - // #8545, #7054, preventing memory leaks for custom events in IE6-8 - // detachEvent needed property on element, by name of that event, to properly expose it to GC - if ( typeof elem[ name ] === core_strundefined ) { - elem[ name ] = null; - } - - elem.detachEvent( name, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse, - - preventDefault: function() { - var e = this.originalEvent; - - this.isDefaultPrevented = returnTrue; - if ( !e ) { - return; - } - - // If preventDefault exists, run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // Support: IE - // Otherwise set the returnValue property of the original event to false - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - var e = this.originalEvent; - - this.isPropagationStopped = returnTrue; - if ( !e ) { - return; - } - // If stopPropagation exists, run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - - // Support: IE - // Set the cancelBubble property of the original event to true - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - } -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var ret, - target = this, - related = event.relatedTarget, - handleObj = event.handleObj; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// IE submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !jQuery._data( form, "submitBubbles" ) ) { - jQuery.event.add( form, "submit._submit", function( event ) { - event._submit_bubble = true; - }); - jQuery._data( form, "submitBubbles", true ); - } - }); - // return undefined since we don't need an event listener - }, - - postDispatch: function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( event._submit_bubble ) { - delete event._submit_bubble; - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - } - }, - - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; -} - -// IE change delegation and checkbox/radio fix -if ( !jQuery.support.changeBubbles ) { - - jQuery.event.special.change = { - - setup: function() { - - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - } - // Allow triggered, simulated change events (#11500) - jQuery.event.simulate( "change", this, event, true ); - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; - - if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - jQuery._data( elem, "changeBubbles", true ); - } - }); - }, - - handle: function( event ) { - var elem = event.target; - - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, - - teardown: function() { - jQuery.event.remove( this, "._change" ); - - return !rformElems.test( this.nodeName ); - } - }; -} - -// Create "bubbling" focus and blur events -if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var type, origFn; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on( types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - var handleObj, type; - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - var elem = this[0]; - if ( elem ) { - return jQuery.event.trigger( type, data, elem, true ); - } - } -}); -var isSimple = /^.[^:#\[\.,]*$/, - rparentsprev = /^(?:parents|prev(?:Until|All))/, - rneedsContext = jQuery.expr.match.needsContext, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var i, - ret = [], - self = this, - len = self.length; - - if ( typeof selector !== "string" ) { - return this.pushStack( jQuery( selector ).filter(function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }) ); - } - - for ( i = 0; i < len; i++ ) { - jQuery.find( selector, self[ i ], ret ); - } - - // Needed because $( selector, context ) becomes $( context ).find( selector ) - ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); - ret.selector = this.selector ? this.selector + " " + selector : selector; - return ret; - }, - - has: function( target ) { - var i, - targets = jQuery( target, this ), - len = targets.length; - - return this.filter(function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector || [], true) ); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector || [], false) ); - }, - - is: function( selector ) { - return !!winnow( - this, - - // If this is a positional/relative selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - typeof selector === "string" && rneedsContext.test( selector ) ? - jQuery( selector ) : - selector || [], - false - ).length; - }, - - closest: function( selectors, context ) { - var cur, - i = 0, - l = this.length, - ret = [], - pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( ; i < l; i++ ) { - for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { - // Always skip document fragments - if ( cur.nodeType < 11 && (pos ? - pos.index(cur) > -1 : - - // Don't pass non-elements to Sizzle - cur.nodeType === 1 && - jQuery.find.matchesSelector(cur, selectors)) ) { - - cur = ret.push( cur ); - break; - } - } - } - - return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } - - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( jQuery.unique(all) ); - }, - - addBack: function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter(selector) - ); - } -}); - -function sibling( cur, dir ) { - do { - cur = cur[ dir ]; - } while ( cur && cur.nodeType !== 1 ); - - return cur; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return sibling( elem, "nextSibling" ); - }, - prev: function( elem ) { - return sibling( elem, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.merge( [], elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( name.slice( -5 ) !== "Until" ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - if ( this.length > 1 ) { - // Remove duplicates - if ( !guaranteedUnique[ name ] ) { - ret = jQuery.unique( ret ); - } - - // Reverse order for parents* and prev-derivatives - if ( rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - } - - return this.pushStack( ret ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - var elem = elems[ 0 ]; - - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 && elem.nodeType === 1 ? - jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : - jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { - return elem.nodeType === 1; - })); - }, - - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, not ) { - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep( elements, function( elem, i ) { - /* jshint -W018 */ - return !!qualifier.call( elem, i, elem ) !== not; - }); - - } - - if ( qualifier.nodeType ) { - return jQuery.grep( elements, function( elem ) { - return ( elem === qualifier ) !== not; - }); - - } - - if ( typeof qualifier === "string" ) { - if ( isSimple.test( qualifier ) ) { - return jQuery.filter( qualifier, elements, not ); - } - - qualifier = jQuery.filter( qualifier, elements ); - } - - return jQuery.grep( elements, function( elem ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not; - }); -} -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); - - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; -} - -var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, - rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, - rtagName = /<([\w:]+)/, - rtbody = /\s*$/g, - - // We have to close these tags to support XHTML (#13200) - wrapMap = { - option: [ 1, "" ], - legend: [ 1, "
", "
" ], - area: [ 1, "", "" ], - param: [ 1, "", "" ], - thead: [ 1, "", "
" ], - tr: [ 2, "", "
" ], - col: [ 2, "", "
" ], - td: [ 3, "", "
" ], - - // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, - // unless wrapped in a div with non-breaking characters in front of it. - _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X
", "
" ] - }, - safeFragment = createSafeFragment( document ), - fragmentDiv = safeFragment.appendChild( document.createElement("div") ); - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -jQuery.fn.extend({ - text: function( value ) { - return jQuery.access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); - }, null, value, arguments.length ); - }, - - append: function() { - return this.domManip( arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.appendChild( elem ); - } - }); - }, - - prepend: function() { - return this.domManip( arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.insertBefore( elem, target.firstChild ); - } - }); - }, - - before: function() { - return this.domManip( arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this ); - } - }); - }, - - after: function() { - return this.domManip( arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - } - }); - }, - - // keepData is for internal use only--do not document - remove: function( selector, keepData ) { - var elem, - elems = selector ? jQuery.filter( selector, this ) : this, - i = 0; - - for ( ; (elem = elems[i]) != null; i++ ) { - - if ( !keepData && elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem ) ); - } - - if ( elem.parentNode ) { - if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { - setGlobalEval( getAll( elem, "script" ) ); - } - elem.parentNode.removeChild( elem ); - } - } - - return this; - }, - - empty: function() { - var elem, - i = 0; - - for ( ; (elem = this[i]) != null; i++ ) { - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - } - - // Remove any remaining nodes - while ( elem.firstChild ) { - elem.removeChild( elem.firstChild ); - } - - // If this is a select, ensure that it displays empty (#12336) - // Support: IE<9 - if ( elem.options && jQuery.nodeName( elem, "select" ) ) { - elem.options.length = 0; - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map( function () { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - }); - }, - - html: function( value ) { - return jQuery.access( this, function( value ) { - var elem = this[0] || {}, - i = 0, - l = this.length; - - if ( value === undefined ) { - return elem.nodeType === 1 ? - elem.innerHTML.replace( rinlinejQuery, "" ) : - undefined; - } - - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && - ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && - !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { - - value = value.replace( rxhtmlTag, "<$1>" ); - - try { - for (; i < l; i++ ) { - // Remove element nodes and prevent memory leaks - elem = this[i] || {}; - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - elem.innerHTML = value; - } - } - - elem = 0; - - // If using innerHTML throws an exception, use the fallback method - } catch(e) {} - } - - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, - - replaceWith: function() { - var - // Snapshot the DOM in case .domManip sweeps something relevant into its fragment - args = jQuery.map( this, function( elem ) { - return [ elem.nextSibling, elem.parentNode ]; - }), - i = 0; - - // Make the changes, replacing each context element with the new content - this.domManip( arguments, function( elem ) { - var next = args[ i++ ], - parent = args[ i++ ]; - - if ( parent ) { - // Don't use the snapshot next if it has moved (#13810) - if ( next && next.parentNode !== parent ) { - next = this.nextSibling; - } - jQuery( this ).remove(); - parent.insertBefore( elem, next ); - } - // Allow new content to include elements from the context set - }, true ); - - // Force removal if there was no new content (e.g., from empty arguments) - return i ? this : this.remove(); - }, - - detach: function( selector ) { - return this.remove( selector, true ); - }, - - domManip: function( args, callback, allowIntersection ) { - - // Flatten any nested arrays - args = core_concat.apply( [], args ); - - var first, node, hasScripts, - scripts, doc, fragment, - i = 0, - l = this.length, - set = this, - iNoClone = l - 1, - value = args[0], - isFunction = jQuery.isFunction( value ); - - // We can't cloneNode fragments that contain checked, in WebKit - if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) { - return this.each(function( index ) { - var self = set.eq( index ); - if ( isFunction ) { - args[0] = value.call( this, index, self.html() ); - } - self.domManip( args, callback, allowIntersection ); - }); - } - - if ( l ) { - fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, !allowIntersection && this ); - first = fragment.firstChild; - - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } - - if ( first ) { - scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); - hasScripts = scripts.length; - - // Use the original fragment for the last item instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - for ( ; i < l; i++ ) { - node = fragment; - - if ( i !== iNoClone ) { - node = jQuery.clone( node, true, true ); - - // Keep references to cloned scripts for later restoration - if ( hasScripts ) { - jQuery.merge( scripts, getAll( node, "script" ) ); - } - } - - callback.call( this[i], node, i ); - } - - if ( hasScripts ) { - doc = scripts[ scripts.length - 1 ].ownerDocument; - - // Reenable scripts - jQuery.map( scripts, restoreScript ); - - // Evaluate executable scripts on first document insertion - for ( i = 0; i < hasScripts; i++ ) { - node = scripts[ i ]; - if ( rscriptType.test( node.type || "" ) && - !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { - - if ( node.src ) { - // Hope ajax is available... - jQuery._evalUrl( node.src ); - } else { - jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); - } - } - } - } - - // Fix #11809: Avoid leaking memory - fragment = first = null; - } - } - - return this; - } -}); - -// Support: IE<8 -// Manipulating tables requires a tbody -function manipulationTarget( elem, content ) { - return jQuery.nodeName( elem, "table" ) && - jQuery.nodeName( content.nodeType === 1 ? content : content.firstChild, "tr" ) ? - - elem.getElementsByTagName("tbody")[0] || - elem.appendChild( elem.ownerDocument.createElement("tbody") ) : - elem; -} - -// Replace/restore the type attribute of script elements for safe DOM manipulation -function disableScript( elem ) { - elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type; - return elem; -} -function restoreScript( elem ) { - var match = rscriptTypeMasked.exec( elem.type ); - if ( match ) { - elem.type = match[1]; - } else { - elem.removeAttribute("type"); - } - return elem; -} - -// Mark scripts as having already been evaluated -function setGlobalEval( elems, refElements ) { - var elem, - i = 0; - for ( ; (elem = elems[i]) != null; i++ ) { - jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); - } -} - -function cloneCopyEvent( src, dest ) { - - if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { - return; - } - - var type, i, l, - oldData = jQuery._data( src ), - curData = jQuery._data( dest, oldData ), - events = oldData.events; - - if ( events ) { - delete curData.handle; - curData.events = {}; - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } - - // make the cloned public data object a copy from the original - if ( curData.data ) { - curData.data = jQuery.extend( {}, curData.data ); - } -} - -function fixCloneNodeIssues( src, dest ) { - var nodeName, e, data; - - // We do not need to do anything for non-Elements - if ( dest.nodeType !== 1 ) { - return; - } - - nodeName = dest.nodeName.toLowerCase(); - - // IE6-8 copies events bound via attachEvent when using cloneNode. - if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) { - data = jQuery._data( dest ); - - for ( e in data.events ) { - jQuery.removeEvent( dest, e, data.handle ); - } - - // Event data gets referenced instead of copied if the expando gets copied too - dest.removeAttribute( jQuery.expando ); - } - - // IE blanks contents when cloning scripts, and tries to evaluate newly-set text - if ( nodeName === "script" && dest.text !== src.text ) { - disableScript( dest ).text = src.text; - restoreScript( dest ); - - // IE6-10 improperly clones children of object elements using classid. - // IE10 throws NoModificationAllowedError if parent is null, #12132. - } else if ( nodeName === "object" ) { - if ( dest.parentNode ) { - dest.outerHTML = src.outerHTML; - } - - // This path appears unavoidable for IE9. When cloning an object - // element in IE9, the outerHTML strategy above is not sufficient. - // If the src has innerHTML and the destination does not, - // copy the src.innerHTML into the dest.innerHTML. #10324 - if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { - dest.innerHTML = src.innerHTML; - } - - } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) { - // IE6-8 fails to persist the checked state of a cloned checkbox - // or radio button. Worse, IE6-7 fail to give the cloned element - // a checked appearance if the defaultChecked value isn't also set - - dest.defaultChecked = dest.checked = src.checked; - - // IE6-7 get confused and end up setting the value of a cloned - // checkbox/radio button to an empty string instead of "on" - if ( dest.value !== src.value ) { - dest.value = src.value; - } - - // IE6-8 fails to return the selected option to the default selected - // state when cloning options - } else if ( nodeName === "option" ) { - dest.defaultSelected = dest.selected = src.defaultSelected; - - // IE6-8 fails to set the defaultValue to the correct value when - // cloning other types of input fields - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - } -} - -jQuery.each({ - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - i = 0, - ret = [], - insert = jQuery( selector ), - last = insert.length - 1; - - for ( ; i <= last; i++ ) { - elems = i === last ? this : this.clone(true); - jQuery( insert[i] )[ original ]( elems ); - - // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() - core_push.apply( ret, elems.get() ); - } - - return this.pushStack( ret ); - }; -}); - -function getAll( context, tag ) { - var elems, elem, - i = 0, - found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) : - typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) : - undefined; - - if ( !found ) { - for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { - if ( !tag || jQuery.nodeName( elem, tag ) ) { - found.push( elem ); - } else { - jQuery.merge( found, getAll( elem, tag ) ); - } - } - } - - return tag === undefined || tag && jQuery.nodeName( context, tag ) ? - jQuery.merge( [ context ], found ) : - found; -} - -// Used in buildFragment, fixes the defaultChecked property -function fixDefaultChecked( elem ) { - if ( manipulation_rcheckableType.test( elem.type ) ) { - elem.defaultChecked = elem.checked; - } -} - -jQuery.extend({ - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var destElements, node, clone, i, srcElements, - inPage = jQuery.contains( elem.ownerDocument, elem ); - - if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { - clone = elem.cloneNode( true ); - - // IE<=8 does not properly clone detached, unknown element nodes - } else { - fragmentDiv.innerHTML = elem.outerHTML; - fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); - } - - if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && - (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { - - // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 - destElements = getAll( clone ); - srcElements = getAll( elem ); - - // Fix all IE cloning issues - for ( i = 0; (node = srcElements[i]) != null; ++i ) { - // Ensure that the destination node is not null; Fixes #9587 - if ( destElements[i] ) { - fixCloneNodeIssues( node, destElements[i] ); - } - } - } - - // Copy the events from the original to the clone - if ( dataAndEvents ) { - if ( deepDataAndEvents ) { - srcElements = srcElements || getAll( elem ); - destElements = destElements || getAll( clone ); - - for ( i = 0; (node = srcElements[i]) != null; i++ ) { - cloneCopyEvent( node, destElements[i] ); - } - } else { - cloneCopyEvent( elem, clone ); - } - } - - // Preserve script evaluation history - destElements = getAll( clone, "script" ); - if ( destElements.length > 0 ) { - setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); - } - - destElements = srcElements = node = null; - - // Return the cloned set - return clone; - }, - - buildFragment: function( elems, context, scripts, selection ) { - var j, elem, contains, - tmp, tag, tbody, wrap, - l = elems.length, - - // Ensure a safe fragment - safe = createSafeFragment( context ), - - nodes = [], - i = 0; - - for ( ; i < l; i++ ) { - elem = elems[ i ]; - - if ( elem || elem === 0 ) { - - // Add nodes directly - if ( jQuery.type( elem ) === "object" ) { - jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); - - // Convert non-html into a text node - } else if ( !rhtml.test( elem ) ) { - nodes.push( context.createTextNode( elem ) ); - - // Convert html into DOM nodes - } else { - tmp = tmp || safe.appendChild( context.createElement("div") ); - - // Deserialize a standard representation - tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - - tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[2]; - - // Descend through wrappers to the right content - j = wrap[0]; - while ( j-- ) { - tmp = tmp.lastChild; - } - - // Manually add leading whitespace removed by IE - if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { - nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); - } - - // Remove IE's autoinserted from table fragments - if ( !jQuery.support.tbody ) { - - // String was a , *may* have spurious - elem = tag === "table" && !rtbody.test( elem ) ? - tmp.firstChild : - - // String was a bare or - wrap[1] === "
" && !rtbody.test( elem ) ? - tmp : - 0; - - j = elem && elem.childNodes.length; - while ( j-- ) { - if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { - elem.removeChild( tbody ); - } - } - } - - jQuery.merge( nodes, tmp.childNodes ); - - // Fix #12392 for WebKit and IE > 9 - tmp.textContent = ""; - - // Fix #12392 for oldIE - while ( tmp.firstChild ) { - tmp.removeChild( tmp.firstChild ); - } - - // Remember the top-level container for proper cleanup - tmp = safe.lastChild; - } - } - } - - // Fix #11356: Clear elements from fragment - if ( tmp ) { - safe.removeChild( tmp ); - } - - // Reset defaultChecked for any radios and checkboxes - // about to be appended to the DOM in IE 6/7 (#8060) - if ( !jQuery.support.appendChecked ) { - jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); - } - - i = 0; - while ( (elem = nodes[ i++ ]) ) { - - // #4087 - If origin and destination elements are the same, and this is - // that element, do not do anything - if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { - continue; - } - - contains = jQuery.contains( elem.ownerDocument, elem ); - - // Append to fragment - tmp = getAll( safe.appendChild( elem ), "script" ); - - // Preserve script evaluation history - if ( contains ) { - setGlobalEval( tmp ); - } - - // Capture executables - if ( scripts ) { - j = 0; - while ( (elem = tmp[ j++ ]) ) { - if ( rscriptType.test( elem.type || "" ) ) { - scripts.push( elem ); - } - } - } - } - - tmp = null; - - return safe; - }, - - cleanData: function( elems, /* internal */ acceptData ) { - var elem, type, id, data, - i = 0, - internalKey = jQuery.expando, - cache = jQuery.cache, - deleteExpando = jQuery.support.deleteExpando, - special = jQuery.event.special; - - for ( ; (elem = elems[i]) != null; i++ ) { - - if ( acceptData || jQuery.acceptData( elem ) ) { - - id = elem[ internalKey ]; - data = id && cache[ id ]; - - if ( data ) { - if ( data.events ) { - for ( type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } - - // Remove cache only if it was not already removed by jQuery.event.remove - if ( cache[ id ] ) { - - delete cache[ id ]; - - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( deleteExpando ) { - delete elem[ internalKey ]; - - } else if ( typeof elem.removeAttribute !== core_strundefined ) { - elem.removeAttribute( internalKey ); - - } else { - elem[ internalKey ] = null; - } - - core_deletedIds.push( id ); - } - } - } - } - }, - - _evalUrl: function( url ) { - return jQuery.ajax({ - url: url, - type: "GET", - dataType: "script", - async: false, - global: false, - "throws": true - }); - } -}); -jQuery.fn.extend({ - wrapAll: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapAll( html.call(this, i) ); - }); - } - - if ( this[0] ) { - // The elements to wrap the target around - var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); - - if ( this[0].parentNode ) { - wrap.insertBefore( this[0] ); - } - - wrap.map(function() { - var elem = this; - - while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { - elem = elem.firstChild; - } - - return elem; - }).append( this ); - } - - return this; - }, - - wrapInner: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapInner( html.call(this, i) ); - }); - } - - return this.each(function() { - var self = jQuery( this ), - contents = self.contents(); - - if ( contents.length ) { - contents.wrapAll( html ); - - } else { - self.append( html ); - } - }); - }, - - wrap: function( html ) { - var isFunction = jQuery.isFunction( html ); - - return this.each(function(i) { - jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); - }); - }, - - unwrap: function() { - return this.parent().each(function() { - if ( !jQuery.nodeName( this, "body" ) ) { - jQuery( this ).replaceWith( this.childNodes ); - } - }).end(); - } -}); -var iframe, getStyles, curCSS, - ralpha = /alpha\([^)]*\)/i, - ropacity = /opacity\s*=\s*([^)]*)/, - rposition = /^(top|right|bottom|left)$/, - // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" - // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display - rdisplayswap = /^(none|table(?!-c[ea]).+)/, - rmargin = /^margin/, - rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), - rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), - rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ), - elemdisplay = { BODY: "block" }, - - cssShow = { position: "absolute", visibility: "hidden", display: "block" }, - cssNormalTransform = { - letterSpacing: 0, - fontWeight: 400 - }, - - cssExpand = [ "Top", "Right", "Bottom", "Left" ], - cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; - -// return a css property mapped to a potentially vendor prefixed property -function vendorPropName( style, name ) { - - // shortcut for names that are not vendor prefixed - if ( name in style ) { - return name; - } - - // check for vendor prefixed names - var capName = name.charAt(0).toUpperCase() + name.slice(1), - origName = name, - i = cssPrefixes.length; - - while ( i-- ) { - name = cssPrefixes[ i ] + capName; - if ( name in style ) { - return name; - } - } - - return origName; -} - -function isHidden( elem, el ) { - // isHidden might be called from jQuery#filter function; - // in that case, element will be second argument - elem = el || elem; - return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); -} - -function showHide( elements, show ) { - var display, elem, hidden, - values = [], - index = 0, - length = elements.length; - - for ( ; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - - values[ index ] = jQuery._data( elem, "olddisplay" ); - display = elem.style.display; - if ( show ) { - // Reset the inline display of this element to learn if it is - // being hidden by cascaded rules or not - if ( !values[ index ] && display === "none" ) { - elem.style.display = ""; - } - - // Set elements which have been overridden with display: none - // in a stylesheet to whatever the default browser style is - // for such an element - if ( elem.style.display === "" && isHidden( elem ) ) { - values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); - } - } else { - - if ( !values[ index ] ) { - hidden = isHidden( elem ); - - if ( display && display !== "none" || !hidden ) { - jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); - } - } - } - } - - // Set the display of most of the elements in a second loop - // to avoid the constant reflow - for ( index = 0; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - if ( !show || elem.style.display === "none" || elem.style.display === "" ) { - elem.style.display = show ? values[ index ] || "" : "none"; - } - } - - return elements; -} - -jQuery.fn.extend({ - css: function( name, value ) { - return jQuery.access( this, function( elem, name, value ) { - var len, styles, - map = {}, - i = 0; - - if ( jQuery.isArray( name ) ) { - styles = getStyles( elem ); - len = name.length; - - for ( ; i < len; i++ ) { - map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); - } - - return map; - } - - return value !== undefined ? - jQuery.style( elem, name, value ) : - jQuery.css( elem, name ); - }, name, value, arguments.length > 1 ); - }, - show: function() { - return showHide( this, true ); - }, - hide: function() { - return showHide( this ); - }, - toggle: function( state ) { - if ( typeof state === "boolean" ) { - return state ? this.show() : this.hide(); - } - - return this.each(function() { - if ( isHidden( this ) ) { - jQuery( this ).show(); - } else { - jQuery( this ).hide(); - } - }); - } -}); - -jQuery.extend({ - // Add in style property hooks for overriding the default - // behavior of getting and setting a style property - cssHooks: { - opacity: { - get: function( elem, computed ) { - if ( computed ) { - // We should always get a number back from opacity - var ret = curCSS( elem, "opacity" ); - return ret === "" ? "1" : ret; - } - } - } - }, - - // Don't automatically add "px" to these possibly-unitless properties - cssNumber: { - "columnCount": true, - "fillOpacity": true, - "fontWeight": true, - "lineHeight": true, - "opacity": true, - "order": true, - "orphans": true, - "widows": true, - "zIndex": true, - "zoom": true - }, - - // Add in properties whose names you wish to fix before - // setting or getting the value - cssProps: { - // normalize float css property - "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" - }, - - // Get and set the style property on a DOM Node - style: function( elem, name, value, extra ) { - // Don't set styles on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { - return; - } - - // Make sure that we're working with the right name - var ret, type, hooks, - origName = jQuery.camelCase( name ), - style = elem.style; - - name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); - - // gets hook for the prefixed version - // followed by the unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // Check if we're setting a value - if ( value !== undefined ) { - type = typeof value; - - // convert relative number strings (+= or -=) to relative numbers. #7345 - if ( type === "string" && (ret = rrelNum.exec( value )) ) { - value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); - // Fixes bug #9237 - type = "number"; - } - - // Make sure that NaN and null values aren't set. See: #7116 - if ( value == null || type === "number" && isNaN( value ) ) { - return; - } - - // If a number was passed in, add 'px' to the (except for certain CSS properties) - if ( type === "number" && !jQuery.cssNumber[ origName ] ) { - value += "px"; - } - - // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, - // but it would mean to define eight (for every problematic property) identical functions - if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) { - style[ name ] = "inherit"; - } - - // If a hook was provided, use that value, otherwise just set the specified value - if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { - - // Wrapped to prevent IE from throwing errors when 'invalid' values are provided - // Fixes bug #5509 - try { - style[ name ] = value; - } catch(e) {} - } - - } else { - // If a hook was provided get the non-computed value from there - if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { - return ret; - } - - // Otherwise just get the value from the style object - return style[ name ]; - } - }, - - css: function( elem, name, extra, styles ) { - var num, val, hooks, - origName = jQuery.camelCase( name ); - - // Make sure that we're working with the right name - name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); - - // gets hook for the prefixed version - // followed by the unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // If a hook was provided get the computed value from there - if ( hooks && "get" in hooks ) { - val = hooks.get( elem, true, extra ); - } - - // Otherwise, if a way to get the computed value exists, use that - if ( val === undefined ) { - val = curCSS( elem, name, styles ); - } - - //convert "normal" to computed value - if ( val === "normal" && name in cssNormalTransform ) { - val = cssNormalTransform[ name ]; - } - - // Return, converting to number if forced or a qualifier was provided and val looks numeric - if ( extra === "" || extra ) { - num = parseFloat( val ); - return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; - } - return val; - } -}); - -// NOTE: we've included the "window" in window.getComputedStyle -// because jsdom on node.js will break without it. -if ( window.getComputedStyle ) { - getStyles = function( elem ) { - return window.getComputedStyle( elem, null ); - }; - - curCSS = function( elem, name, _computed ) { - var width, minWidth, maxWidth, - computed = _computed || getStyles( elem ), - - // getPropertyValue is only needed for .css('filter') in IE9, see #12537 - ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined, - style = elem.style; - - if ( computed ) { - - if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { - ret = jQuery.style( elem, name ); - } - - // A tribute to the "awesome hack by Dean Edwards" - // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right - // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels - // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values - if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { - - // Remember the original values - width = style.width; - minWidth = style.minWidth; - maxWidth = style.maxWidth; - - // Put in the new values to get a computed value out - style.minWidth = style.maxWidth = style.width = ret; - ret = computed.width; - - // Revert the changed values - style.width = width; - style.minWidth = minWidth; - style.maxWidth = maxWidth; - } - } - - return ret; - }; -} else if ( document.documentElement.currentStyle ) { - getStyles = function( elem ) { - return elem.currentStyle; - }; - - curCSS = function( elem, name, _computed ) { - var left, rs, rsLeft, - computed = _computed || getStyles( elem ), - ret = computed ? computed[ name ] : undefined, - style = elem.style; - - // Avoid setting ret to empty string here - // so we don't default to auto - if ( ret == null && style && style[ name ] ) { - ret = style[ name ]; - } - - // From the awesome hack by Dean Edwards - // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 - - // If we're not dealing with a regular pixel number - // but a number that has a weird ending, we need to convert it to pixels - // but not position css attributes, as those are proportional to the parent element instead - // and we can't measure the parent instead because it might trigger a "stacking dolls" problem - if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { - - // Remember the original values - left = style.left; - rs = elem.runtimeStyle; - rsLeft = rs && rs.left; - - // Put in the new values to get a computed value out - if ( rsLeft ) { - rs.left = elem.currentStyle.left; - } - style.left = name === "fontSize" ? "1em" : ret; - ret = style.pixelLeft + "px"; - - // Revert the changed values - style.left = left; - if ( rsLeft ) { - rs.left = rsLeft; - } - } - - return ret === "" ? "auto" : ret; - }; -} - -function setPositiveNumber( elem, value, subtract ) { - var matches = rnumsplit.exec( value ); - return matches ? - // Guard against undefined "subtract", e.g., when used as in cssHooks - Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : - value; -} - -function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { - var i = extra === ( isBorderBox ? "border" : "content" ) ? - // If we already have the right measurement, avoid augmentation - 4 : - // Otherwise initialize for horizontal or vertical properties - name === "width" ? 1 : 0, - - val = 0; - - for ( ; i < 4; i += 2 ) { - // both box models exclude margin, so add it if we want it - if ( extra === "margin" ) { - val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); - } - - if ( isBorderBox ) { - // border-box includes padding, so remove it if we want content - if ( extra === "content" ) { - val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - } - - // at this point, extra isn't border nor margin, so remove border - if ( extra !== "margin" ) { - val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } else { - // at this point, extra isn't content, so add padding - val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - - // at this point, extra isn't content nor padding, so add border - if ( extra !== "padding" ) { - val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } - } - - return val; -} - -function getWidthOrHeight( elem, name, extra ) { - - // Start with offset property, which is equivalent to the border-box value - var valueIsBorderBox = true, - val = name === "width" ? elem.offsetWidth : elem.offsetHeight, - styles = getStyles( elem ), - isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; - - // some non-html elements return undefined for offsetWidth, so check for null/undefined - // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 - // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 - if ( val <= 0 || val == null ) { - // Fall back to computed then uncomputed css if necessary - val = curCSS( elem, name, styles ); - if ( val < 0 || val == null ) { - val = elem.style[ name ]; - } - - // Computed unit is not pixels. Stop here and return. - if ( rnumnonpx.test(val) ) { - return val; - } - - // we need the check for style in case a browser which returns unreliable values - // for getComputedStyle silently falls back to the reliable elem.style - valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); - - // Normalize "", auto, and prepare for extra - val = parseFloat( val ) || 0; - } - - // use the active box-sizing model to add/subtract irrelevant styles - return ( val + - augmentWidthOrHeight( - elem, - name, - extra || ( isBorderBox ? "border" : "content" ), - valueIsBorderBox, - styles - ) - ) + "px"; -} - -// Try to determine the default display value of an element -function css_defaultDisplay( nodeName ) { - var doc = document, - display = elemdisplay[ nodeName ]; - - if ( !display ) { - display = actualDisplay( nodeName, doc ); - - // If the simple way fails, read from inside an iframe - if ( display === "none" || !display ) { - // Use the already-created iframe if possible - iframe = ( iframe || - jQuery("