Author: rhauch
Date: 2009-09-12 13:55:25 -0400 (Sat, 12 Sep 2009)
New Revision: 1218
Added:
trunk/dna-cnd/src/main/java/org/jboss/dna/cnd/package-info.java
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/package-info.java
trunk/dna-common/src/main/java/org/jboss/dna/common/component/package-info.java
trunk/dna-common/src/main/java/org/jboss/dna/common/i18n/package-info.java
trunk/dna-common/src/main/java/org/jboss/dna/common/math/package-info.java
trunk/dna-common/src/main/java/org/jboss/dna/common/package-info.java
trunk/dna-common/src/main/java/org/jboss/dna/common/statistic/package-info.java
trunk/dna-common/src/main/java/org/jboss/dna/common/text/package-info.java
trunk/dna-common/src/main/java/org/jboss/dna/common/util/package-info.java
trunk/dna-common/src/main/java/org/jboss/dna/common/xml/package-info.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/session/package-info.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/nodetype/package-info.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/package-info.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/package-info.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/package-info.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/service/package-info.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/package-info.java
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/package-info.java
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/spi/package-info.java
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/package-info.java
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/package-info.java
trunk/extensions/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/package-info.java
trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/package-info.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/package-info.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/common/package-info.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/package-info.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/package-info.java
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/scm/package-info.java
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/package-info.java
trunk/extensions/dna-mimetype-detector-aperture/src/main/java/org/jboss/dna/mimetype/aperture/package-info.java
trunk/extensions/dna-sequencer-cnd/src/main/java/org/jboss/dna/sequencer/cnd/package-info.java
trunk/extensions/dna-sequencer-images/src/main/java/org/jboss/dna/sequencer/image/package-info.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/package-info.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/package-info.java
trunk/extensions/dna-sequencer-jbpm-jpdl/src/main/java/org/jboss/dna/sequencer/jpdl3/package-info.java
trunk/extensions/dna-sequencer-mp3/src/main/java/org/jboss/dna/sequencer/mp3/package-info.java
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/excel/package-info.java
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/package-info.java
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/powerpoint/package-info.java
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/word/package-info.java
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/package-info.java
trunk/extensions/dna-sequencer-zip/src/main/java/org/jboss/dna/sequencer/zip/package-info.java
Removed:
trunk/dna-common/src/main/java/org/jboss/dna/common/component/AbstractComponent.java
trunk/extensions/dna-connector-federation/.classpath
trunk/extensions/dna-connector-federation/.project
trunk/extensions/dna-connector-federation/pom.xml
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedLexicon.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepository.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepositoryConnection.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepositorySource.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedWorkspace.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatingRequestProcessor.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederationException.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederationI18n.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/Projection.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/ProjectionParser.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/Contribution.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/ContributionStatistics.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/EmptyContribution.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/MultiChildContribution.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/MultiPropertyContribution.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/NodeContribution.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/NonEmptyContribution.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/OneChildContribution.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/OnePropertyContribution.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/PlaceholderContribution.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/ThreePropertyContribution.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/TwoChildContribution.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/TwoPropertyContribution.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/FederatedNode.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/FiveContributionMergePlan.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/FourContributionMergePlan.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/MergePlan.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/MultipleContributionMergePlan.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/OneContributionMergePlan.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/ThreeContributionMergePlan.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/TwoContributionMergePlan.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/strategy/MergeStrategy.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/strategy/OneContributionMergeStrategy.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/strategy/SimpleMergeStrategy.java
trunk/extensions/dna-connector-federation/src/main/resources/org/jboss/dna/connector/federation/FederationI18n.properties
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositoryConnectionTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositorySourceIntegrationTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositorySourceTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositoryTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatingRequestProcessorTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederationI18nTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/ProjectionParserTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/ProjectionPathRuleTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/ProjectionTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/ContributionStatisticsTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/EmptyContributionTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/MultiChildContributionTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/MultiPropertyContributionTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/NodeContributionTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/OneChildContributionTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/OnePropertyContributionTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/ThreePropertyContributionTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/TwoChildContributionTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/TwoPropertyContributionTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/FederatedNodeTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/FiveContributionMergePlanTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/FourContributionMergePlanTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/MergePlanTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/MultipleContributionMergePlanTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/OneContributionMergePlanTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/ThreeContributionMergePlanTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/TwoContributionMergePlanTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/strategy/OneContributionMergeStrategyTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/strategy/SimpleMergeStrategyTest.java
trunk/extensions/dna-connector-federation/src/test/resources/log4j.properties
Modified:
trunk/dna-cnd/src/main/java/org/jboss/dna/cnd/CndI18n.java
trunk/dna-common/src/main/java/org/jboss/dna/common/CommonI18n.java
trunk/dna-common/src/main/java/org/jboss/dna/common/SystemFailureException.java
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/AbstractProblems.java
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/EmptyIterator.java
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/ImmutableAppendedList.java
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/Problem.java
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/Problems.java
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/ReadOnlyIterator.java
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/SimpleProblems.java
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/ThreadSafeProblems.java
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/UnmodifiableProperties.java
trunk/dna-common/src/main/java/org/jboss/dna/common/component/ClassLoaderFactory.java
trunk/dna-common/src/main/java/org/jboss/dna/common/component/Component.java
trunk/dna-common/src/main/java/org/jboss/dna/common/component/ComponentConfig.java
trunk/dna-common/src/main/java/org/jboss/dna/common/component/ComponentLibrary.java
trunk/dna-common/src/main/java/org/jboss/dna/common/component/StandardClassLoaderFactory.java
trunk/dna-common/src/main/java/org/jboss/dna/common/i18n/ClasspathLocalizationRepository.java
trunk/dna-common/src/main/java/org/jboss/dna/common/i18n/I18n.java
trunk/dna-common/src/main/java/org/jboss/dna/common/i18n/LocalizationRepository.java
trunk/dna-common/src/main/java/org/jboss/dna/common/math/DoubleOperations.java
trunk/dna-common/src/main/java/org/jboss/dna/common/math/Duration.java
trunk/dna-common/src/main/java/org/jboss/dna/common/math/DurationOperations.java
trunk/dna-common/src/main/java/org/jboss/dna/common/math/FloatOperations.java
trunk/dna-common/src/main/java/org/jboss/dna/common/math/IntegerOperations.java
trunk/dna-common/src/main/java/org/jboss/dna/common/math/LongOperations.java
trunk/dna-common/src/main/java/org/jboss/dna/common/math/MathOperations.java
trunk/dna-common/src/main/java/org/jboss/dna/common/math/ShortOperations.java
trunk/dna-common/src/main/java/org/jboss/dna/common/statistic/Histogram.java
trunk/dna-common/src/main/java/org/jboss/dna/common/statistic/SimpleStatistics.java
trunk/dna-common/src/main/java/org/jboss/dna/common/statistic/Stopwatch.java
trunk/dna-common/src/main/java/org/jboss/dna/common/text/Inflector.java
trunk/dna-common/src/main/java/org/jboss/dna/common/text/Jsr283Encoder.java
trunk/dna-common/src/main/java/org/jboss/dna/common/text/NoOpEncoder.java
trunk/dna-common/src/main/java/org/jboss/dna/common/text/TextDecoder.java
trunk/dna-common/src/main/java/org/jboss/dna/common/text/TextEncoder.java
trunk/dna-common/src/main/java/org/jboss/dna/common/text/UrlEncoder.java
trunk/dna-common/src/main/java/org/jboss/dna/common/text/XmlNameEncoder.java
trunk/dna-common/src/main/java/org/jboss/dna/common/text/XmlValueEncoder.java
trunk/dna-common/src/main/java/org/jboss/dna/common/util/CheckArg.java
trunk/dna-common/src/main/java/org/jboss/dna/common/util/ClassUtil.java
trunk/dna-common/src/main/java/org/jboss/dna/common/util/FileUtil.java
trunk/dna-common/src/main/java/org/jboss/dna/common/util/HashCode.java
trunk/dna-common/src/main/java/org/jboss/dna/common/util/IoUtil.java
trunk/dna-common/src/main/java/org/jboss/dna/common/util/LogContext.java
trunk/dna-common/src/main/java/org/jboss/dna/common/util/Reflection.java
trunk/dna-common/src/main/java/org/jboss/dna/common/util/SecureHash.java
trunk/dna-common/src/main/java/org/jboss/dna/common/util/StringUtil.java
trunk/dna-common/src/main/java/org/jboss/dna/common/xml/SimpleNamespaceContext.java
trunk/dna-common/src/main/java/org/jboss/dna/common/xml/XmlCharacters.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/DnaIntLexicon.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/DnaLexicon.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/ExecutionContext.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/Graph.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/GraphI18n.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/JaasSecurityContext.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/JcrLexicon.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/JcrMixLexicon.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/JcrNtLexicon.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/Location.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/Locations.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/Node.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/NodeConflictBehavior.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/Results.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/SecurityContext.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/Subgraph.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/cache/BasicCachePolicy.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/cache/CachePolicy.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/cache/Cacheable.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/cache/ImmutableCachePolicy.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositoryConnection.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositoryConnectionFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositoryConnectionPool.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositoryContext.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositorySource.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositorySourceCapabilities.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositorySourceException.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/UuidAlreadyExistsException.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/FederatedRepositorySource.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/JoinRequestProcessor.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/inmemory/InMemoryRepository.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/inmemory/InMemoryRepositorySource.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapNode.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapRepositoryConnection.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/io/Destination.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/io/GraphImporter.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/mimetype/MimeTypeDetector.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/mimetype/MimeTypeDetectorConfig.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/mimetype/MimeTypeDetectors.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/NetChangeObserver.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/ObservationBus.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/Observer.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/Binary.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/BinaryFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/DateTime.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/DateTimeFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/InvalidPathException.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/InvalidPathExpressionException.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/IoException.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/Name.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/NameFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/NamespaceException.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/NamespaceRegistry.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/Path.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/PathExpression.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/PathFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/PathNotFoundException.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/Property.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/PropertyFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/PropertyType.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/Reference.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/ReferentialIntegrityException.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/UuidFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/ValueComparators.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/ValueFactories.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/ValueFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/ValueFormatException.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/AbstractBinary.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/AbstractBinaryValueFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/AbstractPath.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/AbstractValueFactories.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/AbstractValueFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicEmptyProperty.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicMultiValueProperty.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicName.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicNamespace.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicPath.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicPathSegment.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicProperty.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicPropertyFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicSingleValueProperty.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BooleanValueFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/ChildPath.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/DecimalValueFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/DelegatingValueFactories.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/DoubleValueFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/InMemoryBinary.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/InMemoryBinaryValueFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/JodaDateTime.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/JodaDateTimeValueFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/LocalNamespaceRegistry.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/LongValueFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/NameValueFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/ObjectValueFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/PathValueFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/RootPath.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/SimpleNamespaceRegistry.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/StandardValueFactories.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/StringValueFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/ThreadSafeNamespaceRegistry.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/UriValueFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/UuidReference.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/UuidReferenceValueFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/UuidValueFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/BatchRequestBuilder.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CacheableRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CloneBranchRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CompositeRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CopyBranchRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CreateNodeRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/DeleteBranchRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/InvalidRequestException.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/InvalidWorkspaceException.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/MoveBranchRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadAllChildrenRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadAllPropertiesRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadBlockOfChildrenRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadBranchRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadNextBlockOfChildrenRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadNodeRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadPropertyRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/RemovePropertyRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/RenameNodeRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/Request.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/RequestException.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/SetPropertyRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/UnsupportedRequestException.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/UpdatePropertiesRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/VerifyNodeExistsRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/processor/LoggingRequestProcessor.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/sequencer/SequencerOutput.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/sequencer/StreamSequencer.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/sequencer/StreamSequencerContext.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/session/InvalidStateException.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/session/ValidationException.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/xml/XmlHandler.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrItem.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrProperty.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/DnaIntLexicon.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/DnaLexicon.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrChildNodeIterator.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrEmptyNodeIterator.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrEmptyPropertyIterator.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrEngine.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrI18n.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrLexicon.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrMixLexicon.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrMultiValueProperty.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrNode.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrPropertyIterator.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRootNode.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrSession.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrSingleValueProperty.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrSvLexicon.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrValue.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrWorkspace.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/PropertyTypeUtil.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/nodetype/NodeTypeExistsException.java
trunk/dna-repository/pom.xml
trunk/dna-repository/src/main/java/org/jboss/dna/repository/DnaConfigurationException.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/DnaLexicon.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryI18n.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryLibrary.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryService.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/InvalidSequencerPathExpression.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/Sequencer.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencerConfig.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencerException.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencerLibrary.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencerOutputMap.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencerPathExpression.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencingService.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/StreamSequencerAdapter.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/service/AbstractServiceAdministrator.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/service/AdministeredService.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/service/ServiceAdministrator.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/AbstractSessionFactory.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/RepositoryNodePath.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/SessionFactory.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/SimpleSessionFactory.java
trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/ConsoleInput.java
trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/RepositoryClient.java
trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/UserInterface.java
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/ConsoleInput.java
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/ContentInfo.java
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/JavaInfo.java
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/JcrTools.java
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/MediaInfo.java
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/SequencingClient.java
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/UserInterface.java
trunk/docs/reference/src/main/docbook/en-US/content/introduction.xml
trunk/docs/reference/src/main/docbook/en-US/master.xml
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/ArtifactType.java
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenClassLoaders.java
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenDependency.java
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenI18n.java
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenRepository.java
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenRepositoryException.java
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenUrl.java
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/SignatureType.java
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/spi/AbstractMavenUrlProvider.java
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/spi/JcrMavenUrlProvider.java
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/spi/MavenUrlProvider.java
trunk/extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/JdbcMetadataI18n.java
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemConnection.java
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemI18n.java
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRequestProcessor.java
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemSource.java
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/InfinispanConnectorI18n.java
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/InfinispanRepository.java
trunk/extensions/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheConnectorI18n.java
trunk/extensions/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheRepository.java
trunk/extensions/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheSource.java
trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/JdbcMetadataI18n.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaConnection.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaConnectorI18n.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaSource.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/Model.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/BasicModel.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/BasicRequestProcessor.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/ChildEntity.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/ChildId.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/LargeValueEntity.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/LargeValueId.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/NodeId.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/PropertiesEntity.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/ReferenceEntity.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/ReferenceId.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/SubgraphNodeEntity.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/SubgraphQuery.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/SubgraphQueryEntity.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/common/ChangeLogEntity.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/common/NamespaceEntity.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/common/WorkspaceEntity.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/Namespaces.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/RequestProcessorCache.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/Serializer.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/StoreOptionEntity.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/StoreOptions.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/Workspaces.java
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/scm/ScmAction.java
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/scm/ScmActionExecutor.java
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/scm/ScmActionFactory.java
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNActionExecutor.java
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNProtocol.java
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryConnection.java
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryConnectorI18n.java
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryLexicon.java
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryRequestProcessor.java
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositorySource.java
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryUtil.java
trunk/extensions/dna-mimetype-detector-aperture/src/main/java/org/jboss/dna/mimetype/aperture/ApertureMimeTypeDetector.java
trunk/extensions/dna-sequencer-cnd/src/main/java/org/jboss/dna/sequencer/cnd/CndSequencer.java
trunk/extensions/dna-sequencer-cnd/src/main/java/org/jboss/dna/sequencer/cnd/CndSequencerI18n.java
trunk/extensions/dna-sequencer-images/src/main/java/org/jboss/dna/sequencer/image/ImageMetadataSequencer.java
trunk/extensions/dna-sequencer-images/src/main/java/org/jboss/dna/sequencer/image/ImageSequencerI18n.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/AbstractJavaMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/ArrayTypeFieldMetadataSequencer.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/CompilationUnitParser.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataI18n.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataSequencer.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataUtil.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaSourceCndDefinition.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/MethodMetadataSequencer.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/ParameterizedTypeFieldMetadataSequencer.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/SimpleTypeMetadataSequencer.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/VariableSequencer.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/AnnotationMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ArrayTypeFieldMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ClassMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ConstructorMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/FieldMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ImportMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ImportOnDemandMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/InterfaceMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavaMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavadocMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/MarkerAnnotationMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/MethodTypeMemberMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ModifierMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/NormalAnnotationMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/PackageMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ParameterizedTypeFieldMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/QualifiedTypeFieldMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/SimpleTypeFieldMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/SingleImportMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/SingleMemberAnnotationMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/TypeMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/WildcardTypeFieldMetadata.java
trunk/extensions/dna-sequencer-mp3/src/main/java/org/jboss/dna/sequencer/mp3/Mp3Metadata.java
trunk/extensions/dna-sequencer-mp3/src/main/java/org/jboss/dna/sequencer/mp3/Mp3MetadataSequencer.java
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/MSOfficeMetadata.java
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/MSOfficeMetadataI18n.java
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/MSOfficeMetadataReader.java
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/MSOfficeMetadataSequencer.java
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/excel/ExcelMetadata.java
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/excel/ExcelMetadataReader.java
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/powerpoint/PowerPointMetadataReader.java
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/powerpoint/SlideMetadata.java
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/word/WordMetadata.java
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/word/WordMetadataReader.java
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/DnaDtdLexicon.java
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/DnaXmlLexicon.java
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/InheritingXmlSequencer.java
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/XmlSequencer.java
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/XmlSequencerHandler.java
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/XmlSequencerI18n.java
trunk/extensions/dna-sequencer-zip/src/main/java/org/jboss/dna/sequencer/zip/ZipSequencer.java
trunk/pom.xml
Log:
Changed to a newer version of the Maven JavaDoc plugin, and configured the JavaDoc to be a
little different (with hopefully better organization). Quite a few of our classes had no
JavaDoc at all (at the class level), so I went through and made sure that every class has
at least one (accurate) sentence and that every package has a package-info.java. While I
was there, I also removed all (or most?) of the @author tags in the non-test code, per the
discussion thread a few months ago. Finally, I removed the
'extensions/dna-connector-federation' project, which is the old implementation
that is no longer used, and updated the Reference Guide accordingly.
Modified: trunk/dna-cnd/src/main/java/org/jboss/dna/cnd/CndI18n.java
===================================================================
--- trunk/dna-cnd/src/main/java/org/jboss/dna/cnd/CndI18n.java 2009-09-12 17:43:41 UTC
(rev 1217)
+++ trunk/dna-cnd/src/main/java/org/jboss/dna/cnd/CndI18n.java 2009-09-12 17:55:25 UTC
(rev 1218)
@@ -26,8 +26,7 @@
import org.jboss.dna.common.i18n.I18n;
/**
- * @author John Verhaeg
- * @author Randall Hauch
+ * The internationalized string constants for the
<code>org.jboss.dna.cnd*</code> packages.
*/
public final class CndI18n {
Copied: trunk/dna-cnd/src/main/java/org/jboss/dna/cnd/package-info.java (from rev 1217,
trunk/dna-common/src/main/java/org/jboss/dna/common/component/ClassLoaderFactory.java)
===================================================================
--- trunk/dna-cnd/src/main/java/org/jboss/dna/cnd/package-info.java
(rev 0)
+++ trunk/dna-cnd/src/main/java/org/jboss/dna/cnd/package-info.java 2009-09-12 17:55:25
UTC (rev 1218)
@@ -0,0 +1,32 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * Compact Node Definition (CND) defines JCR node types, property definitions, and child
node definitions
+ * in a concise and easy-to-read form. The CND format was originally defined by the
+ * <a
href="http://jackrabbit.apache.org/">Apache Jackrabbit</a>
project, which is the reference implementation
+ * of the JCR 1.0 specification. However, the format has since been adopted as a
repository-neutral format
+ * and defined as part of the JCR 2.0 specification.
+ */
+
+package org.jboss.dna.cnd;
\ No newline at end of file
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/CommonI18n.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/CommonI18n.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/CommonI18n.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,8 +28,7 @@
import org.jboss.dna.common.i18n.I18n;
/**
- * @author John Verhaeg
- * @author Randall Hauch
+ * The internationalized string constants for the
<code>org.jboss.dna.common*</code> packages.
*/
public final class CommonI18n {
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/SystemFailureException.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/SystemFailureException.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/SystemFailureException.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,10 +24,8 @@
package org.jboss.dna.common;
-
/**
- *
- * @author Randall Hauch
+ * A generic {@link RuntimeException runtime exception} representing a catastrophic
and/or unrecoverable failure of the system.
*/
public class SystemFailureException extends RuntimeException {
@@ -36,13 +34,15 @@
private static final long serialVersionUID = 8281373010920861138L;
/**
- *
+ * Construct a system failure exception with no message.
*/
public SystemFailureException() {
}
/**
- * @param message
+ * Construct a system failure exception with a single message.
+ *
+ * @param message the message describing the failure
*/
public SystemFailureException( String message ) {
super(message);
@@ -50,7 +50,9 @@
}
/**
- * @param cause
+ * Construct a system failure exception with another exception that is the cause of
the failure.
+ *
+ * @param cause the original cause of the failure
*/
public SystemFailureException( Throwable cause ) {
super(cause);
@@ -58,10 +60,13 @@
}
/**
- * @param message
- * @param cause
+ * Construct a system failure exception with a single message and another exception
that is the cause of the failure.
+ *
+ * @param message the message describing the failure
+ * @param cause the original cause of the failure
*/
- public SystemFailureException( String message, Throwable cause ) {
+ public SystemFailureException( String message,
+ Throwable cause ) {
super(message, cause);
}
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/AbstractProblems.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/AbstractProblems.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/AbstractProblems.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -31,9 +31,6 @@
/**
* A list of problems for some execution context. The problems will be {@link #iterator()
returned} in the order in which they
* were encountered (although this cannot be guaranteed in contexts involving multiple
threads or processes).
- *
- * @author Randall Hauch
- * @author John Verhaeg
*/
public abstract class AbstractProblems implements Problems {
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/EmptyIterator.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/EmptyIterator.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/EmptyIterator.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -25,11 +25,15 @@
import java.util.Iterator;
import java.util.NoSuchElementException;
+import net.jcip.annotations.Immutable;
/**
- * @author jverhaeg
- * @param <T> some type
+ * A reusuable {@link Iterator} implementation that has no elements. Note that the
objects are immutable, and therefore may be
+ * shared and reused.
+ *
+ * @param <T> the type of the elements over which the iteration is being performed
*/
+@Immutable
public final class EmptyIterator<T> implements Iterator<T> {
/**
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/ImmutableAppendedList.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/ImmutableAppendedList.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/ImmutableAppendedList.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -37,7 +37,6 @@
* that contains all of the elements in the parent list as well as the last appended
element, but while reusing the existing
* parent list and without having to create a copy of the parent list.
*
- * @author Randall Hauch
* @param <T> the type of element
*/
@Immutable
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/collection/Problem.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/collection/Problem.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/collection/Problem.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -29,7 +29,10 @@
import org.jboss.dna.common.util.HashCode;
/**
- * @author Randall Hauch
+ * An immutable representation of a problem, with a status, code, internationalized and
parameterized message, values for the
+ * parameters, information about the resource and location, and an optional exception.
The use of internationalized messages
+ * allows for automatic localization of the messages (and substitution of the parameter
values) via the
+ * {@link #getMessageString()} method.
*/
@Immutable
public class Problem {
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/collection/Problems.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/Problems.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/Problems.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -27,43 +27,112 @@
import org.jboss.dna.common.i18n.I18n;
/**
- * @author John Verhaeg
+ * An interface for a collection of {@link Problem} objects, with multiple overloaded
methods for adding errors, warnings, and
+ * informational messages.
*/
public interface Problems extends Iterable<Problem> {
+ /**
+ * Add an error message with the parameters that should be used when localizing the
message.
+ *
+ * @param message the internationalized message describing the problem
+ * @param params the values for the parameters in the message
+ */
void addError( I18n message,
Object... params );
+ /**
+ * Add an error exception and message with the parameters that should be used when
localizing the message.
+ *
+ * @param throwable the exception that represents the error; may be null
+ * @param message the internationalized message describing the problem
+ * @param params the values for the parameters in the message
+ */
void addError( Throwable throwable,
I18n message,
Object... params );
+ /**
+ * Add an error message with a description of the resource, its location, and the
parameters that should be used when
+ * localizing the message
+ *
+ * @param message the internationalized message describing the problem
+ * @param resource the description of the resource; may be null
+ * @param location the location of the resource; may be null
+ * @param params the values for the parameters in the message
+ */
void addError( I18n message,
String resource,
String location,
Object... params );
+ /**
+ * Add an error exception and message with a description of the resource, its
location, and the parameters that should be used
+ * when localizing the message
+ *
+ * @param throwable the exception that represents the error; may be null
+ * @param message the internationalized message describing the problem
+ * @param resource the description of the resource; may be null
+ * @param location the location of the resource; may be null
+ * @param params the values for the parameters in the message
+ */
void addError( Throwable throwable,
I18n message,
String resource,
String location,
Object... params );
+ /**
+ * Add an error message with the parameters that should be used when localizing the
message.
+ *
+ * @param code the error code
+ * @param message the internationalized message describing the problem
+ * @param params the values for the parameters in the message
+ */
void addError( int code,
I18n message,
Object... params );
+ /**
+ * Add an error exception and message with the parameters that should be used when
localizing the message.
+ *
+ * @param throwable the exception that represents the error; may be null
+ * @param code the error code
+ * @param message the internationalized message describing the problem
+ * @param params the values for the parameters in the message
+ */
void addError( Throwable throwable,
int code,
I18n message,
Object... params );
+ /**
+ * Add an error message with a description of the resource, its location, and the
parameters that should be used when
+ * localizing the message
+ *
+ * @param code the error code
+ * @param message the internationalized message describing the problem
+ * @param resource the description of the resource; may be null
+ * @param location the location of the resource; may be null
+ * @param params the values for the parameters in the message
+ */
void addError( int code,
I18n message,
String resource,
String location,
Object... params );
+ /**
+ * Add an error exception and message with a description of the resource, its
location, and the parameters that should be used
+ * when localizing the message
+ *
+ * @param throwable the exception that represents the error; may be null
+ * @param code the error code
+ * @param message the internationalized message describing the problem
+ * @param resource the description of the resource; may be null
+ * @param location the location of the resource; may be null
+ * @param params the values for the parameters in the message
+ */
void addError( Throwable throwable,
int code,
I18n message,
@@ -71,39 +140,107 @@
String location,
Object... params );
+ /**
+ * Add a warning message with the parameters that should be used when localizing the
message.
+ *
+ * @param message the internationalized message describing the problem
+ * @param params the values for the parameters in the message
+ */
void addWarning( I18n message,
Object... params );
+ /**
+ * Add a warning exception and message with the parameters that should be used when
localizing the message.
+ *
+ * @param throwable the exception that represents the error; may be null
+ * @param message the internationalized message describing the problem
+ * @param params the values for the parameters in the message
+ */
void addWarning( Throwable throwable,
I18n message,
Object... params );
+ /**
+ * Add a warning message with a description of the resource, its location, and the
parameters that should be used when
+ * localizing the message
+ *
+ * @param message the internationalized message describing the problem
+ * @param resource the description of the resource; may be null
+ * @param location the location of the resource; may be null
+ * @param params the values for the parameters in the message
+ */
void addWarning( I18n message,
String resource,
String location,
Object... params );
+ /**
+ * Add a warning exception and message with a description of the resource, its
location, and the parameters that should be
+ * used when localizing the message
+ *
+ * @param throwable the exception that represents the warning; may be null
+ * @param message the internationalized message describing the problem
+ * @param resource the description of the resource; may be null
+ * @param location the location of the resource; may be null
+ * @param params the values for the parameters in the message
+ */
void addWarning( Throwable throwable,
I18n message,
String resource,
String location,
Object... params );
+ /**
+ * Add a warning message with the parameters that should be used when localizing the
message.
+ *
+ * @param code the problem code
+ * @param message the internationalized message describing the problem
+ * @param params the values for the parameters in the message
+ */
void addWarning( int code,
I18n message,
Object... params );
+ /**
+ * Add a warning exception and message with the parameters that should be used when
localizing the message.
+ *
+ * @param throwable the exception that represents the warning; may be null
+ * @param code the problem code
+ * @param message the internationalized message describing the problem
+ * @param params the values for the parameters in the message
+ */
void addWarning( Throwable throwable,
int code,
I18n message,
Object... params );
+ /**
+ * Add a warning message with a description of the resource, its location, and the
parameters that should be used when
+ * localizing the message
+ *
+ * @param code the problem code
+ * @param message the internationalized message describing the problem
+ * @param resource the description of the resource; may be null
+ * @param location the location of the resource; may be null
+ * @param params the values for the parameters in the message
+ */
void addWarning( int code,
I18n message,
String resource,
String location,
Object... params );
+ /**
+ * Add a warning exception and message with a description of the resource, its
location, and the parameters that should be
+ * used when localizing the message
+ *
+ * @param throwable the exception that represents the warning; may be null
+ * @param code the problem code
+ * @param message the internationalized message describing the problem
+ * @param resource the description of the resource; may be null
+ * @param location the location of the resource; may be null
+ * @param params the values for the parameters in the message
+ */
void addWarning( Throwable throwable,
int code,
I18n message,
@@ -111,39 +248,107 @@
String location,
Object... params );
+ /**
+ * Add a informational message with the parameters that should be used when
localizing the message.
+ *
+ * @param message the internationalized message describing the problem
+ * @param params the values for the parameters in the message
+ */
void addInfo( I18n message,
Object... params );
+ /**
+ * Add an informational exception and message with the parameters that should be used
when localizing the message.
+ *
+ * @param throwable the exception that represents the warning; may be null
+ * @param message the internationalized message describing the problem
+ * @param params the values for the parameters in the message
+ */
void addInfo( Throwable throwable,
I18n message,
Object... params );
+ /**
+ * Add an informational message with a description of the resource, its location, and
the parameters that should be used when
+ * localizing the message
+ *
+ * @param message the internationalized message describing the problem
+ * @param resource the description of the resource; may be null
+ * @param location the location of the resource; may be null
+ * @param params the values for the parameters in the message
+ */
void addInfo( I18n message,
String resource,
String location,
Object... params );
+ /**
+ * Add an informational exception and message with a description of the resource, its
location, and the parameters that should
+ * be used when localizing the message
+ *
+ * @param throwable the exception that represents the problem; may be null
+ * @param message the internationalized message describing the problem
+ * @param resource the description of the resource; may be null
+ * @param location the location of the resource; may be null
+ * @param params the values for the parameters in the message
+ */
void addInfo( Throwable throwable,
I18n message,
String resource,
String location,
Object... params );
+ /**
+ * Add a informational message with the parameters that should be used when
localizing the message.
+ *
+ * @param code the problem code
+ * @param message the internationalized message describing the problem
+ * @param params the values for the parameters in the message
+ */
void addInfo( int code,
I18n message,
Object... params );
+ /**
+ * Add a informational exception and message with the parameters that should be used
when localizing the message.
+ *
+ * @param throwable the exception that represents the warning; may be null
+ * @param code the problem code
+ * @param message the internationalized message describing the problem
+ * @param params the values for the parameters in the message
+ */
void addInfo( Throwable throwable,
int code,
I18n message,
Object... params );
+ /**
+ * Add an informational message with a description of the resource, its location, and
the parameters that should be used when
+ * localizing the message
+ *
+ * @param code the problem code
+ * @param message the internationalized message describing the problem
+ * @param resource the description of the resource; may be null
+ * @param location the location of the resource; may be null
+ * @param params the values for the parameters in the message
+ */
void addInfo( int code,
I18n message,
String resource,
String location,
Object... params );
+ /**
+ * Add an informational exception and message with a description of the resource, its
location, and the parameters that should
+ * be used when localizing the message
+ *
+ * @param throwable the exception that represents the problem; may be null
+ * @param code the problem code
+ * @param message the internationalized message describing the problem
+ * @param resource the description of the resource; may be null
+ * @param location the location of the resource; may be null
+ * @param params the values for the parameters in the message
+ */
void addInfo( Throwable throwable,
int code,
I18n message,
@@ -151,18 +356,55 @@
String location,
Object... params );
+ /**
+ * Get the number of problems that are in this collection
+ *
+ * @return the number of problems; never negative
+ * @see #hasProblems()
+ * @see #isEmpty()
+ */
+ int size();
+
+ /**
+ * Determine if this collection is empty.
+ *
+ * @return true if the there are no problems, or false if there is at least one
+ * @see #hasProblems()
+ * @see #size()
+ */
+ boolean isEmpty();
+
+ /**
+ * Determine if there are problems in this collection.
+ *
+ * @return true if there is at least one problem, or false if it is empty
+ * @see #isEmpty()
+ * @see #size()
+ */
boolean hasProblems();
+ /**
+ * Determine if there is at least one error in this collection.
+ *
+ * @return true if there is at least one error in this collection, or false if there
are no errors
+ */
boolean hasErrors();
+ /**
+ * Determine if there is at least one warning in this collection.
+ *
+ * @return true if there is at least one warning in this collection, or false if
there are no warnings
+ */
boolean hasWarnings();
+ /**
+ * Determine if there is at least one informational problem in this collection.
+ *
+ * @return true if there is at least one informational problem in this collection, or
false if there are no informational
+ * problems
+ */
boolean hasInfo();
- boolean isEmpty();
-
- int size();
-
/**
* <p>
* {@inheritDoc}
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/ReadOnlyIterator.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/ReadOnlyIterator.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/ReadOnlyIterator.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -27,9 +27,9 @@
/**
* An {@link Iterator} implementation that only allows reading elements, used as a
wrapper around another iterator to make the
- * contents appear to be immutable.
+ * contents immutable to the user of this iterator.
*
- * @param <T> the type that is being iterated over
+ * @param <T> the type of the elements over which the iteration is being performed
*/
public final class ReadOnlyIterator<T> implements Iterator<T> {
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/SimpleProblems.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/SimpleProblems.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/SimpleProblems.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,11 +28,8 @@
import net.jcip.annotations.NotThreadSafe;
/**
- * A list of problems for some execution context. The problems will be {@link #iterator()
returned} in the order in which they
- * were encountered (although this cannot be guaranteed in contexts involving multiple
threads or processes).
- *
- * @author Randall Hauch
- * @author John Verhaeg
+ * A simple {@link Problems} collection. The problems will be {@link #iterator()
returned} in the order in which they were
+ * encountered (although this cannot be guaranteed in contexts involving multiple threads
or processes).
*/
@NotThreadSafe
public class SimpleProblems extends AbstractProblems {
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/ThreadSafeProblems.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/ThreadSafeProblems.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/ThreadSafeProblems.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -32,10 +32,8 @@
import net.jcip.annotations.ThreadSafe;
/**
- * A thread-safe list of problems for some execution context. The problems will be {@link
#iterator() returned} in the order in
- * which they were encountered.
- *
- * @author Randall Hauch
+ * A thread-safe {@link Problems} collection. The problems will be {@link #iterator()
returned} in the order in which they were
+ * encountered.
*/
@ThreadSafe
public class ThreadSafeProblems extends AbstractProblems {
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/UnmodifiableProperties.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/UnmodifiableProperties.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/UnmodifiableProperties.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -35,10 +35,12 @@
import java.util.Properties;
import java.util.Set;
import java.util.Map.Entry;
+import net.jcip.annotations.Immutable;
/**
- * @author Randall Hauch
+ * An immutable {@link Properties} implementation.
*/
+@Immutable
public class UnmodifiableProperties extends Properties {
/**
Copied: trunk/dna-common/src/main/java/org/jboss/dna/common/collection/package-info.java
(from rev 1217,
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederationI18nTest.java)
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/collection/package-info.java
(rev 0)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,30 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * A set of common classes for dealing with collections of other objects. Some of these
classes work with standard
+ * collections, while others represent {@link Problems} that record multiple warnings,
errors, and informational
+ * messages.
+ */
+
+package org.jboss.dna.common.collection;
\ No newline at end of file
Property changes on:
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/package-info.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted:
trunk/dna-common/src/main/java/org/jboss/dna/common/component/AbstractComponent.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/component/AbstractComponent.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/component/AbstractComponent.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,45 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.common.component;
-
-/**
- * @param <T> the type of configuration
- * @author Randall Hauch
- */
-public class AbstractComponent<T extends ComponentConfig> implements
Component<T> {
-
- /**
- * {@inheritDoc}
- */
- public T getConfiguration() {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public void setConfiguration( T configuration ) {
- }
-
-}
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/component/ClassLoaderFactory.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/component/ClassLoaderFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/component/ClassLoaderFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -25,12 +25,12 @@
/**
* Factory interface for creating class loaders.
- * @author Randall Hauch
*/
public interface ClassLoaderFactory {
/**
* Get a class loader for the supplied classpath.
+ *
* @param classpath the classpath to use
* @return the class loader; may not be null
*/
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/component/Component.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/component/Component.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/component/Component.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -29,7 +29,7 @@
* <p>
* Implementations must provide a no-argument constructor.
* </p>
- * @author Randall Hauch
+ *
* @param <T> the type of configuration
*/
public interface Component<T extends ComponentConfig> {
@@ -38,12 +38,14 @@
* This method allows the implementation to initialize and configure itself using the
supplied {@link ComponentConfig}
* information, and is called prior to any other class to this object. When this
method is called, the implementation must
* maintain a reference to the supplied configuration (which should then be returned
in {@link #getConfiguration()}.
+ *
* @param configuration the configuration for the component
*/
void setConfiguration( T configuration );
/**
* Return the configuration for this component, as supplied to the last {@link
#setConfiguration(ComponentConfig)} invocation.
+ *
* @return the configuration, or null if not yet configured
*/
T getConfiguration();
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/component/ComponentConfig.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/component/ComponentConfig.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/component/ComponentConfig.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -34,7 +34,7 @@
import org.jboss.dna.common.util.ClassUtil;
/**
- * @author Randall Hauch
+ * An immutable configuration for a {@link Component}.
*/
@Immutable
public class ComponentConfig implements Comparable<ComponentConfig> {
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/component/ComponentLibrary.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/component/ComponentLibrary.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/component/ComponentLibrary.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -48,7 +48,6 @@
* obtained} are always reflected by the configurations.
* </p>
*
- * @author Randall Hauch
* @param <ComponentType> the type of component being managed, which may be a
subclass of {@link Component}
* @param <ConfigType> the configuration type describing the components
*/
@@ -257,7 +256,7 @@
if (newInstance instanceof Component) {
((Component<ConfigType>)newInstance).setConfiguration(config);
}
-
+
if (config.getProperties() != null) {
for (Map.Entry<String, Object> entry :
config.getProperties().entrySet()) {
// Set the JavaBean-style property on the RepositorySource instance
...
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/component/StandardClassLoaderFactory.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/component/StandardClassLoaderFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/component/StandardClassLoaderFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -26,7 +26,8 @@
import net.jcip.annotations.Immutable;
/**
- * @author Randall Hauch
+ * A {@link ClassLoaderFactory} implementation that loads classes using the thread's
{@link Thread#getContextClassLoader() context
+ * class loader} or (optionally) a supplied class loader.
*/
@Immutable
public class StandardClassLoaderFactory implements ClassLoaderFactory {
@@ -42,7 +43,8 @@
this(true, delegate);
}
- public StandardClassLoaderFactory( boolean useCurrentThreadContextClassLoader, final
ClassLoader delegate ) {
+ public StandardClassLoaderFactory( boolean useCurrentThreadContextClassLoader,
+ final ClassLoader delegate ) {
this.delegate = delegate != null ? delegate : this.getClass().getClassLoader();
this.useCurrentThreadContextClassLoader = useCurrentThreadContextClassLoader;
}
Copied: trunk/dna-common/src/main/java/org/jboss/dna/common/component/package-info.java
(from rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ClassMetadata.java)
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/component/package-info.java
(rev 0)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/component/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,28 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * A simple framework for loading and managing {@link Component} objects that may be
configured and used reflectively.
+ */
+
+package org.jboss.dna.common.component;
\ No newline at end of file
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/i18n/ClasspathLocalizationRepository.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/i18n/ClasspathLocalizationRepository.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/i18n/ClasspathLocalizationRepository.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -36,7 +36,6 @@
* returned immediately.
* </p>
* named with a name that matches
- * @author Randall Hauch
*/
public class ClasspathLocalizationRepository implements LocalizationRepository {
@@ -54,6 +53,7 @@
* Create a repository using the supplied class loader. Null may be passed if the
class loader should be obtained from the
* current thread's {@link Thread#getContextClassLoader() context class loader}
or, if that is null, the same class loader
* that loaded this class.
+ *
* @param classLoader the class loader to use; may be null
*/
public ClasspathLocalizationRepository( ClassLoader classLoader ) {
@@ -65,7 +65,8 @@
/**
* {@inheritDoc}
*/
- public URL getLocalizationBundle( String bundleName, Locale locale ) {
+ public URL getLocalizationBundle( String bundleName,
+ Locale locale ) {
URL url = null;
String pathPfx = bundleName.replaceAll("\\.", "/");
String variant = '_' + locale.toString();
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/i18n/I18n.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/i18n/I18n.java 2009-09-12 17:43:41
UTC (rev 1217)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/i18n/I18n.java 2009-09-12 17:55:25
UTC (rev 1218)
@@ -46,11 +46,8 @@
import org.jboss.dna.common.util.StringUtil;
/**
- * Manages the initialization of internationalization (i18n) files, substitution of
values within i18n message placeholders, and
- * dynamically reading properties from i18n property files.
- *
- * @author John Verhaeg
- * @author Randall Hauch
+ * An internalized string object, which manages the initialization of
internationalization (i18n) files, substitution of values
+ * within i18n message placeholders, and dynamically reading properties from i18n
property files.
*/
@ThreadSafe
public final class I18n {
@@ -101,8 +98,8 @@
* Note, calling this method will <em>not</em> trigger localization of
the supplied internationalization class.
*
* @param i18nClass The internalization class for which localization problems should
be returned.
- * @param locale The locale for which localization problems should be returned. If
<code>null</code>, the default locale
- * will be used.
+ * @param locale The locale for which localization problems should be returned. If
<code>null</code>, the default locale will
+ * be used.
* @return The localization problems encountered while localizing the supplied
internationalization class to the supplied
* locale; never <code>null</code>.
*/
@@ -134,8 +131,8 @@
* Set the repository of localized messages. If <code>null</code>, a
{@link ClasspathLocalizationRepository} instance that
* uses this class loader will be used.
*
- * @param localizationRepository the localization repository to use; may be
<code>null</code> if the default repository
- * should be used.
+ * @param localizationRepository the localization repository to use; may be
<code>null</code> if the default repository should
+ * be used.
*/
public static void setLocalizationRepository( LocalizationRepository
localizationRepository ) {
I18n.localizationRepository = localizationRepository != null ?
localizationRepository : DEFAULT_LOCALIZATION_REPOSITORY;
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/i18n/LocalizationRepository.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/i18n/LocalizationRepository.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/i18n/LocalizationRepository.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,7 +28,6 @@
/**
* A repository of localized property files used by the {@link I18n internationalization
framework}.
- * @author Randall Hauch
*/
public interface LocalizationRepository {
@@ -36,11 +35,13 @@
* Obtain the URL to the properties file containing the localized messages given the
supplied bundle name. This method is
* responsible for searching to find the most appropriate localized messages given
the locale, but does not need to search
* using the {@link Locale#getDefault() default locale} (as that is done by the
{@link I18n#text(Object...) calling} method.
+ *
* @param bundleName the name of the bundle of properties; never null
* @param locale the locale for which the properties file URL is desired
* @return the URL to the properties file containing the localized messages for the
named bundle, or null if no such bundle
- * could be found
+ * could be found
*/
- URL getLocalizationBundle( String bundleName, Locale locale );
+ URL getLocalizationBundle( String bundleName,
+ Locale locale );
}
Copied: trunk/dna-common/src/main/java/org/jboss/dna/common/i18n/package-info.java (from
rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ModifierMetadata.java)
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/i18n/package-info.java
(rev 0)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/i18n/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,28 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * A simple framework for defining internationalized strings and the mechanism by which
the strings are localized.
+ */
+
+package org.jboss.dna.common.i18n;
\ No newline at end of file
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/math/DoubleOperations.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/math/DoubleOperations.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/math/DoubleOperations.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -26,31 +26,40 @@
import java.math.BigDecimal;
import java.util.Comparator;
import java.util.Random;
+import net.jcip.annotations.Immutable;
+/**
+ * The {@link MathOperations math operations} for double numbers.
+ */
+@Immutable
public class DoubleOperations implements MathOperations<Double>,
Comparator<Double> {
public Class<Double> getOperandClass() {
return Double.class;
}
- public Double add( Double value1, Double value2 ) {
+ public Double add( Double value1,
+ Double value2 ) {
if (value1 == null) return value2 != null ? value2 : createZeroValue();
if (value2 == null) return value1;
return (value1 + value2);
}
- public Double subtract( Double value1, Double value2 ) {
+ public Double subtract( Double value1,
+ Double value2 ) {
if (value1 == null) return negate(value2);
if (value2 == null) return value1;
return (value1 - value2);
}
- public Double multiply( Double value1, Double value2 ) {
+ public Double multiply( Double value1,
+ Double value2 ) {
if (value1 == null || value2 == null) return createZeroValue();
return (value1 * value2);
}
- public double divide( Double value1, Double value2 ) {
+ public double divide( Double value1,
+ Double value2 ) {
if (value1 == null || value2 == null) throw new IllegalArgumentException();
return value1 / value2;
}
@@ -65,19 +74,22 @@
return (value + 1);
}
- public Double maximum( Double value1, Double value2 ) {
+ public Double maximum( Double value1,
+ Double value2 ) {
if (value1 == null) return value2;
if (value2 == null) return value1;
return Math.max(value1, value2);
}
- public Double minimum( Double value1, Double value2 ) {
+ public Double minimum( Double value1,
+ Double value2 ) {
if (value1 == null) return value2;
if (value2 == null) return value1;
return Math.min(value1, value2);
}
- public int compare( Double value1, Double value2 ) {
+ public int compare( Double value1,
+ Double value2 ) {
if (value1 == null) return value2 != null ? -1 : 0;
if (value2 == null) return 1;
return value1.compareTo(value2);
@@ -115,7 +127,9 @@
return this;
}
- public Double random( Double minimum, Double maximum, Random rng ) {
+ public Double random( Double minimum,
+ Double maximum,
+ Random rng ) {
Double difference = subtract(maximum, minimum);
return minimum + difference.doubleValue() * rng.nextDouble();
}
@@ -158,21 +172,24 @@
return exp;
}
- public Double roundUp( Double value, int decimalShift ) {
+ public Double roundUp( Double value,
+ int decimalShift ) {
if (value == 0) return 0.0d;
double shiftedValue = (Math.abs(value) * Math.pow(10.0d, decimalShift) + 0.5d) *
Math.signum(value);
double roundedValue = (int)shiftedValue;
return roundedValue * Math.pow(10.0d, -decimalShift);
}
- public Double roundDown( Double value, int decimalShift ) {
+ public Double roundDown( Double value,
+ int decimalShift ) {
if (value == 0) return 0.0d;
double shiftedValue = (Math.abs(value) * Math.pow(10.0d, decimalShift)) *
Math.signum(value);
double roundedValue = (int)shiftedValue;
return roundedValue * Math.pow(10.0d, -decimalShift);
}
- public Double keepSignificantFigures( Double value, int numSigFigs ) {
+ public Double keepSignificantFigures( Double value,
+ int numSigFigs ) {
if (numSigFigs < 0) return value;
if (numSigFigs == 0) return 0.0d;
int currentExp = getExponentInScientificNotation(value);
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/math/Duration.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/math/Duration.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/math/Duration.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -26,11 +26,13 @@
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.concurrent.TimeUnit;
+import net.jcip.annotations.Immutable;
/**
* A number representing an immutable duration of time. This is intended to be used in
the same manner as other {@link Number}
* subclasses.
*/
+@Immutable
public class Duration extends Number implements Comparable<Duration> {
private static final long serialVersionUID = 1L;
@@ -222,6 +224,8 @@
*/
public Components getComponents() {
if (this.components == null) {
+ // This is idempotent, so no need to synchronize ...
+
// Calculate how many seconds, and don't lose any information ...
BigDecimal bigSeconds = new BigDecimal(this.durationInNanos).divide(new
BigDecimal(1000000000));
// Calculate the minutes, and round to lose the seconds
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/math/DurationOperations.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/math/DurationOperations.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/math/DurationOperations.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -27,31 +27,40 @@
import java.util.Comparator;
import java.util.Random;
import java.util.concurrent.TimeUnit;
+import net.jcip.annotations.Immutable;
+/**
+ * The {@link MathOperations math operations} for {@link Duration}s.
+ */
+@Immutable
public class DurationOperations implements MathOperations<Duration>,
Comparator<Duration> {
public Class<Duration> getOperandClass() {
return Duration.class;
}
- public Duration add( Duration value1, Duration value2 ) {
+ public Duration add( Duration value1,
+ Duration value2 ) {
if (value1 == null) return value2 != null ? value2 : createZeroValue();
if (value2 == null) return value1;
return value1.add(value2);
}
- public Duration subtract( Duration value1, Duration value2 ) {
+ public Duration subtract( Duration value1,
+ Duration value2 ) {
if (value1 == null) return negate(value2);
if (value2 == null) return value1;
return value1.subtract(value2);
}
- public Duration multiply( Duration value1, Duration value2 ) {
+ public Duration multiply( Duration value1,
+ Duration value2 ) {
if (value1 == null || value2 == null) return createZeroValue();
return value1.multiply(value2.longValue());
}
- public double divide( Duration value1, Duration value2 ) {
+ public double divide( Duration value1,
+ Duration value2 ) {
if (value1 == null || value2 == null) throw new IllegalArgumentException();
return value1.divide(value2);
}
@@ -66,19 +75,22 @@
return value.add(1l, TimeUnit.NANOSECONDS);
}
- public Duration maximum( Duration value1, Duration value2 ) {
+ public Duration maximum( Duration value1,
+ Duration value2 ) {
if (value1 == null) return value2;
if (value2 == null) return value1;
return new Duration(Math.max(value1.longValue(), value2.longValue()));
}
- public Duration minimum( Duration value1, Duration value2 ) {
+ public Duration minimum( Duration value1,
+ Duration value2 ) {
if (value1 == null) return value2;
if (value2 == null) return value1;
return new Duration(Math.min(value1.longValue(), value2.longValue()));
}
- public int compare( Duration value1, Duration value2 ) {
+ public int compare( Duration value1,
+ Duration value2 ) {
if (value1 == null) return value2 != null ? -1 : 0;
if (value2 == null) return 1;
return value1.compareTo(value2);
@@ -116,7 +128,9 @@
return this;
}
- public Duration random( Duration minimum, Duration maximum, Random rng ) {
+ public Duration random( Duration minimum,
+ Duration maximum,
+ Random rng ) {
Duration difference = subtract(maximum, minimum);
return new Duration(minimum.getDuratinInNanoseconds() +
rng.nextInt(difference.intValue()));
}
@@ -153,7 +167,8 @@
return exp;
}
- public Duration roundUp( Duration durationValue, int decimalShift ) {
+ public Duration roundUp( Duration durationValue,
+ int decimalShift ) {
long value = durationValue.longValue();
if (value == 0) return new Duration(0l);
if (decimalShift >= 0) return durationValue;
@@ -169,7 +184,8 @@
return new Duration(shiftedValue);
}
- public Duration roundDown( Duration durationValue, int decimalShift ) {
+ public Duration roundDown( Duration durationValue,
+ int decimalShift ) {
long value = durationValue.longValue();
if (value == 0) return new Duration(0l);
if (decimalShift >= 0) return durationValue;
@@ -182,7 +198,8 @@
return new Duration(shiftedValue);
}
- public Duration keepSignificantFigures( Duration value, int numSigFigs ) {
+ public Duration keepSignificantFigures( Duration value,
+ int numSigFigs ) {
if (numSigFigs < 0) return value;
if (numSigFigs == 0) return new Duration(0l);
int currentExp = getExponentInScientificNotation(value);
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/math/FloatOperations.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/math/FloatOperations.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/math/FloatOperations.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -26,31 +26,40 @@
import java.math.BigDecimal;
import java.util.Comparator;
import java.util.Random;
+import net.jcip.annotations.Immutable;
+/**
+ * The {@link MathOperations math operations} for float numbers.
+ */
+@Immutable
public class FloatOperations implements MathOperations<Float>,
Comparator<Float> {
public Class<Float> getOperandClass() {
return Float.class;
}
- public Float add( Float value1, Float value2 ) {
+ public Float add( Float value1,
+ Float value2 ) {
if (value1 == null) return value2 != null ? value2 : createZeroValue();
if (value2 == null) return value1;
return (value1 + value2);
}
- public Float subtract( Float value1, Float value2 ) {
+ public Float subtract( Float value1,
+ Float value2 ) {
if (value1 == null) return negate(value2);
if (value2 == null) return value1;
return (value1 - value2);
}
- public Float multiply( Float value1, Float value2 ) {
+ public Float multiply( Float value1,
+ Float value2 ) {
if (value1 == null || value2 == null) return createZeroValue();
return (value1 * value2);
}
- public double divide( Float value1, Float value2 ) {
+ public double divide( Float value1,
+ Float value2 ) {
if (value1 == null || value2 == null) throw new IllegalArgumentException();
return value1 / value2;
}
@@ -65,19 +74,22 @@
return (value + 1);
}
- public Float maximum( Float value1, Float value2 ) {
+ public Float maximum( Float value1,
+ Float value2 ) {
if (value1 == null) return value2;
if (value2 == null) return value1;
return Math.max(value1, value2);
}
- public Float minimum( Float value1, Float value2 ) {
+ public Float minimum( Float value1,
+ Float value2 ) {
if (value1 == null) return value2;
if (value2 == null) return value1;
return Math.min(value1, value2);
}
- public int compare( Float value1, Float value2 ) {
+ public int compare( Float value1,
+ Float value2 ) {
if (value1 == null) return value2 != null ? -1 : 0;
if (value2 == null) return 1;
return value1.compareTo(value2);
@@ -115,7 +127,9 @@
return this;
}
- public Float random( Float minimum, Float maximum, Random rng ) {
+ public Float random( Float minimum,
+ Float maximum,
+ Random rng ) {
Float difference = subtract(maximum, minimum);
return minimum + difference.floatValue() * rng.nextFloat();
}
@@ -158,14 +172,16 @@
return exp;
}
- public Float roundUp( Float value, int decimalShift ) {
+ public Float roundUp( Float value,
+ int decimalShift ) {
if (value == 0) return 0.0f;
double shiftedValue = (Math.abs(value.doubleValue()) * Math.pow(10.0d,
decimalShift) + 0.5d) * Math.signum(value);
double roundedValue = (long)shiftedValue;
return (float)(roundedValue * Math.pow(10.0d, -decimalShift));
}
- public Float roundDown( Float value, int decimalShift ) {
+ public Float roundDown( Float value,
+ int decimalShift ) {
if (value == 0) return 0.0f;
if (decimalShift > 0) return value;
double shiftedValue = (Math.abs(value.doubleValue()) * Math.pow(10.0d,
decimalShift)) * Math.signum(value);
@@ -173,7 +189,8 @@
return (float)(roundedValue * Math.pow(10.0d, -decimalShift));
}
- public Float keepSignificantFigures( Float value, int numSigFigs ) {
+ public Float keepSignificantFigures( Float value,
+ int numSigFigs ) {
int currentExp = getExponentInScientificNotation(value);
int decimalShift = (int)Math.signum(currentExp) * (Math.abs(currentExp) +
numSigFigs - 1);
return roundUp(value, decimalShift);
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/math/IntegerOperations.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/math/IntegerOperations.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/math/IntegerOperations.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -26,31 +26,40 @@
import java.math.BigDecimal;
import java.util.Comparator;
import java.util.Random;
+import net.jcip.annotations.Immutable;
+/**
+ * The {@link MathOperations math operations} for integer numbers.
+ */
+@Immutable
public class IntegerOperations implements MathOperations<Integer>,
Comparator<Integer> {
public Class<Integer> getOperandClass() {
return Integer.class;
}
- public Integer add( Integer value1, Integer value2 ) {
+ public Integer add( Integer value1,
+ Integer value2 ) {
if (value1 == null) return value2 != null ? value2 : createZeroValue();
if (value2 == null) return value1;
return value1 + value2;
}
- public Integer subtract( Integer value1, Integer value2 ) {
+ public Integer subtract( Integer value1,
+ Integer value2 ) {
if (value1 == null) return negate(value2);
if (value2 == null) return value1;
return value1 - value2;
}
- public Integer multiply( Integer value1, Integer value2 ) {
+ public Integer multiply( Integer value1,
+ Integer value2 ) {
if (value1 == null || value2 == null) return createZeroValue();
return value1 * value2;
}
- public double divide( Integer value1, Integer value2 ) {
+ public double divide( Integer value1,
+ Integer value2 ) {
if (value1 == null || value2 == null) throw new IllegalArgumentException();
return value1 / value2;
}
@@ -65,19 +74,22 @@
return value + 1;
}
- public Integer maximum( Integer value1, Integer value2 ) {
+ public Integer maximum( Integer value1,
+ Integer value2 ) {
if (value1 == null) return value2;
if (value2 == null) return value1;
return Math.max(value1, value2);
}
- public Integer minimum( Integer value1, Integer value2 ) {
+ public Integer minimum( Integer value1,
+ Integer value2 ) {
if (value1 == null) return value2;
if (value2 == null) return value1;
return Math.min(value1, value2);
}
- public int compare( Integer value1, Integer value2 ) {
+ public int compare( Integer value1,
+ Integer value2 ) {
if (value1 == null) return value2 != null ? -1 : 0;
if (value2 == null) return 1;
return value1.compareTo(value2);
@@ -115,7 +127,9 @@
return this;
}
- public Integer random( Integer minimum, Integer maximum, Random rng ) {
+ public Integer random( Integer minimum,
+ Integer maximum,
+ Random rng ) {
Integer difference = subtract(maximum, minimum);
return minimum + rng.nextInt(difference);
}
@@ -152,7 +166,8 @@
return exp;
}
- public Integer roundUp( Integer value, int decimalShift ) {
+ public Integer roundUp( Integer value,
+ int decimalShift ) {
if (value == 0) return 0;
if (decimalShift >= 0) return value;
int shiftedValueP5 = Math.abs(value);
@@ -167,7 +182,8 @@
return shiftedValue;
}
- public Integer roundDown( Integer value, int decimalShift ) {
+ public Integer roundDown( Integer value,
+ int decimalShift ) {
if (value == 0) return 0;
if (decimalShift >= 0) return value;
int shiftedValue = Math.abs(value);
@@ -179,7 +195,8 @@
return shiftedValue;
}
- public Integer keepSignificantFigures( Integer value, int numSigFigs ) {
+ public Integer keepSignificantFigures( Integer value,
+ int numSigFigs ) {
if (numSigFigs < 0) return value;
if (numSigFigs == 0) return 0;
int currentExp = getExponentInScientificNotation(value);
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/math/LongOperations.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/math/LongOperations.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/math/LongOperations.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -26,31 +26,40 @@
import java.math.BigDecimal;
import java.util.Comparator;
import java.util.Random;
+import net.jcip.annotations.Immutable;
+/**
+ * The {@link MathOperations math operations} for long numbers.
+ */
+@Immutable
public class LongOperations implements MathOperations<Long>, Comparator<Long>
{
public Class<Long> getOperandClass() {
return Long.class;
}
- public Long add( Long value1, Long value2 ) {
+ public Long add( Long value1,
+ Long value2 ) {
if (value1 == null) return value2 != null ? value2 : createZeroValue();
if (value2 == null) return value1;
return (value1 + value2);
}
- public Long subtract( Long value1, Long value2 ) {
+ public Long subtract( Long value1,
+ Long value2 ) {
if (value1 == null) return negate(value2);
if (value2 == null) return value1;
return (value1 - value2);
}
- public Long multiply( Long value1, Long value2 ) {
+ public Long multiply( Long value1,
+ Long value2 ) {
if (value1 == null || value2 == null) return createZeroValue();
return (value1 * value2);
}
- public double divide( Long value1, Long value2 ) {
+ public double divide( Long value1,
+ Long value2 ) {
if (value1 == null || value2 == null) throw new IllegalArgumentException();
return value1 / value2;
}
@@ -65,19 +74,22 @@
return (value + 1);
}
- public Long maximum( Long value1, Long value2 ) {
+ public Long maximum( Long value1,
+ Long value2 ) {
if (value1 == null) return value2;
if (value2 == null) return value1;
return Math.max(value1, value2);
}
- public Long minimum( Long value1, Long value2 ) {
+ public Long minimum( Long value1,
+ Long value2 ) {
if (value1 == null) return value2;
if (value2 == null) return value1;
return Math.min(value1, value2);
}
- public int compare( Long value1, Long value2 ) {
+ public int compare( Long value1,
+ Long value2 ) {
if (value1 == null) return value2 != null ? -1 : 0;
if (value2 == null) return 1;
return value1.compareTo(value2);
@@ -115,7 +127,9 @@
return this;
}
- public Long random( Long minimum, Long maximum, Random rng ) {
+ public Long random( Long minimum,
+ Long maximum,
+ Random rng ) {
Long difference = subtract(maximum, minimum);
return minimum + rng.nextInt(difference.intValue());
}
@@ -158,7 +172,8 @@
return exp;
}
- public Long roundUp( Long value, int decimalShift ) {
+ public Long roundUp( Long value,
+ int decimalShift ) {
if (value == 0) return 0l;
if (decimalShift >= 0) return value;
long shiftedValueP5 = Math.abs(value);
@@ -173,7 +188,8 @@
return shiftedValue;
}
- public Long roundDown( Long value, int decimalShift ) {
+ public Long roundDown( Long value,
+ int decimalShift ) {
if (value == 0) return 0l;
if (decimalShift >= 0) return value;
long shiftedValue = Math.abs(value);
@@ -185,7 +201,8 @@
return shiftedValue;
}
- public Long keepSignificantFigures( Long value, int numSigFigs ) {
+ public Long keepSignificantFigures( Long value,
+ int numSigFigs ) {
if (value == 0l) return value;
if (numSigFigs < 0) return value;
if (numSigFigs == 0) return 0l;
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/math/MathOperations.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/math/MathOperations.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/math/MathOperations.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -26,16 +26,20 @@
import java.math.BigDecimal;
import java.util.Comparator;
import java.util.Random;
+import net.jcip.annotations.Immutable;
/**
* The set of mathematic operations for a particular class of values. This is useful for
generic classes that must work with one
* of the {@link Number} subclasses.
+ *
* @param <T> the numeric class, usually a subclass of {@link Number} (although
this is not required)
*/
+@Immutable
public interface MathOperations<T> {
/**
* Return the class that these operations operate upon.
+ *
* @return the class
*/
public Class<T> getOperandClass();
@@ -43,41 +47,50 @@
/**
* Add the two operands and return the sum. The {@link #createZeroValue() zero value}
is used in place of any operand that is
* null.
+ *
* @param value1 the first operand
* @param value2 the second operand
* @return the sum of the two operands.
*/
- public T add( T value1, T value2 );
+ public T add( T value1,
+ T value2 );
/**
* Subtract the second operand from the first, and return the difference. The {@link
#createZeroValue() zero value} is used in
* place of any operand that is null.
+ *
* @param value1 the first operand
* @param value2 the second operand
* @return the difference between the two operands.
*/
- public T subtract( T value1, T value2 );
+ public T subtract( T value1,
+ T value2 );
/**
* Multiply the two operands and return the product. The {@link #createZeroValue()
zero value} is used in place of any operand
* that is null.
+ *
* @param value1 the first operand
* @param value2 the second operand
* @return the product of the two operands.
*/
- public T multiply( T value1, T value2 );
+ public T multiply( T value1,
+ T value2 );
/**
* Divide the first operand by the second, and return the result. The {@link
#createZeroValue() zero value} is used in place
* of any operand that is null.
+ *
* @param value1 the first operand
* @param value2 the second operand
* @return the result of the division
*/
- public double divide( T value1, T value2 );
+ public double divide( T value1,
+ T value2 );
/**
* Negate the supplied operand. The {@link #createZeroValue() zero value} is used in
place of any operand that is null.
+ *
* @param value the value that is to be negated
* @return the result of the negation
*/
@@ -85,8 +98,9 @@
/**
* Increment the supplied operand by 1. (Note, the exact meaning of "1" is
dependent upon the particular
- * {@link #getOperandClass() operand class}. The {@link #createZeroValue() zero
value} is used in place of any operand that
- * is null.
+ * {@link #getOperandClass() operand class}. The {@link #createZeroValue() zero
value} is used in place of any operand that is
+ * null.
+ *
* @param value the value that is to be incremented
* @return the incremented value
*/
@@ -95,34 +109,41 @@
/**
* Compare the two operands and return the one that is larger. A null value is
considered smaller than non-null values
* (including 0).
+ *
* @param value1 the first operand
* @param value2 the second operand
* @return the larger of the two operands
*/
- public T maximum( T value1, T value2 );
+ public T maximum( T value1,
+ T value2 );
/**
* Compare the two operands and return the one that is smaller. A null value is
considered larger than non-null values
* (including 0).
+ *
* @param value1 the first operand
* @param value2 the second operand
* @return the smaller of the two operands
*/
- public T minimum( T value1, T value2 );
+ public T minimum( T value1,
+ T value2 );
/**
* Compare the two operands and return an integer that describes whether the first
value is larger, smaller or the same as the
- * second value. The semantics are identical to those of {@link Comparable}. The
{@link #createZeroValue() zero value} is
- * used in place of any operand that is null.
+ * second value. The semantics are identical to those of {@link Comparable}. The
{@link #createZeroValue() zero value} is used
+ * in place of any operand that is null.
+ *
* @param value1 the first operand
* @param value2 the second operand
* @return -1 if the first value is smaller than the second, 1 if the first value is
larger than the second, or 0 if they are
- * equal.
+ * equal.
*/
- public int compare( T value1, T value2 );
+ public int compare( T value1,
+ T value2 );
/**
* Create a {@link BigDecimal} representation of the supplied value.
+ *
* @param value the value that is to be converted to a BigDecimal
* @return the BigDecimal representation, or null if <code>value</code>
is null
*/
@@ -131,46 +152,52 @@
/**
* Convert the {@link BigDecimal} representation into the natural object
representation. This may result in loss of some data
* (e.g., converting a decimal to an integer results in the loss of the fractional
part of the number).
+ *
* @param value the BigDecimal value
* @return the natural representation, or null if <code>value</code> is
null
*/
public T fromBigDecimal( BigDecimal value );
/**
- * Convert the value to a double. This may result in a loss of information depending
upon the
- * {@link #getOperandClass() operand class}.
+ * Convert the value to a double. This may result in a loss of information depending
upon the {@link #getOperandClass()
+ * operand class}.
+ *
* @param value the value
* @return the representation as a double
*/
public double doubleValue( T value );
/**
- * Convert the value to a float. This may result in a loss of information depending
upon the
- * {@link #getOperandClass() operand class}.
+ * Convert the value to a float. This may result in a loss of information depending
upon the {@link #getOperandClass() operand
+ * class}.
+ *
* @param value the value
* @return the representation as a float
*/
public float floatValue( T value );
/**
- * Convert the value to an integer. This may result in a loss of information
depending upon the
- * {@link #getOperandClass() operand class}.
+ * Convert the value to an integer. This may result in a loss of information
depending upon the {@link #getOperandClass()
+ * operand class}.
+ *
* @param value the value
* @return the representation as an integer
*/
public int intValue( T value );
/**
- * Convert the value to a short. This may result in a loss of information depending
upon the
- * {@link #getOperandClass() operand class}.
+ * Convert the value to a short. This may result in a loss of information depending
upon the {@link #getOperandClass() operand
+ * class}.
+ *
* @param value the value
* @return the representation as a short
*/
public short shortValue( T value );
/**
- * Convert the value to a long integer. This may result in a loss of information
depending upon the
- * {@link #getOperandClass() operand class}.
+ * Convert the value to a long integer. This may result in a loss of information
depending upon the {@link #getOperandClass()
+ * operand class}.
+ *
* @param value the value
* @return the representation as a long
*/
@@ -178,12 +205,14 @@
/**
* Create the object form of the "zero value". This is often used to create
an uninitialized object.
+ *
* @return the object that represents zero.
*/
public T createZeroValue();
/**
* Convert the integer representation into the natural object representation.
+ *
* @param value the integer value
* @return the object representation of the integer
*/
@@ -191,6 +220,7 @@
/**
* Convert the long representation into the natural object representation.
+ *
* @param value the long value
* @return the object representation of the long integer
*/
@@ -198,6 +228,7 @@
/**
* Convert the double representation into the natural object representation.
+ *
* @param value the double value
* @return the object representation of the floating point number
*/
@@ -205,6 +236,7 @@
/**
* Return the square root of the supplied operand.
+ *
* @param value the value whose root is to be found; may not be null or 0
* @return the square root of the value
*/
@@ -213,12 +245,14 @@
/**
* Return a {@link Comparator Comparator<T>} for this {@link #getOperandClass()
operand class}. The implementation is free to
* return the same comparator instance from multiple invocations of this method.
+ *
* @return a comparator
*/
public Comparator<T> getComparator();
/**
* Get the exponent if the number were written in exponential form.
+ *
* @param value the value
* @return the scale
*/
@@ -232,11 +266,13 @@
* For example, consider the number 10.000354. This can be rounded to 10.0004 by
calling this method and supplying the value
* and an "exponentToKeep" value of -4.
* </p>
+ *
* @param value the value to be rounded
* @param decimalShift the number of places the decimal point should be shifted
before rounding
* @return the rounded value
*/
- public T roundUp( T value, int decimalShift );
+ public T roundUp( T value,
+ int decimalShift );
/**
* Round down the supplied value to the desired scale. This process works
(conceptually) by shifting the decimal point of the
@@ -246,21 +282,27 @@
* For example, consider the number 10.000354. This can be rounded to 10.0003 by
calling this method and supplying the value
* and an "exponentToKeep" value of -4.
* </p>
+ *
* @param value the value to be rounded
* @param decimalShift the number of places the decimal point should be shifted
before rounding
* @return the rounded value
*/
- public T roundDown( T value, int decimalShift );
+ public T roundDown( T value,
+ int decimalShift );
- public T keepSignificantFigures( T value, int numSigFigs );
+ public T keepSignificantFigures( T value,
+ int numSigFigs );
/**
* Generate a random instance within the specified range.
+ *
* @param minimum the minimum value, or null if the {@link #createZeroValue()
zero-value} should be used for the minimum
* @param maximum the maximum value, or null if the {@link #createZeroValue()
zero-value} should be used for the maximum
* @param rng the random number generator to use
* @return an instance of the {@link #getOperandClass() operand class} placed within
the desired range using a random
- * distribution, or null if this class does not support generating random instances
+ * distribution, or null if this class does not support generating random
instances
*/
- public T random( T minimum, T maximum, Random rng );
+ public T random( T minimum,
+ T maximum,
+ Random rng );
}
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/math/ShortOperations.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/math/ShortOperations.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/math/ShortOperations.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -26,31 +26,40 @@
import java.math.BigDecimal;
import java.util.Comparator;
import java.util.Random;
+import net.jcip.annotations.Immutable;
+/**
+ * The {@link MathOperations math operations} for short numbers.
+ */
+@Immutable
public class ShortOperations implements MathOperations<Short>,
Comparator<Short> {
public Class<Short> getOperandClass() {
return Short.class;
}
- public Short add( Short value1, Short value2 ) {
+ public Short add( Short value1,
+ Short value2 ) {
if (value1 == null) return value2 != null ? value2 : createZeroValue();
if (value2 == null) return value1;
return (short)(value1 + value2);
}
- public Short subtract( Short value1, Short value2 ) {
+ public Short subtract( Short value1,
+ Short value2 ) {
if (value1 == null) return negate(value2);
if (value2 == null) return value1;
return (short)(value1 - value2);
}
- public Short multiply( Short value1, Short value2 ) {
+ public Short multiply( Short value1,
+ Short value2 ) {
if (value1 == null || value2 == null) return createZeroValue();
return (short)(value1 * value2);
}
- public double divide( Short value1, Short value2 ) {
+ public double divide( Short value1,
+ Short value2 ) {
if (value1 == null || value2 == null) throw new IllegalArgumentException();
return value1 / value2;
}
@@ -65,19 +74,22 @@
return (short)(value + 1);
}
- public Short maximum( Short value1, Short value2 ) {
+ public Short maximum( Short value1,
+ Short value2 ) {
if (value1 == null) return value2;
if (value2 == null) return value1;
return (short)Math.max(value1, value2);
}
- public Short minimum( Short value1, Short value2 ) {
+ public Short minimum( Short value1,
+ Short value2 ) {
if (value1 == null) return value2;
if (value2 == null) return value1;
return (short)Math.min(value1, value2);
}
- public int compare( Short value1, Short value2 ) {
+ public int compare( Short value1,
+ Short value2 ) {
if (value1 == null) return value2 != null ? -1 : 0;
if (value2 == null) return 1;
return value1.compareTo(value2);
@@ -115,7 +127,9 @@
return this;
}
- public Short random( Short minimum, Short maximum, Random rng ) {
+ public Short random( Short minimum,
+ Short maximum,
+ Random rng ) {
Short difference = subtract(maximum, minimum);
int increment = rng.nextInt(difference.intValue());
return new Integer(minimum + increment).shortValue();
@@ -158,7 +172,8 @@
return exp;
}
- public Short roundUp( Short value, int decimalShift ) {
+ public Short roundUp( Short value,
+ int decimalShift ) {
if (value == 0) return 0;
if (decimalShift >= 0) return value;
int shiftedValueP5 = Math.abs(value);
@@ -173,7 +188,8 @@
return (short)shiftedValue;
}
- public Short roundDown( Short value, int decimalShift ) {
+ public Short roundDown( Short value,
+ int decimalShift ) {
if (value == 0) return 0;
if (decimalShift >= 0) return value;
int shiftedValue = Math.abs(value);
@@ -185,7 +201,8 @@
return (short)shiftedValue;
}
- public Short keepSignificantFigures( Short value, int numSigFigs ) {
+ public Short keepSignificantFigures( Short value,
+ int numSigFigs ) {
if (numSigFigs < 0) return value;
if (numSigFigs == 0) return 0;
int currentExp = getExponentInScientificNotation(value);
Copied: trunk/dna-common/src/main/java/org/jboss/dna/common/math/package-info.java (from
rev 1217,
trunk/dna-repository/src/main/java/org/jboss/dna/repository/service/AdministeredService.java)
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/math/package-info.java
(rev 0)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/math/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * A set of classes that define mathematic operations for a particular class of values.
+ * This is useful for generic classes that must work with one of the {@link Number}
subclasses.
+ */
+
+package org.jboss.dna.common.math;
\ No newline at end of file
Copied: trunk/dna-common/src/main/java/org/jboss/dna/common/package-info.java (from rev
1217,
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/SessionFactory.java)
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/package-info.java
(rev 0)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,31 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The parent package for the common, low-level utilities and simple frameworks for all
of JBoss DNA.
+ * These include the {@link org.jboss.dna.common.i18n.I18n internationalization
framework},
+ * component management framework, and utilities for statistics, math, collections, text
processing,
+ * XML, and general utilities.
+ */
+
+package org.jboss.dna.common;
\ No newline at end of file
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/statistic/Histogram.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/statistic/Histogram.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/statistic/Histogram.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -31,9 +31,16 @@
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
+import net.jcip.annotations.NotThreadSafe;
import org.jboss.dna.common.math.MathOperations;
import org.jboss.dna.common.util.StringUtil;
+/**
+ * A representation of a histogram of values.
+ *
+ * @param <T> the type of value
+ */
+@NotThreadSafe
public class Histogram<T extends Number> {
public static final int DEFAULT_BUCKET_COUNT = 10;
@@ -48,7 +55,8 @@
private BucketingStrategy actualValueStrategy = new DefaultBucketingStrategy();
private BucketingStrategy bucketingStrategy = actualValueStrategy;
- public Histogram( MathOperations<T> operations, List<T> values ) {
+ public Histogram( MathOperations<T> operations,
+ List<T> values ) {
this.math = operations;
this.values = new LinkedList<T>(values);
this.buckets = new LinkedList<Bucket>();
@@ -57,7 +65,8 @@
Collections.sort(this.values, this.math.getComparator());
}
- public Histogram( MathOperations<T> operations, T... values ) {
+ public Histogram( MathOperations<T> operations,
+ T... values ) {
this(operations, Arrays.asList(values));
}
@@ -74,21 +83,26 @@
/**
* Set the histogram to use the standard deviation to determine the bucket sizes.
+ *
* @param median
* @param standardDeviation
* @param sigma
*/
- public void setStrategy( double median, double standardDeviation, int sigma ) {
+ public void setStrategy( double median,
+ double standardDeviation,
+ int sigma ) {
this.bucketingStrategy = new StandardDeviationBucketingStrategy(median,
standardDeviation, sigma);
this.bucketWidth = null;
}
/**
* Set the histogram to use the supplied minimum and maximum values to determine the
bucket size.
+ *
* @param minimum
* @param maximum
*/
- public void setStrategy( T minimum, T maximum ) {
+ public void setStrategy( T minimum,
+ T maximum ) {
this.bucketingStrategy = new ExplicitBucketingStrategy(minimum, maximum);
this.bucketWidth = null;
}
@@ -107,6 +121,7 @@
/**
* Set the number of significant figures used in the calculation of the bucket
widths.
+ *
* @param significantFigures the number of significant figures for the bucket widths
* @return this histogram, useful for method-chaining
* @see #DEFAULT_SIGNIFICANT_FIGURES
@@ -122,6 +137,7 @@
/**
* Return the number of buckets in this histogram.
+ *
* @return the number of buckets.
*/
public int getBucketCount() {
@@ -130,6 +146,7 @@
/**
* Set the number of buckets that this histogram will use.
+ *
* @param count the number of buckets
* @return this histogram, useful for method-chaining
* @see #DEFAULT_BUCKET_COUNT
@@ -146,6 +163,7 @@
/**
* Get the buckets in this histogram. If the histogram has not yet been computed,
this method will cause it to be generated.
* The resulting list should not be modified.
+ *
* @return the histogram buckets.
*/
public List<Bucket> getBuckets() {
@@ -166,7 +184,13 @@
T actualMaximum = this.actualValueStrategy.getUpperBound();
// Create the buckets ...
- List<T> boundaries = getBucketBoundaries(this.math, lowerBound, upperBound,
actualMinimum, actualMaximum, this.bucketCount, this.significantFigures);
+ List<T> boundaries = getBucketBoundaries(this.math,
+ lowerBound,
+ upperBound,
+ actualMinimum,
+ actualMaximum,
+ this.bucketCount,
+ this.significantFigures);
this.buckets.clear();
int numBuckets = boundaries.isEmpty() ? 0 : boundaries.size() - 1;
for (int i = 0; i != numBuckets; ++i) {
@@ -187,6 +211,7 @@
/**
* Return the total number of values that have gone into this histogram.
+ *
* @return the total number of values
* @see Bucket#getPercentageOfValues()
*/
@@ -212,13 +237,15 @@
/**
* Generate a textual (horizontal) bar graph of this histogram.
+ *
* @param maxBarLength the maximum bar length, or 0 if the bar length is to represent
actual counts
* @return the strings that make up the histogram
*/
public List<String> getTextGraph( int maxBarLength ) {
compute();
if (maxBarLength < 1) maxBarLength = (int)this.getMaximumCount();
- final float barLengthForHundredPercent = this.buckets.isEmpty() ? maxBarLength :
100.0f * maxBarLength / getMaximumPercentage();
+ final float barLengthForHundredPercent = this.buckets.isEmpty() ? maxBarLength :
100.0f * maxBarLength
+
/ getMaximumPercentage();
final String fullLengthBar = StringUtil.createString('*',
(int)barLengthForHundredPercent);
List<String> result = new LinkedList<String>();
// First calculate the labels and the max length ...
@@ -258,7 +285,13 @@
return result;
}
- protected static <T> List<T> getBucketBoundaries( MathOperations<T>
math, T lowerBound, T upperBound, T actualMinimum, T actualMaximum, int bucketCount, int
bucketWidthSigFigs ) {
+ protected static <T> List<T> getBucketBoundaries( MathOperations<T>
math,
+ T lowerBound,
+ T upperBound,
+ T actualMinimum,
+ T actualMaximum,
+ int bucketCount,
+ int bucketWidthSigFigs ) {
lowerBound = math.compare(lowerBound, actualMinimum) < 0 ? actualMinimum :
lowerBound;
upperBound = math.compare(actualMaximum, upperBound) < 0 ? actualMaximum :
upperBound;
if (math.compare(lowerBound, upperBound) == 0) {
@@ -315,7 +348,8 @@
private final T width;
private long numValues;
- protected Bucket( T lowerBound, T upperBound ) {
+ protected Bucket( T lowerBound,
+ T upperBound ) {
this.lowerBound = lowerBound;
this.upperBound = upperBound;
this.width = Histogram.this.math.subtract(upperBound, lowerBound);
@@ -323,6 +357,7 @@
/**
* Get the lower bound of this bucket.
+ *
* @return the lower bound
*/
public T getLowerBound() {
@@ -331,6 +366,7 @@
/**
* Get the upper bound of this bucket.
+ *
* @return the upper bound
*/
public T getUpperBound() {
@@ -339,6 +375,7 @@
/**
* Get the width of this bucket.
+ *
* @return the width
*/
public T getWidth() {
@@ -347,6 +384,7 @@
/**
* Return the percentage of values in the histogram that appear in this bucket.
+ *
* @return the percentage of all values in the histogram that appear in this
bucket.
*/
public float getPercentageOfValues() {
@@ -358,6 +396,7 @@
/**
* Add a value to this bucket
+ *
* @param value
*/
protected void addValue( T value ) {
@@ -366,6 +405,7 @@
/**
* Get the number of values in this bucket.
+ *
* @return the number of values
*/
public long getNumberOfValues() {
@@ -374,12 +414,14 @@
/**
* Check whether the value fits in this bucket.
+ *
* @param value the value to check
* @param isLast
* @return 0 if the value fits in this bucket, -1 if the value fits in a prior
bucket, or 1 if the value fits in a later
- * bucket
+ * bucket
*/
- public int checkValue( T value, boolean isLast ) {
+ public int checkValue( T value,
+ boolean isLast ) {
if (Histogram.this.math.compare(this.lowerBound, value) > 0) return -1;
if (isLast) {
if (Histogram.this.math.compare(value, this.upperBound) > 0) return
1;
@@ -456,7 +498,8 @@
private final T lowerBound;
private final T upperBound;
- protected ExplicitBucketingStrategy( T lowerBound, T upperBound ) {
+ protected ExplicitBucketingStrategy( T lowerBound,
+ T upperBound ) {
this.lowerBound = lowerBound;
this.upperBound = upperBound;
}
@@ -478,7 +521,9 @@
private final double standardDeviation;
private final int numberOfDeviationsAboveAndBelow;
- protected StandardDeviationBucketingStrategy( double median, double
standardDeviation, int numDeviationsAboveAndBelow ) {
+ protected StandardDeviationBucketingStrategy( double median,
+ double standardDeviation,
+ int numDeviationsAboveAndBelow ) {
this.median = median;
this.standardDeviation = Math.abs(standardDeviation);
this.numberOfDeviationsAboveAndBelow = Math.abs(numDeviationsAboveAndBelow);
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/statistic/SimpleStatistics.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/statistic/SimpleStatistics.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/statistic/SimpleStatistics.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -33,15 +33,15 @@
/**
* Encapsulation of the statistics for a series of values to which new values are
frequently added. The statistics include the
- * {@link #getMinimum() minimum}, {@link #getMaximum() maximum}, {@link #getTotal() total
(aggregate sum)}, and
- * {@link #getMean() mean (average)}. See {@link DetailedStatistics} for a subclass that
also calculates the
- * {@link DetailedStatistics#getMedian() median}, {@link
DetailedStatistics#getStandardDeviation() standard deviation} and the
- * {@link DetailedStatistics#getHistogram() histogram} of the values.
+ * {@link #getMinimum() minimum}, {@link #getMaximum() maximum}, {@link #getTotal() total
(aggregate sum)}, and {@link #getMean()
+ * mean (average)}. See {@link DetailedStatistics} for a subclass that also calculates
the {@link DetailedStatistics#getMedian()
+ * median}, {@link DetailedStatistics#getStandardDeviation() standard deviation} and the
{@link DetailedStatistics#getHistogram()
+ * histogram} of the values.
* <p>
* This class is threadsafe.
* </p>
+ *
* @param <T> the number type used in these statistics
- * @author Randall Hauch
*/
@ThreadSafe
public class SimpleStatistics<T extends Number> {
@@ -66,6 +66,7 @@
/**
* Add a new value to these statistics.
+ *
* @param value the new value
*/
public void add( T value ) {
@@ -81,6 +82,7 @@
/**
* A method that can be overridden by subclasses when {@link #add(Number) add} is
called. This method is called within the
* write lock, and does real work. Therefore, subclasses should call this method when
they overwrite it.
+ *
* @param value the value already added
*/
protected void doAddValue( T value ) {
@@ -107,6 +109,7 @@
/**
* Get the aggregate sum of the values in the series.
+ *
* @return the total of the values, or 0.0 if the {@link #getCount() count} is 0
*/
public T getTotal() {
@@ -121,6 +124,7 @@
/**
* Get the maximum value in the series.
+ *
* @return the maximum value, or 0.0 if the {@link #getCount() count} is 0
*/
public T getMaximum() {
@@ -135,6 +139,7 @@
/**
* Get the minimum value in the series.
+ *
* @return the minimum value, or 0.0 if the {@link #getCount() count} is 0
*/
public T getMinimum() {
@@ -149,6 +154,7 @@
/**
* Get the number of values that have been measured.
+ *
* @return the count
*/
public int getCount() {
@@ -164,6 +170,7 @@
/**
* Return the approximate mean (average) value represented as an instance of the
operand type. Note that this may truncate if
* the operand type is not able to have the required precision. For the accurate
mean, see {@link #getMeanValue() }.
+ *
* @return the mean (average), or 0.0 if the {@link #getCount() count} is 0
*/
public T getMean() {
@@ -178,6 +185,7 @@
/**
* Return the mean (average) value.
+ *
* @return the mean (average), or 0.0 if the {@link #getCount() count} is 0
* @see #getMean()
*/
@@ -229,7 +237,12 @@
public String toString() {
int count = this.getCount();
String samples = Inflector.getInstance().pluralize("sample", count);
- return StringUtil.createString("{0} {1}: min={2}; avg={3}; max={4}",
count, samples, this.minimum, this.mean, this.maximum);
+ return StringUtil.createString("{0} {1}: min={2}; avg={3}; max={4}",
+ count,
+ samples,
+ this.minimum,
+ this.mean,
+ this.maximum);
}
}
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/statistic/Stopwatch.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/statistic/Stopwatch.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/statistic/Stopwatch.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,8 +28,7 @@
import org.jboss.dna.common.math.DurationOperations;
/**
- * Provides a mechanism to measure time in the same was as a physical stopwatch.
- * @author Randall Hauch
+ * Provides a mechanism to measure time in the same way as a physical stopwatch.
*/
@NotThreadSafe
public class Stopwatch implements Comparable<Stopwatch> {
@@ -47,7 +46,8 @@
this(detailedStats, null);
}
- public Stopwatch( boolean detailedStats, String description ) {
+ public Stopwatch( boolean detailedStats,
+ String description ) {
this.description = description != null ? description : "";
this.detailedStats = detailedStats ? new DetailedStatistics<Duration>(new
DurationOperations()) : null;
this.stats = detailedStats ? this.detailedStats : new
SimpleStatistics<Duration>(new DurationOperations());
@@ -61,6 +61,7 @@
/**
* Start the stopwatch and begin recording the statistics a new run. This method does
nothing if the stopwatch is already
* {@link #isRunning() running}
+ *
* @see #isRunning()
*/
public void start() {
@@ -72,6 +73,7 @@
/**
* Stop the stopwatch and record the statistics for the latest run. This method does
nothing if the stopwatch is not currently
* {@link #isRunning() running}
+ *
* @see #isRunning()
*/
public void stop() {
@@ -84,6 +86,7 @@
/**
* Return the number of runs (complete starts and stops) this stopwatch has
undergone.
+ *
* @return the number of runs.
* @see #isRunning()
*/
@@ -93,6 +96,7 @@
/**
* Return whether this stopwatch is currently running.
+ *
* @return true if running, or false if not
*/
public boolean isRunning() {
@@ -101,8 +105,9 @@
/**
* Get the total duration that this stopwatch has recorded.
+ *
* @return the total duration, or an empty duration if this stopwatch has not been
used since creation or being
- * {@link #reset() reset}
+ * {@link #reset() reset}
*/
public Duration getTotalDuration() {
return this.stats.getTotal();
@@ -110,8 +115,9 @@
/**
* Get the average duration that this stopwatch has recorded.
+ *
* @return the average duration, or an empty duration if this stopwatch has not been
used since creation or being
- * {@link #reset() reset}
+ * {@link #reset() reset}
*/
public Duration getAverageDuration() {
return this.stats.getMean();
@@ -119,8 +125,9 @@
/**
* Get the median duration that this stopwatch has recorded.
+ *
* @return the median duration, or an empty duration if this stopwatch has not been
used since creation or being
- * {@link #reset() reset}
+ * {@link #reset() reset}
*/
public Duration getMedianDuration() {
return this.detailedStats != null ? this.detailedStats.getMedian() : new
Duration(0l);
@@ -128,8 +135,9 @@
/**
* Get the minimum duration that this stopwatch has recorded.
+ *
* @return the total minimum, or an empty duration if this stopwatch has not been
used since creation or being
- * {@link #reset() reset}
+ * {@link #reset() reset}
*/
public Duration getMinimumDuration() {
return this.stats.getMinimum();
@@ -137,8 +145,9 @@
/**
* Get the maximum duration that this stopwatch has recorded.
+ *
* @return the maximum duration, or an empty duration if this stopwatch has not been
used since creation or being
- * {@link #reset() reset}
+ * {@link #reset() reset}
*/
public Duration getMaximumDuration() {
return this.stats.getMaximum();
@@ -146,6 +155,7 @@
/**
* Return this stopwatch's simple statistics.
+ *
* @return the statistics
* @see #getDetailedStatistics()
*/
@@ -155,6 +165,7 @@
/**
* Return this stopwatch's detailed statistics, if they are being kept.
+ *
* @return the statistics
* @see #getSimpleStatistics()
*/
@@ -164,8 +175,9 @@
/**
* Return true if detailed statistics are being kept.
+ *
* @return true if {@link #getDetailedStatistics() detailed statistics} are being
kept, or false if only
- * {@link #getSimpleStatistics() simple statistics} are being kept.
+ * {@link #getSimpleStatistics() simple statistics} are being kept.
*/
public boolean isDetailedStatistics() {
return this.detailedStats != null;
@@ -182,12 +194,14 @@
* focused around the values that are up to 'numSigmas' above and below the
{@link #getMedianDuration() median}, and all
* values outside of this range are placed in the first and last bucket.
* </p>
- * @param numSigmas the number of standard deviations from the {@link
#getMedianDuration() median}, or 0 if the buckets of
- * the histogram should be evenly distributed
+ *
+ * @param numSigmas the number of standard deviations from the {@link
#getMedianDuration() median}, or 0 if the buckets of the
+ * histogram should be evenly distributed
* @return the histogram
*/
public Histogram<Duration> getHistogram( int numSigmas ) {
- return this.detailedStats != null ? this.detailedStats.getHistogram(numSigmas) :
new Histogram<Duration>(this.stats.getMathOperations());
+ return this.detailedStats != null ? this.detailedStats.getHistogram(numSigmas) :
new Histogram<Duration>(
+
this.stats.getMathOperations());
}
/**
Copied: trunk/dna-common/src/main/java/org/jboss/dna/common/statistic/package-info.java
(from rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/InterfaceMetadata.java)
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/statistic/package-info.java
(rev 0)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/statistic/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,28 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * A set of utilities for working with statistics, including a {@link Stopwatch} and
{@link Histogram}s.
+ */
+
+package org.jboss.dna.common.statistic;
\ No newline at end of file
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/text/Inflector.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/text/Inflector.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/text/Inflector.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,6 +28,7 @@
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import net.jcip.annotations.ThreadSafe;
import org.jboss.dna.common.util.CheckArg;
/**
@@ -35,9 +36,8 @@
* the <a
href="http://api.rubyonrails.org/classes/Inflector.html">Inf...
class in <a
* href="http://www.rubyonrails.org">Ruby on Rails</a>, which is
distributed under the <a
*
href="http://wiki.rubyonrails.org/rails/pages/License">Rails
license</a>.
- *
- * @author Randall Hauch
*/
+@ThreadSafe
public class Inflector {
protected static final Inflector INSTANCE = new Inflector();
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/text/Jsr283Encoder.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/text/Jsr283Encoder.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/text/Jsr283Encoder.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -25,43 +25,44 @@
import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
+import net.jcip.annotations.Immutable;
/**
* Encoder that escapes characters that are not allowed in JCR names. The mapping defined
in Section 3.6.3 of the JSR-283 public
- * review document: <table cellspacing="0" cellpadding="1"
border="1">
+ * review document:
+ * <table cellspacing="0" cellpadding="1"
border="1">
* <tr>
* <th>Non-JCR character<br/>(Unicode code point)</th>
- * <th>Private use<br/>Unicode code point </th>
+ * <th>Private use<br/>Unicode code point</th>
* </tr>
* <tr>
- * <td>* (U+002A)</td>
- * <td> U+F02A </td>
+ * <td>(U+002A)</td>
+ * <td>U+F02A</td>
* </tr>
* <tr>
* <td>/ (U+002F)</td>
- * <td> U+F02F </td>
+ * <td>U+F02F</td>
* </tr>
* <tr>
* <td>: (U+003A)</td>
- * <td> U+F03A </td>
+ * <td>U+F03A</td>
* </tr>
* <tr>
* <td>[ (U+005B)</td>
- * <td> U+F05B </td>
+ * <td>U+F05B</td>
* </tr>
* <tr>
* <td>] (U+005D)</td>
- * <td> U+F05D </td>
+ * <td>U+F05D</td>
* </tr>
* <tr>
* <td>| (U+007C)</td>
- * <td> U+F07C </td>
+ * <td>U+F07C</td>
* </tr>
* </table>
* </p>
- *
- * @author Randall Hauch
*/
+@Immutable
public class Jsr283Encoder implements TextEncoder, TextDecoder {
/**
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/text/NoOpEncoder.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/text/NoOpEncoder.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/text/NoOpEncoder.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,12 +23,13 @@
*/
package org.jboss.dna.common.text;
+import net.jcip.annotations.Immutable;
+
/**
* An encoder implementation that does nothing. This is useful when a {@link TextEncoder
encoder} is optional but the code is
* easier to write when there is always an encoder.
- *
- * @author Randall Hauch
*/
+@Immutable
public class NoOpEncoder implements TextEncoder, TextDecoder {
private static final NoOpEncoder INSTANCE = new NoOpEncoder();
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/text/TextDecoder.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/text/TextDecoder.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/text/TextDecoder.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,12 +23,14 @@
*/
package org.jboss.dna.common.text;
+import net.jcip.annotations.Immutable;
+
/**
* Interface for components that can decode text. This is the counterpart to {@link
TextEncoder}.
*
- * @author Randall Hauch
* @see TextEncoder
*/
+@Immutable
public interface TextDecoder {
/**
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/text/TextEncoder.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/text/TextEncoder.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/text/TextEncoder.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,12 +23,14 @@
*/
package org.jboss.dna.common.text;
+import net.jcip.annotations.Immutable;
+
/**
* Interface for components that can encode text. This is the counterpart to {@link
TextDecoder}.
*
- * @author Randall Hauch
* @see TextDecoder
*/
+@Immutable
public interface TextEncoder {
/**
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/text/UrlEncoder.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/text/UrlEncoder.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/text/UrlEncoder.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -26,14 +26,14 @@
import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
import java.util.BitSet;
+import net.jcip.annotations.Immutable;
/**
* An encoder useful for converting text to be used within a URL, as defined by Section
2.3 of <a
- *
href="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396</a>. Note that
this class does not encode a complete URL ({@link java.net.URLEncoder}
- * and {@link java.net.URLDecoder} should be used for such purposes).
- *
- * @author Randall Hauch
+ *
href="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396</a>. Note that
this class does not encode a complete URL (
+ * {@link java.net.URLEncoder} and {@link java.net.URLDecoder} should be used for such
purposes).
*/
+@Immutable
public class UrlEncoder implements TextEncoder, TextDecoder {
/**
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/text/XmlNameEncoder.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/text/XmlNameEncoder.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/text/XmlNameEncoder.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -26,6 +26,7 @@
import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
import java.util.BitSet;
+import net.jcip.annotations.Immutable;
/**
* An {@link TextEncoder encoder} and {@link TextDecoder decoder} for XML element and
attribute names.
@@ -40,9 +41,8 @@
* Decoding transforms every <code>_xHHHH_</code> encoding sequences back
into the UTF-16 character. Note that
* {@link #decode(String) decoding} can be safely done on any XML name, even if the name
does not contain any encoded sequences.
* </p>
- *
- * @author Randall Hauch
*/
+@Immutable
public class XmlNameEncoder implements TextDecoder, TextEncoder {
private static final BitSet XML_NAME_ALLOWED_CHARACTERS = new BitSet(2 ^ 16);
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/text/XmlValueEncoder.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/text/XmlValueEncoder.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/text/XmlValueEncoder.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -27,34 +27,34 @@
import java.text.StringCharacterIterator;
import java.util.HashMap;
import java.util.Map;
+import net.jcip.annotations.Immutable;
/**
- * An encoder useful for converting text to be used within XML attribute values.
- * The following translations will be performed:
+ * An encoder useful for converting text to be used within XML attribute values. The
following translations will be performed:
* <table cellspacing="0" cellpadding="1"
border="1">
* <tr>
* <th>Raw (Unencoded)<br/>Character</th>
* <th>Translated (Encoded)<br/>Entity</th>
* </tr>
* <tr>
- * <td> & </td>
- * <td> &amp; </td>
+ * <td>&</td>
+ * <td>&amp;</td>
* </tr>
* <tr>
- * <td> < </td>
- * <td> &lt; </td>
+ * <td><</td>
+ * <td>&lt;</td>
* </tr>
* <tr>
- * <td> > </td>
- * <td> &gt; </td>
+ * <td>></td>
+ * <td>&gt;</td>
* </tr>
* <tr>
- * <td> " </td>
- * <td> &quot; </td>
+ * <td>"</td>
+ * <td>&quot;</td>
* </tr>
* <tr>
- * <td> ' </td>
- * <td> &#039; </td>
+ * <td>'</td>
+ * <td>&#039;</td>
* </tr>
* <tr>
* <td>All Others</td>
@@ -63,23 +63,24 @@
* </table>
* </p>
*/
+@Immutable
public class XmlValueEncoder implements TextEncoder, TextDecoder {
-
+
private static final Map<String, Character> SPECIAL_ENTITIES;
-
+
static {
SPECIAL_ENTITIES = new HashMap<String, Character>();
-
+
SPECIAL_ENTITIES.put("quot", '"');
SPECIAL_ENTITIES.put("gt", '>');
SPECIAL_ENTITIES.put("lt", '<');
SPECIAL_ENTITIES.put("amp", '&');
-
+
}
-
+
/**
* {@inheritDoc}
- *
+ *
* @see org.jboss.dna.common.text.TextEncoder#encode(java.lang.String)
*/
public String encode( String text ) {
@@ -112,7 +113,7 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.jboss.dna.common.text.TextDecoder#decode(java.lang.String)
*/
public String decode( String encodedText ) {
@@ -122,36 +123,34 @@
for (char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) {
if (c == '&') {
int index = iter.getIndex();
-
+
do {
c = iter.next();
- }
- while (c != CharacterIterator.DONE && c != ';');
+ } while (c != CharacterIterator.DONE && c != ';');
// We found a closing semicolon
if (c == ';') {
String s = encodedText.substring(index + 1, iter.getIndex());
-
+
if (SPECIAL_ENTITIES.containsKey(s)) {
sb.append(SPECIAL_ENTITIES.get(s));
continue;
-
+
}
-
+
if (s.length() > 0 && s.charAt(0) == '#') {
try {
- sb.append((char) Short.parseShort(s.substring(1,
s.length())));
+ sb.append((char)Short.parseShort(s.substring(1,
s.length())));
continue;
- }
- catch (NumberFormatException nfe) {
+ } catch (NumberFormatException nfe) {
// This is possible in malformed encodings, but let it fall
through
}
}
}
-
+
// Malformed encoding, restore state and pass poorly encoded data back
c = '&';
- iter.setIndex(index);
+ iter.setIndex(index);
}
sb.append(c);
Copied: trunk/dna-common/src/main/java/org/jboss/dna/common/text/package-info.java (from
rev 1217,
trunk/dna-common/src/main/java/org/jboss/dna/common/component/AbstractComponent.java)
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/text/package-info.java
(rev 0)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/text/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,32 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * A set of utilities for working with text. Included is an {@link Inflector} class that
transforms (English) works into singular,
+ * plural, and human-readable forms, and is capable of transforming between camel-case,
whitespace-delimited, or underscore-delimited
+ * forms. There is also components that can {@link TextEncoder encode} and {@link
TextDecoder decode} text.
+ * Finally, this package defines a simple framework for {@link TokenStream tokenizing
text} (e.g., from files or stream)
+ * making it very easy to create very straightforward parsers.
+ */
+
+package org.jboss.dna.common.text;
\ No newline at end of file
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/util/CheckArg.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/util/CheckArg.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/util/CheckArg.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -26,12 +26,14 @@
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.common.CommonI18n;
/**
* Utility class that checks arguments to methods. This class is to be used only in API
methods, where failure to supply correct
* arguments should result in a useful error message. In all cases, use the
<code>assert</code> statement.
*/
+@Immutable
public final class CheckArg {
// ########################## int METHODS ###################################
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/util/ClassUtil.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/util/ClassUtil.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/util/ClassUtil.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -30,12 +30,12 @@
import java.security.PrivilegedAction;
import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
+import net.jcip.annotations.Immutable;
/**
* Static utilities for working with classes.
- *
- * @author John Verhaeg
*/
+@Immutable
public final class ClassUtil {
private static void addObjectString( Object object,
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/util/FileUtil.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/util/FileUtil.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/util/FileUtil.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -34,7 +34,12 @@
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
+import net.jcip.annotations.Immutable;
+/**
+ * A set of utilities for working with files and directories.
+ */
+@Immutable
public class FileUtil {
/**
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/util/HashCode.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/util/HashCode.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/util/HashCode.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,12 +24,13 @@
package org.jboss.dna.common.util;
import java.util.Arrays;
+import net.jcip.annotations.Immutable;
/**
* Utilities for easily computing hash codes. The algorithm should generally produce good
distributions for use in hash-based
* containers or collections, but as expected does always result in repeatable hash codes
given the inputs.
- * @author Randall Hauch
*/
+@Immutable
public class HashCode {
// Prime number used in improving distribution: 1,000,003
@@ -37,6 +38,7 @@
/**
* Compute a combined hash code from the supplied objects. This method always returns
0 if no objects are supplied.
+ *
* @param objects the objects that should be used to compute the hash code
* @return the hash code
*/
@@ -46,11 +48,13 @@
/**
* Compute a combined hash code from the supplied objects using the supplied seed.
+ *
* @param seed a value upon which the hash code will be based; may be 0
* @param objects the objects that should be used to compute the hash code
* @return the hash code
*/
- protected static int compute( int seed, Object... objects ) {
+ protected static int compute( int seed,
+ Object... objects ) {
if (objects == null || objects.length == 0) {
return seed * HashCode.PRIME;
}
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/util/IoUtil.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/util/IoUtil.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/util/IoUtil.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -35,10 +35,12 @@
import java.io.Reader;
import java.io.Writer;
import java.util.Arrays;
+import net.jcip.annotations.Immutable;
/**
- * @author Randall Hauch
+ * A set of utilities for more easily performing I/O.
*/
+@Immutable
public class IoUtil {
/**
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/util/LogContext.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/util/LogContext.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/util/LogContext.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,13 +23,14 @@
*/
package org.jboss.dna.common.util;
+import net.jcip.annotations.Immutable;
import org.slf4j.MDC;
/**
* Provides a "mapped diagnostic context" (MDC) for use in capturing extra
context information to be included in logs of
* multithreaded applications. Not all logging implementations support MDC, although a
few do (including <a
- *
href="http://logging.apache.org/log4j/1.3/index.html">Log4J&... and
<a href="http://logback.qos.ch/">Logback</a>). Note that
- * if the logging implementation does not support MDC, this information is ignored.
+ *
href="http://logging.apache.org/log4j/1.3/index.html">Log4J&... and
<a href="http://logback.qos.ch/">Logback</a>). Note that if
+ * the logging implementation does not support MDC, this information is ignored.
* <p>
* It can be difficult to understand what is going on within a multithreaded application.
When multiple threads are working
* simultaneously, their log messages are mixed together. Thus, it's difficult to
follow the log messages of a single thread. Log
@@ -61,19 +62,22 @@
* the values for those keys.
* </p>
*/
+@Immutable
public class LogContext {
/**
* Put a context value (the <code>val</code> parameter) as identified
with the <code>key</code> parameter into the current
- * thread's context map. The <code>key</code> parameter cannot be
null. The code>val</code> parameter can be null only if
- * the underlying implementation supports it.
+ * thread's context map. The <code>key</code> parameter cannot be
null. The code>val</code> parameter can be null only if the
+ * underlying implementation supports it.
* <p>
* This method delegates all work to the MDC of the underlying logging system.
+ *
* @param key the key
* @param value the value
* @throws IllegalArgumentException in case the "key" parameter is null
*/
- public static void set( String key, String value ) {
+ public static void set( String key,
+ String value ) {
MDC.put(key, value);
}
@@ -81,6 +85,7 @@
* Get the context identified by the <code>key</code> parameter. The
<code>key</code> parameter cannot be null.
* <p>
* This method delegates all work to the MDC of the underlying logging system.
+ *
* @param key the key
* @return the string value identified by the <code>key</code>
parameter.
* @throws IllegalArgumentException in case the "key" parameter is null
@@ -93,6 +98,7 @@
* Remove the the context identified by the <code>key</code> parameter
using the underlying system's MDC implementation. The
* <code>key</code> parameter cannot be null. This method does nothing if
there is no previous value associated with
* <code>key</code>.
+ *
* @param key the key
* @throws IllegalArgumentException in case the "key" parameter is null
*/
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/util/Reflection.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/util/Reflection.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/util/Reflection.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -35,12 +35,12 @@
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
+import net.jcip.annotations.Immutable;
/**
* Utility class for working reflectively with objects.
- *
- * @author Randall Hauch
*/
+@Immutable
public class Reflection {
/**
@@ -196,7 +196,7 @@
private static final Class<?>[] EMPTY_CLASS_ARRAY = new Class[] {};
private static final String[] BRACKETS_PAIR = new String[] {"",
"[]", "[][]", "[][][]", "[][][][]",
"[][][][][]"};
- private Class<?> targetClass;
+ private final Class<?> targetClass;
private Map<String, LinkedList<Method>> methodMap = null; // used for the
brute-force method finder
/**
@@ -497,6 +497,7 @@
Method method;
LinkedList<Method> methodsWithSameName;
if (this.methodMap == null) {
+ // This is idempotent, so no need to lock or synchronize ...
this.methodMap = new HashMap<String, LinkedList<Method>>();
Method[] methods = this.targetClass.getMethods();
for (int i = 0; i != methods.length; ++i) {
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/util/SecureHash.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/util/SecureHash.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/util/SecureHash.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -30,10 +30,12 @@
import java.io.InputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
+import net.jcip.annotations.Immutable;
/**
- * @author Randall Hauch
+ * A simple utility to generate various kinds of secure hashes.
*/
+@Immutable
public class SecureHash {
/**
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/util/StringUtil.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/util/StringUtil.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/util/StringUtil.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -36,11 +36,13 @@
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.common.CommonI18n;
/**
* Utilities for string processing and manipulation.
*/
+@Immutable
public class StringUtil {
public static final String[] EMPTY_STRING_ARRAY = new String[0];
@@ -123,12 +125,12 @@
matcher.appendReplacement(text, matcher.group());
} else {
Object parameter = parameters[ndx];
-
+
// Automatically pretty-print arrays
if (parameter != null && parameter.getClass().isArray()) {
parameter = Arrays.asList((Object[])parameter);
}
-
+
matcher.appendReplacement(text, Matcher.quoteReplacement(parameter ==
null ? "null" : parameter.toString()));
}
}
Copied: trunk/dna-common/src/main/java/org/jboss/dna/common/util/package-info.java (from
rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavadocMetadata.java)
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/util/package-info.java
(rev 0)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/util/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,28 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * A set of miscellaneous utilities.
+ */
+
+package org.jboss.dna.common.util;
\ No newline at end of file
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/xml/SimpleNamespaceContext.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/xml/SimpleNamespaceContext.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/xml/SimpleNamespaceContext.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -29,7 +29,8 @@
import javax.xml.namespace.NamespaceContext;
/**
- * @author Randall Hauch
+ * A simple {@link NamespaceContext} implementation that maintains the namespace and
prefix mappings discovered within an XML
+ * document.
*/
public class SimpleNamespaceContext implements NamespaceContext {
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/xml/XmlCharacters.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/xml/XmlCharacters.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/xml/XmlCharacters.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -25,29 +25,31 @@
import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
+import net.jcip.annotations.Immutable;
/**
- * A utility class for determining the validity of various XML names, per the
- * <a
href="http://www.w3.org/TR/REC-xml/">XML 1.0
Specification</a>.
+ * A utility class for determining the validity of various XML names, per the <a
href="http://www.w3.org/TR/REC-xml/">XML 1.0
+ * Specification</a>.
*/
+@Immutable
public class XmlCharacters {
private static final int NUMBER_OF_CHARACTERS = 1 << 16; // 65536 or 0x10000
/**
- * This implementation uses an array that captures for each character the XML
classifications.
- * An array is used because it is a fast way of looking up each character.
+ * This implementation uses an array that captures for each character the XML
classifications. An array is used because it is
+ * a fast way of looking up each character.
*/
private static final char[] MASKS = new char[NUMBER_OF_CHARACTERS];
private static final int VALID_CHARACTER = 1;
- private static final int CONTENT_CHARACTER = 1 <<1;
- private static final int SPACE_CHARACTER = 1 <<2;
- private static final int NAME_START_CHARACTER = 1<<3;
- private static final int NAME_CHARACTER = 1<<4;
- private static final int NCNAME_START_CHARACTER = 1<<5;
- private static final int NCNAME_CHARACTER = 1<<6;
- private static final int PUBID_CHARACTER = 1<<7;
+ private static final int CONTENT_CHARACTER = 1 << 1;
+ private static final int SPACE_CHARACTER = 1 << 2;
+ private static final int NAME_START_CHARACTER = 1 << 3;
+ private static final int NAME_CHARACTER = 1 << 4;
+ private static final int NCNAME_START_CHARACTER = 1 << 5;
+ private static final int NCNAME_CHARACTER = 1 << 6;
+ private static final int PUBID_CHARACTER = 1 << 7;
static {
@@ -59,9 +61,11 @@
MASKS[0x9] |= VALID_CHARACTER | CONTENT_CHARACTER;
MASKS[0xA] |= VALID_CHARACTER | CONTENT_CHARACTER;
MASKS[0xD] |= VALID_CHARACTER | CONTENT_CHARACTER;
- for (int i = 0x20; i <= 0xD7FF; ++i) MASKS[i] |= VALID_CHARACTER |
CONTENT_CHARACTER;
- for (int i = 0xE000; i <= 0xFFFD; ++i) MASKS[i] |= VALID_CHARACTER |
CONTENT_CHARACTER;
- // Last range is bigger than our character array, so we'll handle in the
'isValid' method ...
+ for (int i = 0x20; i <= 0xD7FF; ++i)
+ MASKS[i] |= VALID_CHARACTER | CONTENT_CHARACTER;
+ for (int i = 0xE000; i <= 0xFFFD; ++i)
+ MASKS[i] |= VALID_CHARACTER | CONTENT_CHARACTER;
+ // Last range is bigger than our character array, so we'll handle in the
'isValid' method ...
// for ( int i=0x10000; i<=0x10FFFF; ++i ) MASKS[i] = VALID_CHARACTER_MASK |
CONTENT_CHARACTER;
// Remove the other characters that are not allowed in XML content:
@@ -71,7 +75,7 @@
MASKS['\n'] &= ~(CONTENT_CHARACTER);
MASKS['\r'] &= ~(CONTENT_CHARACTER);
MASKS[']'] &= ~(CONTENT_CHARACTER);
-
+
// ---------------------
// Whitespace Characters
// ---------------------
@@ -95,21 +99,34 @@
int nameStartMask = NAME_START_CHARACTER | NCNAME_START_CHARACTER |
NAME_CHARACTER | NCNAME_CHARACTER;
MASKS[':'] |= nameStartMask;
MASKS['_'] |= nameStartMask;
- for (int i = 'A'; i <= 'Z'; ++i) MASKS[i] |= nameStartMask;
- for (int i = 'a'; i <= 'z'; ++i) MASKS[i] |= nameStartMask;
- for (int i = 0xC0; i <= 0xD6; ++i) MASKS[i] |= nameStartMask;
- for (int i = 0xD8; i <= 0xF6; ++i) MASKS[i] |= nameStartMask;
- for (int i = 0xF8; i <= 0x2FF; ++i) MASKS[i] |= nameStartMask;
- for (int i = 0x370; i <= 0x37D; ++i) MASKS[i] |= nameStartMask;
- for (int i = 0x37F; i <= 0x1FFF; ++i) MASKS[i] |= nameStartMask;
- for (int i = 0x200C; i <= 0x200D; ++i) MASKS[i] |= nameStartMask;
- for (int i = 0x2070; i <= 0x218F; ++i) MASKS[i] |= nameStartMask;
- for (int i = 0x2C00; i <= 0x2FEF; ++i) MASKS[i] |= nameStartMask;
- for (int i = 0x3001; i <= 0xD7FF; ++i) MASKS[i] |= nameStartMask;
- for (int i = 0xF900; i <= 0xFDCF; ++i) MASKS[i] |= nameStartMask;
- for (int i = 0xFDF0; i <= 0xFFFD; ++i) MASKS[i] |= nameStartMask;
+ for (int i = 'A'; i <= 'Z'; ++i)
+ MASKS[i] |= nameStartMask;
+ for (int i = 'a'; i <= 'z'; ++i)
+ MASKS[i] |= nameStartMask;
+ for (int i = 0xC0; i <= 0xD6; ++i)
+ MASKS[i] |= nameStartMask;
+ for (int i = 0xD8; i <= 0xF6; ++i)
+ MASKS[i] |= nameStartMask;
+ for (int i = 0xF8; i <= 0x2FF; ++i)
+ MASKS[i] |= nameStartMask;
+ for (int i = 0x370; i <= 0x37D; ++i)
+ MASKS[i] |= nameStartMask;
+ for (int i = 0x37F; i <= 0x1FFF; ++i)
+ MASKS[i] |= nameStartMask;
+ for (int i = 0x200C; i <= 0x200D; ++i)
+ MASKS[i] |= nameStartMask;
+ for (int i = 0x2070; i <= 0x218F; ++i)
+ MASKS[i] |= nameStartMask;
+ for (int i = 0x2C00; i <= 0x2FEF; ++i)
+ MASKS[i] |= nameStartMask;
+ for (int i = 0x3001; i <= 0xD7FF; ++i)
+ MASKS[i] |= nameStartMask;
+ for (int i = 0xF900; i <= 0xFDCF; ++i)
+ MASKS[i] |= nameStartMask;
+ for (int i = 0xFDF0; i <= 0xFFFD; ++i)
+ MASKS[i] |= nameStartMask;
// Last range is bigger than our character array ...
- //for (int i = 0x10000; i <= 0xEFFFF; ++i) MASKS[i] |= nameStartMask;
+ // for (int i = 0x10000; i <= 0xEFFFF; ++i) MASKS[i] |= nameStartMask;
// ---------------
// Name Characters
@@ -122,10 +139,13 @@
MASKS['-'] |= nameMask;
MASKS['.'] |= nameMask;
MASKS[0xB7] |= nameMask;
- for (int i = '0'; i <= '9'; ++i) MASKS[i] |= nameMask;
- for (int i = 0x0300; i <= 0x036F; ++i) MASKS[i] |= nameStartMask;
- for (int i = 0x203F; i <= 0x2040; ++i) MASKS[i] |= nameStartMask;
-
+ for (int i = '0'; i <= '9'; ++i)
+ MASKS[i] |= nameMask;
+ for (int i = 0x0300; i <= 0x036F; ++i)
+ MASKS[i] |= nameStartMask;
+ for (int i = 0x203F; i <= 0x2040; ++i)
+ MASKS[i] |= nameStartMask;
+
// --------
// NC Names
// --------
@@ -134,7 +154,7 @@
// See
http://www.w3.org/TR/REC-xml-names/#ns-decl
// So, remove the NCNAME_CHARACTER and NCNAME_START_CHARACTER masks from
':' ...
MASKS[':'] &= ~(NCNAME_START_CHARACTER | NCNAME_CHARACTER);
-
+
// --------------------
// Public ID characters
// --------------------
@@ -142,9 +162,12 @@
MASKS[0x20] |= PUBID_CHARACTER;
MASKS[0xA] |= PUBID_CHARACTER;
MASKS[0xD] |= PUBID_CHARACTER;
- for (int i = 'A'; i <= 'Z'; ++i) MASKS[i] |= PUBID_CHARACTER;
- for (int i = 'a'; i <= 'z'; ++i) MASKS[i] |= PUBID_CHARACTER;
- for (int i = '0'; i <= '9'; ++i) MASKS[i] |= PUBID_CHARACTER;
+ for (int i = 'A'; i <= 'Z'; ++i)
+ MASKS[i] |= PUBID_CHARACTER;
+ for (int i = 'a'; i <= 'z'; ++i)
+ MASKS[i] |= PUBID_CHARACTER;
+ for (int i = '0'; i <= '9'; ++i)
+ MASKS[i] |= PUBID_CHARACTER;
MASKS['-'] |= PUBID_CHARACTER;
MASKS['\''] |= PUBID_CHARACTER;
MASKS['('] |= PUBID_CHARACTER;
@@ -171,47 +194,47 @@
}
/**
- * Determine whether the supplied character is a valid first character in an XML
Name.
- * The first character in an XML name is more restrictive than the {@link
#isValidName(int) remaining characters}.
+ * Determine whether the supplied character is a valid first character in an XML
Name. The first character in an XML name is
+ * more restrictive than the {@link #isValidName(int) remaining characters}.
*
* @param c the character
* @return true if the character is valid for an XML Name's first character
*/
public static boolean isValidNameStart( int c ) {
- return c < NUMBER_OF_CHARACTERS && ( MASKS[c] &
NAME_START_CHARACTER ) != 0;
+ return c < NUMBER_OF_CHARACTERS && (MASKS[c] &
NAME_START_CHARACTER) != 0;
}
/**
- * Determine whether the supplied character is a valid first character in an XML
NCName.
- * The first character in an XML NCName is more restrictive than the {@link
#isValidName(int) remaining characters}.
+ * Determine whether the supplied character is a valid first character in an XML
NCName. The first character in an XML NCName
+ * is more restrictive than the {@link #isValidName(int) remaining characters}.
*
* @param c the character
* @return true if the character is valid for an XML NCName's first character
*/
public static boolean isValidNcNameStart( int c ) {
- return c < NUMBER_OF_CHARACTERS && ( MASKS[c] &
NCNAME_START_CHARACTER ) != 0;
+ return c < NUMBER_OF_CHARACTERS && (MASKS[c] &
NCNAME_START_CHARACTER) != 0;
}
/**
- * Determine whether the supplied character is a valid non-first character in an XML
Name.
- * The {@link #isValidNameStart(int) first character} in an XML name is more
restrictive than the remaining characters.
+ * Determine whether the supplied character is a valid non-first character in an XML
Name. The {@link #isValidNameStart(int)
+ * first character} in an XML name is more restrictive than the remaining
characters.
*
* @param c the character
* @return true if the character is valid character in an XML Name
*/
public static boolean isValidName( int c ) {
- return c < NUMBER_OF_CHARACTERS && ( MASKS[c] & NAME_CHARACTER )
!= 0;
+ return c < NUMBER_OF_CHARACTERS && (MASKS[c] & NAME_CHARACTER) !=
0;
}
/**
- * Determine whether the supplied character is a valid non-first character in an XML
NCName.
- * The {@link #isValidNcNameStart(int) first character} in an XML NCName is more
restrictive than the remaining characters.
+ * Determine whether the supplied character is a valid non-first character in an XML
NCName. The
+ * {@link #isValidNcNameStart(int) first character} in an XML NCName is more
restrictive than the remaining characters.
*
* @param c the character
* @return true if the character is valid character in an XML NCName
*/
public static boolean isValidNcName( int c ) {
- return c < NUMBER_OF_CHARACTERS && ( MASKS[c] & NCNAME_CHARACTER )
!= 0;
+ return c < NUMBER_OF_CHARACTERS && (MASKS[c] & NCNAME_CHARACTER)
!= 0;
}
/**
@@ -221,7 +244,7 @@
* @return true if the character is valid character in an XML Pubid
*/
public static boolean isValidPubid( int c ) {
- return c < NUMBER_OF_CHARACTERS && ( MASKS[c] & PUBID_CHARACTER )
!= 0;
+ return c < NUMBER_OF_CHARACTERS && (MASKS[c] & PUBID_CHARACTER) !=
0;
}
/**
@@ -231,7 +254,7 @@
* @return true if the character is valid character in XML
*/
public static boolean isValid( int c ) {
- return (c < NUMBER_OF_CHARACTERS && ( MASKS[c] & VALID_CHARACTER )
!= 0) || ( 0x10000 <= c && c <= 0x10FFFF);
+ return (c < NUMBER_OF_CHARACTERS && (MASKS[c] & VALID_CHARACTER)
!= 0) || (0x10000 <= c && c <= 0x10FFFF);
}
/**
@@ -241,7 +264,7 @@
* @return true if the character is valid character in XML content
*/
public static boolean isValidContent( int c ) {
- return (c < NUMBER_OF_CHARACTERS && ( MASKS[c] & CONTENT_CHARACTER
) != 0) || ( 0x10000 <= c && c <= 0x10FFFF);
+ return (c < NUMBER_OF_CHARACTERS && (MASKS[c] & CONTENT_CHARACTER)
!= 0) || (0x10000 <= c && c <= 0x10FFFF);
}
/**
@@ -251,9 +274,9 @@
* @return true if the character is valid whitespace character in XML
*/
public static boolean isValidSpace( int c ) {
- return c <= 0x20 && ( MASKS[c] & SPACE_CHARACTER ) != 0;
+ return c <= 0x20 && (MASKS[c] & SPACE_CHARACTER) != 0;
}
-
+
/**
* Determine if the supplied name is a valid XML Name.
*
@@ -261,17 +284,17 @@
* @return true if the supplied name is indeed a valid XML Name, or false otherwise
*/
public static boolean isValidName( String name ) {
- if ( name == null || name.length() == 0 ) return false;
+ if (name == null || name.length() == 0) return false;
CharacterIterator iter = new StringCharacterIterator(name);
char c = iter.first();
- if ( !isValidNameStart(c) ) return false;
- while ( c != CharacterIterator.DONE ) {
- if ( !isValidName(c) ) return false;
+ if (!isValidNameStart(c)) return false;
+ while (c != CharacterIterator.DONE) {
+ if (!isValidName(c)) return false;
c = iter.next();
}
return true;
}
-
+
/**
* Determine if the supplied name is a valid XML NCName.
*
@@ -279,12 +302,12 @@
* @return true if the supplied name is indeed a valid XML NCName, or false
otherwise
*/
public static boolean isValidNcName( String name ) {
- if ( name == null || name.length() == 0 ) return false;
+ if (name == null || name.length() == 0) return false;
CharacterIterator iter = new StringCharacterIterator(name);
char c = iter.first();
- if ( !isValidNcNameStart(c) ) return false;
- while ( c != CharacterIterator.DONE ) {
- if ( !isValidNcName(c) ) return false;
+ if (!isValidNcNameStart(c)) return false;
+ while (c != CharacterIterator.DONE) {
+ if (!isValidNcName(c)) return false;
c = iter.next();
}
return true;
Copied: trunk/dna-common/src/main/java/org/jboss/dna/common/xml/package-info.java (from
rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavadocMetadata.java)
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/xml/package-info.java
(rev 0)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/xml/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,28 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * A set of utilities for working with XML documents.
+ */
+
+package org.jboss.dna.common.xml;
\ No newline at end of file
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/DnaIntLexicon.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/DnaIntLexicon.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/DnaIntLexicon.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,20 +23,21 @@
*/
package org.jboss.dna.graph;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.graph.property.Name;
import org.jboss.dna.graph.property.basic.BasicName;
-
/**
* A lexicon of internal and implementation-specific information
*/
+@Immutable
public class DnaIntLexicon {
public static class Namespace {
public static final String URI =
"http://www.jboss.org/dna/internal/1.0";
public static final String PREFIX = "dnaint";
}
-
+
public static final Name NODE_DEFINITON = new BasicName(Namespace.URI,
"nodeDefinition");
-
+
}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/DnaLexicon.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/DnaLexicon.java 2009-09-12 17:43:41
UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/DnaLexicon.java 2009-09-12 17:55:25
UTC (rev 1218)
@@ -23,12 +23,14 @@
*/
package org.jboss.dna.graph;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.graph.property.Name;
import org.jboss.dna.graph.property.basic.BasicName;
/**
- * @author Randall Hauch
+ * A lexicon of names used within JBoss DNA.
*/
+@Immutable
public class DnaLexicon {
public static class Namespace {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/ExecutionContext.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/ExecutionContext.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/ExecutionContext.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -53,9 +53,6 @@
* example, an ExecutionContext could be used to create another context that references
the same {@link #getNamespaceRegistry()
* namespace registry} but which has a different {@link #getSecurityContext() security
context}.
* </p>
- *
- * @author Randall Hauch
- * @author John Verhaeg
*/
@Immutable
public class ExecutionContext implements ClassLoaderFactory, Cloneable {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/Graph.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/Graph.java 2009-09-12 17:43:41 UTC
(rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/Graph.java 2009-09-12 17:55:25 UTC
(rev 1218)
@@ -90,8 +90,6 @@
* content. The graph is designed to be an <i><a
href="http://en.wikipedia.org/wiki/Domain_Specific_Language">... domain
* specific language</a></i>, meaning calls to it are designed to read like
sentences even though they are really just Java
* methods. And to be more readable, methods can be chained together.
- *
- * @author Randall Hauch
*/
@NotThreadSafe
public class Graph {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/GraphI18n.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/GraphI18n.java 2009-09-12 17:43:41
UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/GraphI18n.java 2009-09-12 17:55:25
UTC (rev 1218)
@@ -29,8 +29,7 @@
import org.jboss.dna.common.i18n.I18n;
/**
- * @author Randall Hauch
- * @author John Verhaeg
+ * The internationalized string constants for the
<code>org.jboss.dna.graph*</code> packages.
*/
public final class GraphI18n {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/JaasSecurityContext.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/JaasSecurityContext.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/JaasSecurityContext.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -16,6 +16,7 @@
import javax.security.auth.login.Configuration;
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
+import net.jcip.annotations.NotThreadSafe;
import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.Logger;
import org.jboss.dna.common.util.Reflection;
@@ -24,6 +25,7 @@
* JAAS-based {@link SecurityContext security context} that provides authentication and
authorization through the JAAS
* {@link LoginContext login context}.
*/
+@NotThreadSafe
public final class JaasSecurityContext implements SecurityContext {
private final Logger log = Logger.getLogger(getClass());
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/JcrLexicon.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/JcrLexicon.java 2009-09-12 17:43:41
UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/JcrLexicon.java 2009-09-12 17:55:25
UTC (rev 1218)
@@ -23,12 +23,14 @@
*/
package org.jboss.dna.graph;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.graph.property.Name;
import org.jboss.dna.graph.property.basic.BasicName;
/**
- * @author Randall Hauch
+ * A lexicon of names with the JCR namespace.
*/
+@Immutable
public class JcrLexicon {
public static class Namespace {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/JcrMixLexicon.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/JcrMixLexicon.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/JcrMixLexicon.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -27,7 +27,7 @@
import org.jboss.dna.graph.property.basic.BasicName;
/**
- * @author Randall Hauch
+ * A lexicon of names with the JCR "mix" namespace.
*/
public class JcrMixLexicon {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/JcrNtLexicon.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/JcrNtLexicon.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/JcrNtLexicon.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -27,7 +27,7 @@
import org.jboss.dna.graph.property.basic.BasicName;
/**
- * @author Randall Hauch
+ * A lexicon of names with the JCR "nt" namespace.
*/
public class JcrNtLexicon {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/Location.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/Location.java 2009-09-12 17:43:41
UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/Location.java 2009-09-12 17:55:25
UTC (rev 1218)
@@ -41,8 +41,6 @@
/**
* The location of a node, as specified by either its path, UUID, and/or identification
properties.
- *
- * @author Randall Hauch
*/
@Immutable
public abstract class Location implements Iterable<Property>,
Comparable<Location> {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/Locations.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/Locations.java 2009-09-12 17:43:41
UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/Locations.java 2009-09-12 17:55:25
UTC (rev 1218)
@@ -29,8 +29,6 @@
* A class used by this package to manage a single {@link Location} or multiple {@link
Location} objects, without having the
* overhead of a collection (when only one is needed) and which can grow efficiently as
new locations are added. This is achieved
* through an effective linked list.
- *
- * @author Randall Hauch
*/
@NotThreadSafe
class Locations {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/Node.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/Node.java 2009-09-12 17:43:41 UTC
(rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/Node.java 2009-09-12 17:55:25 UTC
(rev 1218)
@@ -34,8 +34,6 @@
/**
* A node in a {@link Graph graph}, with methods to access the properties and children.
- *
- * @author Randall Hauch
*/
@Immutable
public interface Node extends Iterable<Location> {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/NodeConflictBehavior.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/NodeConflictBehavior.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/NodeConflictBehavior.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -26,8 +26,6 @@
/**
* An enumeration used by several commands for the choice of handling duplicate nodes,
such as when a node is to be copied to
* another location where a node already exists.
- *
- * @author Randall Hauch
*/
public enum NodeConflictBehavior {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/Results.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/Results.java 2009-09-12 17:43:41 UTC
(rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/Results.java 2009-09-12 17:55:25 UTC
(rev 1218)
@@ -31,8 +31,6 @@
/**
* A set of nodes returned from a {@link Graph graph}, with methods to access the
properties and children of the nodes in the
* result. The {@link #iterator()} method can be used to iterate all over the nodes in
the result.
- *
- * @author Randall Hauch
*/
@Immutable
public interface Results extends Graph.BaseResults<Node> {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/SecurityContext.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/SecurityContext.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/SecurityContext.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,12 +1,15 @@
package org.jboss.dna.graph;
+import net.jcip.annotations.NotThreadSafe;
+
/**
- * A security context provides a pluggable means to support disparate authentication and
authorization
- * mechanisms that specify the user name and roles.
+ * A security context provides a pluggable means to support disparate authentication and
authorization mechanisms that specify the
+ * user name and roles.
* <p>
* A security context should only be associated with the execution context
<b>after</b> authentication has occurred.
* </p>
*/
+@NotThreadSafe
public interface SecurityContext {
/**
@@ -23,7 +26,7 @@
* @return true if the user has the role and is logged in; false otherwise
*/
boolean hasRole( String roleName );
-
+
/**
* Logs the user out of the authentication mechanism.
* <p>
@@ -31,5 +34,5 @@
* </p>
*/
void logout();
-
+
}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/Subgraph.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/Subgraph.java 2009-09-12 17:43:41
UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/Subgraph.java 2009-09-12 17:55:25
UTC (rev 1218)
@@ -40,8 +40,6 @@
* of the subgraph will contain the locations for child nodes that are below the maximum
depth and therefore not included in this
* subgraph.
* </p>
- *
- * @author Randall Hauch
*/
@Immutable
public interface Subgraph extends Graph.BaseResults<SubgraphNode> {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/cache/BasicCachePolicy.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/cache/BasicCachePolicy.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/cache/BasicCachePolicy.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,11 +24,13 @@
package org.jboss.dna.graph.cache;
import java.util.concurrent.TimeUnit;
+import net.jcip.annotations.NotThreadSafe;
import org.jboss.dna.common.util.CheckArg;
/**
- * @author Randall Hauch
+ * A basic mutable {@link CachePolicy} implementation.
*/
+@NotThreadSafe
public class BasicCachePolicy implements CachePolicy {
private static final long serialVersionUID = 1L;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/cache/CachePolicy.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/cache/CachePolicy.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/cache/CachePolicy.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -29,8 +29,6 @@
/**
* The specification of how node data is to be cached. The time values provided are
relative, allowing the same cache policy
* instance to be shared among multiple {@link Cacheable} objects.
- *
- * @author Randall Hauch
*/
@Immutable
public interface CachePolicy extends Serializable {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/cache/Cacheable.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/cache/Cacheable.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/cache/Cacheable.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,8 +28,6 @@
/**
* Interface defining an object that can be cached according to a {@link CachePolicy}.
- *
- * @author Randall Hauch
*/
public interface Cacheable extends Serializable {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/cache/ImmutableCachePolicy.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/cache/ImmutableCachePolicy.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/cache/ImmutableCachePolicy.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,9 +23,12 @@
*/
package org.jboss.dna.graph.cache;
+import net.jcip.annotations.Immutable;
+
/**
- * @author Randall Hauch
+ * A basic {@link CachePolicy} implementation with a fixed {@link #getTimeToLive() time
to live}.
*/
+@Immutable
public class ImmutableCachePolicy implements CachePolicy {
private static final long serialVersionUID = 1L;
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositoryConnection.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositoryConnection.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositoryConnection.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -110,8 +110,6 @@
* However, it is perfectly acceptable to throw an exception if the connection becomes
invalid (e.g., there is a communication
* failure) or if a fatal error would prevent subsequent requests from being processed.
* </p>
- *
- * @author Randall Hauch
*/
@NotThreadSafe
public interface RepositoryConnection {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositoryConnectionFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositoryConnectionFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositoryConnectionFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,13 +23,14 @@
*/
package org.jboss.dna.graph.connector;
+import net.jcip.annotations.ThreadSafe;
+
/**
* An interface for a factory of {@link RepositoryConnection}s using the names of the
{@link RepositorySource} from which the
* connections are to be obtained. This interface need not be implemented by a {@link
RepositorySource}, as implementations are
* usually provided by the system.
- *
- * @author Randall Hauch
*/
+@ThreadSafe
public interface RepositoryConnectionFactory {
/**
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositoryConnectionPool.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositoryConnectionPool.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositoryConnectionPool.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -47,8 +47,6 @@
/**
* A reusable implementation of a managed pool of connections that is optimized for safe
concurrent operations.
- *
- * @author Randall Hauch
*/
@ThreadSafe
public class RepositoryConnectionPool {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositoryContext.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositoryContext.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositoryContext.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,6 +23,7 @@
*/
package org.jboss.dna.graph.connector;
+import net.jcip.annotations.ThreadSafe;
import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.Subgraph;
import org.jboss.dna.graph.observe.Observer;
@@ -30,9 +31,8 @@
/**
* The context for a repository. This interface need not be implemented by a {@link
RepositorySource}, as it is normally provided
* to the source when {@link RepositorySource#initialize(RepositoryContext)
initialized}.
- *
- * @author Randall Hauch
*/
+@ThreadSafe
public interface RepositoryContext {
/**
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositorySource.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositorySource.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositorySource.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,6 +28,7 @@
import java.net.URI;
import java.util.UUID;
import javax.naming.Referenceable;
+import net.jcip.annotations.NotThreadSafe;
import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.property.Binary;
import org.jboss.dna.graph.property.DateTime;
@@ -133,9 +134,8 @@
* delegate authentication to JAAS. Either way, just realize that it's perfectly
acceptable for the connector to require its own
* security properties.
* </p>
- *
- * @author Randall Hauch
*/
+@NotThreadSafe
public interface RepositorySource extends Referenceable, Serializable {
/**
@@ -160,7 +160,8 @@
String getName();
/**
- * Get a connection from this source.
+ * Get a connection from this source. Even though each RepositorySource need not be
thread safe, this method should be safe to
+ * be called concurrently by multiple threads.
*
* @return a connection
* @throws RepositorySourceException if there is a problem obtaining a connection
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositorySourceCapabilities.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositorySourceCapabilities.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositorySourceCapabilities.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -30,7 +30,6 @@
* complex behavior.
*
* @see RepositorySource#getCapabilities()
- * @author Randall Hauch
*/
@Immutable
public class RepositorySourceCapabilities {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositorySourceException.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositorySourceException.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositorySourceException.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,9 +23,12 @@
*/
package org.jboss.dna.graph.connector;
+import net.jcip.annotations.Immutable;
+
/**
- * @author Randall Hauch
+ * A runtime exception signalling an error within a {@link RepositorySource}.
*/
+@Immutable
public class RepositorySourceException extends RuntimeException {
/**
@@ -44,7 +47,8 @@
* @param sourceName the identifier of the source from which this exception eminates
* @param message
*/
- public RepositorySourceException( String sourceName, String message ) {
+ public RepositorySourceException( String sourceName,
+ String message ) {
super(message);
this.sourceName = sourceName;
}
@@ -53,7 +57,8 @@
* @param sourceName the identifier of the source from which this exception eminates
* @param cause
*/
- public RepositorySourceException( String sourceName, Throwable cause ) {
+ public RepositorySourceException( String sourceName,
+ Throwable cause ) {
super(cause);
this.sourceName = sourceName;
}
@@ -63,7 +68,9 @@
* @param message
* @param cause
*/
- public RepositorySourceException( String sourceName, String message, Throwable cause
) {
+ public RepositorySourceException( String sourceName,
+ String message,
+ Throwable cause ) {
super(message, cause);
this.sourceName = sourceName;
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/UuidAlreadyExistsException.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/UuidAlreadyExistsException.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/UuidAlreadyExistsException.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,6 +24,7 @@
package org.jboss.dna.graph.connector;
import java.util.UUID;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.graph.GraphI18n;
import org.jboss.dna.graph.request.CloneBranchRequest;
@@ -32,6 +33,7 @@
* workspace and the {@link CloneBranchRequest#removeExisting() UUID conflict behavior}
is set to throw an exception instead of
* removing the existing nodes.
*/
+@Immutable
public class UuidAlreadyExistsException extends RepositorySourceException {
private static final long serialVersionUID = 1L;
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/FederatedRepositorySource.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/FederatedRepositorySource.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/FederatedRepositorySource.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -39,6 +39,7 @@
import javax.naming.StringRefAddr;
import javax.naming.spi.ObjectFactory;
import net.jcip.annotations.GuardedBy;
+import net.jcip.annotations.NotThreadSafe;
import org.jboss.dna.common.i18n.I18n;
import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.HashCode;
@@ -65,8 +66,9 @@
import org.jboss.dna.graph.property.ValueFactory;
/**
- *
+ * A {@link RepositorySource} for a federated repository.
*/
+@NotThreadSafe
public class FederatedRepositorySource implements RepositorySource, ObjectFactory {
/**
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/JoinRequestProcessor.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/JoinRequestProcessor.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/JoinRequestProcessor.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -74,7 +74,7 @@
import org.jboss.dna.graph.request.processor.RequestProcessor;
/**
- *
+ * A {@link RequestProcessor} that performs the join portion of the fork-join operation.
*/
@NotThreadSafe
class JoinRequestProcessor extends RequestProcessor {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/inmemory/InMemoryRepository.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/inmemory/InMemoryRepository.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/inmemory/InMemoryRepository.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -36,7 +36,7 @@
import org.jboss.dna.graph.property.Name;
/**
- * @author Randall Hauch
+ * A specialized {@link MapRepository} that represents an in-memory repository.
*/
@NotThreadSafe
public class InMemoryRepository extends MapRepository {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/inmemory/InMemoryRepositorySource.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/inmemory/InMemoryRepositorySource.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/inmemory/InMemoryRepositorySource.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -58,8 +58,6 @@
/**
* A {@link RepositorySource} for an in-memory repository. Each {@link
InMemoryRepositorySource} instance contains its own
* repository, and the lifetime of the source dictates the lifetime of the repository and
its content.
- *
- * @author Randall Hauch
*/
public class InMemoryRepositorySource implements MapRepositorySource, ObjectFactory {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapNode.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapNode.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapNode.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -36,6 +36,9 @@
import org.jboss.dna.graph.property.Property;
import org.jboss.dna.graph.property.PropertyFactory;
+/**
+ * A node within a {@link MapRepository}.
+ */
public class MapNode {
private final UUID uuid;
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapRepositoryConnection.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapRepositoryConnection.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapRepositoryConnection.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -35,12 +35,15 @@
import org.jboss.dna.graph.request.Request;
import org.jboss.dna.graph.request.processor.RequestProcessor;
+/**
+ * A connection to a {@link MapRepository}.
+ */
public class MapRepositoryConnection implements RepositoryConnection {
private final MapRepositorySource source;
private final MapRepository repository;
public MapRepositoryConnection( MapRepositorySource source,
- MapRepository repository ) {
+ MapRepository repository ) {
assert source != null;
assert repository != null;
this.source = source;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/io/Destination.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/io/Destination.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/io/Destination.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -32,8 +32,6 @@
/**
* Interface used internally as the destination for the requests. This is used to
abstract whether the requests should be
* submitted immediately or in a single batch.
- *
- * @author Randall Hauch
*/
@NotThreadSafe
public interface Destination {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/io/GraphImporter.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/io/GraphImporter.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/io/GraphImporter.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -45,8 +45,8 @@
import org.xml.sax.helpers.XMLReaderFactory;
/**
- * @author Randall Hauch
- * @author John Verhaeg
+ * An importer of graph content. This class can be used directly, or the import can be
done via the {@link Graph} using the
+ * {@link Graph#importXmlFrom(java.io.File)} (and similar) methods.
*/
public class GraphImporter {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/mimetype/MimeTypeDetector.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/mimetype/MimeTypeDetector.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/mimetype/MimeTypeDetector.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -30,8 +30,6 @@
/**
* MIME-type detection libraries must provide thread-safe implementations of this
interface to enable DNA to use the libraries to
* return MIME-types for data sources.
- *
- * @author jverhaeg
*/
@ThreadSafe
public interface MimeTypeDetector {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/mimetype/MimeTypeDetectorConfig.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/mimetype/MimeTypeDetectorConfig.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/mimetype/MimeTypeDetectorConfig.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,12 +24,13 @@
package org.jboss.dna.graph.mimetype;
import java.util.Map;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.common.component.ComponentConfig;
-import org.jboss.dna.graph.mimetype.MimeTypeDetector;
/**
- * @author jverhaeg
+ * A configuration for a {@link MimeTypeDetector} component.
*/
+@Immutable
public class MimeTypeDetectorConfig extends ComponentConfig {
public MimeTypeDetectorConfig( String name,
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/mimetype/MimeTypeDetectors.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/mimetype/MimeTypeDetectors.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/mimetype/MimeTypeDetectors.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -31,12 +31,9 @@
import org.jboss.dna.common.component.ComponentLibrary;
import org.jboss.dna.common.component.StandardClassLoaderFactory;
import org.jboss.dna.common.util.Logger;
-import org.jboss.dna.graph.mimetype.MimeTypeDetector;
/**
* Facility for managing {@link MimeTypeDetectorConfig}s.
- *
- * @author jverhaeg
*/
@ThreadSafe
public final class MimeTypeDetectors implements MimeTypeDetector {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/NetChangeObserver.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/NetChangeObserver.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/NetChangeObserver.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -32,6 +32,7 @@
import java.util.TreeMap;
import net.jcip.annotations.Immutable;
import net.jcip.annotations.NotThreadSafe;
+import net.jcip.annotations.ThreadSafe;
import org.jboss.dna.common.util.HashCode;
import org.jboss.dna.graph.Location;
import org.jboss.dna.graph.property.Name;
@@ -50,6 +51,7 @@
* example, if a property is updated and then updated again, the net change will be a
single change. Or, if a node is created and
* then deleted, no net change will be observed.
*/
+@ThreadSafe
public abstract class NetChangeObserver extends ChangeObserver {
public enum ChangeType {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/ObservationBus.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/ObservationBus.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/ObservationBus.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,10 +23,13 @@
*/
package org.jboss.dna.graph.observe;
+import net.jcip.annotations.ThreadSafe;
+
/**
* A simple {@link Observer} that is itself {@link Observable}. This class essentially
multiplexes the events from a single
* Observable to disseminate each event to multiple Observers.
*/
+@ThreadSafe
public class ObservationBus implements Observable, Observer {
private final ChangeObservers observers = new ChangeObservers();
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/Observer.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/Observer.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/Observer.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,7 +24,7 @@
package org.jboss.dna.graph.observe;
/**
- *
+ * The interface for an observer of graph changes.
*/
public interface Observer {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/Binary.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/Binary.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/Binary.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -30,8 +30,6 @@
/**
* Value holder for binary data. Binary instances are not mutable.
- *
- * @author Randall Hauch
*/
@Immutable
public interface Binary extends Comparable<Binary>, Serializable {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/BinaryFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/BinaryFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/BinaryFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -27,13 +27,13 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
+import net.jcip.annotations.ThreadSafe;
/**
* A factory for creating {@link Binary} instances. This interface extends the {@link
ValueFactory} generic interface and adds
* specific methods for creating binary objects.
- *
- * @author Randall Hauch
*/
+@ThreadSafe
public interface BinaryFactory extends ValueFactory<Binary> {
/**
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/DateTime.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/DateTime.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/DateTime.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -34,8 +34,6 @@
*
href="http://jcp.org/en/jsr/detail?id=310">JSR-310</a>, which will
be based upon <a
*
href="http://joda-time.sourceforge.net/">Joda-Time</a>. This class
serves as a stable migration path toward the new JSR 310
* classes.
- *
- * @author Randall Hauch
*/
@Immutable
public interface DateTime extends Comparable<DateTime>, Serializable {
@@ -57,7 +55,7 @@
* <li>two digit minute, from 00 to 59;</li>
* <li>two digit second, from 00 to 59;</li>
* <li>three decimal places for milliseconds, if required;</li>
- * <li>time zone offset of the form <code>�HH:mm</code> (or
'0' if UTC)</li>
+ * <li>time zone offset of the form <code>�HH:mm</code> (or
'0' if UTC)</li>
* </ul>
*
* @return the string representation; never null
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/DateTimeFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/DateTimeFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/DateTimeFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,7 +23,6 @@
*/
package org.jboss.dna.graph.property;
-
/**
* A factory for creating {@link DateTime date-time instants}. This interface extends the
{@link ValueFactory} generic interface
* and adds specific methods for creating instants for the current time (and time zone)
as well as various combinations of
@@ -50,7 +49,7 @@
* <li>two digit minute, from 00 to 59;</li>
* <li>two digit second, from 00 to 59;</li>
* <li>three decimal places for milliseconds, if required;</li>
- * <li>time zone offset of the form <code>�HH:mm</code> (or '0'
if UTC)</li>
+ * <li>time zone offset of the form <code>�HH:mm</code> (or '0'
if UTC)</li>
* </ul>
* </p>
* <h3>Day of Year Based</h3>
@@ -69,7 +68,7 @@
* <li>two digit minute, from 00 to 59;</li>
* <li>two digit second, from 00 to 59;</li>
* <li>three decimal places for milliseconds, if required;</li>
- * <li>time zone offset of the form <code>�HH:mm</code> (or '0'
if UTC)</li>
+ * <li>time zone offset of the form <code>�HH:mm</code> (or '0'
if UTC)</li>
* </ul>
* </p>
* <h3>Week Based</h3>
@@ -89,7 +88,7 @@
* <li>two digit minute, from 00 to 59;</li>
* <li>two digit second, from 00 to 59;</li>
* <li>three decimal places for milliseconds, if required;</li>
- * <li>time zone offset of the form <code>�HH:mm</code> (or '0'
if UTC)</li>
+ * <li>time zone offset of the form <code>�HH:mm</code> (or '0'
if UTC)</li>
* </ul>
* </p>
* <p>
@@ -98,8 +97,6 @@
* the previous year, and the last week finishes in the next year. The weekyear field is
defined to refer to the year that owns
* the week, which may differ from the actual year.
* </p>
- *
- * @author Randall Hauch
*/
public interface DateTimeFactory extends ValueFactory<DateTime> {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/InvalidPathException.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/InvalidPathException.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/InvalidPathException.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,9 +23,12 @@
*/
package org.jboss.dna.graph.property;
+import net.jcip.annotations.Immutable;
+
/**
- * @author Randall Hauch
+ * A runtime exception that represents that an invalid {@link Path path} was specified.
*/
+@Immutable
public class InvalidPathException extends RuntimeException {
/**
@@ -58,7 +61,8 @@
* @param message
* @param cause
*/
- public InvalidPathException( String message, Throwable cause ) {
+ public InvalidPathException( String message,
+ Throwable cause ) {
super(message, cause);
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/InvalidPathExpressionException.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/InvalidPathExpressionException.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/InvalidPathExpressionException.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,9 +23,12 @@
*/
package org.jboss.dna.graph.property;
+import net.jcip.annotations.Immutable;
+
/**
- * @author Randall Hauch
+ * A runtime exception that represents that an invalid {@link PathExpression path
expression} was specified.
*/
+@Immutable
public class InvalidPathExpressionException extends RuntimeException {
/**
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/IoException.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/IoException.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/IoException.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,10 +23,12 @@
*/
package org.jboss.dna.graph.property;
+import net.jcip.annotations.Immutable;
+
/**
- * @author Randall Hauch
- * @author John Verhaeg
+ * A runtime exception that represents that an error occurred during input/output.
*/
+@Immutable
public class IoException extends RuntimeException {
/**
@@ -60,7 +62,7 @@
* @param cause
*/
public IoException( String message,
- Throwable cause ) {
+ Throwable cause ) {
super(message, cause);
}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/Name.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/Name.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/Name.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,8 +28,6 @@
/**
* A qualified name consisting of a namespace and a local name.
- *
- * @author Randall Hauch
*/
@Immutable
public interface Name extends Comparable<Name>, Serializable, Readable {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/NameFactory.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/NameFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/NameFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,13 +23,13 @@
*/
package org.jboss.dna.graph.property;
+import net.jcip.annotations.ThreadSafe;
import org.jboss.dna.common.text.TextDecoder;
/**
* A factory for creating {@link Name names}.
- *
- * @author Randall Hauch
*/
+@ThreadSafe
public interface NameFactory extends ValueFactory<Name> {
/**
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/NamespaceException.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/NamespaceException.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/NamespaceException.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,9 +23,12 @@
*/
package org.jboss.dna.graph.property;
+import net.jcip.annotations.Immutable;
+
/**
- * @author Randall Hauch
+ * A runtime exception denoting that a namespace was invalid or not found.
*/
+@Immutable
public class NamespaceException extends RuntimeException {
/**
@@ -58,7 +61,8 @@
* @param message
* @param cause
*/
- public NamespaceException( String message, Throwable cause ) {
+ public NamespaceException( String message,
+ Throwable cause ) {
super(message, cause);
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/NamespaceRegistry.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/NamespaceRegistry.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/NamespaceRegistry.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -29,8 +29,6 @@
/**
* Registry of namespaces, which are used to provide isolated and independent domains for
{@link Name names}.
- *
- * @author Randall Hauch
*/
@ThreadSafe
public interface NamespaceRegistry {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/Path.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/Path.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/Path.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -69,9 +69,6 @@
* {@link #isAncestorOf(Path) ancestor} or {@link #isDecendantOf(Path) decendent} of
another path, and
* {@link #getCommonAncestor(Path) finding a common ancestor}.
* </p>
- *
- * @author Randall Hauch
- * @author John Verhaeg
*/
@Immutable
public interface Path extends Comparable<Path>, Iterable<Path.Segment>,
Serializable, Readable {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/PathExpression.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/PathExpression.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/PathExpression.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -142,8 +142,6 @@
* Square brackets can also be used to specify criteria on a node's properties or
children. Whatever appears in between the square
* brackets does not appear in the selected node.
* </p>
- *
- * @author Randall Hauch
*/
@Immutable
public class PathExpression implements Serializable {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/PathFactory.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/PathFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/PathFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,15 +23,14 @@
*/
package org.jboss.dna.graph.property;
+import net.jcip.annotations.ThreadSafe;
import org.jboss.dna.common.text.TextDecoder;
/**
* A factory for creating {@link Path paths}. This interface extends the {@link
ValueFactory} generic interface and adds specific
* methods for creating paths (and relative paths) from a series of names, segments, or
combinations.
- *
- * @author Randall Hauch
- * @author John Verhaeg
*/
+@ThreadSafe
public interface PathFactory extends ValueFactory<Path> {
/**
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/PathNotFoundException.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/PathNotFoundException.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/PathNotFoundException.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,12 +23,15 @@
*/
package org.jboss.dna.graph.property;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.graph.GraphI18n;
import org.jboss.dna.graph.Location;
/**
- * @author Randall Hauch
+ * A runtime exception denoting that a node or property at a supplied {@link Path path}
was not found. This exception does contain
+ * the lowest ancestor of the path that was found to exist.
*/
+@Immutable
public class PathNotFoundException extends RuntimeException {
/**
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/Property.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/Property.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/Property.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -54,8 +54,6 @@
* heterogeneous values, so casting may not always work. Also, this technique guarantees
that the values are properly converted if
* the type is not what you expected.
* </p>
- *
- * @author Randall Hauch
*/
@Immutable
public interface Property extends Iterable<Object>, Comparable<Property>,
Readable {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/PropertyFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/PropertyFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/PropertyFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,10 +24,12 @@
package org.jboss.dna.graph.property;
import java.util.Iterator;
+import net.jcip.annotations.ThreadSafe;
/**
- * @author Randall Hauch
+ * A factory for creating {@link Property} objects.
*/
+@ThreadSafe
public interface PropertyFactory {
/**
* Create a property with the supplied name and values
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/PropertyType.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/PropertyType.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/PropertyType.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -39,8 +39,7 @@
import org.jboss.dna.graph.GraphI18n;
/**
- * @author Randall Hauch
- * @author John Verhaeg
+ * The data types for property values.
*/
@Immutable
public enum PropertyType {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/Reference.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/Reference.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/Reference.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -29,7 +29,6 @@
/**
* A representation of a reference to another node. Node references may not necessarily
resolve to an existing node.
- * @author Randall Hauch
*/
@Immutable
public interface Reference extends Comparable<Reference>, Serializable {
@@ -37,6 +36,7 @@
/**
* Get the string form of the Reference. The {@link Path#DEFAULT_ENCODER default
encoder} is used to encode characters in the
* reference.
+ *
* @return the encoded string
* @see #getString(TextEncoder)
*/
@@ -44,6 +44,7 @@
/**
* Get the encoded string form of the Reference, using the supplied encoder to encode
characters in the reference.
+ *
* @param encoder the encoder to use, or null if the {@link Path#DEFAULT_ENCODER
default encoder} should be used
* @return the encoded string
* @see #getString()
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/ReferentialIntegrityException.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/ReferentialIntegrityException.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/ReferentialIntegrityException.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,11 +28,13 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.graph.Location;
/**
- * @author Randall Hauch
+ * A runtime exception denoting that an operation could not be performed because it would
leave references in an invalid state.
*/
+@Immutable
public class ReferentialIntegrityException extends RuntimeException {
/**
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/UuidFactory.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/UuidFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/UuidFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,13 +24,13 @@
package org.jboss.dna.graph.property;
import java.util.UUID;
+import net.jcip.annotations.ThreadSafe;
/**
* A factory for creating {@link UUID UUID instances}. This interface extends the {@link
ValueFactory} generic interface and adds
* specific methods for creating UUIDs.
- *
- * @author Randall Hauch
*/
+@ThreadSafe
public interface UuidFactory extends ValueFactory<UUID> {
/**
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/ValueComparators.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/ValueComparators.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/ValueComparators.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -31,13 +31,17 @@
import java.util.Comparator;
import java.util.Date;
import java.util.UUID;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.common.util.SecureHash;
import org.jboss.dna.graph.GraphI18n;
import org.jboss.dna.graph.property.basic.StringValueFactory;
/**
- * @author Randall Hauch
+ * A set of {@link Comparator} objects for the different kinds of property values.
+ *
+ * @see PropertyType#getComparator()
*/
+@Immutable
public class ValueComparators {
/**
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/ValueFactories.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/ValueFactories.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/ValueFactories.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -25,12 +25,12 @@
import java.math.BigDecimal;
import java.net.URI;
+import net.jcip.annotations.ThreadSafe;
/**
* The set of standard {@link ValueFactory} instances.
- *
- * @author Randall Hauch
*/
+@ThreadSafe
public interface ValueFactories extends Iterable<ValueFactory<?>> {
/**
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/ValueFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/ValueFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/ValueFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -32,6 +32,7 @@
import java.util.Date;
import java.util.Iterator;
import java.util.UUID;
+import net.jcip.annotations.ThreadSafe;
import org.jboss.dna.common.text.TextDecoder;
import org.jboss.dna.common.text.TextEncoder;
@@ -44,10 +45,9 @@
* <li>{@link IoException} - If an unexpected problem occurs during the conversion
(such as an {@link IOException}).</li>
* </ul>
*
- * @author Randall Hauch
- * @author John Verhaeg
* @param <T> the type of value to create
*/
+@ThreadSafe
public interface ValueFactory<T> {
static final TextDecoder DEFAULT_DECODER = Path.NO_OP_DECODER;
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/ValueFormatException.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/ValueFormatException.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/ValueFormatException.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,9 +23,12 @@
*/
package org.jboss.dna.graph.property;
+import net.jcip.annotations.Immutable;
+
/**
- * @author Randall Hauch
+ * A runtime exception denoting that a value could not be converted to a specific type
because of the value's format.
*/
+@Immutable
public class ValueFormatException extends RuntimeException {
/**
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/AbstractBinary.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/AbstractBinary.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/AbstractBinary.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -39,8 +39,6 @@
/**
* An abstract implementation of {@link Binary} that provides some common capabilities
for other implementations.
- *
- * @author Randall Hauch
*/
@Immutable
public abstract class AbstractBinary implements Binary {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/AbstractBinaryValueFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/AbstractBinaryValueFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/AbstractBinaryValueFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -51,9 +51,6 @@
/**
* An abstract {@link BinaryFactory} implementation that contains many general methods
that are likely to be appropriate for many
* concrete implementations.
- *
- * @author Randall Hauch
- * @author John Verhaeg
*/
@Immutable
public abstract class AbstractBinaryValueFactory extends
AbstractValueFactory<Binary> implements BinaryFactory {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/AbstractPath.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/AbstractPath.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/AbstractPath.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -29,6 +29,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.NoSuchElementException;
+import net.jcip.annotations.Immutable;
import net.jcip.annotations.NotThreadSafe;
import org.jboss.dna.common.CommonI18n;
import org.jboss.dna.common.text.TextEncoder;
@@ -44,9 +45,8 @@
* but it does provide implementations for most of the methods based upon a few abstract
methods. For example, any implementaton
* that requires the {@link Path.Segment path's segments} are written to use the
{@link #iterator()}, since that is likely more
* efficient for the majority of implementations.
- *
- * @author Randall Hauch
*/
+@Immutable
public abstract class AbstractPath implements Path {
/**
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/AbstractValueFactories.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/AbstractValueFactories.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/AbstractValueFactories.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,6 +24,7 @@
package org.jboss.dna.graph.property.basic;
import java.util.Iterator;
+import net.jcip.annotations.ThreadSafe;
import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.property.PropertyType;
import org.jboss.dna.graph.property.ValueFactories;
@@ -33,9 +34,8 @@
* Abstract implementation of {@link ValueFactories} that implements all the methods
other than the <code>get*Factory()</code>
* methods. Subclasses can simply implement these methods and inherit the {@link
#iterator()}, {@link #getValueFactory(Object)}
* and {@link #getValueFactory(PropertyType)} method implementations.
- *
- * @author Randall Hauch
*/
+@ThreadSafe
public abstract class AbstractValueFactories implements ValueFactories {
/**
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/AbstractValueFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/AbstractValueFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/AbstractValueFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -47,8 +47,6 @@
/**
* Abstract {@link ValueFactory}.
*
- * @author Randall Hauch
- * @author John Verhaeg
* @param <T> the property type
*/
@Immutable
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicEmptyProperty.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicEmptyProperty.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicEmptyProperty.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -31,8 +31,6 @@
/**
* An immutable version of a property that has no values. This is done for efficiency of
the in-memory representation, since many
* properties will have just a single value, while others will have multiple values.
- *
- * @author Randall Hauch
*/
@Immutable
public class BasicEmptyProperty extends BasicProperty {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicMultiValueProperty.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicMultiValueProperty.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicMultiValueProperty.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -33,8 +33,6 @@
/**
* An immutable version of a property that has 2 or more values. This is done for
efficiency of the in-memory representation,
* since many properties will have just a single value, while others will have multiple
values.
- *
- * @author Randall Hauch
*/
@Immutable
public class BasicMultiValueProperty extends BasicProperty {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicName.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicName.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicName.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -33,9 +33,6 @@
/**
* A basic implementation of {@link Name}.
- *
- * @author Randall Hauch
- * @author John Verhaeg
*/
@Immutable
public class BasicName implements Name {
@@ -91,7 +88,7 @@
if (this.getLocalName().equals(Path.PARENT)) return Path.PARENT;
}
if (encoder == null) encoder = Path.DEFAULT_ENCODER;
-
+
if (namespaceUri.length() > 0) {
return "{" + encoder.encode(this.namespaceUri) + "}" +
encoder.encode(this.localName);
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicNamespace.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicNamespace.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicNamespace.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,7 +28,7 @@
import org.jboss.dna.graph.property.NamespaceRegistry.Namespace;
/**
- * @author Randall Hauch
+ * Basic implementation of a {@link NamespaceRegistry} namespace.
*/
@Immutable
public class BasicNamespace implements NamespaceRegistry.Namespace {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicPath.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicPath.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicPath.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -35,9 +35,6 @@
/**
* A basic implementation of {@link Path}.
- *
- * @author Randall Hauch
- * @author John Verhaeg
*/
@Immutable
public class BasicPath extends AbstractPath {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicPathSegment.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicPathSegment.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicPathSegment.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -32,8 +32,6 @@
/**
* A basic implementation of {@link Path.Segment}.
- *
- * @author Randall Hauch
*/
@Immutable
public class BasicPathSegment implements Path.Segment {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicProperty.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicProperty.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicProperty.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -35,7 +35,7 @@
import org.jboss.dna.graph.property.ValueComparators;
/**
- * @author Randall Hauch
+ * An abstract {@link Property} implementation.
*/
@Immutable
public abstract class BasicProperty implements Property {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicPropertyFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicPropertyFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicPropertyFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -27,6 +27,7 @@
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.property.Name;
import org.jboss.dna.graph.property.Property;
@@ -36,8 +37,9 @@
import org.jboss.dna.graph.property.ValueFactory;
/**
- * @author Randall Hauch
+ * A basic {@link PropertyFactory} implementation.
*/
+@Immutable
public class BasicPropertyFactory implements PropertyFactory {
private final ValueFactories factories;
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicSingleValueProperty.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicSingleValueProperty.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicSingleValueProperty.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -31,8 +31,6 @@
/**
* An immutable version of a property that has exactly 1 value. This is done for
efficiency of the in-memory representation, since
* many properties will have just a single value, while others will have multiple
values.
- *
- * @author Randall Hauch
*/
@Immutable
public class BasicSingleValueProperty extends BasicProperty {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BooleanValueFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BooleanValueFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BooleanValueFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -45,9 +45,6 @@
/**
* The standard {@link ValueFactory} for {@link PropertyType#BOOLEAN} values.
- *
- * @author Randall Hauch
- * @author John Verhaeg
*/
@Immutable
public class BooleanValueFactory extends AbstractValueFactory<Boolean> {
@@ -78,9 +75,10 @@
* {@inheritDoc}
*/
public Boolean create( int value ) {
- throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Integer.class.getSimpleName(),
-
value));
+ throw new ValueFormatException(value, getPropertyType(),
+
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
+
Integer.class.getSimpleName(),
+ value));
}
/**
@@ -88,8 +86,8 @@
*/
public Boolean create( long value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Long.class.getSimpleName(),
-
value));
+
Long.class.getSimpleName(),
+
value));
}
/**
@@ -104,8 +102,8 @@
*/
public Boolean create( float value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Float.class.getSimpleName(),
-
value));
+
Float.class.getSimpleName(),
+
value));
}
/**
@@ -113,8 +111,8 @@
*/
public Boolean create( double value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Double.class.getSimpleName(),
-
value));
+
Double.class.getSimpleName(),
+
value));
}
/**
@@ -123,17 +121,18 @@
public Boolean create( BigDecimal value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
BigDecimal.class.getSimpleName(),
- value));
+
BigDecimal.class.getSimpleName(),
+ value));
}
/**
* {@inheritDoc}
*/
public Boolean create( Calendar value ) {
- throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Calendar.class.getSimpleName(),
-
value));
+ throw new ValueFormatException(value, getPropertyType(),
+
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
+
Calendar.class.getSimpleName(),
+ value));
}
/**
@@ -141,8 +140,8 @@
*/
public Boolean create( Date value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Date.class.getSimpleName(),
-
value));
+
Date.class.getSimpleName(),
+
value));
}
/**
@@ -151,9 +150,10 @@
* @see
org.jboss.dna.graph.property.ValueFactory#create(org.jboss.dna.graph.property.DateTime)
*/
public Boolean create( DateTime value ) throws ValueFormatException {
- throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
DateTime.class.getSimpleName(),
-
value));
+ throw new ValueFormatException(value, getPropertyType(),
+
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
+
DateTime.class.getSimpleName(),
+ value));
}
/**
@@ -161,8 +161,8 @@
*/
public Boolean create( Name value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Name.class.getSimpleName(),
-
value));
+
Name.class.getSimpleName(),
+
value));
}
/**
@@ -170,8 +170,8 @@
*/
public Boolean create( Path value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Path.class.getSimpleName(),
-
value));
+
Path.class.getSimpleName(),
+
value));
}
/**
@@ -180,8 +180,8 @@
public Boolean create( Reference value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Reference.class.getSimpleName(),
- value));
+
Reference.class.getSimpleName(),
+ value));
}
/**
@@ -189,8 +189,8 @@
*/
public Boolean create( URI value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
URI.class.getSimpleName(),
-
value));
+
URI.class.getSimpleName(),
+
value));
}
/**
@@ -200,8 +200,8 @@
*/
public Boolean create( UUID value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
UUID.class.getSimpleName(),
-
value));
+
UUID.class.getSimpleName(),
+
value));
}
/**
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/ChildPath.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/ChildPath.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/ChildPath.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,6 +28,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.common.collection.ImmutableAppendedList;
import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.property.Path;
@@ -35,9 +36,8 @@
/**
* Implementation of a {@link Path} that has the information for the last segment but
that points to another Path for the parent
* information.
- *
- * @author Randall Hauch
*/
+@Immutable
public class ChildPath extends AbstractPath {
/**
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/DecimalValueFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/DecimalValueFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/DecimalValueFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -45,9 +45,6 @@
/**
* The standard {@link ValueFactory} for {@link PropertyType#DECIMAL} values.
- *
- * @author Randall Hauch
- * @author John Verhaeg
*/
@Immutable
public class DecimalValueFactory extends AbstractValueFactory<BigDecimal> {
@@ -67,8 +64,8 @@
} catch (NumberFormatException err) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.errorConvertingType.text(String.class.getSimpleName(),
-
BigDecimal.class.getSimpleName(),
- value),
err);
+
BigDecimal.class.getSimpleName(),
+ value),
err);
}
}
@@ -99,9 +96,10 @@
* {@inheritDoc}
*/
public BigDecimal create( boolean value ) {
- throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Boolean.class.getSimpleName(),
-
value));
+ throw new ValueFormatException(value, getPropertyType(),
+
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
+
Boolean.class.getSimpleName(),
+ value));
}
/**
@@ -156,8 +154,8 @@
*/
public BigDecimal create( Name value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Name.class.getSimpleName(),
-
value));
+
Name.class.getSimpleName(),
+
value));
}
/**
@@ -165,8 +163,8 @@
*/
public BigDecimal create( Path value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Path.class.getSimpleName(),
-
value));
+
Path.class.getSimpleName(),
+
value));
}
/**
@@ -175,8 +173,8 @@
public BigDecimal create( Reference value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Reference.class.getSimpleName(),
- value));
+
Reference.class.getSimpleName(),
+ value));
}
/**
@@ -184,8 +182,8 @@
*/
public BigDecimal create( URI value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
URI.class.getSimpleName(),
-
value));
+
URI.class.getSimpleName(),
+
value));
}
/**
@@ -195,8 +193,8 @@
*/
public BigDecimal create( UUID value ) throws IoException {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
UUID.class.getSimpleName(),
-
value));
+
UUID.class.getSimpleName(),
+
value));
}
/**
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/DelegatingValueFactories.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/DelegatingValueFactories.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/DelegatingValueFactories.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -25,6 +25,7 @@
import java.math.BigDecimal;
import java.net.URI;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.graph.property.BinaryFactory;
import org.jboss.dna.graph.property.DateTimeFactory;
import org.jboss.dna.graph.property.NameFactory;
@@ -35,8 +36,9 @@
import org.jboss.dna.graph.property.ValueFactory;
/**
- * @author Randall Hauch
+ * A {@link ValueFactories} implementation that delegates to another instance, and that
is often useful for subclassing.
*/
+@Immutable
public class DelegatingValueFactories extends AbstractValueFactories {
private final ValueFactories delegate;
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/DoubleValueFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/DoubleValueFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/DoubleValueFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -45,9 +45,6 @@
/**
* The standard {@link ValueFactory} for {@link PropertyType#DOUBLE} values.
- *
- * @author Randall Hauch
- * @author John Verhaeg
*/
@Immutable
public class DoubleValueFactory extends AbstractValueFactory<Double> {
@@ -67,8 +64,8 @@
} catch (NumberFormatException err) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.errorConvertingType.text(String.class.getSimpleName(),
-
Double.class.getSimpleName(),
- value),
err);
+
Double.class.getSimpleName(),
+ value),
err);
}
}
@@ -100,8 +97,8 @@
*/
public Double create( boolean value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Double.class.getSimpleName(),
-
value));
+
Double.class.getSimpleName(),
+
value));
}
/**
@@ -127,8 +124,8 @@
if (result == Double.NEGATIVE_INFINITY || result == Double.POSITIVE_INFINITY) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.errorConvertingType.text(BigDecimal.class.getSimpleName(),
-
Double.class.getSimpleName(),
- value));
+
Double.class.getSimpleName(),
+ value));
}
return result;
}
@@ -164,8 +161,8 @@
*/
public Double create( Name value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Name.class.getSimpleName(),
-
value));
+
Name.class.getSimpleName(),
+
value));
}
/**
@@ -173,8 +170,8 @@
*/
public Double create( Path value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Path.class.getSimpleName(),
-
value));
+
Path.class.getSimpleName(),
+
value));
}
/**
@@ -183,8 +180,8 @@
public Double create( Reference value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Reference.class.getSimpleName(),
- value));
+
Reference.class.getSimpleName(),
+ value));
}
/**
@@ -192,8 +189,8 @@
*/
public Double create( URI value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
URI.class.getSimpleName(),
-
value));
+
URI.class.getSimpleName(),
+
value));
}
/**
@@ -203,8 +200,8 @@
*/
public Double create( UUID value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
UUID.class.getSimpleName(),
-
value));
+
UUID.class.getSimpleName(),
+
value));
}
/**
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/InMemoryBinary.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/InMemoryBinary.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/InMemoryBinary.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -31,8 +31,6 @@
/**
* An implementation of {@link Binary} that keeps the binary data in-memory.
- *
- * @author Randall Hauch
*/
@Immutable
public class InMemoryBinary extends AbstractBinary {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/InMemoryBinaryValueFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/InMemoryBinaryValueFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/InMemoryBinaryValueFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -34,8 +34,6 @@
* <p>
* This factory does not {@link #find(byte[]) reuse} any instances.
* </p>
- *
- * @author Randall Hauch
*/
@Immutable
public class InMemoryBinaryValueFactory extends AbstractBinaryValueFactory {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/JodaDateTime.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/JodaDateTime.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/JodaDateTime.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -36,8 +36,6 @@
/**
* Implementation of DateTime based upon the Joda-Time library.
- *
- * @author Randall Hauch
*/
@Immutable
public class JodaDateTime implements org.jboss.dna.graph.property.DateTime {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/JodaDateTimeValueFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/JodaDateTimeValueFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/JodaDateTimeValueFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -47,9 +47,6 @@
/**
* The standard {@link ValueFactory} for {@link PropertyType#DATE} values.
- *
- * @author Randall Hauch
- * @author John Verhaeg
*/
@Immutable
public class JodaDateTimeValueFactory extends AbstractValueFactory<DateTime>
implements DateTimeFactory {
@@ -69,8 +66,8 @@
} catch (IllegalArgumentException err) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.errorConvertingType.text(String.class.getSimpleName(),
-
DateTime.class.getSimpleName(),
- value),
err);
+
DateTime.class.getSimpleName(),
+ value),
err);
}
}
@@ -102,8 +99,8 @@
*/
public DateTime create( boolean value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Date.class.getSimpleName(),
-
value));
+
Date.class.getSimpleName(),
+
value));
}
/**
@@ -158,8 +155,8 @@
*/
public DateTime create( Name value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Name.class.getSimpleName(),
-
value));
+
Name.class.getSimpleName(),
+
value));
}
/**
@@ -167,8 +164,8 @@
*/
public DateTime create( Path value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Path.class.getSimpleName(),
-
value));
+
Path.class.getSimpleName(),
+
value));
}
/**
@@ -177,8 +174,8 @@
public DateTime create( Reference value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Reference.class.getSimpleName(),
- value));
+
Reference.class.getSimpleName(),
+ value));
}
/**
@@ -186,8 +183,8 @@
*/
public DateTime create( URI value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
URI.class.getSimpleName(),
-
value));
+
URI.class.getSimpleName(),
+
value));
}
/**
@@ -197,8 +194,8 @@
*/
public DateTime create( UUID value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
UUID.class.getSimpleName(),
-
value));
+
UUID.class.getSimpleName(),
+
value));
}
/**
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/LocalNamespaceRegistry.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/LocalNamespaceRegistry.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/LocalNamespaceRegistry.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -33,7 +33,8 @@
import org.jboss.dna.graph.property.NamespaceRegistry;
/**
- * @author Randall Hauch
+ * A special {@link NamespaceRegistry} implementation that can be used to track transient
registrations for another delegate
+ * registry.
*/
@ThreadSafe
public class LocalNamespaceRegistry extends SimpleNamespaceRegistry {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/LongValueFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/LongValueFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/LongValueFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -45,9 +45,6 @@
/**
* The standard {@link ValueFactory} for {@link PropertyType#LONG} values.
- *
- * @author Randall Hauch
- * @author John Verhaeg
*/
@Immutable
public class LongValueFactory extends AbstractValueFactory<Long> {
@@ -67,8 +64,8 @@
} catch (NumberFormatException err) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.errorConvertingType.text(String.class.getSimpleName(),
-
Long.class.getSimpleName(),
- value),
err);
+
Long.class.getSimpleName(),
+ value),
err);
}
}
@@ -100,8 +97,8 @@
*/
public Long create( boolean value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Long.class.getSimpleName(),
-
value));
+
Long.class.getSimpleName(),
+
value));
}
/**
@@ -157,8 +154,8 @@
*/
public Long create( Name value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Name.class.getSimpleName(),
-
value));
+
Name.class.getSimpleName(),
+
value));
}
/**
@@ -166,8 +163,8 @@
*/
public Long create( Path value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Path.class.getSimpleName(),
-
value));
+
Path.class.getSimpleName(),
+
value));
}
/**
@@ -176,8 +173,8 @@
public Long create( Reference value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Reference.class.getSimpleName(),
- value));
+
Reference.class.getSimpleName(),
+ value));
}
/**
@@ -185,8 +182,8 @@
*/
public Long create( URI value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
URI.class.getSimpleName(),
-
value));
+
URI.class.getSimpleName(),
+
value));
}
/**
@@ -196,8 +193,8 @@
*/
public Long create( UUID value ) throws IoException {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
UUID.class.getSimpleName(),
-
value));
+
UUID.class.getSimpleName(),
+
value));
}
/**
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/NameValueFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/NameValueFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/NameValueFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -51,9 +51,6 @@
/**
* The standard {@link ValueFactory} for {@link PropertyType#NAME} values.
- *
- * @author Randall Hauch
- * @author John Verhaeg
*/
@Immutable
public class NameValueFactory extends AbstractValueFactory<Name> implements
NameFactory {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/ObjectValueFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/ObjectValueFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/ObjectValueFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -45,9 +45,6 @@
/**
* The standard {@link ValueFactory} for {@link PropertyType#OBJECT} values.
- *
- * @author Randall Hauch
- * @author John Verhaeg
*/
@Immutable
public class ObjectValueFactory extends AbstractValueFactory<Object> {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/PathValueFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/PathValueFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/PathValueFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -52,9 +52,6 @@
/**
* The standard {@link ValueFactory} for {@link PropertyType#NAME} values.
- *
- * @author Randall Hauch
- * @author John Verhaeg
*/
@Immutable
public class PathValueFactory extends AbstractValueFactory<Path> implements
PathFactory {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/RootPath.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/RootPath.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/RootPath.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -38,8 +38,6 @@
/**
* Optimized implementation of {@link Path} that serves as the root path.
- *
- * @author Randall Hauch
*/
@Immutable
public class RootPath extends AbstractPath {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/SimpleNamespaceRegistry.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/SimpleNamespaceRegistry.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/SimpleNamespaceRegistry.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -37,8 +37,6 @@
/**
* A simple {@link NamespaceRegistry} implementation that is not thread-safe, but that
provides all the basic functionality.
- *
- * @author Randall Hauch
*/
@NotThreadSafe
public class SimpleNamespaceRegistry implements NamespaceRegistry {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/StandardValueFactories.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/StandardValueFactories.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/StandardValueFactories.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -43,8 +43,6 @@
/**
* The standard set of {@link ValueFactory value factories}.
- *
- * @author Randall Hauch
*/
@Immutable
public class StandardValueFactories extends AbstractValueFactories {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/StringValueFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/StringValueFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/StringValueFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -52,9 +52,6 @@
/**
* The standard {@link ValueFactory} for {@link PropertyType#STRING} values.
- *
- * @author Randall Hauch
- * @author John Verhaeg
*/
@Immutable
public class StringValueFactory extends AbstractValueFactory<String> {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/ThreadSafeNamespaceRegistry.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/ThreadSafeNamespaceRegistry.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/ThreadSafeNamespaceRegistry.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -37,8 +37,6 @@
/**
* A thread-safe {@link NamespaceRegistry} that may be used as a thread-safe wrapper
around another non-thread-safe
* implementation.
- *
- * @author Randall Hauch
*/
@ThreadSafe
public class ThreadSafeNamespaceRegistry implements NamespaceRegistry {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/UriValueFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/UriValueFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/UriValueFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -48,9 +48,6 @@
/**
* The standard {@link ValueFactory} for {@link PropertyType#URI} values.
- *
- * @author Randall Hauch
- * @author John Verhaeg
*/
@Immutable
public class UriValueFactory extends AbstractValueFactory<URI> {
@@ -75,8 +72,8 @@
} catch (URISyntaxException err) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.errorConvertingType.text(String.class.getSimpleName(),
-
URI.class.getSimpleName(),
- value),
err);
+
URI.class.getSimpleName(),
+ value),
err);
}
}
@@ -93,9 +90,10 @@
* {@inheritDoc}
*/
public URI create( int value ) {
- throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Integer.class.getSimpleName(),
-
value));
+ throw new ValueFormatException(value, getPropertyType(),
+
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
+
Integer.class.getSimpleName(),
+ value));
}
/**
@@ -103,17 +101,18 @@
*/
public URI create( long value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Long.class.getSimpleName(),
-
value));
+
Long.class.getSimpleName(),
+
value));
}
/**
* {@inheritDoc}
*/
public URI create( boolean value ) {
- throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Boolean.class.getSimpleName(),
-
value));
+ throw new ValueFormatException(value, getPropertyType(),
+
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
+
Boolean.class.getSimpleName(),
+ value));
}
/**
@@ -121,8 +120,8 @@
*/
public URI create( float value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Float.class.getSimpleName(),
-
value));
+
Float.class.getSimpleName(),
+
value));
}
/**
@@ -130,8 +129,8 @@
*/
public URI create( double value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Double.class.getSimpleName(),
-
value));
+
Double.class.getSimpleName(),
+
value));
}
/**
@@ -140,17 +139,18 @@
public URI create( BigDecimal value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
BigDecimal.class.getSimpleName(),
- value));
+
BigDecimal.class.getSimpleName(),
+ value));
}
/**
* {@inheritDoc}
*/
public URI create( Calendar value ) {
- throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Calendar.class.getSimpleName(),
-
value));
+ throw new ValueFormatException(value, getPropertyType(),
+
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
+
Calendar.class.getSimpleName(),
+ value));
}
/**
@@ -158,8 +158,8 @@
*/
public URI create( Date value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Date.class.getSimpleName(),
-
value));
+
Date.class.getSimpleName(),
+
value));
}
/**
@@ -168,9 +168,10 @@
* @see
org.jboss.dna.graph.property.ValueFactory#create(org.jboss.dna.graph.property.DateTime)
*/
public URI create( DateTime value ) throws ValueFormatException {
- throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
DateTime.class.getSimpleName(),
-
value));
+ throw new ValueFormatException(value, getPropertyType(),
+
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
+
DateTime.class.getSimpleName(),
+ value));
}
/**
@@ -198,8 +199,8 @@
public URI create( Reference value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Reference.class.getSimpleName(),
- value));
+
Reference.class.getSimpleName(),
+ value));
}
/**
@@ -209,8 +210,8 @@
*/
public URI create( UUID value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
UUID.class.getSimpleName(),
-
value));
+
UUID.class.getSimpleName(),
+
value));
}
/**
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/UuidReference.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/UuidReference.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/UuidReference.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -30,7 +30,7 @@
import org.jboss.dna.graph.property.Reference;
/**
- * @author Randall Hauch
+ * A {@link Reference} implementation that uses a single {@link UUID} as the pointer.
*/
@Immutable
public class UuidReference implements Reference {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/UuidReferenceValueFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/UuidReferenceValueFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/UuidReferenceValueFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -45,9 +45,6 @@
/**
* The standard {@link ValueFactory} for {@link PropertyType#REFERENCE} values.
- *
- * @author Randall Hauch
- * @author John Verhaeg
*/
@Immutable
public class UuidReferenceValueFactory extends AbstractValueFactory<Reference> {
@@ -68,8 +65,8 @@
} catch (IllegalArgumentException err) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.errorConvertingType.text(String.class.getSimpleName(),
-
Reference.class.getSimpleName(),
- value),
err);
+
Reference.class.getSimpleName(),
+ value),
err);
}
}
@@ -86,9 +83,10 @@
* {@inheritDoc}
*/
public Reference create( int value ) {
- throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Integer.class.getSimpleName(),
-
value));
+ throw new ValueFormatException(value, getPropertyType(),
+
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
+
Integer.class.getSimpleName(),
+ value));
}
/**
@@ -96,17 +94,18 @@
*/
public Reference create( long value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Long.class.getSimpleName(),
-
value));
+
Long.class.getSimpleName(),
+
value));
}
/**
* {@inheritDoc}
*/
public Reference create( boolean value ) {
- throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Boolean.class.getSimpleName(),
-
value));
+ throw new ValueFormatException(value, getPropertyType(),
+
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
+
Boolean.class.getSimpleName(),
+ value));
}
/**
@@ -114,8 +113,8 @@
*/
public Reference create( float value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Float.class.getSimpleName(),
-
value));
+
Float.class.getSimpleName(),
+
value));
}
/**
@@ -123,8 +122,8 @@
*/
public Reference create( double value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Double.class.getSimpleName(),
-
value));
+
Double.class.getSimpleName(),
+
value));
}
/**
@@ -133,17 +132,18 @@
public Reference create( BigDecimal value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
BigDecimal.class.getSimpleName(),
- value));
+
BigDecimal.class.getSimpleName(),
+ value));
}
/**
* {@inheritDoc}
*/
public Reference create( Calendar value ) {
- throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Calendar.class.getSimpleName(),
-
value));
+ throw new ValueFormatException(value, getPropertyType(),
+
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
+
Calendar.class.getSimpleName(),
+ value));
}
/**
@@ -151,8 +151,8 @@
*/
public Reference create( Date value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Date.class.getSimpleName(),
-
value));
+
Date.class.getSimpleName(),
+
value));
}
/**
@@ -161,9 +161,10 @@
* @see
org.jboss.dna.graph.property.ValueFactory#create(org.jboss.dna.graph.property.DateTime)
*/
public Reference create( DateTime value ) throws ValueFormatException {
- throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
DateTime.class.getSimpleName(),
-
value));
+ throw new ValueFormatException(value, getPropertyType(),
+
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
+
DateTime.class.getSimpleName(),
+ value));
}
/**
@@ -171,8 +172,8 @@
*/
public Reference create( Name value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Name.class.getSimpleName(),
-
value));
+
Name.class.getSimpleName(),
+
value));
}
/**
@@ -180,8 +181,8 @@
*/
public Reference create( Path value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Path.class.getSimpleName(),
-
value));
+
Path.class.getSimpleName(),
+
value));
}
/**
@@ -206,8 +207,8 @@
*/
public Reference create( URI value ) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Date.class.getSimpleName(),
-
value));
+
Date.class.getSimpleName(),
+
value));
}
/**
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/UuidValueFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/UuidValueFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/UuidValueFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -46,9 +46,6 @@
/**
* The standard {@link ValueFactory} for {@link PropertyType#URI} values.
- *
- * @author Randall Hauch
- * @author John Verhaeg
*/
@Immutable
public class UuidValueFactory extends AbstractValueFactory<UUID> implements
UuidFactory {
@@ -78,8 +75,8 @@
} catch (IllegalArgumentException err) {
throw new ValueFormatException(value, PropertyType.UUID,
GraphI18n.errorConvertingType.text(String.class.getSimpleName(),
-
URI.class.getSimpleName(),
- value),
err);
+
URI.class.getSimpleName(),
+ value),
err);
}
}
@@ -96,9 +93,10 @@
* {@inheritDoc}
*/
public UUID create( int value ) {
- throw new ValueFormatException(value, PropertyType.UUID,
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Integer.class.getSimpleName(),
-
value));
+ throw new ValueFormatException(value, PropertyType.UUID,
+
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
+
Integer.class.getSimpleName(),
+ value));
}
/**
@@ -106,17 +104,18 @@
*/
public UUID create( long value ) {
throw new ValueFormatException(value, PropertyType.UUID,
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Long.class.getSimpleName(),
-
value));
+
Long.class.getSimpleName(),
+
value));
}
/**
* {@inheritDoc}
*/
public UUID create( boolean value ) {
- throw new ValueFormatException(value, PropertyType.UUID,
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Boolean.class.getSimpleName(),
-
value));
+ throw new ValueFormatException(value, PropertyType.UUID,
+
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
+
Boolean.class.getSimpleName(),
+ value));
}
/**
@@ -124,8 +123,8 @@
*/
public UUID create( float value ) {
throw new ValueFormatException(value, PropertyType.UUID,
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Float.class.getSimpleName(),
-
value));
+
Float.class.getSimpleName(),
+
value));
}
/**
@@ -133,8 +132,8 @@
*/
public UUID create( double value ) {
throw new ValueFormatException(value, PropertyType.UUID,
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Double.class.getSimpleName(),
-
value));
+
Double.class.getSimpleName(),
+
value));
}
/**
@@ -143,17 +142,18 @@
public UUID create( BigDecimal value ) {
throw new ValueFormatException(value, PropertyType.UUID,
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
BigDecimal.class.getSimpleName(),
- value));
+
BigDecimal.class.getSimpleName(),
+ value));
}
/**
* {@inheritDoc}
*/
public UUID create( Calendar value ) {
- throw new ValueFormatException(value, PropertyType.UUID,
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Calendar.class.getSimpleName(),
-
value));
+ throw new ValueFormatException(value, PropertyType.UUID,
+
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
+
Calendar.class.getSimpleName(),
+ value));
}
/**
@@ -161,8 +161,8 @@
*/
public UUID create( Date value ) {
throw new ValueFormatException(value, PropertyType.UUID,
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Date.class.getSimpleName(),
-
value));
+
Date.class.getSimpleName(),
+
value));
}
/**
@@ -171,9 +171,10 @@
* @see
org.jboss.dna.graph.property.ValueFactory#create(org.jboss.dna.graph.property.DateTime)
*/
public UUID create( DateTime value ) throws ValueFormatException {
- throw new ValueFormatException(value, PropertyType.UUID,
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
DateTime.class.getSimpleName(),
-
value));
+ throw new ValueFormatException(value, PropertyType.UUID,
+
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
+
DateTime.class.getSimpleName(),
+ value));
}
/**
@@ -181,8 +182,8 @@
*/
public UUID create( Name value ) {
throw new ValueFormatException(value, PropertyType.UUID,
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Name.class.getSimpleName(),
-
value));
+
Name.class.getSimpleName(),
+
value));
}
/**
@@ -190,8 +191,8 @@
*/
public UUID create( Path value ) {
throw new ValueFormatException(value, PropertyType.UUID,
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Path.class.getSimpleName(),
-
value));
+
Path.class.getSimpleName(),
+
value));
}
/**
@@ -204,8 +205,8 @@
}
throw new ValueFormatException(value, PropertyType.UUID,
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
Reference.class.getSimpleName(),
- value));
+
Reference.class.getSimpleName(),
+ value));
}
/**
@@ -213,8 +214,8 @@
*/
public UUID create( URI value ) {
throw new ValueFormatException(value, PropertyType.UUID,
GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
-
URI.class.getSimpleName(),
-
value));
+
URI.class.getSimpleName(),
+
value));
}
/**
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/BatchRequestBuilder.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/BatchRequestBuilder.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/BatchRequestBuilder.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -27,6 +27,7 @@
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
+import net.jcip.annotations.NotThreadSafe;
import org.jboss.dna.graph.Location;
import org.jboss.dna.graph.NodeConflictBehavior;
import org.jboss.dna.graph.connector.UuidAlreadyExistsException;
@@ -44,6 +45,7 @@
* remove and return the enqueued requests (as a {@link CompositeRequest} if there is
more than one enqueued request).
* </p>
*/
+@NotThreadSafe
public class BatchRequestBuilder {
private LinkedList<Request> requests;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CacheableRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CacheableRequest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CacheableRequest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -30,8 +30,6 @@
/**
* A request that contains results that may be cached.
- *
- * @author Randall Hauch
*/
@ThreadSafe
public abstract class CacheableRequest extends Request implements Cacheable {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CloneBranchRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CloneBranchRequest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CloneBranchRequest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -21,8 +21,6 @@
* new parent's children; nodes can be cloned to an exact location among the
parent's children, replacing the existing node at
* that location.</li>
* </ol>
- *
- * @author Brian Carothers
*/
public class CloneBranchRequest extends ChangeRequest {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CompositeRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CompositeRequest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CompositeRequest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -41,8 +41,6 @@
* request has the effect of cancelling all other requests in the composite, including
the composite. (This is implemented by
* having all {@link Request} objects in the composite share the same cancelled flag
object.)
* </p>
- *
- * @author Randall Hauch
*/
@Immutable
public class CompositeRequest extends Request implements Iterable<Request> {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CopyBranchRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CopyBranchRequest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CopyBranchRequest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -37,7 +37,6 @@
* UUIDs for the copied nodes. {@link CloneBranchRequest Cloning a branch} provides
functionality similar to copy, but with the
* ability to preserve UUIDs in the move.
*
- * @author Randall Hauch
* @see CloneBranchRequest
*/
public class CopyBranchRequest extends ChangeRequest {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CreateNodeRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CreateNodeRequest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CreateNodeRequest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -40,8 +40,6 @@
/**
* Instruction to create the node under the specified location. This command will create
the node and set the initial properties.
- *
- * @author Randall Hauch
*/
public class CreateNodeRequest extends ChangeRequest implements Iterable<Property>
{
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/DeleteBranchRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/DeleteBranchRequest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/DeleteBranchRequest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -31,8 +31,6 @@
/**
* Instruction that a branch be deleted.
- *
- * @author Randall Hauch
*/
public class DeleteBranchRequest extends ChangeRequest {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/InvalidRequestException.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/InvalidRequestException.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/InvalidRequestException.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,11 +23,12 @@
*/
package org.jboss.dna.graph.request;
+import net.jcip.annotations.Immutable;
+
/**
* Specifies that the request was invalid and could not be completed.
- *
- * @author Randall Hauch
*/
+@Immutable
public class InvalidRequestException extends RequestException {
/**
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/InvalidWorkspaceException.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/InvalidWorkspaceException.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/InvalidWorkspaceException.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,11 +23,12 @@
*/
package org.jboss.dna.graph.request;
+import net.jcip.annotations.Immutable;
+
/**
* Specifies that the request was invalid and could not be completed.
- *
- * @author Randall Hauch
*/
+@Immutable
public class InvalidWorkspaceException extends RequestException {
/**
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/MoveBranchRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/MoveBranchRequest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/MoveBranchRequest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -33,8 +33,6 @@
/**
* Instruction that a branch be moved from one location into another.
- *
- * @author Randall Hauch
*/
public class MoveBranchRequest extends ChangeRequest {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadAllChildrenRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadAllChildrenRequest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadAllChildrenRequest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -36,8 +36,6 @@
/**
* Instruction to read all of the children of a node at a specific location.
- *
- * @author Randall Hauch
*/
public class ReadAllChildrenRequest extends CacheableRequest implements
Iterable<Location> {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadAllPropertiesRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadAllPropertiesRequest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadAllPropertiesRequest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -37,8 +37,6 @@
/**
* Instruction to read the properties and the number of children of the node at the
specifed location.
- *
- * @author Randall Hauch
*/
public class ReadAllPropertiesRequest extends CacheableRequest implements
Iterable<Property> {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadBlockOfChildrenRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadBlockOfChildrenRequest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadBlockOfChildrenRequest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -40,7 +40,6 @@
* a large number of children.
*
* @see ReadNextBlockOfChildrenRequest
- * @author Randall Hauch
*/
public class ReadBlockOfChildrenRequest extends CacheableRequest {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadBranchRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadBranchRequest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadBranchRequest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -43,8 +43,6 @@
/**
* Instruction to read the properties and children of the nodes in the branch at the
supplied location. The children of the nodes
* at the bottom of the branch are not read.
- *
- * @author Randall Hauch
*/
@NotThreadSafe
public class ReadBranchRequest extends CacheableRequest implements
Iterable<Location> {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadNextBlockOfChildrenRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadNextBlockOfChildrenRequest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadNextBlockOfChildrenRequest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -40,7 +40,6 @@
* to be read.
*
* @see ReadBlockOfChildrenRequest
- * @author Randall Hauch
*/
public class ReadNextBlockOfChildrenRequest extends CacheableRequest {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadNodeRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadNodeRequest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadNodeRequest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -40,8 +40,6 @@
/**
* Instruction to read the properties and children of the node at the specifed location.
- *
- * @author Randall Hauch
*/
public class ReadNodeRequest extends CacheableRequest implements Iterable<Location>
{
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadPropertyRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadPropertyRequest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadPropertyRequest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -33,8 +33,6 @@
/**
* Instruction to read a single property on the node at the specified location.
- *
- * @author Randall Hauch
*/
public class ReadPropertyRequest extends CacheableRequest {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/RemovePropertyRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/RemovePropertyRequest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/RemovePropertyRequest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -33,8 +33,6 @@
/**
* Instruction to remove the property with the supplied name from the node at the given
location. This request has no net effect
* if the node does not contain a property with the supplied name.
- *
- * @author Randall Hauch
*/
public class RemovePropertyRequest extends ChangeRequest {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/RenameNodeRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/RenameNodeRequest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/RenameNodeRequest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -33,8 +33,6 @@
/**
* Instruction to rename an existing node (but keep it under the same parent). The
same-name-sibling index will be determined
* automatically, based upon it's current location within the list of children.
- *
- * @author Randall Hauch
*/
public class RenameNodeRequest extends ChangeRequest {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/Request.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/Request.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/Request.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -31,8 +31,6 @@
/**
* The abstract base class for all classes representing requests to be executed against a
{@link RepositoryConnection}.
- *
- * @author Randall Hauch
*/
public abstract class Request implements Serializable {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/RequestException.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/RequestException.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/RequestException.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,11 +23,12 @@
*/
package org.jboss.dna.graph.request;
+import net.jcip.annotations.Immutable;
+
/**
* Specifies that the request was invalid and could not be completed.
- *
- * @author Randall Hauch
*/
+@Immutable
public class RequestException extends RuntimeException {
/**
@@ -61,7 +62,7 @@
* @param cause
*/
public RequestException( String message,
- Throwable cause ) {
+ Throwable cause ) {
super(message, cause);
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/SetPropertyRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/SetPropertyRequest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/SetPropertyRequest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -34,8 +34,6 @@
/**
* Instruction to set a particular property on the node at the specified location. This
request <i>never</i> removes the node,
* even if the property is empty.
- *
- * @author Randall Hauch
*/
public class SetPropertyRequest extends ChangeRequest {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/UnsupportedRequestException.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/UnsupportedRequestException.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/UnsupportedRequestException.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,11 +23,12 @@
*/
package org.jboss.dna.graph.request;
+import net.jcip.annotations.Immutable;
+
/**
* Specifies that the request was a type that is not supported.
- *
- * @author Randall Hauch
*/
+@Immutable
public class UnsupportedRequestException extends RequestException {
/**
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/UpdatePropertiesRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/UpdatePropertiesRequest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/UpdatePropertiesRequest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -50,8 +50,6 @@
* {@link Property#isSingle()}, and {@link Property#isMultiple()}) has no influence on
whether the property should be removed. It
* is possible for a property to have no values.
* </p>
- *
- * @author Randall Hauch
*/
public class UpdatePropertiesRequest extends ChangeRequest {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/VerifyNodeExistsRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/VerifyNodeExistsRequest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/VerifyNodeExistsRequest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -30,8 +30,6 @@
/**
* Instruction to verify the existance of a node at the specified location. This request
also returns the actual location.
- *
- * @author Randall Hauch
*/
public class VerifyNodeExistsRequest extends CacheableRequest {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/processor/LoggingRequestProcessor.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/processor/LoggingRequestProcessor.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/processor/LoggingRequestProcessor.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,6 +23,7 @@
*/
package org.jboss.dna.graph.request.processor;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.Logger;
import org.jboss.dna.graph.GraphI18n;
@@ -53,9 +54,8 @@
/**
* A {@link RequestProcessor} implementation that wraps another and that logs messages at
the supplied level.
- *
- * @author Randall Hauch
*/
+@Immutable
public class LoggingRequestProcessor extends RequestProcessor {
private final RequestProcessor delegate;
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/sequencer/SequencerOutput.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/sequencer/SequencerOutput.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/sequencer/SequencerOutput.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,18 +28,15 @@
/**
* Interface for sequencers to use to generate their output.
- *
- * @author Randall Hauch
- * @author John Verhaeg
*/
public interface SequencerOutput {
/**
* Set the supplied property on the supplied node.
* <p>
- * The {@link StreamSequencerContext#getValueFactories() value factories} should be
used to create paths, names, and values. These
- * factories can be used to create new values or convert values from one property
type to another. (Note that each of the
- * factories have methods that create values from all of the property types.)
+ * The {@link StreamSequencerContext#getValueFactories() value factories} should be
used to create paths, names, and values.
+ * These factories can be used to create new values or convert values from one
property type to another. (Note that each of
+ * the factories have methods that create values from all of the property types.)
* </p>
* <p>
* This method is provided as a convenience, but it identical to creating a {@link
Path} and {@link Name} using the
@@ -73,9 +70,9 @@
/**
* Set the supplied property on the supplied node.
* <p>
- * The {@link StreamSequencerContext#getValueFactories() value factories} should be
used to create paths, names, and values. These
- * factories can be used to create new values or convert values from one property
type to another. (Note that each of the
- * factories have methods that create values from all of the property types.)
+ * The {@link StreamSequencerContext#getValueFactories() value factories} should be
used to create paths, names, and values.
+ * These factories can be used to create new values or convert values from one
property type to another. (Note that each of
+ * the factories have methods that create values from all of the property types.)
* </p>
*
* @param nodePath the path to the node containing the property; may not be null
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/sequencer/StreamSequencer.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/sequencer/StreamSequencer.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/sequencer/StreamSequencer.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -31,9 +31,6 @@
* <p>
* Implementations must provide a no-argument constructor.
* </p>
- *
- * @author Randall Hauch
- * @author John Verhaeg
*/
public interface StreamSequencer {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/sequencer/StreamSequencerContext.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/sequencer/StreamSequencerContext.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/sequencer/StreamSequencerContext.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,6 +28,7 @@
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import net.jcip.annotations.ThreadSafe;
import org.jboss.dna.common.collection.Problems;
import org.jboss.dna.common.collection.SimpleProblems;
import org.jboss.dna.graph.ExecutionContext;
@@ -36,8 +37,9 @@
import org.jboss.dna.graph.property.Property;
/**
- * @author John Verhaeg
+ * A special {@link ExecutionContext} that is used for sequencing streams.
*/
+@ThreadSafe
public class StreamSequencerContext extends ExecutionContext {
private final Path inputPath;
@@ -47,10 +49,10 @@
private final String mimeType;
public StreamSequencerContext( ExecutionContext context,
- Path inputPath,
- Set<Property> inputProperties,
- String mimeType,
- Problems problems ) {
+ Path inputPath,
+ Set<Property> inputProperties,
+ String mimeType,
+ Problems problems ) {
super(context);
this.inputPath = inputPath;
this.inputProperties = inputProperties != null ? new
HashSet<Property>(inputProperties) : new HashSet<Property>();
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/session/InvalidStateException.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/session/InvalidStateException.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/session/InvalidStateException.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,9 +23,12 @@
*/
package org.jboss.dna.graph.session;
+import net.jcip.annotations.Immutable;
+
/**
- *
+ * A runtime exception signaling an invalid state of a graph session.
*/
+@Immutable
public class InvalidStateException extends RuntimeException {
private static final long serialVersionUID = 1L;
@@ -57,7 +60,7 @@
* @param cause
*/
public InvalidStateException( String message,
- Throwable cause ) {
+ Throwable cause ) {
super(message, cause);
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/session/ValidationException.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/session/ValidationException.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/session/ValidationException.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,9 +23,12 @@
*/
package org.jboss.dna.graph.session;
+import net.jcip.annotations.Immutable;
+
/**
- *
+ * A runtime exception signaling failed validation within a graph session.
*/
+@Immutable
public class ValidationException extends RuntimeException {
private static final long serialVersionUID = 1L;
Copied: trunk/dna-graph/src/main/java/org/jboss/dna/graph/session/package-info.java (from
rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavadocMetadata.java)
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/session/package-info.java
(rev 0)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/session/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,30 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * A graph session provides a stateful environment in which graph operations can be
enqueued and the state
+ * and structure of the graph are cached.
+ */
+
+package org.jboss.dna.graph.session;
+
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/xml/XmlHandler.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/xml/XmlHandler.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/xml/XmlHandler.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -60,8 +60,6 @@
* This class can be passed to the {@link SAXParser}'s {@link
SAXParser#parse(java.io.File, org.xml.sax.helpers.DefaultHandler)
* parse(..,DefaultHandler)} methods.
* </p>
- *
- * @author Randall Hauch
*/
@NotThreadSafe
public class XmlHandler extends DefaultHandler2 {
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrItem.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrItem.java 2009-09-12 17:43:41
UTC (rev 1217)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrItem.java 2009-09-12 17:55:25
UTC (rev 1218)
@@ -27,14 +27,16 @@
import javax.jcr.ItemNotFoundException;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.property.Name;
import org.jboss.dna.graph.property.NamespaceRegistry;
import org.jboss.dna.graph.property.Path;
/**
- * @author jverhaeg
+ * An abstract {@link Item} implementation.
*/
+@Immutable
abstract class AbstractJcrItem implements Item {
protected final SessionCache cache;
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrProperty.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrProperty.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrProperty.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -44,7 +44,7 @@
import org.jboss.dna.jcr.SessionCache.NodeEditor;
/**
- * @author jverhaeg
+ * An abstract {@link Property JCR Property} implementation.
*/
@NotThreadSafe
abstract class AbstractJcrProperty extends AbstractJcrItem implements Property,
Comparable<Property> {
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/DnaIntLexicon.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/DnaIntLexicon.java 2009-09-12 17:43:41
UTC (rev 1217)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/DnaIntLexicon.java 2009-09-12 17:55:25
UTC (rev 1218)
@@ -23,12 +23,14 @@
*/
package org.jboss.dna.jcr;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.graph.property.Name;
import org.jboss.dna.graph.property.basic.BasicName;
/**
* A lexicon of internal and implementation-specific information
*/
+@Immutable
public class DnaIntLexicon extends org.jboss.dna.graph.DnaIntLexicon {
public static final Name MULTI_VALUED_PROPERTIES = new BasicName(Namespace.URI,
"multiValuedProperties");
}
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/DnaLexicon.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/DnaLexicon.java 2009-09-12 17:43:41 UTC
(rev 1217)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/DnaLexicon.java 2009-09-12 17:55:25 UTC
(rev 1218)
@@ -23,12 +23,14 @@
*/
package org.jboss.dna.jcr;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.graph.property.Name;
import org.jboss.dna.graph.property.basic.BasicName;
/**
- * @author Randall Hauch
+ * A lexicon of names used within JBoss DNA.
*/
+@Immutable
public class DnaLexicon extends org.jboss.dna.repository.DnaLexicon {
public static final Name BASE = new BasicName(Namespace.URI, "base");
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrChildNodeIterator.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrChildNodeIterator.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrChildNodeIterator.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -29,6 +29,7 @@
import org.jboss.dna.common.util.CheckArg;
/**
+ * A concrete {@link NodeIterator} implementation.
*/
@Immutable
final class JcrChildNodeIterator implements NodeIterator {
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrEmptyNodeIterator.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrEmptyNodeIterator.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrEmptyNodeIterator.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -26,11 +26,13 @@
import java.util.NoSuchElementException;
import javax.jcr.Node;
import javax.jcr.NodeIterator;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.common.util.CheckArg;
/**
- *
+ * A concrete {@link NodeIterator} that is always empty.
*/
+@Immutable
class JcrEmptyNodeIterator implements NodeIterator {
/**
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrEmptyPropertyIterator.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrEmptyPropertyIterator.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrEmptyPropertyIterator.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -26,11 +26,13 @@
import java.util.NoSuchElementException;
import javax.jcr.Property;
import javax.jcr.PropertyIterator;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.common.util.CheckArg;
/**
- *
+ * A concrete {@link PropertyIterator}.
*/
+@Immutable
class JcrEmptyPropertyIterator implements PropertyIterator {
/**
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrEngine.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrEngine.java 2009-09-12 17:43:41 UTC
(rev 1217)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrEngine.java 2009-09-12 17:55:25 UTC
(rev 1218)
@@ -32,6 +32,7 @@
import java.util.concurrent.locks.ReentrantLock;
import javax.jcr.Repository;
import javax.jcr.RepositoryException;
+import net.jcip.annotations.ThreadSafe;
import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.Graph;
@@ -53,6 +54,7 @@
/**
* The basic component that encapsulates the JBoss DNA services, including the {@link
Repository} instances.
*/
+@ThreadSafe
public class JcrEngine extends DnaEngine {
private final Map<String, JcrRepository> repositories;
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrI18n.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrI18n.java 2009-09-12 17:43:41 UTC
(rev 1217)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrI18n.java 2009-09-12 17:55:25 UTC
(rev 1218)
@@ -23,12 +23,13 @@
*/
package org.jboss.dna.jcr;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.common.i18n.I18n;
/**
- * @author John Verhaeg
- * @author Randall Hauch
+ * The internationalized string constants for the
<code>org.jboss.dna.jcr*</code> packages.
*/
+@Immutable
public final class JcrI18n {
public static I18n cannotConvertValue;
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrLexicon.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrLexicon.java 2009-09-12 17:43:41 UTC
(rev 1217)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrLexicon.java 2009-09-12 17:55:25 UTC
(rev 1218)
@@ -23,12 +23,14 @@
*/
package org.jboss.dna.jcr;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.graph.property.Name;
import org.jboss.dna.graph.property.basic.BasicName;
/**
* Lexicon of names from the standard JCR
"<code>http://www.jcp.org/jcr/1.0</code>" namespace.
*/
+@Immutable
public class JcrLexicon extends org.jboss.dna.graph.JcrLexicon {
public static final Name BASE_VERSION = new BasicName(Namespace.URI,
"baseVersion");
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrMixLexicon.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrMixLexicon.java 2009-09-12 17:43:41
UTC (rev 1217)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrMixLexicon.java 2009-09-12 17:55:25
UTC (rev 1218)
@@ -23,9 +23,12 @@
*/
package org.jboss.dna.jcr;
+import net.jcip.annotations.Immutable;
+
/**
* Lexicon of names from the standard JCR
"<code>http://www.jcp.org/jcr/mix/1.0</code>" namespace.
*/
+@Immutable
public class JcrMixLexicon extends org.jboss.dna.graph.JcrMixLexicon {
}
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrMultiValueProperty.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrMultiValueProperty.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrMultiValueProperty.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -41,7 +41,9 @@
import org.jboss.dna.graph.property.Property;
/**
+ * A {@link javax.jcr.Property JCR Property} implementation that has multiple values.
*
+ * @see JcrSingleValueProperty
*/
@NotThreadSafe
final class JcrMultiValueProperty extends AbstractJcrProperty {
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrNode.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrNode.java 2009-09-12 17:43:41 UTC
(rev 1217)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrNode.java 2009-09-12 17:55:25 UTC
(rev 1218)
@@ -24,13 +24,16 @@
package org.jboss.dna.jcr;
import javax.jcr.ItemNotFoundException;
+import javax.jcr.Node;
import javax.jcr.RepositoryException;
import net.jcip.annotations.NotThreadSafe;
import org.jboss.dna.graph.Location;
import org.jboss.dna.graph.session.GraphSession.NodeId;
/**
- *
+ * A concrete {@link Node JCR Node} implementation.
+ *
+ * @see JcrRootNode
*/
@NotThreadSafe
final class JcrNode extends AbstractJcrNode {
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrPropertyIterator.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrPropertyIterator.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrPropertyIterator.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -31,6 +31,7 @@
import org.jboss.dna.common.util.CheckArg;
/**
+ * DNA implementation of a {@link PropertyIterator}.
*/
@Immutable
final class JcrPropertyIterator implements PropertyIterator {
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java 2009-09-12 17:43:41
UTC (rev 1217)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java 2009-09-12 17:55:25
UTC (rev 1218)
@@ -95,9 +95,6 @@
* Note, {@link Session#getAttributeNames() attributes} on credentials are not supported.
JCR {@link SimpleCredentials} are also
* not supported.
* </p>
- *
- * @author John Verhaeg
- * @author Randall Hauch
*/
@ThreadSafe
public class JcrRepository implements Repository {
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRootNode.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRootNode.java 2009-09-12 17:43:41 UTC
(rev 1217)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRootNode.java 2009-09-12 17:55:25 UTC
(rev 1218)
@@ -25,16 +25,17 @@
import javax.jcr.Item;
import javax.jcr.ItemNotFoundException;
+import javax.jcr.Node;
import javax.jcr.RepositoryException;
import javax.jcr.nodetype.ConstraintViolationException;
-import net.jcip.annotations.NotThreadSafe;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.graph.Location;
import org.jboss.dna.graph.session.GraphSession.NodeId;
/**
- * @author jverhaeg
+ * A concrete implementation of a root {@link Node JCR Node}.
*/
-@NotThreadSafe
+@Immutable
final class JcrRootNode extends AbstractJcrNode {
JcrRootNode( SessionCache cache,
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrSession.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrSession.java 2009-09-12 17:43:41 UTC
(rev 1217)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrSession.java 2009-09-12 17:55:25 UTC
(rev 1218)
@@ -76,8 +76,7 @@
import org.xml.sax.helpers.XMLReaderFactory;
/**
- * @author John Verhaeg
- * @author Randall Hauch
+ * The DNA implementation of a {@link Session JCR Session}.
*/
@NotThreadSafe
class JcrSession implements Session {
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrSingleValueProperty.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrSingleValueProperty.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrSingleValueProperty.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -27,6 +27,7 @@
import java.util.Calendar;
import java.util.UUID;
import javax.jcr.Node;
+import javax.jcr.Property;
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
import javax.jcr.Value;
@@ -34,6 +35,7 @@
import javax.jcr.lock.LockException;
import javax.jcr.nodetype.ConstraintViolationException;
import javax.jcr.version.VersionException;
+import net.jcip.annotations.NotThreadSafe;
import org.jboss.dna.graph.Location;
import org.jboss.dna.graph.property.Binary;
import org.jboss.dna.graph.property.Name;
@@ -41,8 +43,11 @@
import org.jboss.dna.graph.property.ValueFactories;
/**
- *
+ * DNA implementation of a {@link Property JCR Property} with a single value.
+ *
+ * @see JcrMultiValueProperty
*/
+@NotThreadSafe
final class JcrSingleValueProperty extends AbstractJcrProperty {
JcrSingleValueProperty( SessionCache cache,
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrSvLexicon.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrSvLexicon.java 2009-09-12 17:43:41
UTC (rev 1217)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrSvLexicon.java 2009-09-12 17:55:25
UTC (rev 1218)
@@ -23,12 +23,14 @@
*/
package org.jboss.dna.jcr;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.graph.property.Name;
import org.jboss.dna.graph.property.basic.BasicName;
/**
* Lexicon of names from the standard JCR
"<code>http://www.jcp.org/jcr/sv/1.0</code>" namespace.
*/
+@Immutable
public class JcrSvLexicon {
public static class Namespace {
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrValue.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrValue.java 2009-09-12 17:43:41 UTC
(rev 1217)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrValue.java 2009-09-12 17:55:25 UTC
(rev 1218)
@@ -45,7 +45,7 @@
import org.jboss.dna.graph.property.ValueFactories;
/**
- *
+ * DNA implementation of a {@link Value JCR Value}.
*/
@NotThreadSafe
final class JcrValue implements Value {
@@ -449,7 +449,7 @@
public String toString() {
return (value == null ? "null" : value.toString()) + " (" +
PropertyType.nameFromValue(type) + ")";
}
-
+
private enum State {
NEVER_CONSUMED,
INPUT_STREAM_CONSUMED,
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrWorkspace.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrWorkspace.java 2009-09-12 17:43:41
UTC (rev 1217)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrWorkspace.java 2009-09-12 17:55:25
UTC (rev 1218)
@@ -79,7 +79,7 @@
import org.xml.sax.helpers.XMLReaderFactory;
/**
- *
+ * DNA implementation of a {@link Workspace JCR Workspace}.
*/
@NotThreadSafe
final class JcrWorkspace implements Workspace {
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/PropertyTypeUtil.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/PropertyTypeUtil.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/PropertyTypeUtil.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,10 +24,13 @@
package org.jboss.dna.jcr;
import javax.jcr.PropertyType;
+import net.jcip.annotations.Immutable;
/**
- *
+ * A utility for working with {@link PropertyType JCR property types} and {@link
org.jboss.dna.graph.property.PropertyType DNA
+ * property types}.
*/
+@Immutable
class PropertyTypeUtil {
/**
Modified:
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/nodetype/NodeTypeExistsException.java
===================================================================
---
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/nodetype/NodeTypeExistsException.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/nodetype/NodeTypeExistsException.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,12 +24,14 @@
package org.jboss.dna.jcr.nodetype;
import javax.jcr.RepositoryException;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.property.Name;
/**
* An exception that captures the error condition that a referenced node type already
exists.
*/
+@Immutable
public class NodeTypeExistsException extends RepositoryException {
/**
Copied: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/nodetype/package-info.java (from rev
1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/VariableSequencer.java)
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/nodetype/package-info.java
(rev 0)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/nodetype/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,39 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The DNA specification for programmatically creating JCR {@link
javax.jcr.nodetype.NodeDefinition}s.
+ * To use, simply obtain the JCR {@link javax.jcr.nodetype.NodeTypeManager} from the
{@link javax.jcr.Workspace#getNodeTypeManager() workspace}
+ * and cast to a {@link org.jboss.dna.jcr.JcrNodeTypeManager}. That object can then be
used to create new
+ * {@link org.jboss.dna.jcr.JcrNodeTypeManager#createNodeDefinitionTemplate() node
definition templates},
+ * {@link org.jboss.dna.jcr.JcrNodeTypeManager#createNodeTypeTemplate() node type
templates},
+ * and {@link org.jboss.dna.jcr.JcrNodeTypeManager#createPropertyDefinitionTemplate()
property definition templates},
+ * and to then {@link
org.jboss.dna.jcr.JcrNodeTypeManager#registerNodeType(NodeTypeDefinition, boolean)
register} the new node types.
+ * <p>
+ * This design is patterned after the similar funcationality in the JCR 2.0 Public Final
Draft (PFD), and will
+ * eventually be migrated to implement the specification when JBoss DNA supports the
final JCR 2.0 final specification.
+ * </p>
+ */
+
+package org.jboss.dna.jcr.nodetype;
+
Copied: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/package-info.java (from rev 1217,
trunk/dna-common/src/main/java/org/jboss/dna/common/component/AbstractComponent.java)
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/package-info.java
(rev 0)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/package-info.java 2009-09-12 17:55:25
UTC (rev 1218)
@@ -0,0 +1,32 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The DNA implementation of the JCR API. To use, first create a {@link
JcrConfiguration} to represent the desired
+ * configuration, and then use the configuration to {@link JcrConfiguration#build()
build} a {@link JcrEngine} instance.
+ * This engine must be {@link JcrEngine#start() started}, used to obtain {@link
JcrEngine#getRepository(String) JCR Repository} instances,
+ * and then {@link JcrEngine#shutdown() shutdown} when no longer needed.
+ */
+
+package org.jboss.dna.jcr;
+
Property changes on: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/package-info.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/dna-repository/pom.xml
===================================================================
--- trunk/dna-repository/pom.xml 2009-09-12 17:43:41 UTC (rev 1217)
+++ trunk/dna-repository/pom.xml 2009-09-12 17:55:25 UTC (rev 1218)
@@ -39,17 +39,6 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.jboss.dna</groupId>
- <artifactId>dna-connector-federation</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.dna</groupId>
- <artifactId>dna-connector-federation</artifactId>
- <version>${pom.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
<!--
Testing (note the scope)
-->
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/DnaConfigurationException.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/DnaConfigurationException.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/DnaConfigurationException.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -21,9 +21,12 @@
*/
package org.jboss.dna.repository;
+import net.jcip.annotations.Immutable;
+
/**
- * @author Randall Hauch
+ * A runtime exception that denotes an error within the configuration for JBoss DNA.
*/
+@Immutable
public class DnaConfigurationException extends RuntimeException {
/**
Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/DnaLexicon.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/DnaLexicon.java 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/DnaLexicon.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,12 +23,14 @@
*/
package org.jboss.dna.repository;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.graph.property.Name;
import org.jboss.dna.graph.property.basic.BasicName;
/**
- * @author Randall Hauch
+ * A lexicon of names used within JBoss DNA.
*/
+@Immutable
public class DnaLexicon extends org.jboss.dna.graph.DnaLexicon {
public static final Name SOURCES = new BasicName(Namespace.URI,
"sources");
Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryI18n.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryI18n.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryI18n.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -25,12 +25,13 @@
import java.util.Locale;
import java.util.Set;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.common.i18n.I18n;
/**
- * @author Randall Hauch
- * @author John Verhaeg
+ * The internationalized string constants for the
<code>org.jboss.dna.repository*</code> packages.
*/
+@Immutable
public final class RepositoryI18n {
// Configuration
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryLibrary.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryLibrary.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryLibrary.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -53,8 +53,6 @@
/**
* A library of {@link RepositorySource} instances and the {@link
RepositoryConnectionPool} used to manage the connections for
* each.
- *
- * @author Randall Hauch
*/
@ThreadSafe
public class RepositoryLibrary implements RepositoryConnectionFactory, Observable {
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryService.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryService.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryService.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -34,7 +34,6 @@
import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.Logger;
import org.jboss.dna.common.util.Reflection;
-import org.jboss.dna.connector.federation.FederationException;
import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.Graph;
import org.jboss.dna.graph.JcrLexicon;
@@ -58,7 +57,7 @@
import org.jboss.dna.repository.service.ServiceAdministrator;
/**
- * @author Randall Hauch
+ * A service that manages the {@link RepositorySource}es defined within a configuration
repository.
*/
@ThreadSafe
public class RepositoryService implements AdministeredService, Observer {
@@ -232,7 +231,7 @@
} catch (PathNotFoundException e) {
// No sources were found, and this is okay!
} catch (Throwable err) {
- throw new
FederationException(RepositoryI18n.errorStartingRepositoryService.text(), err);
+ throw new
DnaConfigurationException(RepositoryI18n.errorStartingRepositoryService.text(), err);
}
this.started.set(true);
Copied: trunk/dna-repository/src/main/java/org/jboss/dna/repository/package-info.java
(from rev 1217,
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/UuidFactory.java)
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/package-info.java
(rev 0)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,33 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The components and services that make up the JBoss DNA repository engine.
+ * To use, first create a {@link DnaConfiguration} to represent the desired
+ * configuration, and then use the configuration to {@link DnaConfiguration#build()
build} a {@link DnaEngine} instance.
+ * This engine must be {@link DnaEngine#start() started}, used to obtain {@link
DnaEngine#getGraph(String) graph} instances,
+ * and then {@link DnaEngine#shutdown() shutdown} when no longer needed.
+ */
+
+package org.jboss.dna.repository;
+
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/InvalidSequencerPathExpression.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/InvalidSequencerPathExpression.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/InvalidSequencerPathExpression.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,11 +23,13 @@
*/
package org.jboss.dna.repository.sequencer;
+import net.jcip.annotations.Immutable;
+import org.jboss.dna.graph.property.PathExpression;
/**
- *
- * @author Randall Hauch
+ * A runtime exception that denotes an invalid {@link PathExpression} for a sequencer.
*/
+@Immutable
public class InvalidSequencerPathExpression extends RuntimeException {
/**
@@ -60,7 +62,8 @@
* @param message
* @param cause
*/
- public InvalidSequencerPathExpression( String message, Throwable cause ) {
+ public InvalidSequencerPathExpression( String message,
+ Throwable cause ) {
super(message, cause);
}
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/Sequencer.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/Sequencer.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/Sequencer.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -40,9 +40,6 @@
* <p>
* Implementations must provide a no-argument constructor.
* </p>
- *
- * @author Randall Hauch
- * @author John Verhaeg
*/
@ThreadSafe
public interface Sequencer extends Component<SequencerConfig> {
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencerConfig.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencerConfig.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencerConfig.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -32,7 +32,7 @@
import org.jboss.dna.common.component.ComponentConfig;
/**
- * @author Randall Hauch
+ * A configuration for a sequencer.
*/
@Immutable
public class SequencerConfig extends ComponentConfig {
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencerException.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencerException.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencerException.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,9 +23,12 @@
*/
package org.jboss.dna.repository.sequencer;
+import net.jcip.annotations.Immutable;
+
/**
- * @author Randall Hauch
+ * A runtime exception that denotes an error within a sequencer.
*/
+@Immutable
public class SequencerException extends RuntimeException {
/**
@@ -55,7 +58,8 @@
* @param message
* @param cause
*/
- public SequencerException( String message, Throwable cause ) {
+ public SequencerException( String message,
+ Throwable cause ) {
super(message, cause);
}
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencerLibrary.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencerLibrary.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencerLibrary.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,12 +23,14 @@
*/
package org.jboss.dna.repository.sequencer;
+import net.jcip.annotations.ThreadSafe;
import org.jboss.dna.common.component.ComponentLibrary;
import org.jboss.dna.graph.sequencer.StreamSequencer;
/**
- * @author Randall Hauch
+ * A library of {@link Sequencer} components.
*/
+@ThreadSafe
public class SequencerLibrary extends ComponentLibrary<Sequencer, SequencerConfig>
{
/**
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencerOutputMap.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencerOutputMap.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencerOutputMap.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -43,9 +43,6 @@
/**
* A basic {@link SequencerOutput} that records all information in-memory and which
organizes the properties by {@link Path node
* paths} and provides access to the nodes in a natural path-order.
- *
- * @author Randall Hauch
- * @author John Verhaeg
*/
@NotThreadSafe
public class SequencerOutputMap implements SequencerOutput,
Iterable<SequencerOutputMap.Entry> {
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencerPathExpression.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencerPathExpression.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencerPathExpression.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -49,8 +49,6 @@
* <code>title</code> property on the <code>/a/b/c</code> node,
and that the output of the sequencing should be placed at
* <code>/d/e/f</code>.
* </p>
- *
- * @author Randall Hauch
*/
@Immutable
public class SequencerPathExpression implements Serializable {
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencingService.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencingService.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencingService.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -63,9 +63,6 @@
/**
* A sequencing system is used to monitor changes in the content of DNA repositories and
to sequence the content to extract or to
* generate structured information.
- *
- * @author Randall Hauch
- * @author John Verhaeg
*/
public class SequencingService implements AdministeredService {
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/StreamSequencerAdapter.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/StreamSequencerAdapter.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/StreamSequencerAdapter.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -50,9 +50,6 @@
/**
* An adapter class that wraps a {@link StreamSequencer} instance to be a {@link
Sequencer}.
- *
- * @author Randall Hauch
- * @author John Verhaeg
*/
public class StreamSequencerAdapter implements Sequencer {
Copied:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/package-info.java
(from rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ModifierMetadata.java)
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/package-info.java
(rev 0)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The classes that make up the sequencing service and its configuration.
+ */
+
+package org.jboss.dna.repository.sequencer;
+
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/service/AbstractServiceAdministrator.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/service/AbstractServiceAdministrator.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/service/AbstractServiceAdministrator.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -33,8 +33,6 @@
/**
* Simple abstract implementation of the service administrator interface that can be
easily subclassed by services that require an
* administrative interface.
- *
- * @author Randall Hauch
*/
@ThreadSafe
public abstract class AbstractServiceAdministrator implements ServiceAdministrator {
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/service/AdministeredService.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/service/AdministeredService.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/service/AdministeredService.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,7 +24,7 @@
package org.jboss.dna.repository.service;
/**
- * @author Randall Hauch
+ * A simple interface for an administered service.
*/
public interface AdministeredService {
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/service/ServiceAdministrator.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/service/ServiceAdministrator.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/service/ServiceAdministrator.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,8 +28,6 @@
/**
* Contract defining an administrative interface for controlling the running state of a
service.
- *
- * @author Randall Hauch
*/
@ThreadSafe
public interface ServiceAdministrator {
@@ -71,7 +69,7 @@
* @param state the desired state in string form
* @return this object for method chaining purposes
* @throws IllegalArgumentException if the specified state string is null or does not
match one of the predefined
- * {@link State predefined enumerated values}
+ * {@link State predefined enumerated values}
* @see #setState(State)
* @see #start()
* @see #pause()
@@ -120,11 +118,12 @@
*
* @param timeout the maximum time to wait
* @param unit the time unit of the timeout argument
- * @return <tt>true</tt> if this service complete shut down and
<tt>false</tt> if the timeout elapsed before it was shut
- * down completely
+ * @return <tt>true</tt> if this service complete shut down and
<tt>false</tt> if the timeout elapsed before it was shut down
+ * completely
* @throws InterruptedException if interrupted while waiting
*/
- boolean awaitTermination( long timeout, TimeUnit unit ) throws InterruptedException;
+ boolean awaitTermination( long timeout,
+ TimeUnit unit ) throws InterruptedException;
/**
* Return whether this system has been started and is currently running.
Copied:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/service/package-info.java
(from rev 1217,
trunk/dna-repository/src/main/java/org/jboss/dna/repository/service/AdministeredService.java)
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/service/package-info.java
(rev 0)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/service/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The definition of common interfaces and classes for DNA services.
+ */
+
+package org.jboss.dna.repository.service;
+
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/AbstractSessionFactory.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/AbstractSessionFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/AbstractSessionFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -39,21 +39,21 @@
* <p>
* This factory using a naming convention where the name supplied to the {@link
#createSession(String)} contains both the name of
* the repository and the name of the workspace. Typically, this is
<i><code>repositoryName/workspaceName</code></i>, where
- * <code>repositoryName</code> is the name under which the Repository
instance was bound, and <code>workspaceName</code> is
- * the name of the workspace. Note that this method looks for the last delimiter in the
whole name to distinguish between the
+ * <code>repositoryName</code> is the name under which the Repository
instance was bound, and <code>workspaceName</code> is the
+ * name of the workspace. Note that this method looks for the last delimiter in the whole
name to distinguish between the
* repository and workspace names.
* </p>
* <p>
* For example, if
"<code>java:comp/env/repository/dataRepository/myWorkspace</code>"
is passed to the
- * {@link #createSession(String)} method, this factory will look for a {@link Repository}
instance registered with the name
"<code>java:comp/env/repository/dataRepository</code>"
- * and use it to {@link Repository#login(String) create a session} to the workspace named
"<code>myWorkspace</code>".
+ * {@link #createSession(String)} method, this factory will look for a {@link Repository}
instance registered with the name "
+ * <code>java:comp/env/repository/dataRepository</code>" and use it to
{@link Repository#login(String) create a session} to the
+ * workspace named "<code>myWorkspace</code>".
* </p>
* <p>
* By default, this factory creates an anonymous JCR session. To use sessions with
specific {@link Credentials}, simply
* {@link #registerCredentials(String, Credentials) register} credentials for the
appropriate repository/workspace name. For
* security reasons, it is not possible to retrieve the Credentials once registered with
this factory.
* </p>
- * @author Randall Hauch
*/
public abstract class AbstractSessionFactory implements SessionFactory {
@@ -73,6 +73,7 @@
/**
* Create an instance of the factory by supplying naming context and the characters
that may be used to delimit the workspace
* name from the repository name.
+ *
* @param workspaceDelimiters the delimiters, or null/empty if the default delimiter
of '/' should be used.
* @throws IllegalArgumentException if the context parameter is null
*/
@@ -104,10 +105,12 @@
/**
* Convenience method to bind a repository in JNDI. Repository instances can be bound
into JNDI using any technique, so this
* method need not be used. <i>Note that the name should not contain the
workspace part.</i>
+ *
* @param name the name of the repository, without the workspace name component.
* @param repository the repository to be bound, or null if an existing repository
should be unbound.
*/
- public void registerRepository( String name, Repository repository ) {
+ public void registerRepository( String name,
+ Repository repository ) {
assert name != null;
// Remove all trailing delimiters ...
name = name.replaceAll("[" + this.workspaceDelimsRegexCharacterSet +
"]+$", "");
@@ -118,7 +121,8 @@
}
}
- protected abstract void doRegisterRepository( String name, Repository repository )
throws SystemFailureException;
+ protected abstract void doRegisterRepository( String name,
+ Repository repository ) throws
SystemFailureException;
protected abstract void doUnregisterRepository( String name ) throws
SystemFailureException;
@@ -128,6 +132,7 @@
* Register the credentials for the repository and workspace given by the supplied
name, username and password. This is
* equivalent to calling <code>registerCredentials(name, new
SimpleCredentials(username,password))</code>, although if
* <code>username</code> is null then this is equivalent to
<code>registerCredentials(name,null)</code>.
+ *
* @param name the name of the repository and workspace
* @param username the username to use, or null if the existing credentials for the
named workspace should be removed
* @param password the password, may be null or empty
@@ -135,7 +140,9 @@
* @see #registerCredentials(String, Credentials)
* @see #removeCredentials(String)
*/
- public boolean registerCredentials( String name, String username, char[] password )
{
+ public boolean registerCredentials( String name,
+ String username,
+ char[] password ) {
if (password == null && username != null) password = new char[] {};
Credentials creds = username == null ? null : new SimpleCredentials(username,
password);
return registerCredentials(name, creds);
@@ -144,13 +151,15 @@
/**
* Register the credentials to be used for the named repository and workspace. Use
the same name as used to
* {@link #createSession(String) create sessions}.
+ *
* @param name the name of the repository and workspace
* @param credentials the credentials to use, or null if the existing credentials for
the named workspace should be removed
* @return true if this overwrote existing credentials
* @see #registerCredentials(String, String, char[])
* @see #removeCredentials(String)
*/
- public boolean registerCredentials( String name, Credentials credentials ) {
+ public boolean registerCredentials( String name,
+ Credentials credentials ) {
boolean foundExisting = false;
name = name != null ? name.trim() : null;
if (credentials == null) {
@@ -164,6 +173,7 @@
/**
* Remove any credentials associated with the named repository and workspace. This is
equivalent to calling
* <code>registerCredentials(name,null)</code>.
+ *
* @param name the name of the repository and workspace
* @return true if existing credentials were found and removed, or false if no such
credentials existed
* @see #registerCredentials(String, Credentials)
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/RepositoryNodePath.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/RepositoryNodePath.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/RepositoryNodePath.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -30,14 +30,16 @@
import org.jboss.dna.repository.RepositoryI18n;
/**
- * @author Randall Hauch
+ * An immutable representation of a path to a node within the named workspace of a named
repository source.
*/
@Immutable
public class RepositoryNodePath {
protected static final Pattern PATTERN = Pattern.compile("([^:/]):(/.*)");
- public static RepositoryNodePath parse( String path, String repositorySourceName,
String defaultRepositoryWorkspaceName ) {
+ public static RepositoryNodePath parse( String path,
+ String repositorySourceName,
+ String defaultRepositoryWorkspaceName ) {
Matcher matcher = PATTERN.matcher(path);
if (matcher.matches()) {
try {
@@ -55,7 +57,9 @@
private final String nodePath;
private final int hc;
- public RepositoryNodePath( String repositorySourceName, String workspaceName, String
nodePath ) {
+ public RepositoryNodePath( String repositorySourceName,
+ String workspaceName,
+ String nodePath ) {
this.repositorySourceName = repositorySourceName;
this.workspaceName = workspaceName;
this.nodePath = nodePath;
@@ -77,13 +81,12 @@
}
/**
- *
* @return the workspace name
*/
public String getWorkspaceName() {
return this.workspaceName;
}
-
+
/**
* {@inheritDoc}
*/
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/SessionFactory.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/SessionFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/SessionFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,7 +28,7 @@
import javax.jcr.Session;
/**
- * @author Randall Hauch
+ * An interface for creating JCR Session objects.
*/
public interface SessionFactory {
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/SimpleSessionFactory.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/SimpleSessionFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/SimpleSessionFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -41,8 +41,6 @@
* {@link #registerCredentials(String, Credentials) register} credentials for the
appropriate repository/workspace name. For
* security reasons, it is not possible to retrieve the Credentials once registered with
this factory.
* </p>
- *
- * @author Randall Hauch
*/
public class SimpleSessionFactory extends AbstractSessionFactory {
Copied: trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/package-info.java
(from rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavadocMetadata.java)
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/package-info.java
(rev 0)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * Utility classes and methods for the JBoss DNA repository system.
+ */
+
+package org.jboss.dna.repository.util;
+
Modified:
trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/ConsoleInput.java
===================================================================
---
trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/ConsoleInput.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/ConsoleInput.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -37,7 +37,7 @@
import com.sun.security.auth.callback.TextCallbackHandler;
/**
- * @author Randall Hauch
+ * The {@link UserInterface} implementation that uses the console.
*/
public class ConsoleInput implements UserInterface {
Modified:
trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/RepositoryClient.java
===================================================================
---
trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/RepositoryClient.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/RepositoryClient.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -57,7 +57,7 @@
import org.xml.sax.SAXException;
/**
- * @author Randall Hauch
+ * The repository client, with the main application.
*/
public class RepositoryClient {
Modified:
trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/UserInterface.java
===================================================================
---
trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/UserInterface.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/UserInterface.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -27,7 +27,7 @@
import javax.security.auth.callback.CallbackHandler;
/**
- * @author Randall Hauch
+ * The methods to interact with the user.
*/
public interface UserInterface {
Modified:
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/ConsoleInput.java
===================================================================
---
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/ConsoleInput.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/ConsoleInput.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -32,7 +32,7 @@
import org.jboss.dna.repository.sequencer.SequencingService;
/**
- * @author Randall Hauch
+ * The {@link UserInterface} implementation that uses the console to interact with a
user.
*/
public class ConsoleInput implements UserInterface {
Modified:
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/ContentInfo.java
===================================================================
---
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/ContentInfo.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/ContentInfo.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,7 +28,7 @@
import net.jcip.annotations.Immutable;
/**
- * @author Randall Hauch
+ * The information about content.
*/
@Immutable
public class ContentInfo {
Modified:
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/JavaInfo.java
===================================================================
---
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/JavaInfo.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/JavaInfo.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -30,8 +30,7 @@
import net.jcip.annotations.Immutable;
/**
- * @author Serge Pagop
- * @author Randall Hauch
+ * The information about Java source.
*/
@Immutable
public class JavaInfo extends ContentInfo {
Modified:
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/JcrTools.java
===================================================================
---
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/JcrTools.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/JcrTools.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -44,15 +44,18 @@
import org.jboss.dna.repository.RepositoryI18n;
/**
- * @author Randall Hauch
+ * Utility methods for working with JCR.
*/
public class JcrTools {
- public Map<String, Object> loadProperties( Node propertyContainer, Problems
problems ) {
+ public Map<String, Object> loadProperties( Node propertyContainer,
+ Problems problems ) {
return loadProperties(propertyContainer, null, problems);
}
- public Map<String, Object> loadProperties( Node propertyContainer,
Map<String, Object> properties, Problems problems ) {
+ public Map<String, Object> loadProperties( Node propertyContainer,
+ Map<String, Object> properties,
+ Problems problems ) {
if (properties == null) properties = new HashMap<String, Object>();
if (propertyContainer != null) {
try {
@@ -83,7 +86,8 @@
return false;
}
- public boolean storeProblems( Node parent, Problems problems ) throws
RepositoryException {
+ public boolean storeProblems( Node parent,
+ Problems problems ) throws RepositoryException {
Node problemsNode = null;
if (parent.hasNode("dna:problems")) {
problemsNode = parent.getNode("dna:problems");
@@ -141,19 +145,32 @@
return childrenRemoved;
}
- public String getPropertyAsString( Node node, String propertyName, boolean required,
Problems problems ) {
+ public String getPropertyAsString( Node node,
+ String propertyName,
+ boolean required,
+ Problems problems ) {
return getPropertyAsString(node, propertyName, required, null);
}
- public String getPropertyAsString( Node node, String propertyName, boolean required,
String defaultValue, Problems problems ) {
+ public String getPropertyAsString( Node node,
+ String propertyName,
+ boolean required,
+ String defaultValue,
+ Problems problems ) {
try {
Property property = node.getProperty(propertyName);
return property.getString();
} catch (ValueFormatException e) {
if (required) {
- problems.addError(e,
RepositoryI18n.requiredPropertyOnNodeWasExpectedToBeStringValue, propertyName,
getReadable(node));
+ problems.addError(e,
+
RepositoryI18n.requiredPropertyOnNodeWasExpectedToBeStringValue,
+ propertyName,
+ getReadable(node));
} else {
- problems.addError(e,
RepositoryI18n.optionalPropertyOnNodeWasExpectedToBeStringValue, propertyName,
getReadable(node));
+ problems.addError(e,
+
RepositoryI18n.optionalPropertyOnNodeWasExpectedToBeStringValue,
+ propertyName,
+ getReadable(node));
}
} catch (PathNotFoundException e) {
if (required) {
@@ -170,7 +187,10 @@
return null;
}
- public Object getPropertyValue( Node node, String propertyName, boolean required,
Problems problems ) {
+ public Object getPropertyValue( Node node,
+ String propertyName,
+ boolean required,
+ Problems problems ) {
try {
Property property = node.getProperty(propertyName);
switch (property.getType()) {
@@ -185,7 +205,11 @@
stream.close();
} catch (IOException e) {
// Log ...
- Logger.getLogger(this.getClass()).error(e,
RepositoryI18n.errorClosingBinaryStreamForPropertyFromNode, propertyName,
node.getPath());
+ Logger.getLogger(this.getClass())
+ .error(e,
+
RepositoryI18n.errorClosingBinaryStreamForPropertyFromNode,
+ propertyName,
+ node.getPath());
}
}
}
@@ -214,7 +238,11 @@
return null;
}
- public String[] getPropertyAsStringArray( Node node, String propertyName, boolean
required, Problems problems, String... defaultValues ) {
+ public String[] getPropertyAsStringArray( Node node,
+ String propertyName,
+ boolean required,
+ Problems problems,
+ String... defaultValues ) {
String[] result = defaultValues;
try {
Property property = node.getProperty(propertyName);
@@ -230,9 +258,15 @@
}
} catch (ValueFormatException e) {
if (required) {
- problems.addError(e,
RepositoryI18n.requiredPropertyOnNodeWasExpectedToBeStringArrayValue, propertyName,
getReadable(node));
+ problems.addError(e,
+
RepositoryI18n.requiredPropertyOnNodeWasExpectedToBeStringArrayValue,
+ propertyName,
+ getReadable(node));
} else {
- problems.addError(e,
RepositoryI18n.optionalPropertyOnNodeWasExpectedToBeStringArrayValue, propertyName,
getReadable(node));
+ problems.addError(e,
+
RepositoryI18n.optionalPropertyOnNodeWasExpectedToBeStringArrayValue,
+ propertyName,
+ getReadable(node));
}
} catch (PathNotFoundException e) {
if (required) {
@@ -248,12 +282,18 @@
return result;
}
- public Node getNode( Node node, String relativePath, boolean required, Problems
problems ) {
+ public Node getNode( Node node,
+ String relativePath,
+ boolean required,
+ Problems problems ) {
Node result = null;
try {
result = node.getNode(relativePath);
} catch (PathNotFoundException e) {
- if (required) problems.addError(e,
RepositoryI18n.requiredNodeDoesNotExistRelativeToNode, relativePath, getReadable(node));
+ if (required) problems.addError(e,
+
RepositoryI18n.requiredNodeDoesNotExistRelativeToNode,
+ relativePath,
+ getReadable(node));
} catch (RepositoryException err) {
problems.addError(err, RepositoryI18n.errorGettingNodeRelativeToNode,
relativePath, getReadable(node));
}
@@ -269,20 +309,30 @@
}
}
- public Node findOrCreateNode( Session session, String path ) throws
RepositoryException {
+ public Node findOrCreateNode( Session session,
+ String path ) throws RepositoryException {
return findOrCreateNode(session, path, null, null);
}
- public Node findOrCreateNode( Session session, String path, String nodeType ) throws
RepositoryException {
+ public Node findOrCreateNode( Session session,
+ String path,
+ String nodeType ) throws RepositoryException {
return findOrCreateNode(session, path, nodeType, nodeType);
}
- public Node findOrCreateNode( Session session, String path, String defaultNodeType,
String finalNodeType ) throws RepositoryException {
+ public Node findOrCreateNode( Session session,
+ String path,
+ String defaultNodeType,
+ String finalNodeType ) throws RepositoryException {
Node root = session.getRootNode();
return findOrCreateNode(session, root, path, defaultNodeType, finalNodeType);
}
- public Node findOrCreateNode( Session session, Node parentNode, String path, String
defaultNodeType, String finalNodeType ) throws RepositoryException {
+ public Node findOrCreateNode( Session session,
+ Node parentNode,
+ String path,
+ String defaultNodeType,
+ String finalNodeType ) throws RepositoryException {
// Remove leading and trailing slashes ...
String relPath = path.replaceAll("^/+",
"").replaceAll("/+$", "");
@@ -318,11 +368,16 @@
return node;
}
- public Node findOrCreateChild( Session session, Node parent, String name ) throws
RepositoryException {
+ public Node findOrCreateChild( Session session,
+ Node parent,
+ String name ) throws RepositoryException {
return findOrCreateChild(session, parent, name, null);
}
- public Node findOrCreateChild( Session session, Node parent, String name, String
nodeType ) throws RepositoryException {
+ public Node findOrCreateChild( Session session,
+ Node parent,
+ String name,
+ String nodeType ) throws RepositoryException {
return findOrCreateNode(session, parent, name, nodeType, nodeType);
}
Modified:
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/MediaInfo.java
===================================================================
---
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/MediaInfo.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/MediaInfo.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,7 +28,7 @@
import net.jcip.annotations.Immutable;
/**
- * @author Randall Hauch
+ * Information about a media file.
*/
@Immutable
public class MediaInfo extends ContentInfo {
Modified:
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/SequencingClient.java
===================================================================
---
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/SequencingClient.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/SequencingClient.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -51,7 +51,7 @@
import org.jboss.dna.repository.util.SessionFactory;
/**
- * @author Randall Hauch
+ * The main application for running the sequencers.
*/
public class SequencingClient {
@@ -252,17 +252,17 @@
for (NodeIterator i = root.getNode("zips").getNodes();
i.hasNext();) {
nodesToVisit.addLast(i.nextNode());
}
-
+
while (!nodesToVisit.isEmpty()) {
Node node = nodesToVisit.remove();
-
+
String nodeType =
"nt:file".equals(node.getPrimaryNodeType()) ? "file" :
"folder";
infos.add(new MediaInfo(node.getPath(), node.getName(), nodeType, new
Properties()));
for (NodeIterator i = node.getNodes(); i.hasNext();) {
nodesToVisit.addLast(i.nextNode());
}
-
+
}
}
if (root.hasNode("java")) {
Modified:
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/UserInterface.java
===================================================================
---
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/UserInterface.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/UserInterface.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,7 +28,7 @@
import java.util.List;
/**
- * @author Randall Hauch
+ * The methods to interact with the user.
*/
public interface UserInterface {
Modified: trunk/docs/reference/src/main/docbook/en-US/content/introduction.xml
===================================================================
--- trunk/docs/reference/src/main/docbook/en-US/content/introduction.xml 2009-09-12
17:43:41 UTC (rev 1217)
+++ trunk/docs/reference/src/main/docbook/en-US/content/introduction.xml 2009-09-12
17:55:25 UTC (rev 1218)
@@ -381,14 +381,14 @@
viewed as repository content.
</para>
</listitem>
- <listitem>
+ <!--listitem>
<para>
<emphasis
role="strong">dna-connector-jdbc-metadata</emphasis>
is a prototype DNA repository connector that provides read-only access to
metadata from relational databases through a JDBC
connection.
<emphasis>This is still under
development.</emphasis>
</para>
- </listitem>
+ </listitem-->
<listitem>
<para>
<emphasis
role="strong">dna-connector-jbosscache</emphasis>
Modified: trunk/docs/reference/src/main/docbook/en-US/master.xml
===================================================================
--- trunk/docs/reference/src/main/docbook/en-US/master.xml 2009-09-12 17:43:41 UTC (rev
1217)
+++ trunk/docs/reference/src/main/docbook/en-US/master.xml 2009-09-12 17:55:25 UTC (rev
1218)
@@ -111,7 +111,7 @@
</partintro>
<xi:include
xmlns:xi="http://www.w3.org/2001/XInclude"
href="content/connectors/in_memory.xml"/>
<xi:include
xmlns:xi="http://www.w3.org/2001/XInclude"
href="content/connectors/file_system.xml"/>
- <xi:include
xmlns:xi="http://www.w3.org/2001/XInclude"
href="content/connectors/jdbc_storage.xml"/>
+ <!--xi:include
xmlns:xi="http://www.w3.org/2001/XInclude"
href="content/connectors/jdbc_storage.xml"/-->
<xi:include
xmlns:xi="http://www.w3.org/2001/XInclude"
href="content/connectors/federation.xml"/>
<xi:include
xmlns:xi="http://www.w3.org/2001/XInclude"
href="content/connectors/subversion.xml"/>
<xi:include
xmlns:xi="http://www.w3.org/2001/XInclude"
href="content/connectors/jboss_cache.xml"/>
Modified:
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/ArtifactType.java
===================================================================
---
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/ArtifactType.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/ArtifactType.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,7 +24,7 @@
package org.jboss.dna.maven;
/**
- * @author Randall Hauch
+ * The type of artifacts in a Maven 2 repository.
*/
public enum ArtifactType {
METADATA("maven-metadata.xml"),
Modified:
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenClassLoaders.java
===================================================================
---
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenClassLoaders.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenClassLoaders.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -47,8 +47,6 @@
* dependency rules</a>. Each {@link MavenRepository} instance owns an instance of
this class, which provides a cached set of
* class loaders and a facility for {@link MavenRepository#getClassLoader(ClassLoader,
MavenId...) getting class loaders} based
* upon a set of one or more versioned libraries.
- *
- * @author Randall Hauch
*/
/* package */class MavenClassLoaders {
Modified:
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenDependency.java
===================================================================
---
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenDependency.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenDependency.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -33,14 +33,13 @@
* Maven does for you is manage this list for you, you have gained a lot. Maven downloads
and links the dependencies for you on
* compilation and other goals that require them. As an added bonus, Maven brings in the
dependencies of those dependencies
* (transitive dependencies), allowing your list to focus solely on the dependencies your
project requires.
- * @author Randall Hauch
*/
public class MavenDependency {
/**
- * The scope of the dependency - <code>compile</code>,
<code>runtime</code>, <code>test</code>,
<code>system</code>,
- * and <code>provided</code>. Used to calculate the various classpaths
used for compilation, testing, and so on. It also
- * assists in determining which artifacts to include in a distribution of this
project. For more information, see <a
+ * The scope of the dependency - <code>compile</code>,
<code>runtime</code>, <code>test</code>,
<code>system</code>, and
+ * <code>provided</code>. Used to calculate the various classpaths used
for compilation, testing, and so on. It also assists
+ * in determining which artifacts to include in a distribution of this project. For
more information, see <a
*
href="http://maven.apache.org/guides/introduction/introduction-to-de...
dependency mechanism</a>.
*/
public enum Scope {
@@ -60,7 +59,8 @@
return this.suffix;
}
- public static Scope valueByText( String suffix, boolean useDefault ) {
+ public static Scope valueByText( String suffix,
+ boolean useDefault ) {
for (Scope type : Scope.values()) {
if (type.suffix.equalsIgnoreCase(suffix)) return type;
}
@@ -95,16 +95,22 @@
this.id = id;
}
- public MavenDependency( String groupId, String artifactId, String version ) {
+ public MavenDependency( String groupId,
+ String artifactId,
+ String version ) {
this.id = new MavenId(groupId, artifactId, version);
}
- public MavenDependency( String groupId, String artifactId, String version, String
classifier ) {
+ public MavenDependency( String groupId,
+ String artifactId,
+ String version,
+ String classifier ) {
this.id = new MavenId(groupId, artifactId, version, classifier);
}
/**
* The identifier of the artifact for this dependency.
+ *
* @return the identifier
*/
public MavenId getId() {
@@ -112,11 +118,12 @@
}
/**
- * The type of dependency. This defaults to <code>jar</code>. While it
usually represents the extension on the filename of
- * the dependency, that is not always the case. A type can be mapped to a different
extension and a classifier. The type often
+ * The type of dependency. This defaults to <code>jar</code>. While it
usually represents the extension on the filename of the
+ * dependency, that is not always the case. A type can be mapped to a different
extension and a classifier. The type often
* correspongs to the packaging used, though this is also not always the case. Some
examples are <code>jar</code>,
* <code>war</code>, <code>ejb-client</code> and
<code>test-jar</code>. New types can be defined by plugins that set
* <code>extensions</code> to <code>true</code>, so this is
not a complete list.
+ *
* @return the dependency type
*/
public String getType() {
@@ -125,18 +132,20 @@
/**
* Set the type of dependency.
- * @param type the new dependency type. If null, then the type will be set to the
- * {@link #DEFAULT_TYPE default dependency type}.
+ *
+ * @param type the new dependency type. If null, then the type will be set to the
{@link #DEFAULT_TYPE default dependency
+ * type}.
*/
public void setType( String type ) {
this.type = type != null ? type.trim() : DEFAULT_TYPE;
}
/**
- * The scope of the dependency - <code>compile</code>,
<code>runtime</code>, <code>test</code>,
<code>system</code>,
- * and <code>provided</code>. Used to calculate the various classpaths
used for compilation, testing, and so on. It also
- * assists in determining which artifacts to include in a distribution of this
project. For more information, see <a
+ * The scope of the dependency - <code>compile</code>,
<code>runtime</code>, <code>test</code>,
<code>system</code>, and
+ * <code>provided</code>. Used to calculate the various classpaths used
for compilation, testing, and so on. It also assists
+ * in determining which artifacts to include in a distribution of this project. For
more information, see <a
*
href="http://maven.apache.org/guides/introduction/introduction-to-de...
dependency mechanism</a>.
+ *
* @return the scope
*/
public Scope getScope() {
@@ -158,6 +167,7 @@
* FOR SYSTEM SCOPE ONLY. Note that use of this property is
<b>discouraged</b> and may be replaced in later versions. This
* specifies the path on the filesystem for this dependency. Requires an absolute
path for the value, not relative. Use a
* property that gives the machine specific absolute path, e.g.
<code>${java.home}</code>.
+ *
* @return systemPath
*/
public String getSystemPath() {
@@ -174,6 +184,7 @@
/**
* Indicates the dependency is optional for use of this library. While the version of
the dependency will be taken into
* account for dependency calculation if the library is used elsewhere, it will not
be passed on transitively.
+ *
* @return true if this is an optional dependency, or false otherwise
*/
public boolean isOptional() {
@@ -191,6 +202,7 @@
* Exclusions explicitly tell Maven that you don't want to include the specified
project that is a dependency of this
* dependency (in other words, its transitive dependency). For example, the
maven-embedder requires maven-core , and we do not
* wish to use it or its dependencies, then we would add it as an exclusion .
+ *
* @return the set of exclusions
*/
public Set<MavenId> getExclusions() {
Modified:
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenI18n.java
===================================================================
---
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenI18n.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenI18n.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,52 +28,52 @@
import org.jboss.dna.common.i18n.I18n;
/**
- * @author Randall Hauch
+ * The internationalized string constants for the
<code>org.jboss.dna.maven*</code> packages.
*/
public final class MavenI18n {
- public static I18n errorGettingUrlForMavenProject;
- public static I18n unsupportedMavenCoordinateFormat;
- public static I18n errorCreatingUrlForMavenId;
- public static I18n errorGettingPomFileForMavenIdAtUrl;
- public static I18n pomFileIsInvalid;
- public static I18n pomFileContainsUnexpectedId;
- public static I18n errorCreatingXpathStatementsToEvaluatePom;
- public static I18n errorCreatingXpathParserToEvaluatePom;
- public static I18n errorReadingXmlDocumentToEvaluatePom;
- public static I18n errorClosingUrlStreamToPom;
+ public static I18n errorGettingUrlForMavenProject;
+ public static I18n unsupportedMavenCoordinateFormat;
+ public static I18n errorCreatingUrlForMavenId;
+ public static I18n errorGettingPomFileForMavenIdAtUrl;
+ public static I18n pomFileIsInvalid;
+ public static I18n pomFileContainsUnexpectedId;
+ public static I18n errorCreatingXpathStatementsToEvaluatePom;
+ public static I18n errorCreatingXpathParserToEvaluatePom;
+ public static I18n errorReadingXmlDocumentToEvaluatePom;
+ public static I18n errorClosingUrlStreamToPom;
- public static I18n unableToOpenSessiontoRepositoryWhenCreatingNode;
- public static I18n unableToFindWorkspaceWhenCreatingNode;
- public static I18n errorCreatingNode;
- public static I18n unableToOpenSessiontoRepositoryWhenReadingNode;
- public static I18n unableToFindWorkspaceWhenReadingNode;
- public static I18n errorReadingNode;
- public static I18n unableToOpenSessiontoRepositoryWhenWritingNode;
- public static I18n unableToFindWorkspaceWhenWritingNode;
- public static I18n errorWritingNode;
+ public static I18n unableToOpenSessiontoRepositoryWhenCreatingNode;
+ public static I18n unableToFindWorkspaceWhenCreatingNode;
+ public static I18n errorCreatingNode;
+ public static I18n unableToOpenSessiontoRepositoryWhenReadingNode;
+ public static I18n unableToFindWorkspaceWhenReadingNode;
+ public static I18n errorReadingNode;
+ public static I18n unableToOpenSessiontoRepositoryWhenWritingNode;
+ public static I18n unableToFindWorkspaceWhenWritingNode;
+ public static I18n errorWritingNode;
- public static I18n unableToWriteToClosedStream;
- public static I18n errorClosingTempFileStreamAfterWritingContent;
- public static I18n errorDeletingTempFileStreamAfterWritingContent;
+ public static I18n unableToWriteToClosedStream;
+ public static I18n errorClosingTempFileStreamAfterWritingContent;
+ public static I18n errorDeletingTempFileStreamAfterWritingContent;
- static {
- try {
- I18n.initialize(MavenI18n.class);
- } catch (final Exception err) {
- System.err.println(err);
- }
- }
+ static {
+ try {
+ I18n.initialize(MavenI18n.class);
+ } catch (final Exception err) {
+ System.err.println(err);
+ }
+ }
- public static Set<Locale> getLocalizationProblemLocales() {
- return I18n.getLocalizationProblemLocales(MavenI18n.class);
- }
+ public static Set<Locale> getLocalizationProblemLocales() {
+ return I18n.getLocalizationProblemLocales(MavenI18n.class);
+ }
- public static Set<String> getLocalizationProblems() {
- return I18n.getLocalizationProblems(MavenI18n.class);
- }
+ public static Set<String> getLocalizationProblems() {
+ return I18n.getLocalizationProblems(MavenI18n.class);
+ }
- public static Set<String> getLocalizationProblems( Locale locale ) {
- return I18n.getLocalizationProblems(MavenI18n.class, locale);
- }
+ public static Set<String> getLocalizationProblems( Locale locale ) {
+ return I18n.getLocalizationProblems(MavenI18n.class, locale);
+ }
}
Modified:
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenRepository.java
===================================================================
---
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenRepository.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenRepository.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -66,7 +66,6 @@
* {@link #getClassLoader(ClassLoader,MavenId...) class loader} by specifying the {@link
MavenId artifact identifiers} for the
* libraries used directly by your code. This class loader will add any libraries that
are required by those you supply.
* </p>
- * @author Randall Hauch
*/
public class MavenRepository implements ClassLoaderFactory {
@@ -86,16 +85,18 @@
/**
* Get a class loader that has as its classpath the JARs for the libraries identified
by the supplied IDs. This method always
* returns a class loader, even when none of the specified libraries {@link
#exists(MavenId) exist} in this repository.
+ *
* @param parent the parent class loader that will be consulted before any project
class loaders; may be null if the
- * {@link Thread#getContextClassLoader() current thread's context class loader}
or the class loader that loaded this class
- * should be used
+ * {@link Thread#getContextClassLoader() current thread's context class
loader} or the class loader that loaded this
+ * class should be used
* @param mavenIds the IDs of the libraries in this Maven repository
* @return the class loader
* @see #exists(MavenId)
* @see #exists(MavenId,MavenId...)
* @throws IllegalArgumentException if no Maven IDs are passed in or if any of the
IDs are null
*/
- public ClassLoader getClassLoader( ClassLoader parent, MavenId... mavenIds ) {
+ public ClassLoader getClassLoader( ClassLoader parent,
+ MavenId... mavenIds ) {
CheckArg.isNotEmpty(mavenIds, "mavenIds");
CheckArg.containsNoNulls(mavenIds, "mavenIds");
return this.classLoaders.getClassLoader(parent, mavenIds);
@@ -104,6 +105,7 @@
/**
* Get a class loader that has as its classpath the JARs for the libraries identified
by the supplied IDs. This method always
* returns a class loader, even when none of the specified libraries {@link
#exists(MavenId) exist} in this repository.
+ *
* @param coordinates the IDs of the libraries in this Maven repository
* @return the class loader
* @throws IllegalArgumentException if no coordinates are passed in or if any of the
coordinate references is null
@@ -115,14 +117,16 @@
/**
* Get a class loader that has as its classpath the JARs for the libraries identified
by the supplied IDs. This method always
* returns a class loader, even when none of the specified libraries {@link
#exists(MavenId) exist} in this repository.
+ *
* @param parent the parent class loader that will be consulted before any project
class loaders; may be null if the
- * {@link Thread#getContextClassLoader() current thread's context class loader}
or the class loader that loaded this class
- * should be used
+ * {@link Thread#getContextClassLoader() current thread's context class
loader} or the class loader that loaded this
+ * class should be used
* @param coordinates the IDs of the libraries in this Maven repository
* @return the class loader
* @throws IllegalArgumentException if no coordinates are passed in or if any of the
coordinate references is null
*/
- public ClassLoader getClassLoader( ClassLoader parent, String... coordinates ) {
+ public ClassLoader getClassLoader( ClassLoader parent,
+ String... coordinates ) {
CheckArg.isNotEmpty(coordinates, "coordinates");
CheckArg.containsNoNulls(coordinates, "coordinates");
MavenId[] mavenIds = new MavenId[coordinates.length];
@@ -135,6 +139,7 @@
/**
* Determine whether the identified library exists in this Maven repository.
+ *
* @param mavenId the ID of the library
* @return true if this repository contains the library, or false if it does not
exist (or the ID is null)
* @throws MavenRepositoryException if there is a problem connecting to or using the
Maven repository, as configured
@@ -148,13 +153,15 @@
/**
* Determine which of the identified libraries exist in this Maven repository.
+ *
* @param firstId the first ID of the library to check
* @param mavenIds the IDs of the libraries; any null IDs will be ignored
* @return the set of IDs for libraries that do exist in this repository; never null
* @throws MavenRepositoryException if there is a problem connecting to or using the
Maven repository, as configured
* @see #exists(MavenId)
*/
- public Set<MavenId> exists( MavenId firstId, MavenId... mavenIds ) throws
MavenRepositoryException {
+ public Set<MavenId> exists( MavenId firstId,
+ MavenId... mavenIds ) throws MavenRepositoryException {
if (mavenIds == null || mavenIds.length == 0) return Collections.emptySet();
// Find the set of MavenIds that are not null ...
@@ -184,6 +191,7 @@
* <p>
* This implementation downloads the POM file for the specified project to extract
the dependencies and exclusions.
* </p>
+ *
* @param mavenId the ID of the project; may not be null
* @return the list of dependencies
* @throws IllegalArgumentException if the MavenId reference is null
@@ -204,16 +212,19 @@
* <p>
* This implementation downloads the POM file for the specified project to extract
the dependencies and exclusions.
* </p>
+ *
* @param mavenId the ID of the Maven project for which the dependencies are to be
obtained
* @param pomStream the stream to the POM file
* @param allowedScopes the set of scopes that are to be allowed in the dependency
list; if null, the default scopes of
- * {@link MavenDependency.Scope#getRuntimeScopes()} are used
+ * {@link MavenDependency.Scope#getRuntimeScopes()} are used
* @return the list of dependencies; never null
* @throws IllegalArgumentException if the MavenId or InputStream references are
null
* @throws IOException if an error occurs reading the stream
* @throws MavenRepositoryException if there is a problem reading the POM file given
the supplied stream and MavenId
*/
- protected List<MavenDependency> getDependencies( MavenId mavenId, InputStream
pomStream, MavenDependency.Scope... allowedScopes ) throws IOException {
+ protected List<MavenDependency> getDependencies( MavenId mavenId,
+ InputStream pomStream,
+ MavenDependency.Scope...
allowedScopes ) throws IOException {
CheckArg.isNotNull(mavenId, "mavenId");
CheckArg.isNotNull(pomStream, "pomStream");
EnumSet<MavenDependency.Scope> includedScopes =
MavenDependency.Scope.getRuntimeScopes();
@@ -271,7 +282,9 @@
// Extract the Maven dependency ...
if (depGroupId == null || depArtifactId == null || depVersion == null) {
- this.logger.trace("Skipping dependency of {1} due to missing
groupId, artifactId or version: {2}", mavenId, dependencyNode);
+ this.logger.trace("Skipping dependency of {1} due to missing
groupId, artifactId or version: {2}",
+ mavenId,
+ dependencyNode);
continue; // not enough information, so skip
}
MavenDependency dependency = new MavenDependency(depGroupId,
depArtifactId, depVersion, depClassifier);
@@ -290,7 +303,9 @@
String excludedArtifactId =
(String)artifactIdExpression.evaluate(exclusionNode, XPathConstants.STRING);
if (excludedGroupId == null || excludedArtifactId == null) {
- this.logger.trace("Skipping exclusion in dependency of {1}
due to missing exclusion groupId or artifactId: {2} ", mavenId, exclusionNode);
+ this.logger.trace("Skipping exclusion in dependency of {1}
due to missing exclusion groupId or artifactId: {2} ",
+ mavenId,
+ exclusionNode);
continue; // not enough information, so skip
}
MavenId excludedId = new MavenId(excludedGroupId,
excludedArtifactId);
@@ -319,13 +334,16 @@
* Get the URL for the artifact with the specified type in the given Maven project.
The resulting URL can be used to
* {@link URL#openConnection() connect} to the repository to {@link
URLConnection#getInputStream() read} or
* {@link URLConnection#getOutputStream() write} the artifact's content.
+ *
* @param mavenId the ID of the Maven project; may not be null
* @param artifactType the type of artifact; may be null, but the URL will not be
able to be read or written to
* @param signatureType the type of signature; may be null if the signature file is
not desired
* @return the URL to this artifact; never null
* @throws MalformedURLException if the supplied information cannot be turned into a
valid URL
*/
- public URL getUrl( MavenId mavenId, ArtifactType artifactType, SignatureType
signatureType ) throws MalformedURLException {
+ public URL getUrl( MavenId mavenId,
+ ArtifactType artifactType,
+ SignatureType signatureType ) throws MalformedURLException {
return this.urlProvider.getUrl(mavenId, artifactType, signatureType, false);
}
@@ -333,21 +351,26 @@
* Get the URL for the artifact with the specified type in the given Maven project.
The resulting URL can be used to
* {@link URL#openConnection() connect} to the repository to {@link
URLConnection#getInputStream() read} or
* {@link URLConnection#getOutputStream() write} the artifact's content.
+ *
* @param mavenId the ID of the Maven project; may not be null
* @param artifactType the type of artifact; may be null, but the URL will not be
able to be read or written to
* @param signatureType the type of signature; may be null if the signature file is
not desired
* @param createIfRequired true if the node structure should be created if any part
of it does not exist; this always expects
- * that the path to the top of the repository tree exists.
+ * that the path to the top of the repository tree exists.
* @return the URL to this artifact; never null
* @throws MalformedURLException if the supplied information cannot be turned into a
valid URL
*/
- public URL getUrl( MavenId mavenId, ArtifactType artifactType, SignatureType
signatureType, boolean createIfRequired ) throws MalformedURLException {
+ public URL getUrl( MavenId mavenId,
+ ArtifactType artifactType,
+ SignatureType signatureType,
+ boolean createIfRequired ) throws MalformedURLException {
return this.urlProvider.getUrl(mavenId, artifactType, signatureType,
createIfRequired);
}
/**
* This method is called to signal this repository that the POM file for a project
has been updated. This method notifies the
* associated class loader of the change, which will adapt appropriately.
+ *
* @param mavenId
*/
protected void notifyUpdatedPom( MavenId mavenId ) {
Modified:
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenRepositoryException.java
===================================================================
---
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenRepositoryException.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenRepositoryException.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -25,7 +25,6 @@
/**
* An configuration or system failure exception.
- * @author Randall Hauch
*/
public class MavenRepositoryException extends RuntimeException {
@@ -45,7 +44,8 @@
* @param message
* @param cause
*/
- public MavenRepositoryException( String message, Throwable cause ) {
+ public MavenRepositoryException( String message,
+ Throwable cause ) {
super(message, cause);
}
Modified:
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenUrl.java
===================================================================
---
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenUrl.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenUrl.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -34,8 +34,6 @@
/**
* Wrapper for a URL that uses a format for referencing JCR nodes and content.
- *
- * @author Randall Hauch
*/
public class MavenUrl {
@@ -104,7 +102,9 @@
this.workspaceName = trimDelimiters(this.workspaceName, true, true);
}
- protected String trimDelimiters( String string, boolean removeLeading, boolean
removeTrailing ) {
+ protected String trimDelimiters( String string,
+ boolean removeLeading,
+ boolean removeTrailing ) {
if (string == null || string.length() == 0) return "";
if (removeLeading) string = string.replaceAll("^/+", "");
if (removeTrailing) string = string.replaceAll("/+$", "");
@@ -132,13 +132,14 @@
* Get a URL that corresponds to the information in this object.
*
* @param handler the URL stream handler that will be used to handle obtaining an
input stream or an output stream on the
- * resulting URL
+ * resulting URL
* @param encoder an encoder that will be used to escape any characters that are not
allowed in URLs; {@link UrlEncoder} will
- * be used if no encoder is specified
+ * be used if no encoder is specified
* @return the URL
* @throws MalformedURLException if the resulting URL would be malformed
*/
- public URL getUrl( URLStreamHandler handler, TextEncoder encoder ) throws
MalformedURLException {
+ public URL getUrl( URLStreamHandler handler,
+ TextEncoder encoder ) throws MalformedURLException {
if (encoder == null) {
encoder = new UrlEncoder().setSlashEncoded(false);
}
@@ -210,7 +211,8 @@
* @return the object representing the JCR information contained in the URL
* @see #parse(URL, TextDecoder)
*/
- public static MavenUrl parse( String url, TextDecoder decoder ) {
+ public static MavenUrl parse( String url,
+ TextDecoder decoder ) {
if (decoder == null) decoder = new UrlEncoder();
// This regular expression has the following groups:
// 1) //hostname:port
@@ -247,7 +249,8 @@
* @return the object representing the JCR information contained in the URL
* @see #parse(String,TextDecoder)
*/
- public static MavenUrl parse( URL url, TextDecoder decoder ) {
+ public static MavenUrl parse( URL url,
+ TextDecoder decoder ) {
if (url == null) return null;
return parse(url.toExternalForm(), decoder);
}
Modified:
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/SignatureType.java
===================================================================
---
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/SignatureType.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/SignatureType.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,7 +24,7 @@
package org.jboss.dna.maven;
/**
- * @author Randall Hauch
+ * The type of signatures used by a Maven 2 repository.
*/
public enum SignatureType {
MD5(".md5"),
Copied:
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/package-info.java
(from rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavadocMetadata.java)
===================================================================
---
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/package-info.java
(rev 0)
+++
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The classes that make up the Maven classloader system.
+ */
+
+package org.jboss.dna.maven;
+
Modified:
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/spi/AbstractMavenUrlProvider.java
===================================================================
---
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/spi/AbstractMavenUrlProvider.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/spi/AbstractMavenUrlProvider.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -27,7 +27,7 @@
import org.jboss.dna.common.collection.UnmodifiableProperties;
/**
- * @author Randall Hauch
+ * An abstract URL provider for Maven 2 repositories.
*/
public abstract class AbstractMavenUrlProvider implements MavenUrlProvider {
@@ -45,6 +45,7 @@
/**
* Get the properties for this provider.
+ *
* @return the properties
*/
public Properties getProperties() {
Modified:
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/spi/JcrMavenUrlProvider.java
===================================================================
---
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/spi/JcrMavenUrlProvider.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/spi/JcrMavenUrlProvider.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -82,8 +82,6 @@
* }
* }
* </pre>
- *
- * @author Randall Hauch
*/
public class JcrMavenUrlProvider extends AbstractMavenUrlProvider {
@@ -349,9 +347,8 @@
}
/**
- * Obtain an input stream to the existing content at the location given by the
supplied {@link MavenUrl}. The Maven URL
- * should have a path that points to the node where the content is stored in the
- * {@link #CONTENT_PROPERTY_NAME content property}.
+ * Obtain an input stream to the existing content at the location given by the
supplied {@link MavenUrl}. The Maven URL should
+ * have a path that points to the node where the content is stored in the {@link
#CONTENT_PROPERTY_NAME content property}.
*
* @param mavenUrl the Maven URL to the content; may not be null
* @return the input stream to the content, or null if there is no existing content
@@ -589,8 +586,8 @@
/**
* A URLConnection with support for obtaining content from a node in a JCR
repository.
* <p>
- * Each JcrUrlConnection is used to make a single request to read or write the
<code>jcr:content</code> property value on
- * the {@link javax.jcr.Node node} that corresponds to the given URL. The node must
already exist.
+ * Each JcrUrlConnection is used to make a single request to read or write the
<code>jcr:content</code> property value on the
+ * {@link javax.jcr.Node node} that corresponds to the given URL. The node must
already exist.
* </p>
*
* @author Randall Hauch
Modified:
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/spi/MavenUrlProvider.java
===================================================================
---
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/spi/MavenUrlProvider.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/spi/MavenUrlProvider.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -34,7 +34,7 @@
import org.jboss.dna.maven.SignatureType;
/**
- * @author Randall Hauch
+ * The definition of a URL provider for Maven 2 repositories.
*/
public interface MavenUrlProvider {
@@ -42,6 +42,7 @@
* Configure this provider given the configuration properties. This method is
intended to be called by the
* {@link MavenRepository} that instantiates this provider, and only once immediately
after instantiation and before any calls
* to {@link #getUrl(MavenId, ArtifactType, SignatureType, boolean)}.
+ *
* @param properties the configuration properties
* @throws MavenRepositoryException if there is a problem connecting to or using the
Maven repository, as configured
*/
@@ -51,15 +52,19 @@
* Get the URL for the artifact with the specified type in the given Maven project.
The resulting URL can be used to
* {@link URL#openConnection() connect} to the repository to {@link
URLConnection#getInputStream() read} or
* {@link URLConnection#getOutputStream() write} the artifact's content.
+ *
* @param mavenId the ID of the Maven project; may not be null
* @param artifactType the type of artifact; may be null, but the URL will not be
able to be read or written to
* @param signatureType the type of signature; may be null if the signature file is
not desired
* @param createIfRequired true if the node structure should be created if any part
of it does not exist; this always expects
- * that the path to the top of the repository tree exists.
+ * that the path to the top of the repository tree exists.
* @return the URL to this artifact, or null if the artifact does not exist
* @throws MalformedURLException if the supplied information cannot be turned into a
valid URL
* @throws MavenRepositoryException if there is a problem connecting to or using the
Maven repository, as configured
*/
- public URL getUrl( MavenId mavenId, ArtifactType artifactType, SignatureType
signatureType, boolean createIfRequired ) throws MalformedURLException,
MavenRepositoryException;
+ public URL getUrl( MavenId mavenId,
+ ArtifactType artifactType,
+ SignatureType signatureType,
+ boolean createIfRequired ) throws MalformedURLException,
MavenRepositoryException;
}
Copied:
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/spi/package-info.java
(from rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavadocMetadata.java)
===================================================================
---
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/spi/package-info.java
(rev 0)
+++
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/spi/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The classes that define the SPI for the Maven classloader system.
+ */
+
+package org.jboss.dna.maven.spi;
+
Modified:
trunk/extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/JdbcMetadataI18n.java
===================================================================
---
trunk/extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/JdbcMetadataI18n.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/JdbcMetadataI18n.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,7 +28,7 @@
import org.jboss.dna.common.i18n.I18n;
/**
- * <a href="mailto:litsenko_sergey@yahoo.com">Sergiy Litsenko</a>
+ * The internationalized string constants for the
<code>org.jboss.dna.common.jdbc*</code> packages.
*/
public final class JdbcMetadataI18n {
public static I18n databaseConnectionHasBeenReleased;
Deleted: trunk/extensions/dna-connector-federation/.classpath
===================================================================
--- trunk/extensions/dna-connector-federation/.classpath 2009-09-12 17:43:41 UTC (rev
1217)
+++ trunk/extensions/dna-connector-federation/.classpath 2009-09-12 17:55:25 UTC (rev
1218)
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="src" path="src/main/resources"/>
- <classpathentry kind="src" output="target/test-classes"
path="src/test/java"/>
- <classpathentry kind="src" output="target/test-classes"
path="src/test/resources"/>
- <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con"
path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
Deleted: trunk/extensions/dna-connector-federation/.project
===================================================================
--- trunk/extensions/dna-connector-federation/.project 2009-09-12 17:43:41 UTC (rev 1217)
+++ trunk/extensions/dna-connector-federation/.project 2009-09-12 17:55:25 UTC (rev 1218)
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>dna-connector-federation</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.maven.ide.eclipse.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.maven.ide.eclipse.maven2Nature</nature>
- </natures>
-</projectDescription>
Deleted: trunk/extensions/dna-connector-federation/pom.xml
===================================================================
--- trunk/extensions/dna-connector-federation/pom.xml 2009-09-12 17:43:41 UTC (rev 1217)
+++ trunk/extensions/dna-connector-federation/pom.xml 2009-09-12 17:55:25 UTC (rev 1218)
@@ -1,89 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.jboss.dna</groupId>
- <artifactId>dna</artifactId>
- <version>0.6-SNAPSHOT</version>
- <relativePath>../..</relativePath>
- </parent>
- <!-- The groupId and version values are inherited from parent -->
- <artifactId>dna-connector-federation</artifactId>
- <packaging>jar</packaging>
- <name>JBoss DNA Federation Connector</name>
- <description>JBoss DNA Connector that federates content from multiple
connectors.</description>
- <
url>http://labs.jboss.org/dna</url>
-
- <!--
- Define the dependencies. Note that all version and scopes default to those
- defined in the dependencyManagement section of the parent pom.
- -->
- <dependencies>
- <!--
- Common
- -->
- <dependency>
- <groupId>org.jboss.dna</groupId>
- <artifactId>dna-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.dna</groupId>
- <artifactId>dna-graph</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.dna</groupId>
- <artifactId>dna-common</artifactId>
- <version>${pom.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.dna</groupId>
- <artifactId>dna-graph</artifactId>
- <version>${pom.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <!--
- Testing (note the scope)
- -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- </dependency>
- <!--
- Logging (require SLF4J API for compiling, but use Log4J and its SLF4J binding for
testing)
- -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </dependency>
- <!--
- Java Concurrency in Practice annotations
- -->
- <dependency>
- <groupId>net.jcip</groupId>
- <artifactId>jcip-annotations</artifactId>
- </dependency>
- </dependencies>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-report-plugin</artifactId>
- </plugin>
- </plugins>
- </reporting>
-</project>
\ No newline at end of file
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedLexicon.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedLexicon.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedLexicon.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,42 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation;
-
-import org.jboss.dna.graph.DnaLexicon;
-import org.jboss.dna.graph.property.Name;
-import org.jboss.dna.graph.property.basic.BasicName;
-
-/**
- * @author Randall Hauch
- */
-public class FederatedLexicon extends DnaLexicon {
-
- public static final Name WORKSPACES = new BasicName(Namespace.URI,
"workspaces");
- public static final Name CACHE = new BasicName(Namespace.URI, "cache");
- public static final Name PROJECTION = new BasicName(Namespace.URI,
"projection");
- public static final Name PROJECTIONS = new BasicName(Namespace.URI,
"projections");
- public static final Name SOURCE_NAME = new BasicName(Namespace.URI,
"sourceName");
- public static final Name WORKSPACE_NAME = new BasicName(Namespace.URI,
"workspaceName");
- public static final Name DEFAULT_WORKSPACE_NAME = new BasicName(Namespace.URI,
"defaultWorkspaceName");
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepository.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepository.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepository.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,220 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import net.jcip.annotations.ThreadSafe;
-import org.jboss.dna.common.util.CheckArg;
-import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.connector.RepositoryConnection;
-import org.jboss.dna.graph.connector.RepositoryConnectionFactory;
-import org.jboss.dna.graph.connector.RepositorySource;
-import org.jboss.dna.graph.request.processor.RequestProcessor;
-
-/**
- * The component that represents a single federated repository. The federated repository
uses a set of {@link RepositorySource
- * federated connectionFactory} as designated by name through the {@link
#getWorkspaceConfigurations() configurations}, and
- * provides the logic of interacting with those connectionFactory and presenting a single
unified graph.
- *
- * @author Randall Hauch
- */
-@ThreadSafe
-public class FederatedRepository {
-
- private final String name;
- private final ExecutionContext context;
- private final RepositoryConnectionFactory connectionFactory;
- private final Map<String, FederatedWorkspace> workspaceConfigsByName;
- private final FederatedWorkspace defaultWorkspace;
- private final AtomicInteger openExecutors = new AtomicInteger(0);
- private final CountDownLatch shutdownLatch = new CountDownLatch(1);
- private final AtomicBoolean shutdownRequested = new AtomicBoolean(false);
-
- /**
- * Create a federated repository instance.
- *
- * @param repositoryName the name of the repository
- * @param context the execution context
- * @param connectionFactory the factory for {@link RepositoryConnection} instances
that should be used
- * @param workspaces the workspace configurations for this repository, with the
default workspace being first; may not be null
- * @throws IllegalArgumentException if any of the parameters are null, or if the name
is blank
- */
- public FederatedRepository( String repositoryName,
- ExecutionContext context,
- RepositoryConnectionFactory connectionFactory,
- Iterable<FederatedWorkspace> workspaces ) {
- CheckArg.isNotEmpty(repositoryName, "repositoryName");
- CheckArg.isNotNull(connectionFactory, "connectionFactory");
- CheckArg.isNotNull(context, "context");
- CheckArg.isNotNull(workspaces, "workspaces");
- this.name = repositoryName;
- this.context = context;
- this.connectionFactory = connectionFactory;
- FederatedWorkspace defaultWorkspace = null;
- Map<String, FederatedWorkspace> configsByName = new HashMap<String,
FederatedWorkspace>();
- for (FederatedWorkspace workspace : workspaces) {
- if (defaultWorkspace == null) defaultWorkspace = workspace;
- configsByName.put(workspace.getName(), workspace);
- }
- this.workspaceConfigsByName = Collections.unmodifiableMap(configsByName);
- this.defaultWorkspace = defaultWorkspace;
- }
-
- /**
- * Get the name of this repository
- *
- * @return name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @return the execution context
- */
- public ExecutionContext getExecutionContext() {
- return context;
- }
-
- /**
- * @return the connectionFactory
- */
- protected RepositoryConnectionFactory getConnectionFactory() {
- return connectionFactory;
- }
-
- /**
- * Utility method called by the administrator.
- */
- public synchronized void start() {
- // Do not establish connections to the connectionFactory; these will be
established as needed
- }
-
- /**
- * Return true if this federated repository is running and ready for connections.
- *
- * @return true if running, or false otherwise
- */
- public boolean isRunning() {
- return this.shutdownRequested.get() != true;
- }
-
- /**
- * Utility method called by the administrator.
- */
- public synchronized void shutdown() {
- this.shutdownRequested.set(true);
- if (this.openExecutors.get() <= 0) shutdownLatch.countDown();
- }
-
- /**
- * Utility method called by the administrator.
- *
- * @param timeout
- * @param unit
- * @return true if all connections open at the time this method is called were {@link
RepositoryConnection#close() closed} in
- * the supplied time, or false if the timeout occurred before all the
connections were closed
- * @throws InterruptedException
- */
- public boolean awaitTermination( long timeout,
- TimeUnit unit ) throws InterruptedException {
- // Await until all connections have been closed, or until the timeout occurs
- return shutdownLatch.await(timeout, unit);
- }
-
- /**
- * Return true if this federated repository has completed its termination and no
longer has any open connections.
- *
- * @return true if terminated, or false otherwise
- */
- public boolean isTerminated() {
- return this.openExecutors.get() != 0;
- }
-
- /**
- * Authenticate the supplied username with the supplied credentials, and return
whether authentication was successful.
- *
- * @param source the {@link RepositorySource} that should be affiliated with the
resulting connection
- * @param username the username
- * @param credentials the credentials
- * @return the repository connection if authentication succeeded, or null otherwise
- */
- public RepositoryConnection createConnection( RepositorySource source,
- String username,
- Object credentials ) {
- return new FederatedRepositoryConnection(this, source.getName());
- }
-
- /**
- * Get the configuration of this repository's workspaces. This set of
configurations (as well as each configuration) is
- * immutable. Therefore, when using a configuration and needing a consistent
configuration, maintain a reference to the
- * configuration during that time (as the actual configuration may be replaced at any
time).
- *
- * @return the repository's worksapce configuration at the time this method is
called.
- */
- public Map<String, FederatedWorkspace> getWorkspaceConfigurations() {
- return workspaceConfigsByName;
- }
-
- /**
- * Called by {@link FederatedRepositoryConnection#execute(ExecutionContext,
org.jboss.dna.graph.request.Request)}.
- *
- * @param context the execution context in which the executor will be run; may not be
null
- * @param sourceName the name of the {@link RepositorySource} that is making use of
this executor; may not be null or empty
- * @return the executor
- */
- protected RequestProcessor getProcessor( ExecutionContext context,
- String sourceName ) {
- Map<String, FederatedWorkspace> workspaces =
this.getWorkspaceConfigurations();
- return new FederatingRequestProcessor(context, sourceName, workspaces,
defaultWorkspace, getConnectionFactory());
- }
-
- /**
- * Called by {@link
FederatedRepositoryConnection#FederatedRepositoryConnection(FederatedRepository,
String)}.
- *
- * @param connection the connection being opened
- */
- /*package*/void register( FederatedRepositoryConnection connection ) {
- openExecutors.incrementAndGet();
- }
-
- /**
- * Called by {@link FederatedRepositoryConnection#close()}.
- *
- * @param connection the connection being closed
- */
- /*package*/void unregister( FederatedRepositoryConnection connection ) {
- if (openExecutors.decrementAndGet() <= 0 && shutdownRequested.get())
{
- // Last connection, so turn out the lights ...
- shutdownLatch.countDown();
- }
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepositoryConnection.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepositoryConnection.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepositoryConnection.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,118 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation;
-
-import java.util.concurrent.TimeUnit;
-import javax.transaction.xa.XAResource;
-import net.jcip.annotations.ThreadSafe;
-import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.cache.CachePolicy;
-import org.jboss.dna.graph.connector.RepositoryConnection;
-import org.jboss.dna.graph.connector.RepositorySourceException;
-import org.jboss.dna.graph.request.Request;
-import org.jboss.dna.graph.request.processor.RequestProcessor;
-
-/**
- * @author Randall Hauch
- */
-@ThreadSafe
-public class FederatedRepositoryConnection implements RepositoryConnection {
-
- private final FederatedRepository repository;
- private final String sourceName;
-
- protected FederatedRepositoryConnection( FederatedRepository repository,
- String sourceName ) {
- assert sourceName != null;
- assert repository != null;
- this.sourceName = sourceName;
- this.repository = repository;
- this.repository.register(this);
- }
-
- /**
- * @return repository
- */
- protected FederatedRepository getRepository() {
- return this.repository;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getSourceName() {
- return this.sourceName;
- }
-
- /**
- * {@inheritDoc}
- */
- public CachePolicy getDefaultCachePolicy() {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public XAResource getXAResource() {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean ping( long time,
- TimeUnit unit ) {
- return this.repository.isRunning();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.graph.connector.RepositoryConnection#execute(org.jboss.dna.graph.ExecutionContext,
- * org.jboss.dna.graph.request.Request)
- */
- public void execute( ExecutionContext context,
- Request request ) throws RepositorySourceException {
- if (!this.repository.isRunning()) {
- throw new
RepositorySourceException(FederationI18n.repositoryHasBeenShutDown.text(this.repository.getName()));
- }
- if (request == null) return;
-
- RequestProcessor processor = this.repository.getProcessor(context, sourceName);
- assert processor != null;
- try {
- processor.process(request);
- } finally {
- processor.close();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void close() {
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepositorySource.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepositorySource.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepositorySource.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,799 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation;
-
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-import javax.naming.Context;
-import javax.naming.RefAddr;
-import javax.naming.Reference;
-import javax.naming.StringRefAddr;
-import javax.naming.spi.ObjectFactory;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.NameCallback;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.login.LoginException;
-import net.jcip.annotations.ThreadSafe;
-import org.jboss.dna.common.collection.Problems;
-import org.jboss.dna.common.collection.SimpleProblems;
-import org.jboss.dna.common.i18n.I18n;
-import org.jboss.dna.common.util.CheckArg;
-import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.Graph;
-import org.jboss.dna.graph.JaasSecurityContext;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.Node;
-import org.jboss.dna.graph.Subgraph;
-import org.jboss.dna.graph.SubgraphNode;
-import org.jboss.dna.graph.cache.BasicCachePolicy;
-import org.jboss.dna.graph.cache.CachePolicy;
-import org.jboss.dna.graph.connector.RepositoryConnection;
-import org.jboss.dna.graph.connector.RepositoryConnectionFactory;
-import org.jboss.dna.graph.connector.RepositoryContext;
-import org.jboss.dna.graph.connector.RepositorySource;
-import org.jboss.dna.graph.connector.RepositorySourceCapabilities;
-import org.jboss.dna.graph.connector.RepositorySourceException;
-import org.jboss.dna.graph.property.Path;
-import org.jboss.dna.graph.property.Property;
-import org.jboss.dna.graph.property.ValueFactories;
-import org.jboss.dna.graph.property.ValueFactory;
-
-/**
- * @author Randall Hauch
- */
-@ThreadSafe
-public class FederatedRepositorySource implements RepositorySource, ObjectFactory {
-
- /**
- */
- private static final long serialVersionUID = 7587346948013486977L;
-
- /**
- * The default limit is {@value} for retrying {@link RepositoryConnection connection}
calls to the underlying source.
- */
- public static final int DEFAULT_RETRY_LIMIT = 0;
-
- public static final String DEFAULT_CONFIGURATION_SOURCE_PATH = "/";
-
- protected static final RepositorySourceCapabilities CAPABILITIES = new
RepositorySourceCapabilities(true, true);
-
- protected static final String REPOSITORY_NAME = "repositoryName";
- protected static final String SOURCE_NAME = "sourceName";
- protected static final String USERNAME = "username";
- protected static final String PASSWORD = "password";
- protected static final String CONFIGURATION_SOURCE_NAME =
"configurationSourceName";
- protected static final String CONFIGURATION_SOURCE_PATH =
"configurationSourcePath";
- protected static final String SECURITY_DOMAIN = "securityDomain";
- protected static final String RETRY_LIMIT = "retryLimit";
-
- private String repositoryName;
- private String sourceName;
- private String username;
- private String password;
- private String configurationSourceName;
- private String configurationWorkspaceName;
- private String configurationSourcePath = DEFAULT_CONFIGURATION_SOURCE_PATH;
- private String securityDomain;
- private final AtomicInteger retryLimit = new AtomicInteger(DEFAULT_RETRY_LIMIT);
- private transient FederatedRepository repository;
- private transient RepositoryContext repositoryContext;
-
- /**
- * Create a new instance of the source, which must still be properly initialized with
a {@link #setRepositoryName(String)
- * repository name}.
- */
- public FederatedRepositorySource() {
- super();
- }
-
- /**
- * Create a new instance of the source with the required repository name and
federation service.
- *
- * @param repositoryName the repository name
- * @throws IllegalArgumentException if the federation service is null or the
repository name is null or blank
- */
- public FederatedRepositorySource( String repositoryName ) {
- super();
- CheckArg.isNotNull(repositoryName, "repositoryName");
- this.repositoryName = repositoryName;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.graph.connector.RepositorySource#initialize(org.jboss.dna.graph.connector.RepositoryContext)
- */
- public void initialize( RepositoryContext context ) throws RepositorySourceException
{
- this.repositoryContext = context;
- }
-
- /**
- * @return repositoryContext
- */
- public RepositoryContext getRepositoryContext() {
- return repositoryContext;
- }
-
- /**
- * {@inheritDoc}
- */
- public synchronized String getName() {
- return sourceName;
- }
-
- /**
- * Set the name of this source.
- * <p>
- * This is a required property.
- * </p>
- *
- * @param sourceName the name of this repository source
- * @see #setConfigurationSourceName(String)
- * @see #setConfigurationSourcePath(String)
- * @see #setPassword(String)
- * @see #setUsername(String)
- * @see #setRepositoryName(String)
- * @see #setPassword(String)
- * @see #setUsername(String)
- * @see #setName(String)
- */
- public synchronized void setName( String sourceName ) {
- if (this.sourceName == sourceName || this.sourceName != null &&
this.sourceName.equals(sourceName)) return; // unchanged
- this.sourceName = sourceName;
- changeRepositoryConfig();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.graph.connector.RepositorySource#getRetryLimit()
- */
- public int getRetryLimit() {
- return retryLimit.get();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.graph.connector.RepositorySource#setRetryLimit(int)
- */
- public void setRetryLimit( int limit ) {
- retryLimit.set(limit < 0 ? 0 : limit);
- }
-
- /**
- * Get the name in JNDI of a {@link RepositorySource} instance that should be used by
the {@link FederatedRepository federated
- * repository} as the configuration repository.
- * <p>
- * This is a required property.
- * </p>
- *
- * @return the JNDI name of the {@link RepositorySource} instance that should be used
for the configuration, or null if the
- * federated repository instance is to be found in JNDI
- * @see #setConfigurationSourceName(String)
- */
- public String getConfigurationSourceName() {
- return configurationSourceName;
- }
-
- /**
- * Get the name of a {@link RepositorySource} instance that should be used by the
{@link FederatedRepository federated
- * repository} as the configuration repository. The instance will be retrieved from
the {@link RepositoryConnectionFactory}
- * instance from the {@link RepositoryContext#getRepositoryConnectionFactory()
repository context} supplied during
- * {@link RepositorySource#initialize(RepositoryContext) initialization}.
- * <p>
- * This is a required property.
- * </p>
- *
- * @param sourceName the name of the {@link RepositorySource} instance that should be
used for the configuration, or null if
- * the federated repository instance is to be found in JNDI
- * @see #getConfigurationSourceName()
- * @see #setConfigurationSourcePath(String)
- * @see #setPassword(String)
- * @see #setUsername(String)
- * @see #setRepositoryName(String)
- * @see #setName(String)
- */
- public void setConfigurationSourceName( String sourceName ) {
- if (this.configurationSourceName == sourceName || this.configurationSourceName !=
null
- && this.configurationSourceName.equals(sourceName)) return; //
unchanged
- this.configurationSourceName = sourceName;
- changeRepositoryConfig();
- }
-
- /**
- * Set the name of the workspace in the {@link #getConfigurationSourceName() source}
used by the {@link FederatedRepository
- * federated repository} as the configuration repository. If this workspace name is
null, the default workspace as defined by
- * that source will be used.
- *
- * @return the name of the configuration workspace, or null if the default workspace
for the
- * {@link #getConfigurationSourceName() configuration source} should be used
- */
- public String getConfigurationWorkspaceName() {
- return configurationWorkspaceName;
- }
-
- /**
- * Set the name of the workspace in the {@link #getConfigurationSourceName() source}
used by the {@link FederatedRepository
- * federated repository} as the configuration repository. If this workspace name is
null, the default workspace as defined by
- * that source will be used.
- *
- * @param workspaceName the name of the configuration workspace, or null if the
default workspace for the
- * {@link #getConfigurationSourceName() configuration source} should be used
- */
- public void setConfigurationWorkspaceName( String workspaceName ) {
- if (this.configurationWorkspaceName == workspaceName ||
this.configurationWorkspaceName != null
- && this.configurationWorkspaceName.equals(workspaceName)) return; //
unchanged
- this.configurationWorkspaceName = workspaceName;
- changeRepositoryConfig();
- }
-
- /**
- * Get the path in the source that will be subgraph below the
<code>/dna:system</code> branch of the repository.
- * <p>
- * This is a required property.
- * </p>
- *
- * @return the string array of projection rules, or null if the projection rules
haven't yet been set or if the federated
- * repository instance is to be found in JNDI
- * @see #setConfigurationSourcePath(String)
- */
- public String getConfigurationSourcePath() {
- return configurationSourcePath;
- }
-
- /**
- * Set the path in the source that will be subgraph below the
<code>/dna:system</code> branch of the repository.
- * <p>
- * This is a required property.
- * </p>
- *
- * @param pathInSourceToConfigurationRoot the path within the configuration source to
the node that should be the root of the
- * configuration information, or null if the path hasn't yet been set or
if the federated repository instance is to be
- * found in JNDI
- * @see #setConfigurationSourcePath(String)
- * @see #setConfigurationSourceName(String)
- * @see #setPassword(String)
- * @see #setUsername(String)
- * @see #setRepositoryName(String)
- * @see #setName(String)
- */
- public void setConfigurationSourcePath( String pathInSourceToConfigurationRoot ) {
- if (this.configurationSourcePath == pathInSourceToConfigurationRoot ||
this.configurationSourcePath != null
- &&
this.configurationSourcePath.equals(pathInSourceToConfigurationRoot)) return;
- String path = pathInSourceToConfigurationRoot != null ?
pathInSourceToConfigurationRoot : DEFAULT_CONFIGURATION_SOURCE_PATH;
- // Ensure one leading slash and one trailing slashes ...
- this.configurationSourcePath = path = ("/" +
path).replaceAll("^/+", "/").replaceAll("/+$", "")
+ "/";
- changeRepositoryConfig();
- }
-
- /**
- * Get the name of the security domain that should be used by JAAS to identify the
application or security context. This
- * should correspond to the JAAS login configuration located within the JAAS login
configuration file.
- *
- * @return securityDomain
- */
- public String getSecurityDomain() {
- return securityDomain;
- }
-
- /**
- * Set the name of the security domain that should be used by JAAS to identify the
application or security context. This
- * should correspond to the JAAS login configuration located within the JAAS login
configuration file.
- *
- * @param securityDomain Sets securityDomain to the specified value.
- */
- public void setSecurityDomain( String securityDomain ) {
- if (this.securityDomain != null &&
this.securityDomain.equals(securityDomain)) return; // unchanged
- this.securityDomain = securityDomain;
- changeRepositoryConfig();
- }
-
- /**
- * Get the name of the federated repository.
- * <p>
- * This is a required property.
- * </p>
- *
- * @return the name of the repository
- * @see #setRepositoryName(String)
- */
- public synchronized String getRepositoryName() {
- return this.repositoryName;
- }
-
- /**
- * Get the name of the federated repository.
- * <p>
- * This is a required property.
- * </p>
- *
- * @param repositoryName the new name of the repository
- * @throws IllegalArgumentException if the repository name is null, empty or blank
- * @see #getRepositoryName()
- * @see #setConfigurationSourceName(String)
- * @see #setConfigurationSourcePath(String)
- * @see #setPassword(String)
- * @see #setUsername(String)
- * @see #setName(String)
- */
- public synchronized void setRepositoryName( String repositoryName ) {
- CheckArg.isNotEmpty(repositoryName, "repositoryName");
- if (this.repositoryName != null &&
this.repositoryName.equals(repositoryName)) return; // unchanged
- this.repositoryName = repositoryName;
- changeRepositoryConfig();
- }
-
- /**
- * Get the username that should be used when authenticating and {@link
#getConnection() creating connections}.
- * <p>
- * This is an optional property, required only when authentication is to be used.
- * </p>
- *
- * @return the username, or null if no username has been set or are not to be used
- * @see #setUsername(String)
- */
- public String getUsername() {
- return this.username;
- }
-
- /**
- * Set the username that should be used when authenticating and {@link
#getConnection() creating connections}.
- * <p>
- * This is an optional property, required only when authentication is to be used.
- * </p>
- *
- * @param username the username, or null if no username has been set or are not to be
used
- * @see #getUsername()
- * @see #setPassword(String)
- * @see #setConfigurationSourceName(String)
- * @see #setConfigurationSourcePath(String)
- * @see #setPassword(String)
- * @see #setRepositoryName(String)
- * @see #setName(String)
- */
- public void setUsername( String username ) {
- if (this.username != null && this.username.equals(username)) return; //
unchanged
- this.username = username;
- changeRepositoryConfig();
- }
-
- /**
- * Get the password that should be used when authenticating and {@link
#getConnection() creating connections}.
- * <p>
- * This is an optional property, required only when authentication is to be used.
- * </p>
- *
- * @return the password, or null if no password have been set or are not to be used
- * @see #setPassword(String)
- */
- public String getPassword() {
- return this.password;
- }
-
- /**
- * Get the password that should be used when authenticating and {@link
#getConnection() creating connections}.
- * <p>
- * This is an optional property, required only when authentication is to be used.
- * </p>
- *
- * @param password the password, or null if no password have been set or are not to
be used
- * @see #getPassword()
- * @see #setConfigurationSourceName(String)
- * @see #setConfigurationSourcePath(String)
- * @see #setUsername(String)
- * @see #setRepositoryName(String)
- * @see #setName(String)
- */
- public void setPassword( String password ) {
- if (this.password != null && this.password.equals(password)) return; //
unchanged
- this.password = password;
- changeRepositoryConfig();
- }
-
- /**
- * This method is called to signal that some aspect of the configuration has changed.
If a {@link #getRepository() repository}
- * instance has been created, it's configuration is
- * {@link #getWorkspaceConfigurations(ExecutionContext, RepositoryConnectionFactory)
rebuilt} and updated. Nothing is done,
- * however, if there is currently no {@link #getRepository() repository}.
- */
- protected synchronized void changeRepositoryConfig() {
- if (this.repository != null) {
- RepositoryContext repositoryContext = getRepositoryContext();
- if (repositoryContext != null) {
- this.repository = getRepository();
- }
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.graph.connector.RepositorySource#getConnection()
- */
- public RepositoryConnection getConnection() throws RepositorySourceException {
- if (getName() == null) {
- I18n msg = FederationI18n.propertyIsRequired;
- throw new RepositorySourceException(getName(), msg.text("name"));
- }
- if (getRepositoryContext() == null) {
- I18n msg = FederationI18n.propertyIsRequired;
- throw new RepositorySourceException(getName(), msg.text("repository
context"));
- }
- if (getUsername() != null && getSecurityDomain() == null) {
- I18n msg = FederationI18n.propertyIsRequired;
- throw new RepositorySourceException(getName(), msg.text("security
domain"));
- }
- // Find the repository ...
- FederatedRepository repository = getRepository();
- // Authenticate the user ...
- String username = this.username;
- Object credentials = this.password;
- RepositoryConnection connection = repository.createConnection(this, username,
credentials);
- if (connection == null) {
- I18n msg =
FederationI18n.unableToAuthenticateConnectionToFederatedRepository;
- throw new RepositorySourceException(msg.text(this.repositoryName,
username));
- }
- // Return the new connection ...
- return connection;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.graph.connector.RepositorySource#close()
- */
- public void close() {
- // do nothing ...
- }
-
- /**
- * Get the {@link FederatedRepository} instance that this source is using. This
method uses the following logic:
- * <ol>
- * <li>If a {@link FederatedRepository} already was obtained from a prior call,
the same instance is returned.</li>
- * <li>A {@link FederatedRepository} is created using a {@link
FederatedWorkspace} is created from this instance's properties
- * and {@link ExecutionContext} and {@link RepositoryConnectionFactory} instances
obtained from JNDI.</li>
- * <li></li>
- * <li></li>
- * </ol>
- *
- * @return the federated repository instance
- * @throws RepositorySourceException
- */
- protected synchronized FederatedRepository getRepository() throws
RepositorySourceException {
- if (repository == null) {
- ExecutionContext context = getExecutionContext();
- RepositoryConnectionFactory connectionFactory =
getRepositoryContext().getRepositoryConnectionFactory();
- // And create the configuration and the repository ...
- List<FederatedWorkspace> configs = getWorkspaceConfigurations(context,
connectionFactory);
- repository = new FederatedRepository(repositoryName, context,
connectionFactory, configs);
- }
- return repository;
- }
-
- protected ExecutionContext getExecutionContext() {
- ExecutionContext factory = getRepositoryContext().getExecutionContext();
- CallbackHandler handler = createCallbackHandler();
- try {
- String securityDomain = getSecurityDomain();
- if (securityDomain != null || getUsername() != null) {
- return factory.with(new JaasSecurityContext(securityDomain, handler));
- }
- return factory;
- } catch (LoginException e) {
- I18n msg = FederationI18n.unableToCreateExecutionContext;
- throw new RepositorySourceException(getName(), msg.text(this.sourceName,
securityDomain), e);
- }
- }
-
- protected CallbackHandler createCallbackHandler() {
- return new CallbackHandler() {
- public void handle( Callback[] callbacks ) {
- for (Callback callback : callbacks) {
- if (callback instanceof NameCallback) {
- NameCallback nameCallback = (NameCallback)callback;
-
nameCallback.setName(FederatedRepositorySource.this.getUsername());
- }
- if (callback instanceof PasswordCallback) {
- PasswordCallback passwordCallback = (PasswordCallback)callback;
-
passwordCallback.setPassword(FederatedRepositorySource.this.getPassword().toCharArray());
- }
- }
- }
- };
- }
-
- /**
- * Create a {@link FederatedWorkspace} instances from the current properties of this
instance. This method does <i>not</i>
- * modify the state of this instance.
- *
- * @param context the execution context that should be used to read the
configuration; may not be null
- * @param connectionFactory the factory for {@link RepositoryConnection}s can be
obtained; may not be null
- * @return the collection of configurations reflecting the workspaces as currently
defined, order such that the default
- * workspace is first; never null
- */
- protected synchronized List<FederatedWorkspace> getWorkspaceConfigurations(
ExecutionContext context,
-
RepositoryConnectionFactory connectionFactory ) {
- Problems problems = new SimpleProblems();
- ValueFactories valueFactories = context.getValueFactories();
- ValueFactory<String> strings = valueFactories.getStringFactory();
- ValueFactory<Long> longs = valueFactories.getLongFactory();
- ProjectionParser projectionParser = ProjectionParser.getInstance();
-
- // Create a graph to access the configuration ...
- Graph config = Graph.create(this.configurationSourceName, connectionFactory,
context);
- if (this.configurationWorkspaceName != null)
config.useWorkspace(this.configurationWorkspaceName);
- String configurationWorkspaceName = config.getCurrentWorkspaceName();
-
- // Read the federated repositories subgraph, of max depth 6:
- // Level 1: the node representing the federated repository
- // Level 2: the "dna:workspaces" node
- // Level 3: a node for each workspace in the federated repository
- // Level 4: the "dna:cache" project node, or the
"dna:projections" nodes
- // Level 5: a node below "dna:projections" for each projection, with
properties for the source name,
- // workspace name, cache expiration time, and projection rules
- Subgraph repositories =
config.getSubgraphOfDepth(5).at(getConfigurationSourcePath());
-
- // Get the name of the default workspace ...
- String defaultWorkspaceName = null;
- Property defaultWorkspaceNameProperty =
repositories.getRoot().getProperty(FederatedLexicon.DEFAULT_WORKSPACE_NAME);
- if (defaultWorkspaceNameProperty != null) {
- // Set the name using the property if there is one ...
- defaultWorkspaceName =
strings.create(defaultWorkspaceNameProperty.getFirstValue());
- }
-
- Node workspacesNode = repositories.getNode(FederatedLexicon.WORKSPACES);
- if (workspacesNode == null) {
- I18n msg = FederationI18n.requiredNodeDoesNotExistRelativeToNode;
- String name =
FederatedLexicon.WORKSPACES.getString(context.getNamespaceRegistry());
- String relativeTo =
repositories.getLocation().getPath().getString(context.getNamespaceRegistry());
- throw new FederationException(msg.text(name, relativeTo,
configurationWorkspaceName, configurationSourceName));
- }
- LinkedList<FederatedWorkspace> workspaces = new
LinkedList<FederatedWorkspace>();
- for (Location workspace : workspacesNode) {
- // Get the name of the workspace ...
- String workspaceName = null;
- SubgraphNode workspaceNode = repositories.getNode(workspace);
- Property workspaceNameProperty =
workspaceNode.getProperty(FederatedLexicon.WORKSPACE_NAME);
- if (workspaceNameProperty != null) {
- // Set the name using the property if there is one ...
- workspaceName = strings.create(workspaceNameProperty.getFirstValue());
- }
- if (workspaceName == null) {
- // Otherwise, set the name using the local name of the workspace node
...
- workspaceName =
workspace.getPath().getLastSegment().getName().getLocalName();
- }
-
- // Get the cache projection ...
- Projection cacheProjection = null;
- CachePolicy cachePolicy = null;
- Node cacheNode = workspaceNode.getNode(FederatedLexicon.CACHE);
- if (cacheNode != null) {
- // Create the projection from the "dna:cache" node ...
- cacheProjection = createProjection(context, projectionParser, cacheNode,
problems);
-
- // Get the cache expiration time for the cache ...
- Property timeToExpire =
cacheNode.getProperty(FederatedLexicon.TIME_TO_EXPIRE);
- if (timeToExpire != null && !timeToExpire.isEmpty()) {
- long timeToCacheInMillis =
longs.create(timeToExpire.getFirstValue());
- cachePolicy = new BasicCachePolicy(timeToCacheInMillis,
TimeUnit.MILLISECONDS).getUnmodifiable();
- }
- }
-
- // Get the source projections ...
- Node projectionsNode = workspaceNode.getNode(FederatedLexicon.PROJECTIONS);
- if (projectionsNode == null) {
- I18n msg = FederationI18n.requiredNodeDoesNotExistRelativeToNode;
- String name =
FederatedLexicon.PROJECTIONS.getString(context.getNamespaceRegistry());
- String relativeTo =
workspaceNode.getLocation().getPath().getString(context.getNamespaceRegistry());
- throw new FederationException(msg.text(name, relativeTo,
configurationWorkspaceName, configurationSourceName));
- }
- List<Projection> sourceProjections = new
LinkedList<Projection>();
- for (Location projection : projectionsNode) {
- Node projectionNode = repositories.getNode(projection);
-
- // Create the projection ...
- sourceProjections.add(createProjection(context, projectionParser,
projectionNode, problems));
- }
-
- // Create the federated workspace configuration ...
- FederatedWorkspace space = new FederatedWorkspace(workspaceName,
cacheProjection, sourceProjections, cachePolicy);
- if (workspaceName.equals(defaultWorkspaceName)) {
- workspaces.addFirst(space);
- } else {
- workspaces.add(space);
- }
- }
-
- return workspaces;
- }
-
- /**
- * Instantiate the {@link Projection} described by the supplied properties.
- *
- * @param context the execution context that should be used to read the
configuration; may not be null
- * @param projectionParser the projection rule parser that should be used; may not be
null
- * @param node the node where these properties were found; never null
- * @param problems the problems container in which any problems should be reported;
never null
- * @return the region instance, or null if it could not be created
- */
- protected Projection createProjection( ExecutionContext context,
- ProjectionParser projectionParser,
- Node node,
- Problems problems ) {
- ValueFactory<String> strings =
context.getValueFactories().getStringFactory();
-
- Path path = node.getLocation().getPath();
-
- // Get the source name from the local name of the node ...
- String sourceName = path.getLastSegment().getName().getLocalName();
- Property sourceNameProperty = node.getProperty(FederatedLexicon.SOURCE_NAME);
- if (sourceNameProperty != null && !sourceNameProperty.isEmpty()) {
- // There is a "dna:sourceName" property, so use this instead ...
- sourceName = strings.create(sourceNameProperty.getFirstValue());
- }
- assert sourceName != null;
-
- // Get the workspace name ...
- String workspaceName = null;
- Property workspaceNameProperty =
node.getProperty(FederatedLexicon.WORKSPACE_NAME);
- if (workspaceNameProperty != null && !workspaceNameProperty.isEmpty()) {
- // There is a "dna:workspaceName" property, so use this instead
...
- workspaceName = strings.create(workspaceNameProperty.getFirstValue());
- }
-
- // Get the projection rules ...
- Projection.Rule[] projectionRules = null;
- Property projectionRulesProperty =
node.getProperty(FederatedLexicon.PROJECTION_RULES);
- if (projectionRulesProperty != null &&
!projectionRulesProperty.isEmpty()) {
- String[] projectionRuleStrs =
strings.create(projectionRulesProperty.getValuesAsArray());
- if (projectionRuleStrs != null && projectionRuleStrs.length != 0) {
- projectionRules = projectionParser.rulesFromStrings(context,
projectionRuleStrs);
- }
- }
- if (problems.hasErrors()) return null;
-
- return new Projection(sourceName, workspaceName, projectionRules);
- }
-
- /**
- * {@inheritDoc}
- */
- public synchronized Reference getReference() {
- String className = getClass().getName();
- String factoryClassName = this.getClass().getName();
- Reference ref = new Reference(className, factoryClassName, null);
-
- if (getRepositoryName() != null) {
- ref.add(new StringRefAddr(REPOSITORY_NAME, getRepositoryName()));
- }
- if (getName() != null) {
- ref.add(new StringRefAddr(SOURCE_NAME, getName()));
- }
- if (getUsername() != null) {
- ref.add(new StringRefAddr(USERNAME, getUsername()));
- }
- if (getPassword() != null) {
- ref.add(new StringRefAddr(PASSWORD, getPassword()));
- }
- if (getConfigurationSourceName() != null) {
- ref.add(new StringRefAddr(CONFIGURATION_SOURCE_NAME,
getConfigurationSourceName()));
- }
- if (getConfigurationSourcePath() != null) {
- ref.add(new StringRefAddr(CONFIGURATION_SOURCE_PATH,
getConfigurationSourcePath()));
- }
- if (getSecurityDomain() != null) {
- ref.add(new StringRefAddr(SECURITY_DOMAIN, getSecurityDomain()));
- }
- ref.add(new StringRefAddr(RETRY_LIMIT, Integer.toString(getRetryLimit())));
- return ref;
- }
-
- /**
- * {@inheritDoc}
- */
- public Object getObjectInstance( Object obj,
- javax.naming.Name name,
- Context nameCtx,
- Hashtable<?, ?> environment ) throws Exception
{
- if (obj instanceof Reference) {
- Map<String, String> values = new HashMap<String, String>();
- Reference ref = (Reference)obj;
- Enumeration<?> en = ref.getAll();
- while (en.hasMoreElements()) {
- RefAddr subref = (RefAddr)en.nextElement();
- if (subref instanceof StringRefAddr) {
- String key = subref.getType();
- Object value = subref.getContent();
- if (value != null) values.put(key, value.toString());
- }
- }
- String repositoryName =
values.get(FederatedRepositorySource.REPOSITORY_NAME);
- String sourceName = values.get(FederatedRepositorySource.SOURCE_NAME);
- String username = values.get(FederatedRepositorySource.USERNAME);
- String password = values.get(FederatedRepositorySource.PASSWORD);
- String configurationSourceName =
values.get(FederatedRepositorySource.CONFIGURATION_SOURCE_NAME);
- String configurationSourcePath =
values.get(FederatedRepositorySource.CONFIGURATION_SOURCE_PATH);
- String securityDomain =
values.get(FederatedRepositorySource.SECURITY_DOMAIN);
- String retryLimit = values.get(FederatedRepositorySource.RETRY_LIMIT);
-
- // Create the source instance ...
- FederatedRepositorySource source = new FederatedRepositorySource();
- if (repositoryName != null) source.setRepositoryName(repositoryName);
- if (sourceName != null) source.setName(sourceName);
- if (username != null) source.setUsername(username);
- if (password != null) source.setPassword(password);
- if (configurationSourceName != null)
source.setConfigurationSourceName(configurationSourceName);
- if (configurationSourcePath != null)
source.setConfigurationSourcePath(configurationSourcePath);
- if (securityDomain != null) source.setSecurityDomain(securityDomain);
- if (retryLimit != null) source.setRetryLimit(Integer.parseInt(retryLimit));
- return source;
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode() {
- return repositoryName.hashCode();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals( Object obj ) {
- if (obj == this) return true;
- if (obj instanceof FederatedRepositorySource) {
- FederatedRepositorySource that = (FederatedRepositorySource)obj;
- // The repository name, source name, and federation service must all match
- if (!this.getRepositoryName().equals(that.getRepositoryName())) return
false;
- if (this.getName() == null) {
- if (that.getName() != null) return false;
- } else {
- if (!this.getName().equals(that.getName())) return false;
- }
- return true;
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.graph.connector.RepositorySource#getCapabilities()
- */
- public RepositorySourceCapabilities getCapabilities() {
- return CAPABILITIES;
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedWorkspace.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedWorkspace.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedWorkspace.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,263 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import net.jcip.annotations.Immutable;
-import org.jboss.dna.common.collection.Problems;
-import org.jboss.dna.common.collection.ThreadSafeProblems;
-import org.jboss.dna.common.util.CheckArg;
-import org.jboss.dna.connector.federation.merge.strategy.MergeStrategy;
-import org.jboss.dna.connector.federation.merge.strategy.OneContributionMergeStrategy;
-import org.jboss.dna.connector.federation.merge.strategy.SimpleMergeStrategy;
-import org.jboss.dna.graph.cache.CachePolicy;
-import org.jboss.dna.graph.connector.RepositorySource;
-
-/**
- * The configuration of a federated repository. workspace The configuration defines,
among other things, the set of
- * {@link #getSourceProjections() source projections} in the federated workspace that
each specify how and where content from a
- * {@link RepositorySource source} is federated into the unified workspace.
- *
- * @author Randall Hauch
- */
-@Immutable
-public class FederatedWorkspace implements Comparable<FederatedWorkspace> {
-
- private final Projection cacheProjection;
- private final CachePolicy cachePolicy;
- private final List<Projection> sourceProjections;
- private final Map<String, List<Projection>> projectionsBySourceName;
- private final Problems problems;
- private final String name;
- private final MergeStrategy mergingStrategy;
-
- /**
- * Create a configuration for a federated workspace.
- *
- * @param workspaceName the name of the federated workspace; may not be null
- * @param cacheProjection the projection used for the cache; may not be null
- * @param sourceProjections the source projections; may not be null
- * @param cachePolicy the cache policy for this workspace; may be null if there is no
policy
- * @throws IllegalArgumentException if the name is null or is blank
- */
- public FederatedWorkspace( String workspaceName,
- Projection cacheProjection,
- Iterable<Projection> sourceProjections,
- CachePolicy cachePolicy ) {
- this(workspaceName, cacheProjection, sourceProjections, cachePolicy, null);
- }
-
- /**
- * Create a configuration for a federated workspace.
- *
- * @param workspaceName the name of the federated workspace; may not be null
- * @param cacheProjection the projection used for the cache; may not be null
- * @param sourceProjections the source projections; may not be null
- * @param cachePolicy the cache policy for this workspace; may be null if there is no
policy
- * @param mergeStrategy the strategy that should be used to merge nodes, or null if
the strategy should be chosen based
- * automatically based upon the number of sources used by the projections
- * @throws IllegalArgumentException if the name is null or is blank
- */
- public FederatedWorkspace( String workspaceName,
- Projection cacheProjection,
- Iterable<Projection> sourceProjections,
- CachePolicy cachePolicy,
- MergeStrategy mergeStrategy ) {
- CheckArg.isNotNull(workspaceName, "workspaceName");
- CheckArg.isNotNull(cacheProjection, "cacheProjection");
- this.name = workspaceName;
- this.cachePolicy = cachePolicy;
- this.problems = new ThreadSafeProblems();
- this.cacheProjection = cacheProjection;
- List<Projection> projectionList = new ArrayList<Projection>();
- for (Projection projection : sourceProjections) {
- if (projection == null) continue;
- if (!projectionList.contains(projection)) {
- projectionList.add(projection);
- }
- }
- this.sourceProjections = Collections.unmodifiableList(projectionList);
- CheckArg.isNotEmpty(this.sourceProjections, "sourceProjections");
- this.projectionsBySourceName = new HashMap<String,
List<Projection>>();
- for (Projection projection : this.sourceProjections) {
- String sourceName = projection.getSourceName();
- List<Projection> projectionsForSource =
projectionsBySourceName.get(sourceName);
- if (projectionsForSource == null) {
- projectionsForSource = new LinkedList<Projection>();
- projectionsBySourceName.put(sourceName, projectionsForSource);
- }
- projectionsForSource.add(projection);
- }
- if (mergeStrategy != null) {
- this.mergingStrategy = mergeStrategy;
- } else {
- if (this.sourceProjections.size() == 1 &&
this.sourceProjections.get(0).isSimple()) {
- this.mergingStrategy = new OneContributionMergeStrategy();
- } else {
- this.mergingStrategy = new SimpleMergeStrategy();
- }
- }
- assert this.mergingStrategy != null;
- }
-
- /**
- * Get the name of this repository
- *
- * @return name
- */
- public String getName() {
- return this.name;
- }
-
- /**
- * Get the cache policy for this workspace
- *
- * @return the workspace's cache policy; may be null
- */
- public CachePolicy getCachePolicy() {
- return cachePolicy;
- }
-
- /**
- * Get the merging strategy used for this workspace
- *
- * @return the workspace's merging strategy; never null
- */
- public MergeStrategy getMergingStrategy() {
- return mergingStrategy;
- }
-
- /**
- * Return the problem associated with this configuration. These problems may change
at any time, although the returned
- * {@link Problems} object is thread-safe.
- *
- * @return the thread-safe problems for this configuration
- */
- public Problems getProblems() {
- return problems;
- }
-
- /**
- * Get the projection that defines the cache for this repository. This projection
does not exist in the
- * {@link #getSourceProjections() list of source projections}.
- *
- * @return the region used for caching; never null
- */
- public Projection getCacheProjection() {
- return cacheProjection;
- }
-
- /**
- * Return the unmodifiable list of source projections.
- *
- * @return the source projections; never null and never empty
- */
- public List<Projection> getSourceProjections() {
- return sourceProjections;
- }
-
- /**
- * Return the unmodifiable list of projections for the source name.
- *
- * @param sourceName the name of the source
- * @return the list of projections for this source, or null if there are none
- */
- public List<Projection> getProjectionsFor( String sourceName ) {
- return this.projectionsBySourceName.get(sourceName);
- }
-
- /**
- * Determine whether this workspace has a projection supplied contribution
- *
- * @param sourceName the name of the source
- * @param workspaceName the name of the workspace
- * @return true if this workspace contains a projection that uses the supplied source
and workspace
- */
- public boolean contains( String sourceName,
- String workspaceName ) {
- List<Projection> projections =
this.projectionsBySourceName.get(sourceName);
- if (projections != null) {
- for (Projection projection : sourceProjections) {
- if (projection.getWorkspaceName().equals(workspaceName)) return true;
- }
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- return this.name.hashCode();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals( Object obj ) {
- if (obj == this) return true;
- if (obj instanceof FederatedWorkspace) {
- FederatedWorkspace that = (FederatedWorkspace)obj;
- if (!this.getName().equals(that.getName())) return false;
- if (!this.getCacheProjection().equals(that.getCacheProjection())) return
false;
- if (!this.getSourceProjections().equals(that.getSourceProjections())) return
false;
- return true;
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- public int compareTo( FederatedWorkspace that ) {
- if (that == this) return 0;
- int diff = this.getName().compareTo(that.getName());
- if (diff != 0) return diff;
- diff = this.getCacheProjection().compareTo(that.getCacheProjection());
- if (diff != 0) return diff;
- Iterator<Projection> thisIter = this.getSourceProjections().iterator();
- Iterator<Projection> thatIter = that.getSourceProjections().iterator();
- while (thisIter.hasNext() && thatIter.hasNext()) {
- diff = thisIter.next().compareTo(thatIter.next());
- if (diff != 0) return diff;
- }
- if (thisIter.hasNext()) return 1;
- if (thatIter.hasNext()) return -1;
- return 0;
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatingRequestProcessor.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatingRequestProcessor.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatingRequestProcessor.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,1262 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import java.util.concurrent.TimeUnit;
-import net.jcip.annotations.Immutable;
-import net.jcip.annotations.NotThreadSafe;
-import org.jboss.dna.common.i18n.I18n;
-import org.jboss.dna.common.util.CheckArg;
-import org.jboss.dna.common.util.Logger;
-import org.jboss.dna.connector.federation.contribution.Contribution;
-import org.jboss.dna.connector.federation.merge.FederatedNode;
-import org.jboss.dna.connector.federation.merge.MergePlan;
-import org.jboss.dna.graph.DnaLexicon;
-import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.JcrLexicon;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.NodeConflictBehavior;
-import org.jboss.dna.graph.cache.CachePolicy;
-import org.jboss.dna.graph.connector.RepositoryConnection;
-import org.jboss.dna.graph.connector.RepositoryConnectionFactory;
-import org.jboss.dna.graph.connector.RepositorySource;
-import org.jboss.dna.graph.connector.RepositorySourceException;
-import org.jboss.dna.graph.property.DateTime;
-import org.jboss.dna.graph.property.Name;
-import org.jboss.dna.graph.property.NamespaceRegistry;
-import org.jboss.dna.graph.property.Path;
-import org.jboss.dna.graph.property.PathFactory;
-import org.jboss.dna.graph.property.PathNotFoundException;
-import org.jboss.dna.graph.property.Property;
-import org.jboss.dna.graph.property.PropertyFactory;
-import org.jboss.dna.graph.request.ChangeRequest;
-import org.jboss.dna.graph.request.CloneBranchRequest;
-import org.jboss.dna.graph.request.CloneWorkspaceRequest;
-import org.jboss.dna.graph.request.CompositeRequest;
-import org.jboss.dna.graph.request.CopyBranchRequest;
-import org.jboss.dna.graph.request.CreateNodeRequest;
-import org.jboss.dna.graph.request.CreateWorkspaceRequest;
-import org.jboss.dna.graph.request.DeleteBranchRequest;
-import org.jboss.dna.graph.request.DestroyWorkspaceRequest;
-import org.jboss.dna.graph.request.GetWorkspacesRequest;
-import org.jboss.dna.graph.request.InvalidWorkspaceException;
-import org.jboss.dna.graph.request.MoveBranchRequest;
-import org.jboss.dna.graph.request.ReadAllChildrenRequest;
-import org.jboss.dna.graph.request.ReadAllPropertiesRequest;
-import org.jboss.dna.graph.request.ReadNodeRequest;
-import org.jboss.dna.graph.request.Request;
-import org.jboss.dna.graph.request.UnsupportedRequestException;
-import org.jboss.dna.graph.request.UpdatePropertiesRequest;
-import org.jboss.dna.graph.request.VerifyWorkspaceRequest;
-import org.jboss.dna.graph.request.processor.RequestProcessor;
-
-/**
- * @author Randall Hauch
- */
-@NotThreadSafe
-public class FederatingRequestProcessor extends RequestProcessor {
-
- private static final Set<Name> HIDDEN_PROPERTIES =
Collections.singleton(DnaLexicon.MERGE_PLAN);
-
- private final Map<String, FederatedWorkspace> workspaces;
- private final FederatedWorkspace defaultWorkspace;
- private final RepositoryConnectionFactory connectionFactory;
- /** The set of all connections, including the cache connection */
- private final Map<String, RepositoryConnection> connectionsBySourceName;
- protected final PathFactory pathFactory;
- private Logger logger;
-
- /**
- * Create a command executor that federates (merges) the information from multiple
sources described by the source projections
- * for the particular workspace specified by the request(s). The request processor
will use the {@link Projection cache
- * projection} of each {@link FederatedWorkspace workspace} to identify the {@link
Projection#getSourceName() repository
- * source} for the cache as well as the {@link Projection#getRules() rules} for how
the paths are mapped in the cache. This
- * cache will be consulted first for the requested information, and will be kept up
to date as changes are made to the
- * federated information.
- *
- * @param context the execution context in which the executor will be run; may not be
null
- * @param sourceName the name of the {@link RepositorySource} that is making use of
this executor; may not be null or empty
- * @param workspaces the configuration for each workspace, keyed by workspace name;
may not be null
- * @param defaultWorkspace the default workspace; null if there is no default
- * @param connectionFactory the factory for {@link RepositoryConnection} instances
- */
- public FederatingRequestProcessor( ExecutionContext context,
- String sourceName,
- Map<String, FederatedWorkspace> workspaces,
- FederatedWorkspace defaultWorkspace,
- RepositoryConnectionFactory connectionFactory ) {
- super(sourceName, context, null);
- CheckArg.isNotEmpty(workspaces, "workspaces");
- CheckArg.isNotNull(connectionFactory, "connectionFactory");
- this.workspaces = workspaces;
- this.connectionFactory = connectionFactory;
- this.logger = context.getLogger(getClass());
- this.connectionsBySourceName = new HashMap<String,
RepositoryConnection>();
- this.defaultWorkspace = defaultWorkspace; // may be null
- this.pathFactory = context.getValueFactories().getPathFactory();
- }
-
- protected DateTime getCurrentTimeInUtc() {
- return getExecutionContext().getValueFactories().getDateFactory().createUtc();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see RequestProcessor#close()
- */
- @Override
- public void close() {
- try {
- super.close();
- } finally {
- // Make sure to close ALL open connections ...
- for (RepositoryConnection connection : connectionsBySourceName.values()) {
- if (connection == null) continue;
- try {
- connection.close();
- } catch (Throwable t) {
- logger.debug("Error while closing connection to {0}",
connection.getSourceName());
- }
- }
- connectionsBySourceName.clear();
- }
- }
-
- protected RepositoryConnection getConnectionToCacheFor( FederatedWorkspace workspace
) throws RepositorySourceException {
- return getConnection(workspace.getCacheProjection());
- }
-
- protected RepositoryConnection getConnection( Projection projection ) throws
RepositorySourceException {
- String sourceName = projection.getSourceName();
- RepositoryConnection connection = connectionsBySourceName.get(sourceName);
- if (connection == null) {
- connection = connectionFactory.createConnection(sourceName);
- connectionsBySourceName.put(sourceName, connection);
- }
- return connection;
- }
-
- protected Set<String> getOpenConnections() {
- return connectionsBySourceName.keySet();
- }
-
- /**
- * Utility to obtain the federated workspace referenced by the request. This method
supports using the default workspace if
- * the workspace name is null. If no such workspace, the request is marked with an
appropriate error.
- *
- * @param request the request; may not be null
- * @param workspaceName the name of the workspace; may be null if the default
workspace should be used
- * @return the federated workspace, or null if none was found
- */
- protected FederatedWorkspace getWorkspace( Request request,
- String workspaceName ) {
- FederatedWorkspace workspace = null;
- if (workspaceName == null) {
- if (defaultWorkspace != null) return defaultWorkspace;
- // There is no default, so record the error ...
- String msg = FederationI18n.noDefaultWorkspace.text(getSourceName());
- request.setError(new InvalidWorkspaceException(msg));
- }
- workspace = workspaces.get(workspaceName);
- if (workspace == null) {
- // There is no workspace with this name, so record an error ...
- String msg = FederationI18n.workspaceDoesNotExist.text(getSourceName(),
workspaceName);
- request.setError(new InvalidWorkspaceException(msg));
- }
- return workspace;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.ReadAllChildrenRequest)
- */
- @Override
- public void process( ReadAllChildrenRequest request ) {
- FederatedWorkspace workspace = getWorkspace(request, request.inWorkspace());
- if (workspace == null) return;
- ReadNodeRequest nodeInfo = getNode(request.of(), workspace);
- if (nodeInfo.hasError()) return;
- for (Location child : nodeInfo.getChildren()) {
- request.addChild(child);
- }
- request.setActualLocationOfNode(nodeInfo.getActualLocationOfNode());
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.ReadAllPropertiesRequest)
- */
- @Override
- public void process( ReadAllPropertiesRequest request ) {
- FederatedWorkspace workspace = getWorkspace(request, request.inWorkspace());
- if (workspace == null) return;
- ReadNodeRequest nodeInfo = getNode(request.at(), workspace);
- if (nodeInfo.hasError()) return;
- for (Property property : nodeInfo.getProperties()) {
- if (HIDDEN_PROPERTIES.contains(property.getName())) continue;
- request.addProperty(property);
- }
- request.setActualLocationOfNode(nodeInfo.getActualLocationOfNode());
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.ReadNodeRequest)
- */
- @Override
- public void process( ReadNodeRequest request ) {
- FederatedWorkspace workspace = getWorkspace(request, request.inWorkspace());
- if (workspace == null) return;
- ReadNodeRequest nodeInfo = getNode(request.at(), workspace);
- if (nodeInfo.hasError()) return;
- for (Property property : nodeInfo.getProperties()) {
- if (HIDDEN_PROPERTIES.contains(property.getName())) continue;
- request.addProperty(property);
- }
- for (Location child : nodeInfo.getChildren()) {
- request.addChild(child);
- }
- request.setActualLocationOfNode(nodeInfo.getActualLocationOfNode());
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.CreateNodeRequest)
- */
- @Override
- public void process( CreateNodeRequest request ) {
- FederatedWorkspace workspace = getWorkspace(request, request.inWorkspace());
- if (workspace == null) return;
-
- // Can push this down if and only if the entire request is within a single
federated source ...
- SingleProjection projection = asSingleProjection(workspace, request.under(),
request);
- if (projection == null) return;
-
- // Push down the request ...
- Location parentLocation = Location.create(projection.pathInSource);
- String workspaceName = projection.projection.getWorkspaceName();
- CreateNodeRequest sourceRequest = new CreateNodeRequest(parentLocation,
workspaceName, request.named(),
- request.properties());
- execute(sourceRequest, projection.projection);
-
- // Copy/transform the results ...
- Location location =
projection.convertToRepository(sourceRequest.getActualLocationOfNode());
- if (sourceRequest.hasError()) {
- request.setError(sourceRequest.getError());
- } else {
- request.setActualLocationOfNode(location);
- }
-
- // Add the cache ...
- Map<Name, Property> props = new HashMap<Name, Property>();
- for (Property property : request.properties()) {
- props.put(property.getName(), property);
- }
- for (Property idProperty : location) {
- props.put(idProperty.getName(), idProperty);
- }
- CreateNodeRequest cacheRequest = new CreateNodeRequest(parentLocation,
workspace.getCacheProjection().getWorkspaceName(),
- request.named(),
props.values());
- executeInCache(cacheRequest, workspace);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.DeleteBranchRequest)
- */
- @Override
- public void process( DeleteBranchRequest request ) {
- FederatedWorkspace workspace = getWorkspace(request, request.inWorkspace());
- if (workspace == null) return;
-
- // Can push this down if and only if the entire request is within a single
federated source ...
- SingleProjection projection = asSingleProjection(workspace, request.at(),
request);
- if (projection == null) return;
-
- // Push down the request ...
- Location sourceLocation = Location.create(projection.pathInSource);
- String workspaceName = projection.projection.getWorkspaceName();
- DeleteBranchRequest sourceRequest = new DeleteBranchRequest(sourceLocation,
workspaceName);
- execute(sourceRequest, projection.projection);
-
- // Copy/transform the results ...
- if (sourceRequest.hasError()) {
- request.setError(sourceRequest.getError());
- } else {
-
request.setActualLocationOfNode(projection.convertToRepository(sourceRequest.getActualLocationOfNode()));
- }
-
- // Delete in the cache ...
- DeleteBranchRequest cacheRequest = new DeleteBranchRequest(request.at(),
workspace.getCacheProjection()
-
.getWorkspaceName());
- executeInCache(cacheRequest, workspace);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.CopyBranchRequest)
- */
- @Override
- public void process( CopyBranchRequest request ) {
- FederatedWorkspace fromWorkspace = getWorkspace(request,
request.fromWorkspace());
- if (fromWorkspace == null) return;
- FederatedWorkspace intoWorkspace = getWorkspace(request,
request.intoWorkspace());
- if (intoWorkspace == null) return;
- if (!fromWorkspace.equals(intoWorkspace)) {
- // Otherwise there wasn't a single projection with a single path ...
- String msg =
FederationI18n.unableToPerformOperationSpanningWorkspaces.text(fromWorkspace.getName(),
-
intoWorkspace.getName());
- request.setError(new UnsupportedRequestException(msg));
- }
-
- // Can push this down if and only if the entire request is within a single
federated source ...
- SingleProjection fromProjection = asSingleProjection(fromWorkspace,
request.from(), request);
- if (fromProjection == null) return;
- SingleProjection intoProjection = asSingleProjection(intoWorkspace,
request.into(), request);
- if (intoProjection == null) return;
- if (!intoProjection.projection.equals(fromProjection.projection)) {
- // Otherwise there wasn't a single projection with a single path ...
- String msg =
FederationI18n.unableToPerformOperationUnlessLocationsAreFromSingleProjection.text(request.from(),
-
request.into(),
-
fromWorkspace.getName(),
-
fromProjection.projection.getRules(),
-
intoProjection.projection.getRules());
- request.setError(new UnsupportedRequestException(msg));
- }
-
- // Push down the request ...
- Location fromLocation = Location.create(fromProjection.pathInSource);
- Location intoLocation = Location.create(intoProjection.pathInSource);
- String workspaceName = fromProjection.projection.getWorkspaceName();
- CopyBranchRequest sourceRequest = new CopyBranchRequest(fromLocation,
workspaceName, intoLocation, workspaceName,
- request.desiredName(),
request.nodeConflictBehavior());
- execute(sourceRequest, fromProjection.projection);
-
- // Copy/transform the results ...
- if (sourceRequest.hasError()) {
- request.setError(sourceRequest.getError());
- } else {
-
request.setActualLocations(fromProjection.convertToRepository(sourceRequest.getActualLocationBefore()),
-
intoProjection.convertToRepository(sourceRequest.getActualLocationAfter()));
- }
-
- // Delete from the cache the parent of the new location ...
- DeleteBranchRequest cacheRequest = new DeleteBranchRequest(request.into(),
fromWorkspace.getCacheProjection()
-
.getWorkspaceName());
- executeInCache(cacheRequest, fromWorkspace);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.CloneBranchRequest)
- */
- @Override
- public void process( CloneBranchRequest request ) {
- FederatedWorkspace fromWorkspace = getWorkspace(request,
request.fromWorkspace());
- if (fromWorkspace == null) return;
- FederatedWorkspace intoWorkspace = getWorkspace(request,
request.intoWorkspace());
- if (intoWorkspace == null) return;
- if (!fromWorkspace.equals(intoWorkspace)) {
- // Otherwise there wasn't a single projection with a single path ...
- String msg =
FederationI18n.unableToPerformOperationSpanningWorkspaces.text(fromWorkspace.getName(),
-
intoWorkspace.getName());
- request.setError(new UnsupportedRequestException(msg));
- }
-
- // Can push this down if and only if the entire request is within a single
federated source ...
- SingleProjection fromProjection = asSingleProjection(fromWorkspace,
request.from(), request);
- if (fromProjection == null) return;
- SingleProjection intoProjection = asSingleProjection(intoWorkspace,
request.into(), request);
- if (intoProjection == null) return;
- if (!intoProjection.projection.equals(fromProjection.projection)) {
- // Otherwise there wasn't a single projection with a single path ...
- String msg =
FederationI18n.unableToPerformOperationUnlessLocationsAreFromSingleProjection.text(request.from(),
-
request.into(),
-
fromWorkspace.getName(),
-
fromProjection.projection.getRules(),
-
intoProjection.projection.getRules());
- request.setError(new UnsupportedRequestException(msg));
- }
-
- // Push down the request ...
- Location fromLocation = Location.create(fromProjection.pathInSource);
- Location intoLocation = Location.create(intoProjection.pathInSource);
- String workspaceName = fromProjection.projection.getWorkspaceName();
- CloneBranchRequest sourceRequest = new CloneBranchRequest(fromLocation,
workspaceName, intoLocation, workspaceName,
- request.desiredName(),
request.desiredSegment(),
-
request.removeExisting());
- execute(sourceRequest, fromProjection.projection);
-
- // Copy/transform the results ...
- if (sourceRequest.hasError()) {
- request.setError(sourceRequest.getError());
- } else {
-
request.setActualLocations(fromProjection.convertToRepository(sourceRequest.getActualLocationBefore()),
-
intoProjection.convertToRepository(sourceRequest.getActualLocationAfter()));
- if (sourceRequest.removeExisting()) {
-
request.setRemovedNodes(Collections.unmodifiableSet(intoProjection.convertToRepository(sourceRequest.getRemovedNodes())));
- }
- }
-
- // Delete from the cache the parent of the new location ...
- DeleteBranchRequest cacheRequest = new DeleteBranchRequest(request.into(),
fromWorkspace.getCacheProjection()
-
.getWorkspaceName());
- executeInCache(cacheRequest, fromWorkspace);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.MoveBranchRequest)
- */
- @Override
- public void process( MoveBranchRequest request ) {
- FederatedWorkspace workspace = getWorkspace(request, request.inWorkspace());
- if (workspace == null) return;
-
- // Can push this down if and only if the entire request is within a single
federated source ...
- SingleProjection fromProjection = asSingleProjection(workspace, request.from(),
request);
- if (fromProjection == null) return;
- SingleProjection intoProjection = asSingleProjection(workspace, request.into(),
request);
- if (intoProjection == null) return;
- if (!intoProjection.projection.equals(fromProjection.projection)) {
- // Otherwise there wasn't a single projection with a single path ...
- String msg =
FederationI18n.unableToPerformOperationUnlessLocationsAreFromSingleProjection.text(request.from(),
-
request.into(),
-
workspace.getName(),
-
fromProjection.projection.getRules(),
-
intoProjection.projection.getRules());
- request.setError(new UnsupportedRequestException(msg));
- }
- SingleProjection beforeProjection = request.before() != null ?
asSingleProjection(workspace, request.before(), request) : null;
-
- // Push down the request ...
- Location fromLocation = Location.create(fromProjection.pathInSource);
- Location intoLocation = Location.create(intoProjection.pathInSource);
- Location beforeLocation = beforeProjection != null ?
Location.create(beforeProjection.pathInSource) : null;
- String workspaceName = fromProjection.projection.getWorkspaceName();
- MoveBranchRequest sourceRequest = new MoveBranchRequest(fromLocation,
intoLocation, beforeLocation, workspaceName,
- request.desiredName(),
request.conflictBehavior());
- execute(sourceRequest, fromProjection.projection);
-
- // Copy/transform the results ...
- if (sourceRequest.hasError()) {
- request.setError(sourceRequest.getError());
- } else {
-
request.setActualLocations(fromProjection.convertToRepository(sourceRequest.getActualLocationBefore()),
-
intoProjection.convertToRepository(sourceRequest.getActualLocationAfter()));
- }
- // Delete from the cache ...
- DeleteBranchRequest cacheRequest = new DeleteBranchRequest(request.from(),
workspace.getCacheProjection()
-
.getWorkspaceName());
- executeInCache(cacheRequest, workspace);
- // Mark the new parent node as being expired ...
- cacheRequest = new DeleteBranchRequest(request.into(),
workspace.getCacheProjection().getWorkspaceName());
- executeInCache(cacheRequest, workspace);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.UpdatePropertiesRequest)
- */
- @Override
- public void process( UpdatePropertiesRequest request ) {
- FederatedWorkspace workspace = getWorkspace(request, request.inWorkspace());
- if (workspace == null) return;
-
- // Can push this down if and only if the entire request is within a single
federated source ...
- SingleProjection projection = asSingleProjection(workspace, request.on(),
request);
- if (projection == null) return;
-
- // Push down the request ...
- Location sourceLocation = Location.create(projection.pathInSource);
- String workspaceName = projection.projection.getWorkspaceName();
- UpdatePropertiesRequest sourceRequest = new
UpdatePropertiesRequest(sourceLocation, workspaceName, request.properties());
- execute(sourceRequest, projection.projection);
-
- // Copy/transform the results ...
- if (sourceRequest.hasError()) {
- request.setError(sourceRequest.getError());
- } else {
-
request.setActualLocationOfNode(projection.convertToRepository(sourceRequest.getActualLocationOfNode()));
- }
-
- // Update the cache ...
- UpdatePropertiesRequest cacheRequest = new UpdatePropertiesRequest(request.on(),
workspace.getCacheProjection()
-
.getWorkspaceName(),
-
request.properties());
- executeInCache(cacheRequest, workspace);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.VerifyWorkspaceRequest)
- */
- @Override
- public void process( VerifyWorkspaceRequest request ) {
- FederatedWorkspace workspace = getWorkspace(request, request.workspaceName());
- if (workspace != null) {
- request.setActualWorkspaceName(workspace.getName());
- Location root = Location.create(pathFactory.createRootPath());
- ReadNodeRequest nodeInfo = getNode(root, workspace);
- if (nodeInfo.hasError()) return;
- request.setActualRootLocation(nodeInfo.getActualLocationOfNode());
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.GetWorkspacesRequest)
- */
- @Override
- public void process( GetWorkspacesRequest request ) {
- request.setAvailableWorkspaceNames(workspaces.keySet());
- super.setCacheableInfo(request);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.CreateWorkspaceRequest)
- */
- @Override
- public void process( CreateWorkspaceRequest request ) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.CloneWorkspaceRequest)
- */
- @Override
- public void process( CloneWorkspaceRequest request ) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.DestroyWorkspaceRequest)
- */
- @Override
- public void process( DestroyWorkspaceRequest request ) {
- throw new UnsupportedOperationException();
- }
-
- @Immutable
- protected class SingleProjection {
- protected final Projection projection;
- protected final Path pathInSource;
- protected final Location federatedLocation;
-
- protected SingleProjection( Projection projection,
- Path pathInSource,
- Location federatedLocation ) {
- this.projection = projection;
- this.federatedLocation = federatedLocation;
- this.pathInSource = pathInSource;
- }
-
- protected final Location convertToRepository( Location sourceLocation ) {
- assert sourceLocation != null;
- if (sourceLocation.hasPath()) {
- Set<Path> paths =
projection.getPathsInRepository(sourceLocation.getPath(), pathFactory);
- assert paths.size() == 1;
- return sourceLocation.with(paths.iterator().next());
- }
- return sourceLocation;
- }
-
- protected Set<Location> convertToRepository( Set<Location>
sourceLocations ) {
- assert sourceLocations != null;
- Set<Location> results = new HashSet<Location>();
- for (Location sourceLocation : sourceLocations) {
- results.add(convertToRepository(sourceLocation));
- }
- return results;
- }
- }
-
- protected SingleProjection asSingleProjection( FederatedWorkspace
federatedWorkspace,
- Location location,
- Request request ) {
- // Check the cache for this location ...
- ReadNodeRequest nodeInfo = getNode(location, federatedWorkspace);
- if (nodeInfo.hasError()) {
- request.setError(nodeInfo.getError());
- return null;
- }
- Location actualLocation = nodeInfo.getActualLocationOfNode();
- Path pathInRepository = actualLocation.getPath();
- assert pathInRepository != null;
-
- // Get the merge plan for the node ...
- MergePlan plan = getMergePlan(nodeInfo);
- assert plan != null;
- if (plan.getRealContributionCount() == 1) {
- for (Contribution contribution : plan) {
- if (contribution.isEmpty() || contribution.isPlaceholder()) continue;
- for (Projection projection :
federatedWorkspace.getProjectionsFor(contribution.getSourceName())) {
- Set<Path> paths = projection.getPathsInSource(pathInRepository,
pathFactory);
- if (paths.size() == 1) {
- return new SingleProjection(projection, paths.iterator().next(),
actualLocation);
- }
- }
- }
- }
-
- // Otherwise there wasn't a single projection with a single path ...
- StringBuilder projections = new StringBuilder();
- boolean first = true;
- for (Contribution contribution : plan) {
- if (contribution.isPlaceholder() || contribution.isEmpty()) continue;
- if (first) first = false;
- else projections.append(", ");
- for (Projection projection :
federatedWorkspace.getProjectionsFor(contribution.getSourceName())) {
- Set<Path> paths = projection.getPathsInSource(pathInRepository,
pathFactory);
- if (paths.size() == 1) {
-
projections.append(FederationI18n.pathInProjection.text(paths.iterator().next(),
projection.getRules()));
- } else {
- projections.append(FederationI18n.pathInProjection.text(paths,
projection.getRules()));
- }
- }
- }
- String msg =
FederationI18n.unableToPerformOperationUnlessLocationIsFromSingleProjection.text(location,
-
federatedWorkspace.getName(),
-
projections);
- request.setError(new UnsupportedRequestException(msg));
- return null;
- }
-
- protected void execute( Request request,
- Projection projection ) {
- RepositoryConnection connection = getConnection(projection);
- connection.execute(getExecutionContext(), request);
- // Don't need to close, as we'll close all connections when this
processor is closed
- }
-
- protected void executeInCache( Request request,
- FederatedWorkspace workspace ) {
- RepositoryConnection connection = getConnectionToCacheFor(workspace);
- connection.execute(getExecutionContext(), request);
- // Don't need to close, as we'll close all connections when this
processor is closed
- if (logger.isTraceEnabled()) {
- traceCacheUpdate(request);
- }
- }
-
- /**
- * Get the node information from the underlying sources or, if possible, from the
cache.
- *
- * @param location the location of the node to be returned
- * @param workspace the federated workspace configuration; may be null
- * @return the node information
- * @throws RepositorySourceException
- */
- protected ReadNodeRequest getNode( Location location,
- FederatedWorkspace workspace ) throws
RepositorySourceException {
- // Check the cache first ...
- ReadNodeRequest fromCache = new ReadNodeRequest(location,
workspace.getCacheProjection().getWorkspaceName());
- executeInCache(fromCache, workspace);
-
- // Look at the cache results from the cache for problems, or if found a plan in
the cache look
- // at the contributions. We'll be putting together the set of source names
for which we need to
- // get the contributions.
- Set<String> sourceNames = null;
- List<Contribution> contributions = new LinkedList<Contribution>();
-
- if (fromCache.hasError()) {
- Throwable error = fromCache.getError();
- if (!(error instanceof PathNotFoundException)) return fromCache;
-
- // The path was not found in the cache, so since we don't know whether
the ancestors are federated
- // from multiple source nodes, we need to populate the cache starting with
the lowest ancestor
- // that already exists in the cache.
- PathNotFoundException notFound =
(PathNotFoundException)fromCache.getError();
- Path lowestExistingAncestor = notFound.getLowestAncestorThatDoesExist();
-
- if (location.hasPath()) {
- // Create a new instance so that we can update it ...
- fromCache = new ReadNodeRequest(location,
workspace.getCacheProjection().getWorkspaceName());
- Path path = location.getPath();
- Path ancestor = path.getParent();
- if (!ancestor.equals(lowestExistingAncestor)) {
- // Load the nodes along the path below the existing ancestor, down to
(but excluding) the desired path
- Path pathToLoad = ancestor;
- while (!pathToLoad.equals(lowestExistingAncestor)) {
- Location locationToLoad = Location.create(pathToLoad);
- loadContributionsFromSources(locationToLoad, workspace, null,
contributions); // sourceNames may be
- // null or empty
- FederatedNode mergedNode = createFederatedNode(locationToLoad,
workspace, fromCache, contributions, true);
- if (mergedNode == null) {
- // No source had a contribution ...
- I18n msg = FederationI18n.nodeDoesNotExistAtPath;
- fromCache.setError(new PathNotFoundException(location,
ancestor, msg.text(path, ancestor)));
- return fromCache;
- }
- MergePlan mergePlan = mergedNode.getMergePlan();
- if (mergePlan != null) {
- Property mergePlanProperty =
getExecutionContext().getPropertyFactory().create(DnaLexicon.MERGE_PLAN,
-
(Object)mergePlan);
- fromCache.addProperty(mergePlanProperty);
- }
- contributions.clear();
- // Move to the next child along the path ...
- pathToLoad = pathToLoad.getParent();
- }
- }
-
- }
-
- // At this point, all ancestors exist ...
- } else {
- // There is no error, so look for the merge plan ...
- MergePlan mergePlan = getMergePlan(fromCache);
- if (mergePlan != null) {
- // We found the merge plan, so check whether it's still valid ...
- final DateTime now = getCurrentTimeInUtc();
- if (!mergePlan.isExpired(now)) {
- // It is still valid, so check whether any contribution is from a
non-existant projection ...
- for (Contribution contribution : mergePlan) {
- if (!workspace.contains(contribution.getSourceName(),
contribution.getWorkspaceName())) {
- // TODO: Record that the cached contribution is from a source
that is no longer in this repository
- }
- }
- return fromCache;
- }
-
- // At least one of the contributions is expired, so go through the
contributions and place
- // the valid contributions in the 'contributions' list; any
expired contribution
- // needs to be loaded by adding the name to the 'sourceNames'
- if (mergePlan.getContributionCount() > 0) {
- sourceNames = new HashSet<String>();
- for (Contribution contribution : mergePlan) {
- if (contribution.isExpired(now)) {
- sourceNames.add(contribution.getSourceName());
- contributions.add(contribution);
- }
- }
- }
- }
- }
-
- // Get the contributions from the sources given their names ...
- location = fromCache.getActualLocationOfNode();
- if (location == null) {
- // Not yet in the cache ...
- location = fromCache.at();
- }
- loadContributionsFromSources(location, workspace, sourceNames, contributions); //
sourceNames may be null or empty
- FederatedNode mergedNode = createFederatedNode(location, workspace, fromCache,
contributions, true);
- if (mergedNode == null) {
- // No source had a contribution ...
- if (location.hasPath()) {
- Path ancestor = location.getPath().getParent();
- I18n msg = FederationI18n.nodeDoesNotExistAtPath;
- fromCache.setError(new PathNotFoundException(location, ancestor,
msg.text(location, ancestor)));
- return fromCache;
- }
- I18n msg = FederationI18n.nodeDoesNotExistAtLocation;
- fromCache.setError(new PathNotFoundException(location, null,
msg.text(location)));
- return fromCache;
- }
- return mergedNode;
- }
-
- protected FederatedNode createFederatedNode( Location location,
- FederatedWorkspace federatedWorkspace,
- ReadNodeRequest fromCache,
- List<Contribution> contributions,
- boolean updateCache ) throws
RepositorySourceException {
- assert location != null;
-
- // If there are no contributions from any source ...
- boolean foundNonEmptyContribution = false;
- for (Contribution contribution : contributions) {
- assert contribution != null;
- if (!contribution.isEmpty()) {
- foundNonEmptyContribution = true;
- break;
- }
- }
- if (!foundNonEmptyContribution) return null;
- if (logger.isTraceEnabled()) {
- NamespaceRegistry registry = getExecutionContext().getNamespaceRegistry();
- logger.trace("Loaded {0} from sources, resulting in these
contributions:", location.getString(registry));
- int i = 0;
- for (Contribution contribution : contributions) {
- logger.trace(" {0} {1}", ++i,
contribution.getString(registry));
- }
- }
-
- // Create the node, and use the existing UUID if one is found in the cache ...
- ExecutionContext context = getExecutionContext();
- assert context != null;
- FederatedNode mergedNode = new FederatedNode(location,
federatedWorkspace.getName());
-
- // Merge the results into a single set of results ...
- assert contributions.size() > 0;
- federatedWorkspace.getMergingStrategy().merge(mergedNode, contributions,
context);
- if (mergedNode.getCachePolicy() == null) {
- mergedNode.setCachePolicy(federatedWorkspace.getCachePolicy());
- }
- if (updateCache) {
- // Place the results into the cache ...
- updateCache(federatedWorkspace, mergedNode, fromCache);
- }
- // And return the results ...
- return mergedNode;
- }
-
- /**
- * Load the node at the supplied location from the sources with the supplied name,
returning the information. This method
- * always obtains the information from the sources and does not use or update the
cache.
- *
- * @param location the location of the node that is to be loaded
- * @param federatedWorkspace the federated workspace
- * @param sourceNames the names of the sources from which contributions are to be
loaded; may be empty or null if all
- * contributions from all sources are to be loaded
- * @param contributions the list into which the contributions are to be placed
- * @throws RepositorySourceException
- */
- protected void loadContributionsFromSources( Location location,
- FederatedWorkspace federatedWorkspace,
- Set<String> sourceNames,
- List<Contribution> contributions )
throws RepositorySourceException {
- // At this point, there is no merge plan, so read information from the sources
...
- final ExecutionContext context = getExecutionContext();
-
- CachePolicy cachePolicy = federatedWorkspace.getCachePolicy();
- // If the location has no path, then we have to submit a request to ALL sources
...
- if (!location.hasPath()) {
- for (Projection projection : federatedWorkspace.getSourceProjections()) {
- final String source = projection.getSourceName();
- final String workspace = projection.getSourceName();
- if (sourceNames != null && !sourceNames.contains(source))
continue;
- final RepositoryConnection sourceConnection = getConnection(projection);
- if (sourceConnection == null) continue; // No source exists by this name
- // Submit the request ...
- ReadNodeRequest request = new ReadNodeRequest(location,
federatedWorkspace.getName());
- sourceConnection.execute(context, request);
- if (request.hasError()) continue;
-
- // Figure out how long we can cache this contribution ...
- long minimumTimeToLive = Long.MAX_VALUE;
- if (cachePolicy != null) {
- minimumTimeToLive = Math.min(minimumTimeToLive,
cachePolicy.getTimeToLive());
- }
- CachePolicy requestCachePolicy = request.getCachePolicy();
- if (requestCachePolicy != null) {
- minimumTimeToLive = Math.min(minimumTimeToLive,
requestCachePolicy.getTimeToLive());
- } else {
- // See if the source has a default policy ...
- CachePolicy sourceCachePolicy =
sourceConnection.getDefaultCachePolicy();
- if (sourceCachePolicy != null) {
- minimumTimeToLive = Math.min(minimumTimeToLive,
sourceCachePolicy.getTimeToLive());
- }
- }
- // The expiration time should be the smallest of the minimum TTL values
...
- DateTime expirationTime = null;
- if (minimumTimeToLive < Long.MAX_VALUE) {
- expirationTime = getCurrentTimeInUtc().plus(minimumTimeToLive,
TimeUnit.MILLISECONDS);
- }
-
- // Convert the locations of the children (relative to the source) to be
relative to this node
- Contribution contribution = Contribution.create(source,
- workspace,
-
request.getActualLocationOfNode(),
- expirationTime,
- request.getProperties(),
- request.getChildren());
- contributions.add(contribution);
- }
- if (contributions.isEmpty() && logger.isTraceEnabled()) {
- NamespaceRegistry registry =
getExecutionContext().getNamespaceRegistry();
- logger.trace("Failed to load {0} from any source",
location.getString(registry));
- }
- return;
- }
-
- // Otherwise, we can do it by path and projections ...
- Path path = location.getPath();
- for (Projection projection : federatedWorkspace.getSourceProjections()) {
- final String source = projection.getSourceName();
- final String workspace = projection.getWorkspaceName();
- if (sourceNames != null && !sourceNames.contains(source)) continue;
- final RepositoryConnection sourceConnection = getConnection(projection);
- if (sourceConnection == null) continue; // No source exists by this name
- // Get the cached information ...
- DateTime expirationTime = null;
- if (cachePolicy != null) {
- expirationTime = getCurrentTimeInUtc().plus(cachePolicy.getTimeToLive(),
TimeUnit.MILLISECONDS);
- }
- // Get the paths-in-source where we should fetch node contributions ...
- Set<Path> pathsInSource = projection.getPathsInSource(path,
pathFactory);
- if (pathsInSource.isEmpty()) {
- // The source has no contributions, but see whether the project exists
BELOW this path.
- // We do this by getting the top-level repository paths of the
projection, and then
- // use those to figure out the children of the nodes.
- Contribution contribution = null;
- List<Path> topLevelPaths =
projection.getTopLevelPathsInRepository(pathFactory);
- Location input = Location.create(path);
- switch (topLevelPaths.size()) {
- case 0:
- break;
- case 1: {
- Path topLevelPath = topLevelPaths.iterator().next();
- if (path.isAncestorOf(topLevelPath)) {
- Location child = Location.create(topLevelPath);
- contribution = Contribution.createPlaceholder(source,
workspace, input, expirationTime, child);
- }
- break;
- }
- default: {
- // We assume that the top-level paths do not overlap ...
- List<Location> children = new
ArrayList<Location>(topLevelPaths.size());
- for (Path topLevelPath : topLevelPaths) {
- if (path.isAncestorOf(topLevelPath)) {
- children.add(Location.create(topLevelPath));
- }
- }
- if (children.size() > 0) {
- contribution = Contribution.createPlaceholder(source,
workspace, input, expirationTime, children);
- }
- }
- }
- if (contribution == null) contribution = Contribution.create(source,
workspace, expirationTime);
- contributions.add(contribution);
- } else {
- // There is at least one (real) contribution ...
-
- // Get the contributions ...
- final int numPaths = pathsInSource.size();
- if (numPaths == 1) {
- Path pathInSource = pathsInSource.iterator().next();
- ReadNodeRequest fromSource = new
ReadNodeRequest(Location.create(pathInSource), workspace);
- sourceConnection.execute(getExecutionContext(), fromSource);
- if (!fromSource.hasError()) {
- Collection<Property> properties =
fromSource.getProperties();
- List<Location> children = fromSource.getChildren();
-
- // Figure out how long we can cache this contribution ...
- long minimumTimeToLive = Long.MAX_VALUE;
- if (cachePolicy != null) {
- minimumTimeToLive = Math.min(minimumTimeToLive,
cachePolicy.getTimeToLive());
- }
- CachePolicy requestCachePolicy = fromSource.getCachePolicy();
- if (requestCachePolicy != null) {
- minimumTimeToLive = Math.min(minimumTimeToLive,
requestCachePolicy.getTimeToLive());
- } else {
- // See if the source has a default policy ...
- CachePolicy sourceCachePolicy =
sourceConnection.getDefaultCachePolicy();
- if (sourceCachePolicy != null) {
- minimumTimeToLive = Math.min(minimumTimeToLive,
sourceCachePolicy.getTimeToLive());
- }
- }
- // The expiration time should be the smallest of the minimum TTL
values ...
- expirationTime = null;
- if (minimumTimeToLive < Long.MAX_VALUE) {
- expirationTime =
getCurrentTimeInUtc().plus(minimumTimeToLive, TimeUnit.MILLISECONDS);
- }
-
- Location actualLocation = fromSource.getActualLocationOfNode();
- Contribution contribution = Contribution.create(source,
- workspace,
- actualLocation,
- expirationTime,
- properties,
- children);
- contributions.add(contribution);
- }
- } else {
- List<Request> fromSourceCommands = new
ArrayList<Request>(numPaths);
- for (Path pathInSource : pathsInSource) {
- fromSourceCommands.add(new
ReadNodeRequest(Location.create(pathInSource), workspace));
- }
- Request request = CompositeRequest.with(fromSourceCommands);
- sourceConnection.execute(context, request);
- for (Request requestObj : fromSourceCommands) {
- ReadNodeRequest fromSource = (ReadNodeRequest)requestObj;
- if (fromSource.hasError()) continue;
-
- // Figure out how long we can cache this contribution ...
- long minimumTimeToLive = Long.MAX_VALUE;
- if (cachePolicy != null) {
- minimumTimeToLive = Math.min(minimumTimeToLive,
cachePolicy.getTimeToLive());
- }
- CachePolicy requestCachePolicy = fromSource.getCachePolicy();
- if (requestCachePolicy != null) {
- minimumTimeToLive = Math.min(minimumTimeToLive,
requestCachePolicy.getTimeToLive());
- } else {
- // See if the source has a default policy ...
- CachePolicy sourceCachePolicy =
sourceConnection.getDefaultCachePolicy();
- if (sourceCachePolicy != null) {
- minimumTimeToLive = Math.min(minimumTimeToLive,
sourceCachePolicy.getTimeToLive());
- }
- }
- // The expiration time should be the smallest of the minimum TTL
values ...
- expirationTime = null;
- if (minimumTimeToLive < Long.MAX_VALUE) {
- expirationTime =
getCurrentTimeInUtc().plus(minimumTimeToLive, TimeUnit.MILLISECONDS);
- }
-
- List<Location> children = fromSource.getChildren();
- Contribution contribution = Contribution.create(source,
- workspace,
-
fromSource.getActualLocationOfNode(),
- expirationTime,
-
fromSource.getProperties(),
- children);
- contributions.add(contribution);
- }
- }
- }
- }
- }
-
- protected MergePlan getMergePlan( ReadNodeRequest request ) {
- Property mergePlanProperty =
request.getPropertiesByName().get(DnaLexicon.MERGE_PLAN);
- if (mergePlanProperty == null || mergePlanProperty.isEmpty()) {
- return null;
- }
- Object value = mergePlanProperty.getValues().next();
- return value instanceof MergePlan ? (MergePlan)value : null;
- }
-
- protected void updateCache( FederatedWorkspace federatedWorkspace,
- FederatedNode mergedNode,
- ReadNodeRequest fromCache ) throws
RepositorySourceException {
- final ExecutionContext context = getExecutionContext();
- final Location location = mergedNode.at();
- final Path path = location.getPath();
- final String cacheWorkspace =
federatedWorkspace.getCacheProjection().getWorkspaceName();
- assert path != null;
- List<Request> requests = new ArrayList<Request>();
- Name childName = null;
-
- // If the merged node has a merge plan, then add it to the properties if it is
not already there ...
- Map<Name, Property> properties = mergedNode.getPropertiesByName();
- MergePlan mergePlan = mergedNode.getMergePlan();
- if (mergePlan != null && !properties.containsKey(DnaLexicon.MERGE_PLAN))
{
- // Record the merge plan on the merged node ...
- Property mergePlanProperty =
getExecutionContext().getPropertyFactory().create(DnaLexicon.MERGE_PLAN,
-
(Object)mergePlan);
- properties.put(mergePlanProperty.getName(), mergePlanProperty);
- }
-
- // Make sure the UUID is being stored ...
- PropertyFactory propertyFactory = getExecutionContext().getPropertyFactory();
- Property uuidProperty = properties.get(DnaLexicon.UUID);
- if (uuidProperty == null) uuidProperty = properties.get(JcrLexicon.UUID);
- if (uuidProperty == null) {
- UUID uuid = mergedNode.at().getUuid();
- if (uuid == null) uuid = UUID.randomUUID();
- uuidProperty = propertyFactory.create(DnaLexicon.UUID, uuid);
- properties.put(uuidProperty.getName(), uuidProperty);
- }
-
- // If the node didn't exist in the first place ...
- if (mergedNode.hasError()) {
- // We need to create the node...
- if (path.isRoot()) {
- // We don't need to re-create the root, just update the properties
and/or children ...
- } else {
- // This is not the root node, so we need to create the node (or replace
it if it exists) ...
- final Location parentLocation = Location.create(path.getParent());
- childName = path.getLastSegment().getName();
- requests.add(new CreateNodeRequest(parentLocation, cacheWorkspace,
childName, NodeConflictBehavior.REPLACE,
- mergedNode.getProperties()));
- // Now create all of the children that this federated node knows of ...
- for (Location child : mergedNode.getChildren()) {
- childName = child.getPath().getLastSegment().getName();
- requests.add(new CreateNodeRequest(location, cacheWorkspace,
childName, NodeConflictBehavior.APPEND, child));
- }
- }
- } else {
- // The node existed, so figure out what to update ...
- if (fromCache.getChildren().equals(mergedNode.getChildren())) {
- // Just update the properties ...
- requests.add(new UpdatePropertiesRequest(location, cacheWorkspace,
properties));
- } else {
- // The children have changed, so figure out how ...
- if (fromCache.getChildren().isEmpty()) {
- // No children in the cache, so just update the properties of the
node ...
- requests.add(new UpdatePropertiesRequest(location, cacheWorkspace,
properties));
-
- // And create all of the children that this federated node knows of
...
- for (Location child : mergedNode.getChildren()) {
- childName = child.getPath().getLastSegment().getName();
- requests.add(new CreateNodeRequest(location, cacheWorkspace,
childName, NodeConflictBehavior.APPEND,
- child));
- }
- } else if (mergedNode.getChildren().isEmpty()) {
- // There were children in the cache but not in the merged node, so
update the cached properties
- requests.add(new UpdatePropertiesRequest(location, cacheWorkspace,
properties));
-
- // and delete all the children ...
- for (Location child : fromCache.getChildren()) {
- requests.add(new DeleteBranchRequest(child, cacheWorkspace));
- }
- } else {
- // There were children in the cache and in the merged node. The easy
way is to just remove the
- // branch from the cache, the create it again ...
- if (path.isRoot()) {
- requests.add(new UpdatePropertiesRequest(location,
cacheWorkspace, properties));
-
- // and delete all the children ...
- for (Location child : fromCache.getChildren()) {
- requests.add(new DeleteBranchRequest(child,
cacheWorkspace));
- }
-
- // Now create all of the children that this federated node knows
of ...
- for (Location child : mergedNode.getChildren()) {
- childName = child.getPath().getLastSegment().getName();
- requests.add(new CreateNodeRequest(location, cacheWorkspace,
childName, NodeConflictBehavior.APPEND,
- child));
- }
- } else {
- requests.add(new DeleteBranchRequest(location, cacheWorkspace));
-
- // This is not the root node, so we need to create the node (or
replace it if it exists) ...
- final Location parentLocation =
Location.create(path.getParent());
- childName = path.getLastSegment().getName();
- requests.add(new CreateNodeRequest(parentLocation,
cacheWorkspace, childName,
- NodeConflictBehavior.REPLACE,
mergedNode.getProperties()));
- // Now create all of the children that this federated node knows
of ...
- for (Location child : mergedNode.getChildren()) {
- childName = child.getPath().getLastSegment().getName();
- requests.add(new CreateNodeRequest(location, cacheWorkspace,
childName, NodeConflictBehavior.APPEND,
- child));
- }
- }
- }
- }
- }
-
- if (logger.isTraceEnabled()) {
- traceCacheUpdates(requests);
- }
-
- // Execute all the requests ...
- final RepositoryConnection cacheConnection =
getConnectionToCacheFor(federatedWorkspace);
- cacheConnection.execute(context, CompositeRequest.with(requests));
-
- // If the children did not have UUIDs, then find the actual locations for each of
the cached nodes ...
- if (requests.size() > 1) {
- Iterator<Request> requestIter = requests.iterator();
- requestIter.next(); // Skip the first request, which creates/updates the node
(we want children)
- List<Location> children = mergedNode.getChildren();
- for (int i = 0; i != children.size(); ++i) {
- Request request = requestIter.next();
- while (!(request instanceof CreateNodeRequest)) { // skip non-create
requests
- request = requestIter.next();
- }
- Location actual =
((CreateNodeRequest)request).getActualLocationOfNode();
- Location child = children.get(i);
- if (!child.hasIdProperties()) {
- assert child.getPath().equals(actual.getPath());
- children.set(i, actual);
- }
- }
- }
- }
-
- private void traceCacheUpdates( Iterable<Request> requests ) {
- NamespaceRegistry registry = getExecutionContext().getNamespaceRegistry();
- logger.trace("Updating cache:");
- for (Request request : requests) {
- if (!(request instanceof ChangeRequest)) continue;
- if (request instanceof CreateNodeRequest) {
- CreateNodeRequest create = (CreateNodeRequest)request;
- logger.trace(" creating {0} under {1} with properties {2}",
- create.named().getString(registry),
- create.under().getString(registry),
- readable(registry, create.properties()));
- } else if (request instanceof UpdatePropertiesRequest) {
- UpdatePropertiesRequest update = (UpdatePropertiesRequest)request;
- logger.trace(" updating {0} with properties {1}",
update.on().getString(registry), readable(registry,
-
update.properties()
-
.values()));
- } else {
- logger.trace(" " + request.toString());
- }
- }
- }
-
- private void traceCacheUpdate( Request request ) {
- NamespaceRegistry registry = getExecutionContext().getNamespaceRegistry();
- if (!(request instanceof ChangeRequest)) return;
- logger.trace("Updating cache:");
- if (request instanceof CreateNodeRequest) {
- CreateNodeRequest create = (CreateNodeRequest)request;
- logger.trace(" creating {0} under {1} with properties {2}",
- create.named().getString(registry),
- create.under().getString(registry),
- readable(registry, create.properties()));
- } else if (request instanceof UpdatePropertiesRequest) {
- UpdatePropertiesRequest update = (UpdatePropertiesRequest)request;
- logger.trace(" updating {0} with properties {1}",
update.on().getString(registry), readable(registry,
-
update.properties()
-
.values()));
- } else {
- logger.trace(" " + request.toString());
- }
- }
-
- private String readable( NamespaceRegistry registry,
- Collection<Property> properties ) {
- if (properties.isEmpty()) return "";
- StringBuilder sb = new StringBuilder();
- boolean first = true;
- for (Property prop : properties) {
- if (first) first = false;
- else sb.append(",");
- sb.append(prop.getString(registry));
- }
- return sb.toString();
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederationException.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederationException.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederationException.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,68 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation;
-
-
-/**
- *
- * @author Randall Hauch
- */
-public class FederationException extends RuntimeException {
-
- /**
- */
- private static final long serialVersionUID = -27536888064529864L;
-
- /**
- *
- */
- public FederationException() {
- }
-
- /**
- * @param message
- */
- public FederationException( String message ) {
- super(message);
-
- }
-
- /**
- * @param cause
- */
- public FederationException( Throwable cause ) {
- super(cause);
-
- }
-
- /**
- * @param message
- * @param cause
- */
- public FederationException( String message, Throwable cause ) {
- super(message, cause);
-
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederationI18n.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederationI18n.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederationI18n.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,74 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
-* See the AUTHORS.txt file in the distribution for a full listing of
-* individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation;
-
-import java.util.Locale;
-import java.util.Set;
-import org.jboss.dna.common.i18n.I18n;
-
-/**
- * @author Randall Hauch
- */
-public final class FederationI18n {
-
- public static I18n requiredNodeDoesNotExistRelativeToNode;
- public static I18n propertyIsRequired;
- public static I18n nodeDoesNotExistAtPath;
- public static I18n nodeDoesNotExistAtLocation;
- public static I18n errorRemovingNodeFromCache;
-
- public static I18n unableToCreateExecutionContext;
- public static I18n federatedRepositoryCannotBeFound;
- public static I18n unableToAuthenticateConnectionToFederatedRepository;
- public static I18n repositoryHasBeenShutDown;
- public static I18n errorAddingProjectionRuleParseMethod;
- public static I18n pathInProjection;
- public static I18n pathsInProjection;
- public static I18n unableToPerformOperationUnlessLocationIsFromSingleProjection;
- public static I18n unableToPerformOperationUnlessLocationsAreFromSingleProjection;
- public static I18n unableToPerformOperationSpanningWorkspaces;
-
- public static I18n workspaceDoesNotExist;
- public static I18n noDefaultWorkspace;
-
- static {
- try {
- I18n.initialize(FederationI18n.class);
- } catch (final Exception err) {
- System.err.println(err);
- }
- }
-
- public static Set<Locale> getLocalizationProblemLocales() {
- return I18n.getLocalizationProblemLocales(FederationI18n.class);
- }
-
- public static Set<String> getLocalizationProblems() {
- return I18n.getLocalizationProblems(FederationI18n.class);
- }
-
- public static Set<String> getLocalizationProblems( Locale locale ) {
- return I18n.getLocalizationProblems(FederationI18n.class, locale);
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/Projection.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/Projection.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/Projection.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,842 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation;
-
-import java.io.Serializable;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import net.jcip.annotations.Immutable;
-import org.jboss.dna.common.text.TextEncoder;
-import org.jboss.dna.common.util.CheckArg;
-import org.jboss.dna.common.util.HashCode;
-import org.jboss.dna.common.util.Logger;
-import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.connector.RepositorySource;
-import org.jboss.dna.graph.property.NamespaceRegistry;
-import org.jboss.dna.graph.property.Path;
-import org.jboss.dna.graph.property.PathFactory;
-
-/**
- * A projection of content from a source into the integrated/federated repository. Each
project consists of a set of {@link Rule
- * rules} for a particular source, where each rule defines how content within a source
is
- * {@link Rule#getPathInRepository(Path, PathFactory) is project into the repository} and
how the repository content is
- * {@link Rule#getPathInSource(Path, PathFactory) projected into the source}. Different
rule subclasses are used for different
- * types.
- *
- * @author Randall Hauch
- */
-@Immutable
-public class Projection implements Comparable<Projection>, Serializable {
-
- /**
- * Initial version
- */
- private static final long serialVersionUID = 1L;
- protected static final List<Method> parserMethods;
- static {
- parserMethods = new CopyOnWriteArrayList<Method>();
- try {
-
parserMethods.add(Projection.class.getDeclaredMethod("parsePathRule",
String.class, ExecutionContext.class));
- } catch (Throwable err) {
- Logger.getLogger(Projection.class).error(err,
FederationI18n.errorAddingProjectionRuleParseMethod);
- }
- }
-
- /**
- * Add a static method that can be used to parse {@link
Rule#getString(NamespaceRegistry, TextEncoder) rule definition
- * strings}. These methods must be static, must accept a {@link String} definition as
the first parameter and an
- * {@link ExecutionContext} environment reference as the second parameter, and should
return the resulting {@link Rule} (or
- * null if the definition format could not be understood by the method. Any
exceptions during
- * {@link Method#invoke(Object, Object...) invocation} will be logged at the
- * {@link Logger#trace(Throwable, String, Object...) trace} level.
- *
- * @param method the method to be added
- * @see #addRuleParser(ClassLoader, String, String)
- */
- public static void addRuleParser( Method method ) {
- if (method != null) parserMethods.add(method);
- }
-
- /**
- * Add a static method that can be used to parse {@link
Rule#getString(NamespaceRegistry, TextEncoder) rule definition
- * strings}. These methods must be static, must accept a {@link String} definition as
the first parameter and an
- * {@link ExecutionContext} environment reference as the second parameter, and should
return the resulting {@link Rule} (or
- * null if the definition format could not be understood by the method. Any
exceptions during
- * {@link Method#invoke(Object, Object...) invocation} will be logged at the
- * {@link Logger#trace(Throwable, String, Object...) trace} level.
- *
- * @param classLoader the class loader that should be used to load the class on which
the method is defined; may not be null
- * @param className the name of the class on which the static method is defined; may
not be null
- * @param methodName the name of the method
- * @throws SecurityException if there is a security exception while loading the class
or getting the method
- * @throws NoSuchMethodException if the method does not exist on the class
- * @throws ClassNotFoundException if the class could not be found given the supplied
class loader
- * @throws IllegalArgumentException if the class loader reference is null, or if the
class name or method name are null or
- * empty
- * @see #addRuleParser(Method)
- */
- public static void addRuleParser( ClassLoader classLoader,
- String className,
- String methodName ) throws SecurityException,
NoSuchMethodException, ClassNotFoundException {
- CheckArg.isNotNull(classLoader, "classLoader");
- CheckArg.isNotEmpty(className, "className");
- CheckArg.isNotEmpty(methodName, "methodName");
- Class<?> clazz = Class.forName(className, true, classLoader);
- parserMethods.add(clazz.getMethod(className, String.class,
ExecutionContext.class));
- }
-
- /**
- * Remove the rule parser method.
- *
- * @param method the method to remove
- * @return true if the method was removed, or false if the method was not a
registered rule parser method
- */
- public static boolean removeRuleParser( Method method ) {
- return parserMethods.remove(method);
- }
-
- /**
- * Remove the rule parser method.
- *
- * @param declaringClassName the name of the class on which the static method is
defined; may not be null
- * @param methodName the name of the method
- * @return true if the method was removed, or false if the method was not a
registered rule parser method
- * @throws IllegalArgumentException if the class loader reference is null, or if the
class name or method name are null or
- * empty
- */
- public static boolean removeRuleParser( String declaringClassName,
- String methodName ) {
- CheckArg.isNotEmpty(declaringClassName, "declaringClassName");
- CheckArg.isNotEmpty(methodName, "methodName");
- for (Method method : parserMethods) {
- if (method.getName().equals(methodName) &&
method.getDeclaringClass().getName().equals(declaringClassName)) {
- return parserMethods.remove(method);
- }
- }
- return false;
- }
-
- /**
- * Parse the string form of a rule definition and return the rule
- *
- * @param definition the definition of the rule that is to be parsed
- * @param context the environment in which this method is being executed; may not be
null
- * @return the rule, or null if the definition could not be parsed
- */
- public static Rule fromString( String definition,
- ExecutionContext context ) {
- CheckArg.isNotNull(context, "env");
- definition = definition != null ? definition.trim() : "";
- if (definition.length() == 0) return null;
- for (Method method : parserMethods) {
- try {
- Rule rule = (Rule)method.invoke(null, definition, context);
- if (rule != null) return rule;
- } catch (Throwable err) {
- String msg = "Error while parsing project rule definition
\"{0}\" using {1}";
- context.getLogger(Projection.class).trace(err, msg, definition, method);
- }
- }
- return null;
- }
-
- /**
- * Pattern that identifies the form:
- *
- * <pre>
- * repository_path => source_path [$ exception ]*
- * </pre>
- *
- * where the following groups are captured on the first call to {@link
Matcher#find()}:
- * <ol>
- * <li><code>repository_path</code></li>
- * <li><code>source_path</code></li>
- * </ol>
- * and the following groups are captured on subsequent calls to {@link
Matcher#find()}:
- * <ol>
- * <li>exception</code></li>
- * </ol>
- * <p>
- * The regular expression is:
- *
- * <pre>
- *
((?:[ˆ=$]|=(?!>))+)(?:(?:=>((?:[ˆ=$]|=(?!>))+))( \$
(?:(?:[ˆ=]|=(?!>))+))*)?
- * </pre>
- *
- * </p>
- */
- protected static final String PATH_RULE_PATTERN_STRING =
"((?:[^=$]|=(?!>))+)(?:(?:=>((?:[^=$]|=(?!>))+))( \\$
(?:(?:[^=]|=(?!>))+))*)?";
- protected static final Pattern PATH_RULE_PATTERN =
Pattern.compile(PATH_RULE_PATTERN_STRING);
-
- /**
- * Parse the string definition of a {@link PathRule}. This method is automatically
registered in the {@link #parserMethods
- * parser methods} by the static initializer of {@link Projection}.
- *
- * @param definition the definition
- * @param context the environment
- * @return the path rule, or null if the definition is not in the right form
- */
- public static PathRule parsePathRule( String definition,
- ExecutionContext context ) {
- definition = definition != null ? definition.trim() : "";
- if (definition.length() == 0) return null;
- Matcher matcher = PATH_RULE_PATTERN.matcher(definition);
- if (!matcher.find()) return null;
- String reposPathStr = matcher.group(1);
- String sourcePathStr = matcher.group(2);
- if (reposPathStr == null || sourcePathStr == null) return null;
- reposPathStr = reposPathStr.trim();
- sourcePathStr = sourcePathStr.trim();
- if (reposPathStr.length() == 0 || sourcePathStr.length() == 0) return null;
- PathFactory pathFactory = context.getValueFactories().getPathFactory();
- Path repositoryPath = pathFactory.create(reposPathStr);
- Path sourcePath = pathFactory.create(sourcePathStr);
-
- // Grab the exceptions ...
- List<Path> exceptions = new LinkedList<Path>();
- while (matcher.find()) {
- String exceptionStr = matcher.group(1);
- Path exception = pathFactory.create(exceptionStr);
- exceptions.add(exception);
- }
- return new PathRule(repositoryPath, sourcePath, exceptions);
- }
-
- private final String sourceName;
- private final String workspaceName;
- private final List<Rule> rules;
- private final boolean simple;
- private final int hc;
-
- /**
- * Create a new federated projection for the supplied source, using the supplied
rules.
- *
- * @param sourceName the name of the source
- * @param workspaceName the name of the workspace in the source; may be null if the
default workspace is to be used
- * @param rules the projection rules
- * @throws IllegalArgumentException if the source name or rule array is null, empty,
or contains all nulls
- */
- public Projection( String sourceName,
- String workspaceName,
- Rule... rules ) {
- CheckArg.isNotEmpty(sourceName, "sourceName");
- CheckArg.isNotEmpty(rules, "rules");
- this.sourceName = sourceName;
- this.workspaceName = workspaceName;
- List<Rule> rulesList = new ArrayList<Rule>();
- for (Rule rule : rules) {
- if (rule != null) rulesList.add(rule);
- }
- this.rules = Collections.unmodifiableList(rulesList);
- CheckArg.isNotEmpty(this.rules, "rules");
- this.simple = computeSimpleProjection(this.rules);
- this.hc = HashCode.compute(this.sourceName, this.workspaceName);
- }
-
- /**
- * Get the name of the source to which this projection applies.
- *
- * @return the source name
- * @see RepositorySource#getName()
- */
- public String getSourceName() {
- return sourceName;
- }
-
- /**
- * Get the name of the workspace in the source to which this projection applies.
- *
- * @return the workspace name, or null if the default workspace of the {@link
#getSourceName() source} is to be used
- */
- public String getWorkspaceName() {
- return workspaceName;
- }
-
- /**
- * Get the rules that define this projection.
- *
- * @return the unmodifiable list of immutable rules; never null
- */
- public List<Rule> getRules() {
- return rules;
- }
-
- /**
- * Get the paths in the source that correspond to the supplied path within the
repository. This method computes the paths
- * given all of the rules. In general, most sources will probably project a node onto
a single repository node. However, some
- * sources may be configured such that the same node in the repository is a
projection of multiple nodes within the source.
- *
- * @param canonicalPathInRepository the canonical path of the node within the
repository; may not be null
- * @param factory the path factory; may not be null
- * @return the set of unique paths in the source projected from the repository path;
never null
- * @throws IllegalArgumentException if the factory reference is null
- */
- public Set<Path> getPathsInSource( Path canonicalPathInRepository,
- PathFactory factory ) {
- CheckArg.isNotNull(factory, "factory");
- assert canonicalPathInRepository == null ? true :
canonicalPathInRepository.equals(canonicalPathInRepository.getCanonicalPath());
- Set<Path> paths = new HashSet<Path>();
- if (canonicalPathInRepository != null) {
- for (Rule rule : getRules()) {
- Path pathInSource = rule.getPathInSource(canonicalPathInRepository,
factory);
- if (pathInSource != null) paths.add(pathInSource);
- }
- }
- return paths;
- }
-
- /**
- * Get the paths in the repository that correspond to the supplied path within the
source. This method computes the paths
- * given all of the rules. In general, most sources will probably project a node onto
a single repository node. However, some
- * sources may be configured such that the same node in the source is projected into
multiple nodes within the repository.
- *
- * @param canonicalPathInSource the canonical path of the node within the source; may
not be null
- * @param factory the path factory; may not be null
- * @return the set of unique paths in the repository projected from the source path;
never null
- * @throws IllegalArgumentException if the factory reference is null
- */
- public Set<Path> getPathsInRepository( Path canonicalPathInSource,
- PathFactory factory ) {
- CheckArg.isNotNull(factory, "factory");
- assert canonicalPathInSource == null ? true :
canonicalPathInSource.equals(canonicalPathInSource.getCanonicalPath());
- Set<Path> paths = new HashSet<Path>();
- for (Rule rule : getRules()) {
- Path pathInRepository = rule.getPathInRepository(canonicalPathInSource,
factory);
- if (pathInRepository != null) paths.add(pathInRepository);
- }
- return paths;
- }
-
- /**
- * Get the paths in the repository that serve as top-level nodes exposed by this
projection.
- *
- * @param factory the path factory that can be used to create new paths; may not be
null
- * @return the list of top-level paths, in the proper order and containing no
duplicates; never null
- */
- public List<Path> getTopLevelPathsInRepository( PathFactory factory ) {
- CheckArg.isNotNull(factory, "factory");
- List<Rule> rules = getRules();
- Set<Path> uniquePaths = new HashSet<Path>();
- List<Path> paths = new ArrayList<Path>(rules.size());
- for (Rule rule : getRules()) {
- for (Path path : rule.getTopLevelPathsInRepository(factory)) {
- if (!uniquePaths.contains(path)) {
- paths.add(path);
- uniquePaths.add(path);
- }
- }
- }
- return paths;
- }
-
- /**
- * Determine whether this project is a simple projection that only involves for any
one repository path no more than a single
- * source path.
- *
- * @return true if this projection is a simple projection, or false if the projection
is not simple (or it cannot be
- * determined if it is simple)
- */
- public boolean isSimple() {
- return simple;
- }
-
- protected boolean computeSimpleProjection( List<Rule> rules ) {
- // Get the set of repository paths for the rules, and see if they overlap ...
- Set<Path> repositoryPaths = new HashSet<Path>();
- for (Rule rule : rules) {
- if (rule instanceof PathRule) {
- PathRule pathRule = (PathRule)rule;
- Path repoPath = pathRule.getPathInRepository();
- if (!repositoryPaths.isEmpty()) {
- if (repositoryPaths.contains(repoPath)) return false;
- for (Path path : repositoryPaths) {
- if (path.isAtOrAbove(repoPath)) return false;
- if (repoPath.isAtOrAbove(path)) return false;
- }
- }
- repositoryPaths.add(repoPath);
- } else {
- return false;
- }
- }
- return true;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- return this.hc;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals( Object obj ) {
- if (obj == this) return true;
- if (obj instanceof Projection) {
- Projection that = (Projection)obj;
- if (this.hashCode() != that.hashCode()) return false;
- if (!this.getSourceName().equals(that.getSourceName())) return false;
- if (!this.getWorkspaceName().equals(that.getWorkspaceName())) return false;
- if (!this.getRules().equals(that.getRules())) return false;
- return true;
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- public int compareTo( Projection that ) {
- if (this == that) return 0;
- int diff = this.getSourceName().compareTo(that.getSourceName());
- if (diff != 0) return diff;
- diff = this.getWorkspaceName().compareTo(that.getWorkspaceName());
- if (diff != 0) return diff;
- Iterator<Rule> thisIter = this.getRules().iterator();
- Iterator<Rule> thatIter = that.getRules().iterator();
- while (thisIter.hasNext() && thatIter.hasNext()) {
- diff = thisIter.next().compareTo(thatIter.next());
- if (diff != 0) return diff;
- }
- if (thisIter.hasNext()) return 1;
- if (thatIter.hasNext()) return -1;
- return 0;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append(this.sourceName);
- sb.append("::");
- sb.append(this.workspaceName);
- sb.append(" { ");
- boolean first = true;
- for (Rule rule : this.getRules()) {
- if (!first) sb.append(" ; ");
- sb.append(rule.toString());
- first = false;
- }
- sb.append(" }");
- return sb.toString();
- }
-
- /**
- * A rule used within a project do define how content within a source is projected
into the federated repository. This mapping
- * is bi-directional, meaning it's possible to determine
- * <ul>
- * <li>the path in repository given a path in source; and</li>
- * <li>the path in source given a path in repository.</li>
- * </ul>
- *
- * @author Randall Hauch
- */
- @Immutable
- public static abstract class Rule implements Comparable<Rule> {
-
- /**
- * Get the paths in the repository that serve as top-level nodes exposed by this
rule.
- *
- * @param factory the path factory that can be used to create new paths; may not
be null
- * @return the list of top-level paths, which are ordered and which must be
unique; never null
- */
- public abstract List<Path> getTopLevelPathsInRepository( PathFactory
factory );
-
- /**
- * Get the path in source that is projected from the supplied repository path, or
null if the supplied repository path is
- * not projected into the source.
- *
- * @param pathInRepository the path in the repository; may not be null
- * @param factory the path factory; may not be null
- * @return the path in source if it is projected by this rule, or null otherwise
- */
- public abstract Path getPathInSource( Path pathInRepository,
- PathFactory factory );
-
- /**
- * Get the path in repository that is projected from the supplied source path, or
null if the supplied source path is not
- * projected into the repository.
- *
- * @param pathInSource the path in the source; may not be null
- * @param factory the path factory; may not be null
- * @return the path in repository if it is projected by this rule, or null
otherwise
- */
- public abstract Path getPathInRepository( Path pathInSource,
- PathFactory factory );
-
- public abstract String getString( NamespaceRegistry registry,
- TextEncoder encoder );
-
- public abstract String getString( TextEncoder encoder );
-
- public abstract String getString();
- }
-
- /**
- * A rule that is defined with a single {@link #getPathInSource() path in source} and
a single {@link #getPathInRepository()
- * path in repository}, and which has a set of {@link #getExceptionsToRule() path
exceptions} (relative paths below the path
- * in source).
- *
- * @author Randall Hauch
- */
- @Immutable
- public static class PathRule extends Rule {
- /** The path of the content as known to the source */
- private final Path sourcePath;
- /** The path where the content is to be placed ("projected") into the
repository */
- private final Path repositoryPath;
- /** The paths (relative to the source path) that identify exceptions to this rule
*/
- private final List<Path> exceptions;
- private final int hc;
- private final List<Path> topLevelRepositoryPaths;
-
- public PathRule( Path repositoryPath,
- Path sourcePath ) {
- this(repositoryPath, sourcePath, (Path[])null);
- }
-
- public PathRule( Path repositoryPath,
- Path sourcePath,
- Path... exceptions ) {
- assert sourcePath != null;
- assert repositoryPath != null;
- this.sourcePath = sourcePath;
- this.repositoryPath = repositoryPath;
- if (exceptions == null || exceptions.length == 0) {
- this.exceptions = Collections.emptyList();
- } else {
- List<Path> exceptionList = new ArrayList<Path>();
- for (Path exception : exceptions) {
- if (exception != null) exceptionList.add(exception);
- }
- this.exceptions = Collections.unmodifiableList(exceptionList);
- }
- this.hc = HashCode.compute(sourcePath, repositoryPath, exceptions);
- assert exceptionPathsAreRelative();
- this.topLevelRepositoryPaths =
Collections.singletonList(getPathInRepository());
- }
-
- public PathRule( Path repositoryPath,
- Path sourcePath,
- List<Path> exceptions ) {
- assert sourcePath != null;
- assert repositoryPath != null;
- this.sourcePath = sourcePath;
- this.repositoryPath = repositoryPath;
- if (exceptions == null || exceptions.isEmpty()) {
- this.exceptions = Collections.emptyList();
- } else {
- this.exceptions = Collections.unmodifiableList(new
ArrayList<Path>(exceptions));
- }
- this.hc = HashCode.compute(sourcePath, repositoryPath, exceptions);
- assert exceptionPathsAreRelative();
- this.topLevelRepositoryPaths =
Collections.singletonList(getPathInRepository());
- }
-
- private boolean exceptionPathsAreRelative() {
- if (this.exceptions != null) {
- for (Path path : this.exceptions) {
- if (path.isAbsolute()) return false;
- }
- }
- return true;
- }
-
- /**
- * The path where the content is to be placed ("projected") into the
repository.
- *
- * @return the projected path of the content in the repository; never null
- */
- public Path getPathInRepository() {
- return repositoryPath;
- }
-
- /**
- * The path of the content as known to the source
- *
- * @return the source-specific path of the content; never null
- */
- public Path getPathInSource() {
- return sourcePath;
- }
-
- /**
- * Get whether this rule has any exceptions.
- *
- * @return true if this rule has exceptions, or false if it has none.
- */
- public boolean hasExceptionsToRule() {
- return exceptions.size() != 0;
- }
-
- /**
- * Get the paths that define the exceptions to this rule. These paths are always
relative to the
- * {@link #getPathInSource() path in source}.
- *
- * @return the unmodifiable exception paths; never null but possibly empty
- */
- public List<Path> getExceptionsToRule() {
- return exceptions;
- }
-
- /**
- * @param pathInSource
- * @return true if the source path is included by this rule
- */
- protected boolean includes( Path pathInSource ) {
- // Check whether the path is outside the source-specific path ...
- if (pathInSource != null &&
this.sourcePath.isAtOrAbove(pathInSource)) {
-
- // The path is inside the source-specific region, so check the exceptions
...
- List<Path> exceptions = getExceptionsToRule();
- if (exceptions.size() != 0) {
- Path subpathInSource = pathInSource.relativeTo(this.sourcePath);
- if (subpathInSource.size() != 0) {
- for (Path exception : exceptions) {
- if (subpathInSource.isAtOrBelow(exception)) return false;
- }
- }
- }
- return true;
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.Projection.Rule#getTopLevelPathsInRepository(org.jboss.dna.graph.property.PathFactory)
- */
- @Override
- public List<Path> getTopLevelPathsInRepository( PathFactory factory ) {
- return topLevelRepositoryPaths;
- }
-
- /**
- * {@inheritDoc}
- * <p>
- * This method considers a path that is at or below the rule's {@link
#getPathInSource() source path} to be included,
- * except if there are {@link #getExceptionsToRule() exceptions} that explicitly
disallow the path.
- * </p>
- *
- * @see org.jboss.dna.connector.federation.Projection.Rule#getPathInSource(Path,
PathFactory)
- */
- @Override
- public Path getPathInSource( Path pathInRepository,
- PathFactory factory ) {
- assert pathInRepository.equals(pathInRepository.getCanonicalPath());
- // Project the repository path into the equivalent source path ...
- Path pathInSource = projectPathInRepositoryToPathInSource(pathInRepository,
factory);
-
- // Check whether the source path is included by this rule ...
- return includes(pathInSource) ? pathInSource : null;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.Projection.Rule#getPathInRepository(org.jboss.dna.graph.property.Path,
- * org.jboss.dna.graph.property.PathFactory)
- */
- @Override
- public Path getPathInRepository( Path pathInSource,
- PathFactory factory ) {
- assert pathInSource.equals(pathInSource.getCanonicalPath());
- // Check whether the source path is included by this rule ...
- if (!includes(pathInSource)) return null;
-
- // Project the repository path into the equivalent source path ...
- return projectPathInSourceToPathInRepository(pathInSource, factory);
- }
-
- /**
- * Convert a path defined in the source system into an equivalent path in the
repository system.
- *
- * @param pathInSource the path in the source system, which may include the
{@link #getPathInSource()}
- * @param factory the path factory; may not be null
- * @return the path in the repository system, which will be normalized and
absolute (including the
- * {@link #getPathInRepository()}), or null if the path is not at or
under the {@link #getPathInSource()}
- */
- protected Path projectPathInSourceToPathInRepository( Path pathInSource,
- PathFactory factory ) {
- if (!this.sourcePath.isAtOrAbove(pathInSource)) return null;
- // Remove the leading source path ...
- Path relativeSourcePath = pathInSource.relativeTo(this.sourcePath);
- // Prepend the region's root path ...
- Path result = factory.create(this.repositoryPath, relativeSourcePath);
- return result.getNormalizedPath();
- }
-
- /**
- * Convert a path defined in the repository system into an equivalent path in the
source system.
- *
- * @param pathInRepository the path in the repository system, which may include
the {@link #getPathInRepository()}
- * @param factory the path factory; may not be null
- * @return the path in the source system, which will be normalized and absolute
(including the {@link #getPathInSource()}
- * ), or null if the path is not at or under the {@link
#getPathInRepository()}
- */
- protected Path projectPathInRepositoryToPathInSource( Path pathInRepository,
- PathFactory factory ) {
- if (!this.repositoryPath.isAtOrAbove(pathInRepository)) return null;
- // Find the relative path from the root of this region ...
- Path pathInRegion = pathInRepository.relativeTo(this.repositoryPath);
- // Prepend the path in source ...
- Path result = factory.create(this.sourcePath, pathInRegion);
- return result.getNormalizedPath();
- }
-
- @Override
- public String getString( NamespaceRegistry registry,
- TextEncoder encoder ) {
- StringBuilder sb = new StringBuilder();
- sb.append(this.getPathInRepository().getString(registry, encoder));
- sb.append(" => ");
- sb.append(this.getPathInSource().getString(registry, encoder));
- if (this.getExceptionsToRule().size() != 0) {
- for (Path exception : this.getExceptionsToRule()) {
- sb.append(" $ ");
- sb.append(exception.getString(registry, encoder));
- }
- }
- return sb.toString();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.Projection.Rule#getString(org.jboss.dna.common.text.TextEncoder)
- */
- @Override
- public String getString( TextEncoder encoder ) {
- StringBuilder sb = new StringBuilder();
- sb.append(this.getPathInRepository().getString(encoder));
- sb.append(" => ");
- sb.append(this.getPathInSource().getString(encoder));
- if (this.getExceptionsToRule().size() != 0) {
- for (Path exception : this.getExceptionsToRule()) {
- sb.append(" $ ");
- sb.append(exception.getString(encoder));
- }
- }
- return sb.toString();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.connector.federation.Projection.Rule#getString()
- */
- @Override
- public String getString() {
- return getString(Path.JSR283_ENCODER);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- return hc;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals( Object obj ) {
- if (obj == this) return true;
- if (obj instanceof PathRule) {
- PathRule that = (PathRule)obj;
- if (!this.getPathInRepository().equals(that.getPathInRepository()))
return false;
- if (!this.getPathInSource().equals(that.getPathInSource())) return
false;
- if (!this.getExceptionsToRule().equals(that.getExceptionsToRule()))
return false;
- return true;
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- public int compareTo( Rule other ) {
- if (other == this) return 0;
- if (other instanceof PathRule) {
- PathRule that = (PathRule)other;
- int diff =
this.getPathInRepository().compareTo(that.getPathInRepository());
- if (diff != 0) return diff;
- diff = this.getPathInSource().compareTo(that.getPathInSource());
- if (diff != 0) return diff;
- Iterator<Path> thisIter = this.getExceptionsToRule().iterator();
- Iterator<Path> thatIter = that.getExceptionsToRule().iterator();
- while (thisIter.hasNext() && thatIter.hasNext()) {
- diff = thisIter.next().compareTo(thatIter.next());
- if (diff != 0) return diff;
- }
- if (thisIter.hasNext()) return 1;
- if (thatIter.hasNext()) return -1;
- return 0;
- }
- return other.getClass().getName().compareTo(this.getClass().getName());
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return getString();
- }
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/ProjectionParser.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/ProjectionParser.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/ProjectionParser.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,244 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation;
-
-import java.lang.reflect.Method;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-import org.jboss.dna.common.text.TextEncoder;
-import org.jboss.dna.common.util.CheckArg;
-import org.jboss.dna.common.util.Logger;
-import org.jboss.dna.common.util.StringUtil;
-import org.jboss.dna.connector.federation.Projection.Rule;
-import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.property.NamespaceRegistry;
-
-/**
- * A parser library for {@link Projection projections} and {@link Projection.Rule
projection rules}.
- *
- * @author Randall Hauch
- */
-public class ProjectionParser {
- private static final ProjectionParser INSTANCE;
-
- static {
- INSTANCE = new ProjectionParser();
- try {
- INSTANCE.addRuleParser(Projection.class, "parsePathRule");
- assert INSTANCE.parserMethods.size() == 1;
- } catch (Throwable err) {
- Logger.getLogger(Projection.class).error(err,
FederationI18n.errorAddingProjectionRuleParseMethod);
- }
- }
-
- /**
- * Get the shared projection parser, which is by default populated with the standard
parser rules.
- *
- * @return the parser; never null
- */
- public static ProjectionParser getInstance() {
- return INSTANCE;
- }
-
- private final List<Method> parserMethods = new
CopyOnWriteArrayList<Method>();
-
- public ProjectionParser() {
- }
-
- /**
- * Add a static method that can be used to parse {@link
Rule#getString(NamespaceRegistry, TextEncoder) rule definition
- * strings}. These methods must be static, must accept a {@link String} definition as
the first parameter and an
- * {@link ExecutionContext} environment reference as the second parameter, and should
return the resulting {@link Rule} (or
- * null if the definition format could not be understood by the method. Any
exceptions during
- * {@link Method#invoke(Object, Object...) invocation} will be logged at the
- * {@link Logger#trace(Throwable, String, Object...) trace} level.
- *
- * @param method the method to be added
- * @see #addRuleParser(ClassLoader, String, String)
- */
- public void addRuleParser( Method method ) {
- if (method != null) parserMethods.add(method);
- }
-
- /**
- * Add a static method that can be used to parse {@link
Rule#getString(NamespaceRegistry, TextEncoder) rule definition
- * strings}. These methods must be static, must accept a {@link String} definition as
the first parameter and an
- * {@link ExecutionContext} environment reference as the second parameter, and should
return the resulting {@link Rule} (or
- * null if the definition format could not be understood by the method. Any
exceptions during
- * {@link Method#invoke(Object, Object...) invocation} will be logged at the
- * {@link Logger#trace(Throwable, String, Object...) trace} level.
- *
- * @param clazz the class on which the static method is defined; may not be null
- * @param methodName the name of the method
- * @throws SecurityException if there is a security exception while loading the class
or getting the method
- * @throws NoSuchMethodException if the method does not exist on the class
- * @throws IllegalArgumentException if the class loader reference is null, or if the
class name or method name are null or
- * empty
- * @see #addRuleParser(Method)
- */
- public void addRuleParser( Class<?> clazz,
- String methodName ) throws SecurityException,
NoSuchMethodException {
- CheckArg.isNotNull(clazz, "clazz");
- CheckArg.isNotEmpty(methodName, "methodName");
- parserMethods.add(clazz.getMethod(methodName, String.class,
ExecutionContext.class));
- }
-
- /**
- * Add a static method that can be used to parse {@link
Rule#getString(NamespaceRegistry, TextEncoder) rule definition
- * strings}. These methods must be static, must accept a {@link String} definition as
the first parameter and an
- * {@link ExecutionContext} environment reference as the second parameter, and should
return the resulting {@link Rule} (or
- * null if the definition format could not be understood by the method. Any
exceptions during
- * {@link Method#invoke(Object, Object...) invocation} will be logged at the
- * {@link Logger#trace(Throwable, String, Object...) trace} level.
- *
- * @param classLoader the class loader that should be used to load the class on which
the method is defined; may not be null
- * @param className the name of the class on which the static method is defined; may
not be null
- * @param methodName the name of the method
- * @throws SecurityException if there is a security exception while loading the class
or getting the method
- * @throws NoSuchMethodException if the method does not exist on the class
- * @throws ClassNotFoundException if the class could not be found given the supplied
class loader
- * @throws IllegalArgumentException if the class loader reference is null, or if the
class name or method name are null or
- * empty
- * @see #addRuleParser(Method)
- */
- public void addRuleParser( ClassLoader classLoader,
- String className,
- String methodName ) throws SecurityException,
NoSuchMethodException, ClassNotFoundException {
- CheckArg.isNotNull(classLoader, "classLoader");
- CheckArg.isNotEmpty(className, "className");
- CheckArg.isNotEmpty(methodName, "methodName");
- Class<?> clazz = Class.forName(className, true, classLoader);
- parserMethods.add(clazz.getMethod(methodName, String.class,
ExecutionContext.class));
- }
-
- /**
- * Remove the rule parser method.
- *
- * @param method the method to remove
- * @return true if the method was removed, or false if the method was not a
registered rule parser method
- */
- public boolean removeRuleParser( Method method ) {
- return parserMethods.remove(method);
- }
-
- /**
- * Remove the rule parser method.
- *
- * @param declaringClassName the name of the class on which the static method is
defined; may not be null
- * @param methodName the name of the method
- * @return true if the method was removed, or false if the method was not a
registered rule parser method
- * @throws IllegalArgumentException if the class loader reference is null, or if the
class name or method name are null or
- * empty
- */
- public boolean removeRuleParser( String declaringClassName,
- String methodName ) {
- CheckArg.isNotEmpty(declaringClassName, "declaringClassName");
- CheckArg.isNotEmpty(methodName, "methodName");
- for (Method method : parserMethods) {
- if (method.getName().equals(methodName) &&
method.getDeclaringClass().getName().equals(declaringClassName)) {
- return parserMethods.remove(method);
- }
- }
- return false;
- }
-
- /**
- * @return parserMethods
- */
- /*package*/List<Method> getParserMethods() {
- return Collections.unmodifiableList(parserMethods);
- }
-
- /**
- * Parse the string form of a rule definition and return the rule
- *
- * @param definition the definition of the rule that is to be parsed
- * @param context the environment in which this method is being executed; may not be
null
- * @return the rule, or null if the definition could not be parsed
- */
- public Rule ruleFromString( String definition,
- ExecutionContext context ) {
- CheckArg.isNotNull(context, "env");
- definition = definition != null ? definition.trim() : "";
- if (definition.length() == 0) return null;
- Logger logger = context.getLogger(getClass());
- for (Method method : parserMethods) {
- try {
- Rule rule = (Rule)method.invoke(null, definition, context);
- if (rule != null) {
- if (logger.isTraceEnabled()) {
- String msg = "Success parsing project rule definition
\"{0}\" using {1}";
- logger.trace(msg, definition, method);
- }
- return rule;
- } else if (logger.isTraceEnabled()) {
- String msg = "Unable to parse project rule definition
\"{0}\" using {1}";
- logger.trace(msg, definition, method);
- }
- } catch (Throwable err) {
- String msg = "Error while parsing project rule definition
\"{0}\" using {1}";
- logger.trace(err, msg, definition, method);
- }
- }
- return null;
- }
-
- /**
- * Parse string forms of an arry of rule definitions and return the rules
- *
- * @param context the environment in which this method is being executed; may not be
null
- * @param definitions the definition of the rules that are to be parsed
- * @return the rule, or null if the definition could not be parsed
- */
- public Rule[] rulesFromStrings( ExecutionContext context,
- String... definitions ) {
- List<Rule> rules = new LinkedList<Rule>();
- for (String definition : definitions) {
- Rule rule = ruleFromString(definition, context);
- if (rule != null) rules.add(rule);
- }
- return rules.toArray(new Rule[rules.size()]);
- }
-
- /**
- * Parse a single string containing one or more string forms of rule definitions, and
return the rules. The string contains
- * each rule on a separate line.
- *
- * @param context the environment in which this method is being executed; may not be
null
- * @param definitions the definitions of the rules that are to be parsed, each
definition separated by a newline character.
- * @return the rule, or null if the definition could not be parsed
- */
- public Rule[] rulesFromString( ExecutionContext context,
- String definitions ) {
- List<String> lines = StringUtil.splitLines(definitions);
- List<Rule> rules = new LinkedList<Rule>();
- for (String definition : lines) {
- Rule rule = ruleFromString(definition, context);
- if (rule != null) rules.add(rule);
- }
- return rules.toArray(new Rule[rules.size()]);
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/Contribution.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/Contribution.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/Contribution.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,677 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.contribution;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-import net.jcip.annotations.Immutable;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.property.DateTime;
-import org.jboss.dna.graph.property.Name;
-import org.jboss.dna.graph.property.NamespaceRegistry;
-import org.jboss.dna.graph.property.Property;
-import org.jboss.dna.graph.property.basic.JodaDateTime;
-
-/**
- * The contribution of a source to the information for a single federated node. Users of
this interface should treat contributions
- * as generally being immutable, since some implementation will be immutable and will
return immutable {@link #getProperties()
- * properties} and {@link #getChildren() children} containers. Thus, rather than make
changes to an existing contribution, a new
- * contribution is created to replace the previous contribution.
- *
- * @author Randall Hauch
- */
-@Immutable
-public abstract class Contribution implements Serializable {
-
- /**
- * Create an empty contribution from the named source.
- *
- * @param sourceName the name of the source, which may not be null or blank
- * @param workspaceName the name of the workspace, which may not be null or blank
- * @param expirationTime the time (in UTC) after which this contribution should be
considered expired, or null if there is no
- * expiration time
- * @return the contribution
- */
- public static Contribution create( String sourceName,
- String workspaceName,
- DateTime expirationTime ) {
- return new EmptyContribution(sourceName, workspaceName, expirationTime);
- }
-
- /**
- * Create a contribution of a single property from the named source.
- *
- * @param sourceName the name of the source, which may not be null or blank
- * @param workspaceName the name of the workspace, which may not be null or blank
- * @param locationInSource the location in the source for this contributed
information; may not be null
- * @param expirationTime the time (in UTC) after which this contribution should be
considered expired, or null if there is no
- * expiration time
- * @param property the property from the source; may not be null
- * @return the contribution
- */
- public static Contribution create( String sourceName,
- String workspaceName,
- Location locationInSource,
- DateTime expirationTime,
- Property property ) {
- if (property == null) {
- return new EmptyContribution(sourceName, workspaceName, expirationTime);
- }
- return new OnePropertyContribution(sourceName, workspaceName, locationInSource,
expirationTime, property);
- }
-
- /**
- * Create a contribution of a single child from the named source.
- *
- * @param sourceName the name of the source, which may not be null or blank
- * @param workspaceName the name of the workspace, which may not be null or blank
- * @param locationInSource the path in the source for this contributed information;
may not be null
- * @param expirationTime the time (in UTC) after which this contribution should be
considered expired, or null if there is no
- * expiration time
- * @param child the child from the source; may not be null or empty
- * @return the contribution
- */
- public static Contribution create( String sourceName,
- String workspaceName,
- Location locationInSource,
- DateTime expirationTime,
- Location child ) {
- if (child == null) {
- return new EmptyContribution(sourceName, workspaceName, expirationTime);
- }
- return new OneChildContribution(sourceName, workspaceName, locationInSource,
expirationTime, child);
- }
-
- /**
- * Create a contribution of a single child from the named source.
- *
- * @param sourceName the name of the source, which may not be null or blank
- * @param workspaceName the name of the workspace, which may not be null or blank
- * @param locationInSource the path in the source for this contributed information;
may not be null
- * @param expirationTime the time (in UTC) after which this contribution should be
considered expired, or null if there is no
- * expiration time
- * @param child1 the first child from the source; may not be null or empty
- * @param child2 the second child from the source; may not be null or empty
- * @return the contribution
- */
- public static Contribution create( String sourceName,
- String workspaceName,
- Location locationInSource,
- DateTime expirationTime,
- Location child1,
- Location child2 ) {
- if (child1 != null) {
- if (child2 != null) {
- return new TwoChildContribution(sourceName, workspaceName,
locationInSource, expirationTime, child1, child2);
- }
- return new OneChildContribution(sourceName, workspaceName, locationInSource,
expirationTime, child1);
- }
- if (child2 != null) {
- return new OneChildContribution(sourceName, workspaceName, locationInSource,
expirationTime, child2);
- }
- return new EmptyContribution(sourceName, workspaceName, expirationTime);
- }
-
- /**
- * Create a contribution of the supplied properties and children from the named
source.
- *
- * @param sourceName the name of the source, which may not be null or blank
- * @param workspaceName the name of the workspace, which may not be null or blank
- * @param locationInSource the path in the source for this contributed information;
may not be null
- * @param expirationTime the time (in UTC) after which this contribution should be
considered expired, or null if there is no
- * expiration time
- * @param properties the properties from the source; may not be null
- * @param children the children from the source; may not be null or empty
- * @return the contribution
- */
- public static Contribution create( String sourceName,
- String workspaceName,
- Location locationInSource,
- DateTime expirationTime,
- Collection<Property> properties,
- List<Location> children ) {
- if (properties == null || properties.isEmpty()) {
- // There are no properties ...
- if (children == null || children.isEmpty()) {
- return new EmptyContribution(sourceName, workspaceName, expirationTime);
- }
- if (children.size() == 1) {
- return new OneChildContribution(sourceName, workspaceName,
locationInSource, expirationTime,
- children.iterator().next());
- }
- if (children.size() == 2) {
- Iterator<Location> iter = children.iterator();
- return new TwoChildContribution(sourceName, workspaceName,
locationInSource, expirationTime, iter.next(),
- iter.next());
- }
- return new MultiChildContribution(sourceName, workspaceName,
locationInSource, expirationTime, children);
- }
- // There are some properties ...
- if (children == null || children.isEmpty()) {
- // There are no children ...
- if (properties.size() == 1) {
- return new OnePropertyContribution(sourceName, workspaceName,
locationInSource, expirationTime,
- properties.iterator().next());
- }
- if (properties.size() == 2) {
- Iterator<Property> iter = properties.iterator();
- return new TwoPropertyContribution(sourceName, workspaceName,
locationInSource, expirationTime, iter.next(),
- iter.next());
- }
- if (properties.size() == 3) {
- Iterator<Property> iter = properties.iterator();
- return new ThreePropertyContribution(sourceName, workspaceName,
locationInSource, expirationTime, iter.next(),
- iter.next(), iter.next());
- }
- return new MultiPropertyContribution(sourceName, workspaceName,
locationInSource, expirationTime, properties);
- }
- // There are some properties AND some children ...
- return new NodeContribution(sourceName, workspaceName, locationInSource,
expirationTime, properties, children);
- }
-
- /**
- * Create a placeholder contribution of a single child from the named source.
- *
- * @param sourceName the name of the source, which may not be null or blank
- * @param workspaceName the name of the workspace, which may not be null or blank
- * @param locationInSource the path in the source for this contributed information;
may not be null
- * @param expirationTime the time (in UTC) after which this contribution should be
considered expired, or null if there is no
- * expiration time
- * @param child the child from the source; may not be null or empty
- * @return the contribution
- */
- public static Contribution createPlaceholder( String sourceName,
- String workspaceName,
- Location locationInSource,
- DateTime expirationTime,
- Location child ) {
- if (child == null) {
- return new EmptyContribution(sourceName, workspaceName, expirationTime);
- }
- return new PlaceholderContribution(sourceName, workspaceName, locationInSource,
expirationTime,
- Collections.singletonList(child));
- }
-
- /**
- * Create a placeholder contribution of the supplied properties and children from the
named source.
- *
- * @param sourceName the name of the source, which may not be null or blank
- * @param workspaceName the name of the workspace, which may not be null or blank
- * @param locationInSource the path in the source for this contributed information;
may not be null
- * @param expirationTime the time (in UTC) after which this contribution should be
considered expired, or null if there is no
- * expiration time
- * @param children the children from the source; may not be null or empty
- * @return the contribution
- */
- public static Contribution createPlaceholder( String sourceName,
- String workspaceName,
- Location locationInSource,
- DateTime expirationTime,
- List<Location> children ) {
- if (children == null || children.isEmpty()) {
- return new EmptyContribution(sourceName, workspaceName, expirationTime);
- }
- return new PlaceholderContribution(sourceName, workspaceName, locationInSource,
expirationTime, children);
- }
-
- /**
- * This is the first version of this class. See the documentation of
BasicMergePlan.serialVersionUID.
- */
- private static final long serialVersionUID = 1L;
-
- protected static final Iterator<Property> EMPTY_PROPERTY_ITERATOR = new
EmptyIterator<Property>();
- protected static final Iterator<Location> EMPTY_CHILDREN_ITERATOR = new
EmptyIterator<Location>();
-
- private final String sourceName;
- private final String workspaceName;
- private DateTime expirationTimeInUtc;
-
- /**
- * Create a contribution for the source with the supplied name and path.
- *
- * @param sourceName the name of the source, which may not be null or blank
- * @param workspaceName the name of the workspace, which may not be null or blank
- * @param expirationTime the time (in UTC) after which this contribution should be
considered expired, or null if there is no
- * expiration time
- */
- protected Contribution( String sourceName,
- String workspaceName,
- DateTime expirationTime ) {
- assert sourceName != null && sourceName.trim().length() != 0;
- assert workspaceName != null && workspaceName.trim().length() != 0;
- assert expirationTime == null ||
expirationTime.equals(expirationTime.toUtcTimeZone());
- this.sourceName = sourceName;
- this.workspaceName = workspaceName;
- this.expirationTimeInUtc = expirationTime;
- }
-
- /**
- * Get the name of the source that made this contribution.
- *
- * @return the name of the contributing source
- */
- public String getSourceName() {
- return this.sourceName;
- }
-
- /**
- * Get the name of the workspace in the {@link #getSourceName() source} from which
this contribution came.
- *
- * @return the name of the workspace
- */
- public String getWorkspaceName() {
- return this.workspaceName;
- }
-
- /**
- * Get the source-specific location of this information.
- *
- * @return the location as known to the source, or null for {@link
EmptyContribution}
- */
- public abstract Location getLocationInSource();
-
- /**
- * Determine whether this contribution has expired given the supplied current time.
- *
- * @param utcTime the current time expressed in UTC; may not be null
- * @return true if at least one contribution has expired, or false otherwise
- */
- public boolean isExpired( DateTime utcTime ) {
- assert utcTime != null;
- assert utcTime.toUtcTimeZone().equals(utcTime); // check that it is passed UTC
time
- if (expirationTimeInUtc == null) return false;
- return !expirationTimeInUtc.isAfter(utcTime);
- }
-
- /**
- * Get the expiration time, already in UTC.
- *
- * @return the expiration time in UTC
- */
- public DateTime getExpirationTimeInUtc() {
- return this.expirationTimeInUtc;
- }
-
- /**
- * Get the properties that are in this contribution. This resulting iterator does not
support {@link Iterator#remove()
- * removal}.
- *
- * @return the properties; never null
- */
- public Iterator<Property> getProperties() {
- return EMPTY_PROPERTY_ITERATOR;
- }
-
- /**
- * Get the number of properties that are in this contribution.
- *
- * @return the number of properties
- */
- public int getPropertyCount() {
- return 0;
- }
-
- /**
- * Get the contributed property with the supplied name.
- *
- * @param name the name of the property
- * @return the contributed property that matches the name, or null if no such
property is in the contribution
- */
- public Property getProperty( Name name ) {
- return null;
- }
-
- /**
- * Get the children that make up this contribution. This resulting iterator does not
support {@link Iterator#remove() removal}
- * .
- *
- * @return the children; never null
- */
- public Iterator<Location> getChildren() {
- return EMPTY_CHILDREN_ITERATOR;
- }
-
- /**
- * Get the number of children that make up this contribution.
- *
- * @return the number of children
- */
- public int getChildrenCount() {
- return 0;
- }
-
- /**
- * Return whether this contribution is an empty contribution.
- *
- * @return true if this contribution is empty, or false otherwise
- */
- public boolean isEmpty() {
- return false;
- }
-
- /**
- * Determine whether this contribution is considered a placeholder necessary solely
because the same source has contributions
- * at or below the children.
- *
- * @return true if a placeholder contribution, or false otherwise
- */
- public boolean isPlaceholder() {
- return false;
- }
-
- /**
- * {@inheritDoc}
- * <p>
- * This implementation returns the hash code of the {@link #getSourceName() source
name}, and is compatible with the
- * implementation of {@link #equals(Object)}.
- * </p>
- */
- @Override
- public int hashCode() {
- return this.sourceName.hashCode();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return getString(null);
- }
-
- public String getString( NamespaceRegistry registry ) {
- StringBuffer sb = new StringBuffer();
- sb.append("Contribution from \"");
- sb.append(getSourceName());
- sb.append("\": ");
- DateTime expiration = getExpirationTimeInUtc();
- if (expiration != null) {
- if (isExpired(new JodaDateTime().toUtcTimeZone())) {
- sb.append("expired ");
- } else {
- sb.append("expires ");
- }
- sb.append(expiration.getString());
- }
- if (getPropertyCount() != 0) {
- sb.append(" { ");
- boolean first = true;
- Iterator<Property> propIter = getProperties();
- while (propIter.hasNext()) {
- if (!first) sb.append(", ");
- else first = false;
- sb.append(propIter.next().getString(registry));
- }
- sb.append(" }");
- }
- if (getChildrenCount() != 0) {
- sb.append("< ");
- boolean first = true;
- Iterator<Location> childIter = getChildren();
- while (childIter.hasNext()) {
- if (!first) sb.append(", ");
- else first = false;
- sb.append(childIter.next().getString(registry));
- }
- sb.append(" >");
- }
- return sb.toString();
- }
-
- /**
- * {@inheritDoc}
- * <p>
- * This implementation only compares the {@link #getSourceName() source name}.
- * </p>
- */
- @Override
- public boolean equals( Object obj ) {
- if (obj == this) return true;
- if (obj instanceof Contribution) {
- Contribution that = (Contribution)obj;
- if (!this.getSourceName().equals(that.getSourceName())) return false;
- return true;
- }
- return false;
- }
-
- protected static class ImmutableIterator<T> implements Iterator<T> {
- private final Iterator<T> iter;
-
- protected ImmutableIterator( Iterator<T> iter ) {
- this.iter = iter;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.util.Iterator#hasNext()
- */
- public boolean hasNext() {
- return iter.hasNext();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.util.Iterator#next()
- */
- public T next() {
- return iter.next();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.util.Iterator#remove()
- */
- public void remove() {
- throw new UnsupportedOperationException();
- }
- }
-
- protected static class EmptyIterator<T> implements Iterator<T> {
-
- /**
- * {@inheritDoc}
- *
- * @see java.util.Iterator#hasNext()
- */
- public boolean hasNext() {
- return false;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.util.Iterator#next()
- */
- public T next() {
- throw new NoSuchElementException();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.util.Iterator#remove()
- */
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- }
-
- protected static class OneValueIterator<T> implements Iterator<T> {
-
- private final T value;
- private boolean next = true;
-
- protected OneValueIterator( T value ) {
- assert value != null;
- this.value = value;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.util.Iterator#hasNext()
- */
- public boolean hasNext() {
- return next;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.util.Iterator#next()
- */
- public T next() {
- if (next) {
- next = false;
- return value;
- }
- throw new NoSuchElementException();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.util.Iterator#remove()
- */
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- }
-
- protected static class TwoValueIterator<T> implements Iterator<T> {
-
- private final T value1;
- private final T value2;
- private int next = 2;
-
- protected TwoValueIterator( T value1,
- T value2 ) {
- this.value1 = value1;
- this.value2 = value2;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.util.Iterator#hasNext()
- */
- public boolean hasNext() {
- return next > 0;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.util.Iterator#next()
- */
- public T next() {
- if (next == 2) {
- next = 1;
- return value1;
- }
- if (next == 1) {
- next = 0;
- return value2;
- }
- throw new NoSuchElementException();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.util.Iterator#remove()
- */
- public void remove() {
- throw new UnsupportedOperationException();
- }
- }
-
- protected static class ThreeValueIterator<T> implements Iterator<T> {
-
- private final T value1;
- private final T value2;
- private final T value3;
- private int next = 3;
-
- protected ThreeValueIterator( T value1,
- T value2,
- T value3 ) {
- this.value1 = value1;
- this.value2 = value2;
- this.value3 = value3;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.util.Iterator#hasNext()
- */
- public boolean hasNext() {
- return next > 0;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.util.Iterator#next()
- */
- public T next() {
- if (next == 3) {
- next = 2;
- return value1;
- }
- if (next == 2) {
- next = 1;
- return value2;
- }
- if (next == 1) {
- next = 0;
- return value3;
- }
- throw new NoSuchElementException();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.util.Iterator#remove()
- */
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/ContributionStatistics.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/ContributionStatistics.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/ContributionStatistics.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,236 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.contribution;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.atomic.AtomicLong;
-import org.jboss.dna.common.util.CheckArg;
-import org.jboss.dna.common.util.HashCode;
-
-/**
- * Simple utility class to record the distribution of contributions.
- *
- * @author Randall Hauch
- */
-public class ContributionStatistics {
-
- /**
- * This should only be enabled when attempting to accumulate the distribution, and
should <i>never</i> be enabled in a
- * release.
- */
- /*package*/static final boolean RECORD = false;
-
- private static final ConcurrentMap<Stats, AtomicLong> DATA = new
ConcurrentHashMap<Stats, AtomicLong>();
-
- /**
- * Record a {@link Contribution} was created for the supplied number of properties
and children. {@link #RECORD} should be
- * checked <i>before</i> this method is called.
- *
- * @param propertyCount the number of properties
- * @param childrenCount the number of children
- */
- /*package*/static void record( int propertyCount,
- int childrenCount ) {
- Stats key = new Stats(propertyCount, childrenCount);
- AtomicLong existing = DATA.putIfAbsent(key, new AtomicLong(1l));
- if (existing != null) existing.incrementAndGet();
- }
-
- public boolean isRecording() {
- return RECORD;
- }
-
- /**
- * Get a copy of the raw statistics data.
- *
- * @return a copy of the data; never null
- */
- public static Map<Stats, AtomicLong> getData() {
- return new HashMap<Stats, AtomicLong>(DATA);
- }
-
- /**
- * Get the N most populous combinations of properties and children counts.
- *
- * @param n the maximum number of data objects to find and return in the raw data;
must be positive
- * @return the list of N (or fewer)
- */
- public static List<Data> getTop( int n ) {
- CheckArg.isPositive(n, "n");
- LinkedList<Data> results = new LinkedList<Data>();
- for (Map.Entry<Stats, AtomicLong> entry : DATA.entrySet()) {
- long value = entry.getValue().get();
- if (results.size() >= n) {
- Data last = results.getLast();
- if (value <= last.getInstanceCount()) continue;
- // The new count is larger than the smallest, so pop the smallest and add
the newest ...
- results.removeLast();
- }
- results.add(new Data(entry.getKey(), value));
- Collections.sort(results);
- }
- return results;
- }
-
- public static final class Data implements Comparable<Data> {
- private final int propertyCount;
- private final int childrenCount;
- private final long instanceCount;
-
- protected Data( Stats stats,
- long instanceCount ) {
- this.propertyCount = stats.getPropertyCount();
- this.childrenCount = stats.getChildrenCount();
- this.instanceCount = instanceCount;
- }
-
- /**
- * @return childrenCount
- */
- public int getChildrenCount() {
- return childrenCount;
- }
-
- /**
- * @return propertyCount
- */
- public int getPropertyCount() {
- return propertyCount;
- }
-
- /**
- * @return instanceCount
- */
- public long getInstanceCount() {
- return instanceCount;
- }
-
- /**
- * {@inheritDoc} This orders the values in the opposite order, so that those with
larger numbers of instances appear
- * first.
- *
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- public int compareTo( Data that ) {
- long diff = that.getInstanceCount() - this.getInstanceCount(); // backwards
- return diff < 0l ? -1 : diff > 0 ? 1 : 0;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- return HashCode.compute(this.propertyCount, this.childrenCount,
this.instanceCount);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals( Object obj ) {
- if (obj instanceof Data) {
- Data that = (Data)obj;
- if (this.propertyCount != that.propertyCount) return false;
- if (this.childrenCount != that.childrenCount) return false;
- if (this.instanceCount != that.instanceCount) return false;
- return true;
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "(# props=" + this.getPropertyCount() + ", #
children=" + this.getChildrenCount() + ") => "
- + this.getInstanceCount();
- }
- }
-
- public static final class Stats {
- private final int propertyCount;
- private final int childrenCount;
-
- protected Stats( int propertyCount,
- int childrenCount ) {
- this.propertyCount = propertyCount;
- this.childrenCount = childrenCount;
- }
-
- /**
- * @return childrenCount
- */
- public int getChildrenCount() {
- return childrenCount;
- }
-
- /**
- * @return propertyCount
- */
- public int getPropertyCount() {
- return propertyCount;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- return HashCode.compute(this.propertyCount, this.childrenCount);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals( Object obj ) {
- if (obj instanceof Stats) {
- Stats that = (Stats)obj;
- if (this.propertyCount != that.propertyCount) return false;
- if (this.childrenCount != that.childrenCount) return false;
- return true;
- }
- return false;
- }
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/EmptyContribution.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/EmptyContribution.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/EmptyContribution.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,97 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.contribution;
-
-import net.jcip.annotations.Immutable;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.property.DateTime;
-
-/**
- * A source contribution that is empty. In other words, the source has no contribution to
make.
- * <p>
- * Note that this is different than an unknown contribution, which may occur when a
source is added to a federated repository
- * after the contributions have already been determined for nodes. In this case, the new
source's contribution for a node is not
- * known and must be determined.
- * </p>
- *
- * @author Randall Hauch
- */
-@Immutable
-public class EmptyContribution extends Contribution {
-
- /**
- * This is the first version of this class. See the documentation of
MergePlan.serialVersionUID.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Create a contribution for the source with the supplied name.
- *
- * @param sourceName the name of the source, which may not be null or blank
- * @param workspaceName the name of the workspace, which may not be null or blank
- * @param expirationTime the time (in UTC) after which this contribution should be
considered expired, or null if there is no
- * expiration time
- */
- public EmptyContribution( String sourceName,
- String workspaceName,
- DateTime expirationTime ) {
- super(sourceName, workspaceName, expirationTime);
- if (ContributionStatistics.RECORD) ContributionStatistics.record(0, 0);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.contribution.Contribution#getLocationInSource()
- */
- @Override
- public Location getLocationInSource() {
- return null;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.connector.federation.contribution.Contribution#isEmpty()
- */
- @Override
- public boolean isEmpty() {
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals( Object obj ) {
- if (obj == this) return true;
- if (obj instanceof EmptyContribution) {
- EmptyContribution that = (EmptyContribution)obj;
- if (!this.getSourceName().equals(that.getSourceName())) return false;
- if (!this.getWorkspaceName().equals(that.getWorkspaceName())) return false;
- return true;
- }
- return false;
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/MultiChildContribution.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/MultiChildContribution.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/MultiChildContribution.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,92 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.contribution;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import net.jcip.annotations.Immutable;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.property.DateTime;
-
-/**
- * The contribution of a source to the information for a single federated node.
- *
- * @author Randall Hauch
- */
-@Immutable
-public class MultiChildContribution extends NonEmptyContribution {
-
- /**
- * This is the first version of this class. See the documentation of
MergePlan.serialVersionUID.
- */
- private static final long serialVersionUID = 1L;
-
- private List<Location> children;
-
- /**
- * Create a contribution of children from the source with the supplied name.
- *
- * @param sourceName the name of the source, which may not be null or blank
- * @param workspaceName the name of the workspace, which may not be null or blank
- * @param locationInSource the location in the source for this contributed
information; may not be null
- * @param expirationTime the time (in UTC) after which this contribution should be
considered expired, or null if there is no
- * expiration time
- * @param children the children from the source; may not be null or empty
- */
- public MultiChildContribution( String sourceName,
- String workspaceName,
- Location locationInSource,
- DateTime expirationTime,
- Iterable<Location> children ) {
- super(sourceName, workspaceName, locationInSource, expirationTime);
- assert children != null;
- this.children = new LinkedList<Location>();
- for (Location child : children) {
- if (child != null) this.children.add(child);
- }
- assert this.children.isEmpty() == false;
- if (ContributionStatistics.RECORD) ContributionStatistics.record(0,
this.children.size());
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.connector.federation.contribution.Contribution#getChildren()
- */
- @Override
- public Iterator<Location> getChildren() {
- return new ImmutableIterator<Location>(children.iterator());
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.contribution.Contribution#getChildrenCount()
- */
- @Override
- public int getChildrenCount() {
- return children.size();
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/MultiPropertyContribution.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/MultiPropertyContribution.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/MultiPropertyContribution.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,104 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.contribution;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import net.jcip.annotations.Immutable;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.property.DateTime;
-import org.jboss.dna.graph.property.Name;
-import org.jboss.dna.graph.property.Property;
-
-/**
- * The record of a source contributing only properties to a node.
- *
- * @author Randall Hauch
- */
-@Immutable
-public class MultiPropertyContribution extends NonEmptyContribution {
-
- /**
- * This is the first version of this class. See the documentation of
MergePlan.serialVersionUID.
- */
- private static final long serialVersionUID = 1L;
-
- protected final Map<Name, Property> properties;
-
- /**
- * Create a contribution of node properties from the source with the supplied name.
- *
- * @param sourceName the name of the source, which may not be null or blank
- * @param workspaceName the name of the workspace, which may not be null or blank
- * @param locationInSource the location in the source for this contributed
information; may not be null
- * @param expirationTime the time (in UTC) after which this contribution should be
considered expired, or null if there is no
- * expiration time
- * @param properties the properties from the source; may not be null
- */
- public MultiPropertyContribution( String sourceName,
- String workspaceName,
- Location locationInSource,
- DateTime expirationTime,
- Iterable<Property> properties ) {
- super(sourceName, workspaceName, locationInSource, expirationTime);
- assert properties != null;
- this.properties = new HashMap<Name, Property>();
- for (Property property : properties) {
- if (property != null) this.properties.put(property.getName(), property);
- }
- assert this.properties.isEmpty() == false;
- if (ContributionStatistics.RECORD)
ContributionStatistics.record(this.properties.size(), 0);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.connector.federation.contribution.Contribution#getProperties()
- */
- @Override
- public Iterator<Property> getProperties() {
- return new
ImmutableIterator<Property>(this.properties.values().iterator());
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.contribution.Contribution#getPropertyCount()
- */
- @Override
- public int getPropertyCount() {
- return this.properties.size();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.contribution.Contribution#getProperty(org.jboss.dna.graph.property.Name)
- */
- @Override
- public Property getProperty( Name name ) {
- return this.properties.get(name);
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/NodeContribution.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/NodeContribution.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/NodeContribution.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,95 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.contribution;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import net.jcip.annotations.Immutable;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.property.DateTime;
-import org.jboss.dna.graph.property.Property;
-
-/**
- * The contribution of a source to the information for a single federated node.
- *
- * @author Randall Hauch
- */
-@Immutable
-public class NodeContribution extends MultiPropertyContribution {
-
- /**
- * This is the first version of this class. See the documentation of
MergePlan.serialVersionUID.
- */
- private static final long serialVersionUID = 1L;
-
- private List<Location> children;
-
- /**
- * Create a contribution of node properties and children from the source with the
supplied name.
- *
- * @param sourceName the name of the source, which may not be null or blank
- * @param workspaceName the name of the workspace, which may not be null or blank
- * @param locationInSource the location in the source for this contributed
information; may not be null
- * @param expirationTime the time (in UTC) after which this contribution should be
considered expired, or null if there is no
- * expiration time
- * @param properties the properties from the source; may not be null
- * @param children the children from the source; may not be null or empty
- */
- public NodeContribution( String sourceName,
- String workspaceName,
- Location locationInSource,
- DateTime expirationTime,
- Iterable<Property> properties,
- Iterable<Location> children ) {
- super(sourceName, workspaceName, locationInSource, expirationTime, properties);
- assert children != null;
- this.children = new LinkedList<Location>();
- for (Location child : children) {
- if (child != null) this.children.add(child);
- }
- assert this.children.isEmpty() == false;
- if (ContributionStatistics.RECORD)
ContributionStatistics.record(this.properties.size(), this.children.size());
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.connector.federation.contribution.Contribution#getChildren()
- */
- @Override
- public Iterator<Location> getChildren() {
- return new ImmutableIterator<Location>(children.iterator());
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.contribution.Contribution#getChildrenCount()
- */
- @Override
- public int getChildrenCount() {
- return children.size();
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/NonEmptyContribution.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/NonEmptyContribution.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/NonEmptyContribution.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,101 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.contribution;
-
-import net.jcip.annotations.Immutable;
-import org.jboss.dna.common.util.HashCode;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.property.DateTime;
-
-/**
- * The record of a non-empty source contribution from a single location within the
source.
- *
- * @author Randall Hauch
- */
-@Immutable
-public abstract class NonEmptyContribution extends Contribution {
-
- /**
- * This is the first version of this class. See the documentation of
MergePlan.serialVersionUID.
- */
- private static final long serialVersionUID = 1L;
-
- private final Location locationInSource;
-
- /**
- * Create a contribution of node properties from the source with the supplied name.
- *
- * @param sourceName the name of the source, which may not be null or blank
- * @param workspaceName the name of the workspace, which may not be null or blank
- * @param locationInSource the location in the source for this contributed
information; may not be null
- * @param expirationTime the time (in UTC) after which this contribution should be
considered expired, or null if there is no
- * expiration time
- */
- protected NonEmptyContribution( String sourceName,
- String workspaceName,
- Location locationInSource,
- DateTime expirationTime ) {
- super(sourceName, workspaceName, expirationTime);
- assert locationInSource != null;
- this.locationInSource = locationInSource;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.contribution.Contribution#getLocationInSource()
- */
- @Override
- public Location getLocationInSource() {
- return locationInSource;
- }
-
- /**
- * {@inheritDoc}
- * <p>
- * This implementation returns the hash code of the {@link #getSourceName() source
name}, and is compatible with the
- * implementation of {@link #equals(Object)}.
- * </p>
- */
- @Override
- public int hashCode() {
- return HashCode.compute(this.getSourceName(), this.getLocationInSource());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals( Object obj ) {
- if (obj == this) return true;
- if (obj instanceof NonEmptyContribution) {
- NonEmptyContribution that = (NonEmptyContribution)obj;
- if (!this.getSourceName().equals(that.getSourceName())) return false;
- if (!this.getWorkspaceName().equals(that.getWorkspaceName())) return false;
- if (!this.getLocationInSource().equals(that.getLocationInSource())) return
false;
- return true;
- }
- return false;
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/OneChildContribution.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/OneChildContribution.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/OneChildContribution.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,87 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.contribution;
-
-import java.util.Iterator;
-import net.jcip.annotations.Immutable;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.property.DateTime;
-
-/**
- * The record of a source contributing only a single child to a node.
- *
- * @author Randall Hauch
- */
-@Immutable
-public class OneChildContribution extends NonEmptyContribution {
-
- /**
- * This is the first version of this class. See the documentation of
MergePlan.serialVersionUID.
- */
- private static final long serialVersionUID = 1L;
-
- private final Location child;
-
- /**
- * Create a contribution of a single child from the source with the supplied name.
- *
- * @param sourceName the name of the source, which may not be null or blank
- * @param workspaceName the name of the workspace, which may not be null or blank
- * @param locationInSource the location in the source for this contributed
information; may not be null
- * @param expirationTime the time (in UTC) after which this contribution should be
considered expired, or null if there is no
- * expiration time
- * @param child the child contributed from the source; may not be null
- */
- public OneChildContribution( String sourceName,
- String workspaceName,
- Location locationInSource,
- DateTime expirationTime,
- Location child ) {
- super(sourceName, workspaceName, locationInSource, expirationTime);
- assert child != null;
- this.child = child;
- if (ContributionStatistics.RECORD) ContributionStatistics.record(0, 1);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.connector.federation.contribution.Contribution#getChildren()
- */
- @Override
- public Iterator<Location> getChildren() {
- return new OneValueIterator<Location>(child);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.contribution.Contribution#getChildrenCount()
- */
- @Override
- public int getChildrenCount() {
- return 1;
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/OnePropertyContribution.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/OnePropertyContribution.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/OnePropertyContribution.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,100 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.contribution;
-
-import java.util.Iterator;
-import net.jcip.annotations.Immutable;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.property.DateTime;
-import org.jboss.dna.graph.property.Name;
-import org.jboss.dna.graph.property.Property;
-
-/**
- * The record of a source contributing only properties to a node.
- *
- * @author Randall Hauch
- */
-@Immutable
-public class OnePropertyContribution extends NonEmptyContribution {
-
- /**
- * This is the first version of this class. See the documentation of
MergePlan.serialVersionUID.
- */
- private static final long serialVersionUID = 1L;
-
- private final Property property;
-
- /**
- * Create a contribution of node properties from the source with the supplied name.
- *
- * @param sourceName the name of the source, which may not be null or blank
- * @param workspaceName the name of the workspace, which may not be null or blank
- * @param locationInSource the location in the source for this contributed
information; may not be null
- * @param expirationTime the time (in UTC) after which this contribution should be
considered expired, or null if there is no
- * expiration time
- * @param property the property from the source; may not be null
- */
- public OnePropertyContribution( String sourceName,
- String workspaceName,
- Location locationInSource,
- DateTime expirationTime,
- Property property ) {
- super(sourceName, workspaceName, locationInSource, expirationTime);
- assert property != null;
- assert property.isEmpty() == false;
- this.property = property;
- if (ContributionStatistics.RECORD) ContributionStatistics.record(1, 0);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.connector.federation.contribution.Contribution#getProperties()
- */
- @Override
- public Iterator<Property> getProperties() {
- return new OneValueIterator<Property>(property);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.contribution.Contribution#getPropertyCount()
- */
- @Override
- public int getPropertyCount() {
- return 1;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.contribution.Contribution#getProperty(org.jboss.dna.graph.property.Name)
- */
- @Override
- public Property getProperty( Name name ) {
- return this.property.getName().equals(name) ? property : null;
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/PlaceholderContribution.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/PlaceholderContribution.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/PlaceholderContribution.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,70 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.contribution;
-
-import net.jcip.annotations.Immutable;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.property.DateTime;
-
-/**
- * A placeholder contribution needed because of a source's contribution below the
specified children.
- *
- * @author Randall Hauch
- */
-@Immutable
-public class PlaceholderContribution extends MultiChildContribution {
-
- /**
- * This is the first version of this class. See the documentation of
MergePlan.serialVersionUID.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Create a contribution of children from the source with the supplied name.
- *
- * @param sourceName the name of the source, which may not be null or blank
- * @param workspaceName the name of the workspace, which may not be null or blank
- * @param locationInSource the location in the source for this contributed
information; may not be null
- * @param expirationTime the time (in UTC) after which this contribution should be
considered expired, or null if there is no
- * expiration time
- * @param children the children from the source; may not be null or empty
- */
- public PlaceholderContribution( String sourceName,
- String workspaceName,
- Location locationInSource,
- DateTime expirationTime,
- Iterable<Location> children ) {
- super(sourceName, workspaceName, locationInSource, expirationTime, children);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.connector.federation.contribution.Contribution#isPlaceholder()
- */
- @Override
- public boolean isPlaceholder() {
- return true;
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/ThreePropertyContribution.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/ThreePropertyContribution.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/ThreePropertyContribution.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,115 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.contribution;
-
-import java.util.Iterator;
-import net.jcip.annotations.Immutable;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.property.DateTime;
-import org.jboss.dna.graph.property.Name;
-import org.jboss.dna.graph.property.Property;
-
-/**
- * The record of a source contributing only properties to a node.
- *
- * @author Randall Hauch
- */
-@Immutable
-public class ThreePropertyContribution extends NonEmptyContribution {
-
- /**
- * This is the first version of this class. See the documentation of
MergePlan.serialVersionUID.
- */
- private static final long serialVersionUID = 1L;
-
- private final Property property1;
- private final Property property2;
- private final Property property3;
-
- /**
- * Create a contribution of node properties from the source with the supplied name.
- *
- * @param sourceName the name of the source, which may not be null or blank
- * @param workspaceName the name of the workspace, which may not be null or blank
- * @param locationInSource the location in the source for this contributed
information; may not be null
- * @param expirationTime the time (in UTC) after which this contribution should be
considered expired, or null if there is no
- * expiration time
- * @param property1 the first property from the source; may not be null
- * @param property2 the second property from the source; may not be null
- * @param property3 the third property from the source; may not be null
- */
- public ThreePropertyContribution( String sourceName,
- String workspaceName,
- Location locationInSource,
- DateTime expirationTime,
- Property property1,
- Property property2,
- Property property3 ) {
- super(sourceName, workspaceName, locationInSource, expirationTime);
- assert property1 != null;
- assert property1.isEmpty() == false;
- assert property2 != null;
- assert property2.isEmpty() == false;
- assert property3 != null;
- assert property3.isEmpty() == false;
- this.property1 = property1;
- this.property2 = property2;
- this.property3 = property3;
- if (ContributionStatistics.RECORD) ContributionStatistics.record(3, 0);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.connector.federation.contribution.Contribution#getProperties()
- */
- @Override
- public Iterator<Property> getProperties() {
- return new ThreeValueIterator<Property>(property1, property2, property3);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.contribution.Contribution#getPropertyCount()
- */
- @Override
- public int getPropertyCount() {
- return 3;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.contribution.Contribution#getProperty(org.jboss.dna.graph.property.Name)
- */
- @Override
- public Property getProperty( Name name ) {
- if (this.property1.getName().equals(name)) return property1;
- if (this.property2.getName().equals(name)) return property2;
- if (this.property3.getName().equals(name)) return property3;
- return null;
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/TwoChildContribution.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/TwoChildContribution.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/TwoChildContribution.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,92 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.contribution;
-
-import java.util.Iterator;
-import net.jcip.annotations.Immutable;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.property.DateTime;
-
-/**
- * The record of a source contributing only two children to a node.
- *
- * @author Randall Hauch
- */
-@Immutable
-public class TwoChildContribution extends NonEmptyContribution {
-
- /**
- * This is the first version of this class. See the documentation of
MergePlan.serialVersionUID.
- */
- private static final long serialVersionUID = 1L;
-
- private final Location child1;
- private final Location child2;
-
- /**
- * Create a contribution of two children from the source with the supplied name.
- *
- * @param sourceName the name of the source, which may not be null or blank
- * @param workspaceName the name of the workspace, which may not be null or blank
- * @param locationInSource the path in the source for this contributed information;
may not be null
- * @param expirationTime the time (in UTC) after which this contribution should be
considered expired, or null if there is no
- * expiration time
- * @param child1 the first child contributed from the source; may not be null
- * @param child2 the second child contributed from the source; may not be null
- */
- public TwoChildContribution( String sourceName,
- String workspaceName,
- Location locationInSource,
- DateTime expirationTime,
- Location child1,
- Location child2 ) {
- super(sourceName, workspaceName, locationInSource, expirationTime);
- assert child1 != null;
- assert child2 != null;
- this.child1 = child1;
- this.child2 = child2;
- if (ContributionStatistics.RECORD) ContributionStatistics.record(0, 2);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.connector.federation.contribution.Contribution#getChildren()
- */
- @Override
- public Iterator<Location> getChildren() {
- return new TwoValueIterator<Location>(child1, child2);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.contribution.Contribution#getChildrenCount()
- */
- @Override
- public int getChildrenCount() {
- return 2;
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/TwoPropertyContribution.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/TwoPropertyContribution.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/TwoPropertyContribution.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,108 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.contribution;
-
-import java.util.Iterator;
-import net.jcip.annotations.Immutable;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.property.DateTime;
-import org.jboss.dna.graph.property.Name;
-import org.jboss.dna.graph.property.Property;
-
-/**
- * The record of a source contributing only properties to a node.
- *
- * @author Randall Hauch
- */
-@Immutable
-public class TwoPropertyContribution extends NonEmptyContribution {
-
- /**
- * This is the first version of this class. See the documentation of
MergePlan.serialVersionUID.
- */
- private static final long serialVersionUID = 1L;
-
- private final Property property1;
- private final Property property2;
-
- /**
- * Create a contribution of node properties from the source with the supplied name.
- *
- * @param sourceName the name of the source, which may not be null or blank
- * @param workspaceName the name of the workspace, which may not be null or blank
- * @param locationInSource the path in the source for this contributed information;
may not be null
- * @param expirationTime the time (in UTC) after which this contribution should be
considered expired, or null if there is no
- * expiration time
- * @param property1 the first property from the source; may not be null
- * @param property2 the first property from the source; may not be null
- */
- public TwoPropertyContribution( String sourceName,
- String workspaceName,
- Location locationInSource,
- DateTime expirationTime,
- Property property1,
- Property property2 ) {
- super(sourceName, workspaceName, locationInSource, expirationTime);
- assert property1 != null;
- assert property1.isEmpty() == false;
- assert property2 != null;
- assert property2.isEmpty() == false;
- this.property1 = property1;
- this.property2 = property2;
- if (ContributionStatistics.RECORD) ContributionStatistics.record(2, 0);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.connector.federation.contribution.Contribution#getProperties()
- */
- @Override
- public Iterator<Property> getProperties() {
- return new TwoValueIterator<Property>(property1, property2);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.contribution.Contribution#getPropertyCount()
- */
- @Override
- public int getPropertyCount() {
- return 2;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.contribution.Contribution#getProperty(org.jboss.dna.graph.property.Name)
- */
- @Override
- public Property getProperty( Name name ) {
- if (this.property1.getName().equals(name)) return property1;
- if (this.property2.getName().equals(name)) return property2;
- return null;
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/FederatedNode.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/FederatedNode.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/FederatedNode.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,106 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.merge;
-
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.request.ReadNodeRequest;
-
-/**
- * An in-memory (and temporary) representation of a federated node and it's merged
properties and children.
- *
- * @author Randall Hauch
- */
-public class FederatedNode extends ReadNodeRequest {
-
- private static final long serialVersionUID = 1L;
-
- private MergePlan mergePlan;
-
- /**
- * Create a federated node given the path and UUID.
- *
- * @param location the location of the federated node; may not be null
- * @param workspaceName the name of the (federated) workspace in which this node
exists
- */
- public FederatedNode( Location location,
- String workspaceName ) {
- super(location, workspaceName);
- super.setActualLocationOfNode(location);
- }
-
- /**
- * Get the merge plan for this federated node
- *
- * @return the merge plan, or null if there is no merge plan
- */
- public MergePlan getMergePlan() {
- return mergePlan;
- }
-
- /**
- * Set the merge plan for this federated node
- *
- * @param mergePlan the new merge plan for this federated node; may be null
- */
- public void setMergePlan( MergePlan mergePlan ) {
- this.mergePlan = mergePlan;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- return this.at().hashCode();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals( Object obj ) {
- if (obj == this) return true;
- if (obj instanceof FederatedNode) {
- FederatedNode that = (FederatedNode)obj;
- if (!this.at().equals(that.at())) return false;
- if (!this.inWorkspace().equals(that.inWorkspace())) return false;
- return true;
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return at().toString();
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/FiveContributionMergePlan.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/FiveContributionMergePlan.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/FiveContributionMergePlan.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,164 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.merge;
-
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-import net.jcip.annotations.ThreadSafe;
-import org.jboss.dna.common.util.HashCode;
-import org.jboss.dna.connector.federation.contribution.Contribution;
-
-/**
- * @author Randall Hauch
- */
-@ThreadSafe
-public class FiveContributionMergePlan extends MergePlan {
-
- private static final long serialVersionUID = 1L;
- private final Contribution contribution1;
- private final Contribution contribution2;
- private final Contribution contribution3;
- private final Contribution contribution4;
- private final Contribution contribution5;
-
- /**
- * @param contribution1 the first contribution for this merge plan
- * @param contribution2 the second contribution for this merge plan
- * @param contribution3 the third contribution for this merge plan
- * @param contribution4 the fourth contribution for this merge plan
- * @param contribution5 the fifth contribution for this merge plan
- */
- /*package*/FiveContributionMergePlan( Contribution contribution1,
- Contribution contribution2,
- Contribution contribution3,
- Contribution contribution4,
- Contribution contribution5 ) {
- assert contribution1 != null;
- assert contribution2 != null;
- assert contribution3 != null;
- assert contribution4 != null;
- assert contribution5 != null;
- this.contribution1 = contribution1;
- this.contribution2 = contribution2;
- this.contribution3 = contribution3;
- this.contribution4 = contribution4;
- this.contribution5 = contribution5;
- assert checkEachContributionIsFromDistinctSource();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.connector.federation.merge.MergePlan#getContributionCount()
- */
- @Override
- public int getContributionCount() {
- return 5;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.merge.MergePlan#getContributionFrom(java.lang.String)
- */
- @Override
- public Contribution getContributionFrom( String sourceName ) {
- if (contribution1.getSourceName().equals(sourceName)) return contribution1;
- if (contribution2.getSourceName().equals(sourceName)) return contribution2;
- if (contribution3.getSourceName().equals(sourceName)) return contribution3;
- if (contribution4.getSourceName().equals(sourceName)) return contribution4;
- if (contribution5.getSourceName().equals(sourceName)) return contribution5;
- return null;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Iterable#iterator()
- */
- public Iterator<Contribution> iterator() {
- return new Iterator<Contribution>() {
- private int next = 5;
-
- public boolean hasNext() {
- return next > 0;
- }
-
- @SuppressWarnings( "synthetic-access" )
- public Contribution next() {
- if (next == 5) {
- next = 4;
- return contribution1;
- }
- if (next == 4) {
- next = 3;
- return contribution2;
- }
- if (next == 3) {
- next = 2;
- return contribution3;
- }
- if (next == 2) {
- next = 1;
- return contribution4;
- }
- if (next == 1) {
- next = 0;
- return contribution5;
- }
- throw new NoSuchElementException();
- }
-
- public void remove() {
- throw new UnsupportedOperationException();
- }
- };
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.merge.MergePlan#isSource(java.lang.String)
- */
- @Override
- public boolean isSource( String sourceName ) {
- if (contribution1.getSourceName().equals(sourceName)) return true;
- if (contribution2.getSourceName().equals(sourceName)) return true;
- if (contribution3.getSourceName().equals(sourceName)) return true;
- if (contribution4.getSourceName().equals(sourceName)) return true;
- if (contribution5.getSourceName().equals(sourceName)) return true;
- return false;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- return HashCode.compute(contribution1, contribution2, contribution3,
contribution4, contribution5);
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/FourContributionMergePlan.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/FourContributionMergePlan.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/FourContributionMergePlan.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,153 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.merge;
-
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-import net.jcip.annotations.ThreadSafe;
-import org.jboss.dna.common.util.HashCode;
-import org.jboss.dna.connector.federation.contribution.Contribution;
-
-/**
- * @author Randall Hauch
- */
-@ThreadSafe
-public class FourContributionMergePlan extends MergePlan {
-
- private static final long serialVersionUID = 1L;
- private final Contribution contribution1;
- private final Contribution contribution2;
- private final Contribution contribution3;
- private final Contribution contribution4;
-
- /**
- * @param contribution1 the first contribution for this merge plan
- * @param contribution2 the second contribution for this merge plan
- * @param contribution3 the third contribution for this merge plan
- * @param contribution4 the fourth contribution for this merge plan
- */
- /*package*/FourContributionMergePlan( Contribution contribution1,
- Contribution contribution2,
- Contribution contribution3,
- Contribution contribution4 ) {
- assert contribution1 != null;
- assert contribution2 != null;
- assert contribution3 != null;
- assert contribution4 != null;
- this.contribution1 = contribution1;
- this.contribution2 = contribution2;
- this.contribution3 = contribution3;
- this.contribution4 = contribution4;
- assert checkEachContributionIsFromDistinctSource();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.connector.federation.merge.MergePlan#getContributionCount()
- */
- @Override
- public int getContributionCount() {
- return 4;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.merge.MergePlan#getContributionFrom(java.lang.String)
- */
- @Override
- public Contribution getContributionFrom( String sourceName ) {
- if (contribution1.getSourceName().equals(sourceName)) return contribution1;
- if (contribution2.getSourceName().equals(sourceName)) return contribution2;
- if (contribution3.getSourceName().equals(sourceName)) return contribution3;
- if (contribution4.getSourceName().equals(sourceName)) return contribution4;
- return null;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Iterable#iterator()
- */
- public Iterator<Contribution> iterator() {
- return new Iterator<Contribution>() {
- private int next = 4;
-
- public boolean hasNext() {
- return next > 0;
- }
-
- @SuppressWarnings( "synthetic-access" )
- public Contribution next() {
- if (next == 4) {
- next = 3;
- return contribution1;
- }
- if (next == 3) {
- next = 2;
- return contribution2;
- }
- if (next == 2) {
- next = 1;
- return contribution3;
- }
- if (next == 1) {
- next = 0;
- return contribution4;
- }
- throw new NoSuchElementException();
- }
-
- public void remove() {
- throw new UnsupportedOperationException();
- }
- };
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.merge.MergePlan#isSource(java.lang.String)
- */
- @Override
- public boolean isSource( String sourceName ) {
- if (contribution1.getSourceName().equals(sourceName)) return true;
- if (contribution2.getSourceName().equals(sourceName)) return true;
- if (contribution3.getSourceName().equals(sourceName)) return true;
- if (contribution4.getSourceName().equals(sourceName)) return true;
- return false;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- return HashCode.compute(contribution1, contribution2, contribution3,
contribution4);
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/MergePlan.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/MergePlan.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/MergePlan.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,417 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.merge;
-
-import java.io.InvalidClassException;
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-import net.jcip.annotations.GuardedBy;
-import net.jcip.annotations.ThreadSafe;
-import org.jboss.dna.common.CommonI18n;
-import org.jboss.dna.common.util.CheckArg;
-import org.jboss.dna.connector.federation.contribution.Contribution;
-import org.jboss.dna.connector.federation.contribution.EmptyContribution;
-import org.jboss.dna.graph.property.DateTime;
-import org.jboss.dna.graph.property.Name;
-import org.jboss.dna.graph.property.Property;
-
-/**
- * This class represents the details about how information from different sources are
merged into a single federated node.
- * <p>
- * A merge plan basically consists of the individual contribution from each source and
the information about how these
- * contributions were merged into the single federated node.
- * </p>
- * <p>
- * Merge plans are designed to be {@link Serializable serializable}, as they are
persisted on the federated node and deserialized
- * to assist in the management of the federated node.
- * </p>
- *
- * @author Randall Hauch
- */
-@ThreadSafe
-public abstract class MergePlan implements Serializable, Iterable<Contribution> {
-
- public static MergePlan create( Contribution... contributions ) {
- CheckArg.isNotNull(contributions, "contributions");
- switch (contributions.length) {
- case 0:
- throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeEmpty.text("contributions"));
- case 1:
- return new OneContributionMergePlan(contributions[0]);
- case 2:
- return new TwoContributionMergePlan(contributions[0], contributions[1]);
- case 3:
- return new ThreeContributionMergePlan(contributions[0], contributions[1],
contributions[2]);
- case 4:
- return new FourContributionMergePlan(contributions[0], contributions[1],
contributions[2], contributions[3]);
- case 5:
- return new FiveContributionMergePlan(contributions[0], contributions[1],
contributions[2], contributions[3],
- contributions[4]);
- default:
- return new MultipleContributionMergePlan(contributions);
- }
- }
-
- public static MergePlan create( Collection<Contribution> contributions ) {
- CheckArg.isNotNull(contributions, "contributions");
- Iterator<Contribution> iter = contributions.iterator();
- switch (contributions.size()) {
- case 0:
- throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeEmpty.text("contributions"));
- case 1:
- return new OneContributionMergePlan(iter.next());
- case 2:
- return new TwoContributionMergePlan(iter.next(), iter.next());
- case 3:
- return new ThreeContributionMergePlan(iter.next(), iter.next(),
iter.next());
- case 4:
- return new FourContributionMergePlan(iter.next(), iter.next(),
iter.next(), iter.next());
- case 5:
- return new FiveContributionMergePlan(iter.next(), iter.next(),
iter.next(), iter.next(), iter.next());
- default:
- return new MultipleContributionMergePlan(contributions);
- }
- }
-
- public static MergePlan addContribution( MergePlan plan,
- Contribution contribution ) {
- CheckArg.isNotNull(plan, "plan");
- CheckArg.isNotNull(contribution, "contribution");
- if (plan instanceof MultipleContributionMergePlan) {
- ((MultipleContributionMergePlan)plan).addContribution(contribution);
- return plan;
- }
- MergePlan newPlan = null;
- if (plan instanceof OneContributionMergePlan) {
- newPlan = new TwoContributionMergePlan(plan.iterator().next(),
contribution);
- } else if (plan instanceof TwoContributionMergePlan) {
- Iterator<Contribution> iter = plan.iterator();
- newPlan = new ThreeContributionMergePlan(iter.next(), iter.next(),
contribution);
- } else if (plan instanceof ThreeContributionMergePlan) {
- Iterator<Contribution> iter = plan.iterator();
- newPlan = new FourContributionMergePlan(iter.next(), iter.next(),
iter.next(), contribution);
- } else if (plan instanceof FourContributionMergePlan) {
- Iterator<Contribution> iter = plan.iterator();
- newPlan = new FiveContributionMergePlan(iter.next(), iter.next(),
iter.next(), iter.next(), contribution);
- } else {
- MultipleContributionMergePlan multiPlan = new
MultipleContributionMergePlan();
- for (Contribution existingContribution : plan) {
- multiPlan.addContribution(existingContribution);
- }
- multiPlan.addContribution(contribution);
- newPlan = multiPlan;
- }
- newPlan.setAnnotations(plan.getAnnotations());
- return newPlan;
- }
-
- /**
- * Define the earliest version of this class that is supported. The Java runtime,
upon deserialization, compares the
- * serialized object's version to this, and if less than this version will throw
a {@link InvalidClassException}. If, however,
- * the serialized object's version is compatible with this class, it will be
deserialized successfully.
- * <p>
- * <a
href="http://java.sun.com/j2se/1.5.0/docs/guide/serialization/spec/v...
documentation</a> describes
- * the following changes can be made without negatively affecting the deserialization
of older versions:
- * <ul>
- * <li>Adding fields - When the class being reconstituted has a field that does
not occur in the stream, that field in the
- * object will be initialized to the default value for its type. If class-specific
initialization is needed, the class may
- * provide a readObject method that can initialize the field to nondefault
values.</i>
- * <li>Adding classes - The stream will contain the type hierarchy of each
object in the stream. Comparing this hierarchy in
- * the stream with the current class can detect additional classes. Since there is no
information in the stream from which to
- * initialize the object, the class's fields will be initialized to the default
values.</i>
- * <li>Removing classes - Comparing the class hierarchy in the stream with that
of the current class can detect that a class
- * has been deleted. In this case, the fields and objects corresponding to that class
are read from the stream. Primitive
- * fields are discarded, but the objects referenced by the deleted class are created,
since they may be referred to later in
- * the stream. They will be garbage-collected when the stream is garbage-collected or
reset.</i>
- * <li>Adding writeObject/readObject methods - If the version reading the
stream has these methods then readObject is
- * expected, as usual, to read the required data written to the stream by the default
serialization. It should call
- * defaultReadObject first before reading any optional data. The writeObject method
is expected as usual to call
- * defaultWriteObject to write the required data and then may write optional
data.</i>
- * <li>Removing writeObject/readObject methods - If the class reading the
stream does not have these methods, the required
- * data will be read by default serialization, and the optional data will be
discarded.</i>
- * <li>Adding java.io.Serializable - This is equivalent to adding types. There
will be no values in the stream for this class
- * so its fields will be initialized to default values. The support for subclassing
nonserializable classes requires that the
- * class's supertype have a no-arg constructor and the class itself will be
initialized to default values. If the no-arg
- * constructor is not available, the InvalidClassException is thrown.</i>
- * <li>Changing the access to a field - The access modifiers public, package,
protected, and private have no effect on the
- * ability of serialization to assign values to the fields.</i>
- * <li>Changing a field from static to nonstatic or transient to nontransient -
When relying on default serialization to
- * compute the serializable fields, this change is equivalent to adding a field to
the class. The new field will be written to
- * the stream but earlier classes will ignore the value since serialization will not
assign values to static or transient
- * fields.</i>
- * </ul>
- * All other kinds of modifications should be avoided.
- * </p>
- */
- private static final long serialVersionUID = 1L;
-
- private final ReadWriteLock annotationLock = new ReentrantReadWriteLock();
- private DateTime expirationTimeInUtc;
- @GuardedBy( "annotationLock" )
- private Map<Name, Property> annotations = null;
-
- /**
- * Create an empty merge plan
- */
- protected MergePlan() {
- }
-
- /**
- * Determine whether this merge plan has expired given the supplied current time. The
{@link #getExpirationTimeInUtc()
- * expiration time} is the earliest time that any of the {@link
#getContributionFrom(String) contributions}
- * {@link Contribution#getExpirationTimeInUtc()}.
- *
- * @param utcTime the current time expressed in UTC; may not be null
- * @return true if at least one contribution has expired, or false otherwise
- */
- public boolean isExpired( DateTime utcTime ) {
- assert utcTime != null;
- assert utcTime.toUtcTimeZone().equals(utcTime); // check that it is passed UTC
time
- DateTime expirationTimeInUtc = getExpirationTimeInUtc();
- return expirationTimeInUtc == null ? false :
utcTime.isAfter(expirationTimeInUtc);
- }
-
- /**
- * Get the expiration time (in UTC) that is the earliest time that any of the {@link
#getContributionFrom(String)
- * contributions} {@link Contribution#getExpirationTimeInUtc()}.
- *
- * @return the expiration time in UTC, or null if there is no known expiration time
- */
- public DateTime getExpirationTimeInUtc() {
- if (expirationTimeInUtc == null) {
- // This is computed regardless of a lock, since it's not expensive and
idempotent
- DateTime earliest = null;
- for (Contribution contribution : this) {
- DateTime contributionTime = contribution.getExpirationTimeInUtc();
- if (earliest == null || (contributionTime != null &&
contributionTime.isBefore(earliest))) {
- earliest = contributionTime;
- }
- }
- expirationTimeInUtc = earliest;
- }
- return expirationTimeInUtc;
- }
-
- /**
- * Get the contribution from the source with the supplied name. Note that
contributions always include sources that contribute
- * information and sources that contribute no information. If a source is not
included in this list, its contributions are
- * <i>unknown</i>; that is, it is unknown whether that source does or
does not contribute to the node.
- *
- * @param sourceName the name of the source
- * @return the contribution, or null if the contribution of the source is unknown
- */
- public abstract Contribution getContributionFrom( String sourceName );
-
- /**
- * Return whether the named source was consulted for a contribution.
- *
- * @param sourceName the name of the source
- * @return true if the source has some {@link Contribution contribution} (even if it
is an {@link EmptyContribution})
- */
- public abstract boolean isSource( String sourceName );
-
- public abstract int getContributionCount();
-
- /**
- * Get the number of contributions that are not placeholders or empty.
- *
- * @return the number of real contributions
- */
- public int getRealContributionCount() {
- int count = 0;
- for (Contribution contribution : this) {
- if (contribution.isPlaceholder()) continue;
- if (contribution.isEmpty()) continue;
- ++count;
- }
- return count;
- }
-
- /**
- * Get the plan annotation property with the given name. Plan annotations are custom
properties that may be set by
- * MergeProcessor implementations to store custom properties on the plan. This method
does nothing if the supplied name is
- * null
- *
- * @param name the name of the annotation
- * @return the existing annotation, or null if there is no annotation with the
supplied name
- * @see #setAnnotation(Property)
- */
- public Property getAnnotation( Name name ) {
- if (name == null) return null;
- try {
- annotationLock.readLock().lock();
- if (this.annotations == null) return null;
- return this.annotations.get(name);
- } finally {
- annotationLock.readLock().unlock();
- }
- }
-
- /**
- * Set the plan annotation property. This method replaces and returns any existing
annotation property with the same name.
- * This method also returns immediately if the supplied annotation is null.
- *
- * @param annotation the new annotation
- * @return the previous annotation property with the same name, or null if there was
no previous annotation property for the
- * name
- * @see #getAnnotation(Name)
- */
- public Property setAnnotation( Property annotation ) {
- if (annotation == null) return null;
- try {
- annotationLock.writeLock().lock();
- if (this.annotations == null) {
- this.annotations = new HashMap<Name, Property>();
- }
- return this.annotations.put(annotation.getName(), annotation);
- } finally {
- annotationLock.writeLock().unlock();
- }
- }
-
- /**
- * Get the number of annotations.
- *
- * @return the number of annotations
- */
- public int getAnnotationCount() {
- try {
- annotationLock.readLock().lock();
- if (this.annotations == null) return 0;
- return this.annotations.size();
- } finally {
- annotationLock.readLock().unlock();
- }
- }
-
- /**
- * Get the set of annotation {@link Name names}.
- *
- * @return the unmodifiable set of names, or an empty set if there are no
annotations
- */
- public Set<Name> getAnnotationNames() {
- try {
- annotationLock.readLock().lock();
- if (this.annotations == null) return Collections.emptySet();
- return Collections.unmodifiableSet(this.annotations.keySet());
- } finally {
- annotationLock.readLock().unlock();
- }
- }
-
- /**
- * Set the annotations. This
- *
- * @param annotations
- */
- protected void setAnnotations( Map<Name, Property> annotations ) {
- try {
- annotationLock.writeLock().lock();
- this.annotations = annotations == null || annotations.isEmpty() ? null :
annotations;
- } finally {
- annotationLock.writeLock().unlock();
- }
- }
-
- /**
- * Get a copy of the annotations.
- *
- * @return a copy of annotations; never null
- */
- public Map<Name, Property> getAnnotations() {
- Map<Name, Property> result = null;
- try {
- annotationLock.writeLock().lock();
- if (this.annotations != null && !this.annotations.isEmpty()) {
- result = new HashMap<Name, Property>(this.annotations);
- } else {
- result = Collections.emptyMap();
- }
- } finally {
- annotationLock.writeLock().unlock();
- }
- return result;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- boolean first = true;
- for (Contribution contribution : this) {
- if (!first) {
- first = false;
- sb.append(", ");
- }
- sb.append(contribution);
- }
- sb.append(getAnnotations());
- return sb.toString();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals( Object obj ) {
- if (obj == this) return true;
- if (obj instanceof MergePlan) {
- MergePlan that = (MergePlan)obj;
- if (this.getContributionCount() != that.getContributionCount()) return
false;
- Iterator<Contribution> thisContribution = this.iterator();
- Iterator<Contribution> thatContribution = that.iterator();
- while (thisContribution.hasNext() && thatContribution.hasNext()) {
- if (!thisContribution.next().equals(thatContribution.next())) return
false;
- }
- if (this.getAnnotationCount() != that.getAnnotationCount()) return false;
- if (!this.getAnnotations().equals(that.getAnnotations())) return false;
- return true;
- }
- return false;
- }
-
- protected boolean checkEachContributionIsFromDistinctSource() {
- Set<String> sourceNames = new HashSet<String>();
- for (Contribution contribution : this) {
- boolean added = sourceNames.add(contribution.getSourceName());
- if (!added) return false;
- }
- return true;
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/MultipleContributionMergePlan.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/MultipleContributionMergePlan.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/MultipleContributionMergePlan.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,153 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.merge;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-import net.jcip.annotations.ThreadSafe;
-import org.jboss.dna.connector.federation.contribution.Contribution;
-
-/**
- * @author Randall Hauch
- */
-@ThreadSafe
-public class MultipleContributionMergePlan extends MergePlan {
-
- private static final long serialVersionUID = 1L;
- private final List<Contribution> contributions = new
CopyOnWriteArrayList<Contribution>();
-
- /**
- * @param contributions the contributions for this merge plan
- */
- /*package*/MultipleContributionMergePlan( Contribution... contributions ) {
- assert contributions != null;
- for (int i = 0; i != contributions.length; ++i) {
- assert contributions[i] != null;
- this.contributions.add(contributions[i]);
- }
- assert checkEachContributionIsFromDistinctSource();
- }
-
- /**
- * @param contributions the contributions for this merge plan
- */
- /*package*/MultipleContributionMergePlan( Iterable<Contribution> contributions
) {
- assert contributions != null;
- for (Contribution contribution : contributions) {
- assert contribution != null;
- this.contributions.add(contribution);
- }
- assert checkEachContributionIsFromDistinctSource();
- }
-
- /**
- * @param contributions the contributions for this merge plan
- */
- /*package*/MultipleContributionMergePlan( Iterator<Contribution> contributions
) {
- assert contributions != null;
- while (contributions.hasNext()) {
- Contribution contribution = contributions.next();
- assert contribution != null;
- this.contributions.add(contribution);
- }
- assert checkEachContributionIsFromDistinctSource();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.connector.federation.merge.MergePlan#getContributionCount()
- */
- @Override
- public int getContributionCount() {
- return contributions.size();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.merge.MergePlan#getContributionFrom(java.lang.String)
- */
- @Override
- public Contribution getContributionFrom( String sourceName ) {
- for (Contribution contribution : contributions) {
- if (contribution.getSourceName().equals(sourceName)) return contribution;
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Iterable#iterator()
- */
- public Iterator<Contribution> iterator() {
- final Iterator<Contribution> iterator = this.contributions.iterator();
- return new Iterator<Contribution>() {
- public boolean hasNext() {
- return iterator.hasNext();
- }
-
- public Contribution next() {
- return iterator.next();
- }
-
- public void remove() {
- throw new UnsupportedOperationException();
- }
- };
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.merge.MergePlan#isSource(java.lang.String)
- */
- @Override
- public boolean isSource( String sourceName ) {
- for (Contribution contribution : contributions) {
- if (contribution.getSourceName().equals(sourceName)) return true;
- }
- return false;
- }
-
- /**
- * @param contribution
- */
- public void addContribution( Contribution contribution ) {
- this.contributions.add(contribution);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- return contributions.hashCode();
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/OneContributionMergePlan.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/OneContributionMergePlan.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/OneContributionMergePlan.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,116 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.merge;
-
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-import net.jcip.annotations.ThreadSafe;
-import org.jboss.dna.connector.federation.contribution.Contribution;
-
-/**
- * @author Randall Hauch
- */
-@ThreadSafe
-public class OneContributionMergePlan extends MergePlan {
-
- private static final long serialVersionUID = 1L;
- private final Contribution contribution;
-
- /**
- * @param contribution the contribution for this merge plan
- */
- /*package*/OneContributionMergePlan( Contribution contribution ) {
- assert contribution != null;
- this.contribution = contribution;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.connector.federation.merge.MergePlan#getContributionCount()
- */
- @Override
- public int getContributionCount() {
- return 1;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.merge.MergePlan#getContributionFrom(java.lang.String)
- */
- @Override
- public Contribution getContributionFrom( String sourceName ) {
- return isSource(sourceName) ? contribution : null;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Iterable#iterator()
- */
- public Iterator<Contribution> iterator() {
- return new Iterator<Contribution>() {
- private boolean next = true;
-
- public boolean hasNext() {
- return next;
- }
-
- @SuppressWarnings( "synthetic-access" )
- public Contribution next() {
- if (next) {
- next = false;
- return contribution;
- }
- throw new NoSuchElementException();
- }
-
- public void remove() {
- throw new UnsupportedOperationException();
- }
- };
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.merge.MergePlan#isSource(java.lang.String)
- */
- @Override
- public boolean isSource( String sourceName ) {
- return contribution.getSourceName().equals(sourceName);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- return contribution.hashCode();
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/ThreeContributionMergePlan.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/ThreeContributionMergePlan.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/ThreeContributionMergePlan.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,142 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.merge;
-
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-import net.jcip.annotations.ThreadSafe;
-import org.jboss.dna.common.util.HashCode;
-import org.jboss.dna.connector.federation.contribution.Contribution;
-
-/**
- * @author Randall Hauch
- */
-@ThreadSafe
-public class ThreeContributionMergePlan extends MergePlan {
-
- private static final long serialVersionUID = 1L;
- private final Contribution contribution1;
- private final Contribution contribution2;
- private final Contribution contribution3;
-
- /**
- * @param contribution1 the first contribution for this merge plan
- * @param contribution2 the second contribution for this merge plan
- * @param contribution3 the third contribution for this merge plan
- */
- /*package*/ThreeContributionMergePlan( Contribution contribution1,
- Contribution contribution2,
- Contribution contribution3 ) {
- assert contribution1 != null;
- assert contribution2 != null;
- assert contribution3 != null;
- this.contribution1 = contribution1;
- this.contribution2 = contribution2;
- this.contribution3 = contribution3;
- assert checkEachContributionIsFromDistinctSource();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.connector.federation.merge.MergePlan#getContributionCount()
- */
- @Override
- public int getContributionCount() {
- return 3;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.merge.MergePlan#getContributionFrom(java.lang.String)
- */
- @Override
- public Contribution getContributionFrom( String sourceName ) {
- if (contribution1.getSourceName().equals(sourceName)) return contribution1;
- if (contribution2.getSourceName().equals(sourceName)) return contribution2;
- if (contribution3.getSourceName().equals(sourceName)) return contribution3;
- return null;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Iterable#iterator()
- */
- public Iterator<Contribution> iterator() {
- return new Iterator<Contribution>() {
- private int next = 3;
-
- public boolean hasNext() {
- return next > 0;
- }
-
- @SuppressWarnings( "synthetic-access" )
- public Contribution next() {
- if (next == 3) {
- next = 2;
- return contribution1;
- }
- if (next == 2) {
- next = 1;
- return contribution2;
- }
- if (next == 1) {
- next = 0;
- return contribution3;
- }
- throw new NoSuchElementException();
- }
-
- public void remove() {
- throw new UnsupportedOperationException();
- }
- };
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.merge.MergePlan#isSource(java.lang.String)
- */
- @Override
- public boolean isSource( String sourceName ) {
- if (contribution1.getSourceName().equals(sourceName)) return true;
- if (contribution2.getSourceName().equals(sourceName)) return true;
- if (contribution3.getSourceName().equals(sourceName)) return true;
- return false;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- return HashCode.compute(contribution1, contribution2, contribution3);
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/TwoContributionMergePlan.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/TwoContributionMergePlan.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/TwoContributionMergePlan.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,129 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.merge;
-
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-import net.jcip.annotations.ThreadSafe;
-import org.jboss.dna.common.util.HashCode;
-import org.jboss.dna.connector.federation.contribution.Contribution;
-
-/**
- * @author Randall Hauch
- */
-@ThreadSafe
-public class TwoContributionMergePlan extends MergePlan {
-
- private static final long serialVersionUID = 1L;
- private final Contribution contribution1;
- private final Contribution contribution2;
-
- /**
- * @param contribution1 the first contribution for this merge plan
- * @param contribution2 the second contribution for this merge plan
- */
- /*package*/TwoContributionMergePlan( Contribution contribution1,
- Contribution contribution2 ) {
- assert contribution1 != null;
- assert contribution2 != null;
- this.contribution1 = contribution1;
- this.contribution2 = contribution2;
- assert checkEachContributionIsFromDistinctSource();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.connector.federation.merge.MergePlan#getContributionCount()
- */
- @Override
- public int getContributionCount() {
- return 2;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.merge.MergePlan#getContributionFrom(java.lang.String)
- */
- @Override
- public Contribution getContributionFrom( String sourceName ) {
- if (contribution1.getSourceName().equals(sourceName)) return contribution1;
- if (contribution2.getSourceName().equals(sourceName)) return contribution2;
- return null;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Iterable#iterator()
- */
- public Iterator<Contribution> iterator() {
- return new Iterator<Contribution>() {
- private int next = 2;
-
- public boolean hasNext() {
- return next > 0;
- }
-
- @SuppressWarnings( "synthetic-access" )
- public Contribution next() {
- if (next == 2) {
- next = 1;
- return contribution1;
- }
- if (next == 1) {
- next = 0;
- return contribution2;
- }
- throw new NoSuchElementException();
- }
-
- public void remove() {
- throw new UnsupportedOperationException();
- }
- };
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.merge.MergePlan#isSource(java.lang.String)
- */
- @Override
- public boolean isSource( String sourceName ) {
- return contribution1.getSourceName().equals(sourceName) ||
contribution2.getSourceName().equals(sourceName);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- return HashCode.compute(contribution1, contribution2);
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/strategy/MergeStrategy.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/strategy/MergeStrategy.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/strategy/MergeStrategy.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,47 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.merge.strategy;
-
-import java.util.List;
-import org.jboss.dna.connector.federation.contribution.Contribution;
-import org.jboss.dna.connector.federation.merge.FederatedNode;
-import org.jboss.dna.graph.ExecutionContext;
-
-/**
- * @author Randall Hauch
- */
-public interface MergeStrategy {
-
- /**
- * Merge the contributions into a single
- *
- * @param federatedNode the federated node into which the contributions are to be
merged; never null
- * @param contributions the contributions to the node; never null, never empty, and
never containing nulls
- * @param context the context in which this operation is to be performed; never null
- */
- public void merge( FederatedNode federatedNode,
- List<Contribution> contributions,
- ExecutionContext context );
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/strategy/OneContributionMergeStrategy.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/strategy/OneContributionMergeStrategy.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/strategy/OneContributionMergeStrategy.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,150 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.merge.strategy;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.UUID;
-import net.jcip.annotations.ThreadSafe;
-import org.jboss.dna.connector.federation.contribution.Contribution;
-import org.jboss.dna.connector.federation.merge.FederatedNode;
-import org.jboss.dna.connector.federation.merge.MergePlan;
-import org.jboss.dna.graph.DnaLexicon;
-import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.property.Path;
-import org.jboss.dna.graph.property.PathFactory;
-import org.jboss.dna.graph.property.Property;
-import org.jboss.dna.graph.property.ValueFormatException;
-
-/**
- * A merge strategy that is optimized for merging when there is a single contribution.
- *
- * @author Randall Hauch
- */
-@ThreadSafe
-public class OneContributionMergeStrategy implements MergeStrategy {
-
- /**
- * {@inheritDoc}
- * <p>
- * This method only uses the one and only one non-null {@link Contribution} in the
<code>contributions</code>.
- * </p>
- *
- * @see
org.jboss.dna.connector.federation.merge.strategy.MergeStrategy#merge(org.jboss.dna.connector.federation.merge.FederatedNode,
- * java.util.List, org.jboss.dna.graph.ExecutionContext)
- */
- public void merge( FederatedNode federatedNode,
- List<Contribution> contributions,
- ExecutionContext context ) {
- assert federatedNode != null;
- assert context != null;
- assert contributions != null;
- assert contributions.size() > 0;
- Contribution contribution = contributions.get(0);
- assert contribution != null;
- final PathFactory pathFactory = context.getValueFactories().getPathFactory();
- Location location = federatedNode.getActualLocationOfNode();
-
- // Copy the children ...
- Iterator<Location> childIterator = contribution.getChildren();
- while (childIterator.hasNext()) {
- Location child = translateChildFromSourceToRepository(pathFactory, location,
childIterator.next());
- federatedNode.addChild(child);
- }
-
- // Copy the properties ...
- Property uuidProperty = null;
- Property dnaUuidProperty = null;
- Iterator<Property> propertyIterator = contribution.getProperties();
- while (propertyIterator.hasNext()) {
- Property property = propertyIterator.next();
- federatedNode.addProperty(property);
- if (property.isSingle()) {
- if (property.getName().equals(DnaLexicon.UUID) &&
hasUuidValue(context, property)) {
- dnaUuidProperty = property;
- } else if (property.getName().getLocalName().equals("uuid")
&& hasUuidValue(context, property)) {
- uuidProperty = property;
- }
- }
- }
- if (dnaUuidProperty != null) uuidProperty = dnaUuidProperty; // use
"dna:uuid" if there is one
-
- if (federatedNode.at().getUuid() != null) {
- federatedNode.setActualLocationOfNode(federatedNode.at());
- } else {
- // Look for the UUID property on the properties, and update the federated
node ...
- if (uuidProperty != null && !uuidProperty.isEmpty()) {
- UUID uuid =
context.getValueFactories().getUuidFactory().create(uuidProperty.getFirstValue());
- uuidProperty = context.getPropertyFactory().create(DnaLexicon.UUID,
uuid); // Use the "dna:uuid" name
-
federatedNode.setActualLocationOfNode(federatedNode.at().with(uuidProperty));
- } else {
- // Make sure there's a UUID for an identification property ...
- if (location.getUuid() == null) {
- location = location.with(UUID.randomUUID());
- }
- // Set the UUID as a property (it wasn't set already) ...
- uuidProperty = location.getIdProperty(DnaLexicon.UUID);
- assert uuidProperty != null; // there should be one!
- federatedNode.addProperty(uuidProperty);
- federatedNode.setActualLocationOfNode(location);
- }
- }
-
- // Assign the merge plan ...
- MergePlan mergePlan = MergePlan.create(contributions);
- federatedNode.setMergePlan(mergePlan);
- Property mergePlanProperty =
context.getPropertyFactory().create(DnaLexicon.MERGE_PLAN, (Object)mergePlan);
- federatedNode.addProperty(mergePlanProperty);
- }
-
- private boolean hasUuidValue( ExecutionContext context,
- Property property ) {
- try {
-
context.getValueFactories().getUuidFactory().create(property.getFirstValue());
- return true;
- } catch (ValueFormatException e) {
- return false;
- }
- }
-
- /**
- * Utility method to translate the list of locations of the children so that the
locations all are correctly relative to
- * parent location of the federated node.
- *
- * @param factory the path factory
- * @param parent the parent of the child
- * @param childInSource the child to be translated, with a source-specific location
- * @return the list of locations of each child
- */
- protected Location translateChildFromSourceToRepository( PathFactory factory,
- Location parent,
- Location childInSource ) {
- // Convert the locations of the children (relative to the source) to be relative
to this node
- Path parentPath = parent.getPath();
- if (parentPath == null) return childInSource;
- Path newPath = factory.create(parentPath,
childInSource.getPath().getLastSegment());
- return childInSource.with(newPath);
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/strategy/SimpleMergeStrategy.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/strategy/SimpleMergeStrategy.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/strategy/SimpleMergeStrategy.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,373 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.merge.strategy;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.UUID;
-import net.jcip.annotations.ThreadSafe;
-import org.jboss.dna.connector.federation.contribution.Contribution;
-import org.jboss.dna.connector.federation.merge.FederatedNode;
-import org.jboss.dna.connector.federation.merge.MergePlan;
-import org.jboss.dna.graph.DnaLexicon;
-import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.property.Name;
-import org.jboss.dna.graph.property.Path;
-import org.jboss.dna.graph.property.PathFactory;
-import org.jboss.dna.graph.property.Property;
-import org.jboss.dna.graph.property.PropertyFactory;
-import org.jboss.dna.graph.property.ValueComparators;
-
-/**
- * This merge strategy simply merges all of the contributions' properties and
combines the children according to the order of the
- * contributions. No children are merged, and all properties are used (except if they are
deemed to be duplicates of the property
- * in other contributions).
- *
- * @author Randall Hauch
- */
-@ThreadSafe
-public class SimpleMergeStrategy implements MergeStrategy {
-
- private boolean removeDuplicateProperties = true;
-
- /**
- * @return removeDuplicateProperties
- */
- public boolean isRemoveDuplicateProperties() {
- return removeDuplicateProperties;
- }
-
- /**
- * @param removeDuplicateProperties Sets removeDuplicateProperties to the specified
value.
- */
- public void setRemoveDuplicateProperties( boolean removeDuplicateProperties ) {
- this.removeDuplicateProperties = removeDuplicateProperties;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.connector.federation.merge.strategy.MergeStrategy#merge(org.jboss.dna.connector.federation.merge.FederatedNode,
- * java.util.List, org.jboss.dna.graph.ExecutionContext)
- */
- public void merge( FederatedNode federatedNode,
- List<Contribution> contributions,
- ExecutionContext context ) {
- assert federatedNode != null;
- assert context != null;
- assert contributions != null;
- assert contributions.size() > 0;
-
- final Location location = federatedNode.getActualLocationOfNode();
- final boolean isRoot = location.hasPath() &&
location.getPath().isRoot();
- final boolean removeDuplicateProperties = isRemoveDuplicateProperties();
- final PathFactory pathFactory = context.getValueFactories().getPathFactory();
- final Map<Name, Integer> childNames = new HashMap<Name, Integer>();
- final Map<Name, Property> properties =
federatedNode.getPropertiesByName();
- properties.clear();
-
- // Record the different ID properties from the federated node and (later) from
each contribution
- final Map<Name, Property> idProperties = new HashMap<Name,
Property>();
- for (Property idProperty : location) {
- idProperties.put(idProperty.getName(), idProperty);
- }
-
- // Iterate over each of the contributions (in order) ...
- for (Contribution contribution : contributions) {
- if (contribution.isEmpty()) continue;
- // If the contribution is a placeholder contribution, then the children
should be merged into other children ...
- if (contribution.isPlaceholder()) {
- // Iterate over the children and add only if there is not already one
...
- Iterator<Location> childIterator = contribution.getChildren();
- while (childIterator.hasNext()) {
- Location child = childIterator.next();
- Name childName = child.getPath().getLastSegment().getName();
- if (!childNames.containsKey(childName)) {
- childNames.put(childName, 1);
- Path pathToChild = pathFactory.create(location.getPath(),
childName);
- federatedNode.addChild(child.with(pathToChild));
- }
- }
- } else {
- // Get the identification properties for each contribution ...
- Location contributionLocation = contribution.getLocationInSource();
- for (Property idProperty : contributionLocation) {
- // Record the property ...
- Property existing = properties.put(idProperty.getName(),
idProperty);
- if (existing != null) {
- // There's already an existing property, so we need to merge
them ...
- Property merged = merge(existing, idProperty,
context.getPropertyFactory(), removeDuplicateProperties);
- properties.put(merged.getName(), merged);
- }
- }
-
- // Accumulate the children ...
- Iterator<Location> childIterator = contribution.getChildren();
- while (childIterator.hasNext()) {
- Location child = childIterator.next();
- Name childName = child.getPath().getLastSegment().getName();
- int index = Path.DEFAULT_INDEX;
- Integer previous = childNames.put(childName, 1);
- if (previous != null) {
- int previousValue = previous.intValue();
- // Correct the index in the child name map ...
- childNames.put(childName, ++previousValue);
- index = previousValue;
- }
- Path pathToChild = pathFactory.create(location.getPath(), childName,
index);
- federatedNode.addChild(child.with(pathToChild)); // keep the same
identifiers
- }
-
- // Add in the properties ...
- Iterator<Property> propertyIter = contribution.getProperties();
- while (propertyIter.hasNext()) {
- Property property = propertyIter.next();
- // Skip the "uuid" property on all root nodes ...
- if (isRoot &&
property.getName().getLocalName().equals("uuid")) continue;
-
- // Record the property ...
- Property existing = properties.put(property.getName(), property);
- if (existing != null && !existing.equals(property)) {
- // There's already an existing property, so we need to merge
them ...
- Property merged = merge(existing, property,
context.getPropertyFactory(), removeDuplicateProperties);
- properties.put(property.getName(), merged);
- }
- }
- }
- }
-
- if (idProperties.size() != 0) {
- // Update the location based upon the merged ID properties ...
- Location newLocation = location;
- for (Property idProperty : idProperties.values()) {
- newLocation = newLocation.with(idProperty);
- }
- federatedNode.setActualLocationOfNode(newLocation);
- } else {
- Location newLocation = location.with(UUID.randomUUID());
- federatedNode.setActualLocationOfNode(newLocation);
- }
-
- // Look for the UUID property on the location, and update the federated node ...
- Property uuidProperty =
federatedNode.getActualLocationOfNode().getIdProperty(DnaLexicon.UUID);
- assert uuidProperty != null;
- properties.put(uuidProperty.getName(), uuidProperty);
-
- // Assign the merge plan ...
- MergePlan mergePlan = MergePlan.create(contributions);
- federatedNode.setMergePlan(mergePlan);
- Property mergePlanProperty =
context.getPropertyFactory().create(DnaLexicon.MERGE_PLAN, (Object)mergePlan);
- properties.put(mergePlanProperty.getName(), mergePlanProperty);
- }
-
- /**
- * Merge the values from the two properties with the same name, returning a new
property with the newly merged values.
- * <p>
- * The current algorithm merges the values by concatenating the values from
<code>property1</code> and <code>property2</code>,
- * and if <code>removeDuplicates</code> is true any values in
<code>property2</code> that are identical to values found in
- * <code>property1</code> are skipped.
- * </p>
- *
- * @param property1 the first property; may not be null, and must have the same
{@link Property#getName() name} as
- * <code>property2</code>
- * @param property2 the second property; may not be null, and must have the same
{@link Property#getName() name} as
- * <code>property1</code>
- * @param factory the property factory, used to create the result
- * @param removeDuplicates true if this method removes any values in the second
property that duplicate values found in the
- * first property.
- * @return the property that contains the same {@link Property#getName() name} as the
input properties, but with values that
- * are merged from both of the input properties
- */
- protected Property merge( Property property1,
- Property property2,
- PropertyFactory factory,
- boolean removeDuplicates ) {
- assert property1 != null;
- assert property2 != null;
- assert property1.getName().equals(property2.getName());
- if (property1.isEmpty()) return property2;
- if (property2.isEmpty()) return property1;
-
- // If they are both single-valued, then we can use a more efficient algorithm
...
- if (property1.isSingle() && property2.isSingle()) {
- Object value1 = property1.getValues().next();
- Object value2 = property2.getValues().next();
- if (removeDuplicates &&
ValueComparators.OBJECT_COMPARATOR.compare(value1, value2) == 0) return property1;
- return factory.create(property1.getName(), new Object[] {value1, value2});
- }
-
- // One or both properties are multi-valued, so use an algorithm that works with
in all cases ...
- if (!removeDuplicates) {
- Iterator<?> valueIterator = new DualIterator(property1.getValues(),
property2.getValues());
- return factory.create(property1.getName(), valueIterator);
- }
-
- // First copy all the values from property 1 ...
- Object[] values = new Object[property1.size() + property2.size()];
- int index = 0;
- for (Object property1Value : property1) {
- values[index++] = property1Value;
- }
- assert index == property1.size();
- // Now add any values of property2 that don't match a value in property1 ...
- for (Object property2Value : property2) {
- // Brute force, go through the values of property1 and compare ...
- boolean matched = false;
- for (Object property1Value : property1) {
- if (ValueComparators.OBJECT_COMPARATOR.compare(property1Value,
property2Value) == 0) {
- // The values are the same ...
- matched = true;
- break;
- }
- }
- if (!matched) values[index++] = property2Value;
- }
- if (index != values.length) {
- Object[] newValues = new Object[index];
- System.arraycopy(values, 0, newValues, 0, index);
- values = newValues;
- }
- return factory.create(property1.getName(), values);
- }
-
- protected static class DualIterator implements Iterator<Object> {
-
- private final Iterator<?>[] iterators;
- private Iterator<?> current;
- private int index = 0;
-
- protected DualIterator( Iterator<?>... iterators ) {
- assert iterators != null;
- assert iterators.length > 0;
- this.iterators = iterators;
- this.current = this.iterators[0];
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.util.Iterator#hasNext()
- */
- public boolean hasNext() {
- if (this.current != null) return this.current.hasNext();
- return false;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.util.Iterator#next()
- */
- public Object next() {
- while (this.current != null) {
- if (this.current.hasNext()) return this.current.next();
- // Get the next iterator ...
- if (++this.index < iterators.length) {
- this.current = this.iterators[this.index];
- } else {
- this.current = null;
- }
- }
- throw new NoSuchElementException();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.util.Iterator#remove()
- */
- public void remove() {
- throw new UnsupportedOperationException();
- }
- }
-
- protected static class Child {
- private final Location location;
- private final boolean placeholder;
-
- protected Child( Location location,
- boolean placeholder ) {
- assert location != null;
- this.location = location;
- this.placeholder = placeholder;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- return location.hasIdProperties() ? location.getIdProperties().hashCode() :
location.getPath()
-
.getLastSegment()
-
.getName()
-
.hashCode();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals( Object obj ) {
- if (obj == this) return true;
- if (obj instanceof Child) {
- Child that = (Child)obj;
- if (this.placeholder && that.placeholder) {
- // If both are placeholders, then compare just the name ...
- assert this.location.hasPath();
- assert that.location.hasPath();
- Name thisName = this.location.getPath().getLastSegment().getName();
- Name thatName = that.location.getPath().getLastSegment().getName();
- return thisName.equals(thatName);
- }
- if (location.hasIdProperties() &&
that.location.hasIdProperties()) {
- List<Property> thisIds = location.getIdProperties();
- List<Property> thatIds = that.location.getIdProperties();
- if (thisIds.size() != thatIds.size()) return false;
- return thisIds.containsAll(thatIds);
- }
- // One or both do not have identification properties, so delegate to the
locations...
- return this.location.equals(that.location);
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return location.toString();
- }
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/main/resources/org/jboss/dna/connector/federation/FederationI18n.properties
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/resources/org/jboss/dna/connector/federation/FederationI18n.properties 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/main/resources/org/jboss/dna/connector/federation/FederationI18n.properties 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,42 +0,0 @@
-#
-# JBoss DNA (
http://www.jboss.org/dna)
-# See the COPYRIGHT.txt file distributed with this work for information
-# regarding copyright ownership. Some portions may be licensed
-# to Red Hat, Inc. under one or more contributor license agreements.
-# See the AUTHORS.txt file in the distribution for a full listing of
-# individual contributors.
-#
-# JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
-# is licensed to you under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2.1 of
-# the License, or (at your option) any later version.
-#
-# JBoss DNA is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this software; if not, write to the Free
-# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-# 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-#
-requiredNodeDoesNotExistRelativeToNode = The required node "{0}" does not exist
relative to "{1}" in "{2}" workspace in the "{3}"
repository
-propertyIsRequired = The {0} property is required but has no value
-nodeDoesNotExistAtPath = No node exists at {0} (or below {1})
-nodeDoesNotExistAtLocation = No node exists at {0}
-errorRemovingNodeFromCache = Error while removing {0} from cache
-
-unableToCreateExecutionContext = Unable to create ExecutionContext for connection to the
"{0}" federated repository when using security domain "{1}"
-federatedRepositoryCannotBeFound = The "{0}" federated repository cannot be
found
-unableToAuthenticateConnectionToFederatedRepository = Unable to authenticate
"{1}" for federated repository "{0}"
-repositoryHasBeenShutDown = The "{0}" federated repository has been shut down
and may no longer be used.
-errorAddingProjectionRuleParseMethod = Error while adding a parsing method for a
federation projection rule
-pathInProjection = path "{0}" in projection {1}
-pathsInProjection = paths "{0}" in projection {1}
-unableToPerformOperationUnlessLocationIsFromSingleProjection = The node "{0}"
in workspace "{1}" must be within a single projection for this operation to
succeed, but is in {2}
-unableToPerformOperationUnlessLocationsAreFromSingleProjection = The nodes
"{0}" and "{1}" in workspace "{2}" must both be within a
single projection for this operation to succeed, but come from projections "{3}"
and "{4}"
-unableToPerformOperationSpanningWorkspaces = Unable to perform operation spanning
workspaces ("{0}" and "{1}")
-
-workspaceDoesNotExist = The "{0}" federated repository does not have a
workspace named "{1}"
-noDefaultWorkspace = The "{0}" federated repository does not have a default
workspace
\ No newline at end of file
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositoryConnectionTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositoryConnectionTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositoryConnectionTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,95 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.stub;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import java.util.concurrent.TimeUnit;
-import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.connector.RepositorySourceException;
-import org.jboss.dna.graph.request.Request;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.MockitoAnnotations;
-import org.mockito.MockitoAnnotations.Mock;
-
-/**
- * @author Randall Hauch
- */
-public class FederatedRepositoryConnectionTest {
-
- private FederatedRepositoryConnection connection;
- private String sourceName;
- @Mock
- private FederatedRepositorySource source;
- @Mock
- private FederatedRepository repository;
-
- @Before
- public void beforeEach() {
- MockitoAnnotations.initMocks(this);
- sourceName = "Source X";
- stub(source.getName()).toReturn(sourceName);
- connection = new FederatedRepositoryConnection(repository, sourceName);
- }
-
- @Test
- public void shouldHaveRepository() {
- assertThat(connection.getRepository(), is(repository));
- }
-
- @Test
- public void shouldHaveNoXaResource() {
- assertThat(connection.getXAResource(), is(nullValue()));
- }
-
- @Test
- public void shouldCheckRepositoryAdminsStartedStateForPingResult() {
- stub(repository.isRunning()).toReturn(true);
- assertThat(connection.ping(1, TimeUnit.SECONDS), is(true));
- verify(repository, times(1)).isRunning();
- }
-
- @Test( expected = RepositorySourceException.class )
- public void shouldFailExecutionIfRepositoryAdminsIsNotStarted() throws Exception {
- stub(repository.isRunning()).toReturn(false);
- ExecutionContext context = mock(ExecutionContext.class);
- Request request = mock(Request.class);
- connection.execute(context, request);
- }
-
- @Test
- public void shouldReturnImmediatelyWhenExecutingNullRequest() throws Exception {
- stub(repository.isRunning()).toReturn(true);
- ExecutionContext context = mock(ExecutionContext.class);
- connection.execute(context, null);
- verify(repository, times(1)).isRunning();
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositorySourceIntegrationTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositorySourceIntegrationTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositorySourceIntegrationTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,396 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.notNullValue;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-import static org.junit.matchers.JUnitMatchers.hasItems;
-import static org.mockito.Matchers.argThat;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.stub;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import java.util.ArrayList;
-import java.util.List;
-import javax.naming.Context;
-import org.jboss.dna.graph.DnaLexicon;
-import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.Graph;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.SecurityContext;
-import org.jboss.dna.graph.connector.RepositoryConnection;
-import org.jboss.dna.graph.connector.RepositoryConnectionFactory;
-import org.jboss.dna.graph.connector.RepositoryContext;
-import org.jboss.dna.graph.connector.RepositorySource;
-import org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource;
-import org.jboss.dna.graph.property.Path;
-import org.jboss.dna.graph.property.PathNotFoundException;
-import org.jboss.dna.graph.property.Property;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.mockito.ArgumentMatcher;
-import org.mockito.MockitoAnnotations;
-import org.mockito.MockitoAnnotations.Mock;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-
-/**
- * This JUnit test constructs a federated repository of multiple repository sources, and
is basically a lightweight integration
- * test that uses all of the actual components of a {@link FederatedRepository} but using
mock or fake components for other
- * systems.
- *
- * @author Randall Hauch
- */
-@Ignore
-public class FederatedRepositorySourceIntegrationTest {
-
- private FederatedRepositorySource source;
- private String sourceName;
- private String username;
- private String credentials;
- private String executionContextFactoryJndiName;
- private String repositoryConnectionFactoryJndiName;
- private String configurationSourceName;
- private String securityDomain;
- private Graph config;
- private InMemoryRepositorySource configSource;
- private Graph cache;
- private InMemoryRepositorySource cacheSource;
- private Graph repository1;
- private InMemoryRepositorySource source1;
- private Graph repository2;
- private InMemoryRepositorySource source2;
- private ExecutionContext context;
- private RepositorySource[] sources;
- @Mock
- private Context jndiContext;
- @Mock
- private RepositoryConnectionFactory connectionFactory;
- @Mock
- private ExecutionContext executionContextFactory;
- @Mock
- private RepositoryContext repositoryContext;
-
- @Before
- public void beforeEach() throws Exception {
- MockitoAnnotations.initMocks(this);
-
- // Set up the environment (ExecutionContext, JNDI, security, etc.)
- context = new ExecutionContext();
- context.getNamespaceRegistry().register(DnaLexicon.Namespace.PREFIX,
DnaLexicon.Namespace.URI);
- executionContextFactoryJndiName = "context factory jndi name";
- repositoryConnectionFactoryJndiName = "repository connection factory jndi
name";
- configurationSourceName = "configuration source name";
- securityDomain = "security domain";
-
stub(jndiContext.lookup(executionContextFactoryJndiName)).toReturn(executionContextFactory);
-
stub(jndiContext.lookup(repositoryConnectionFactoryJndiName)).toReturn(connectionFactory);
- stub(executionContextFactory.with(anySecurityContext())).toReturn(context);
- stub(repositoryContext.getExecutionContext()).toReturn(executionContextFactory);
-
stub(repositoryContext.getRepositoryConnectionFactory()).toReturn(connectionFactory);
-
- // Set up the federated repository source ...
- source = new FederatedRepositorySource("Test Repository");
- sourceName = "federated source";
- username = "valid username";
- credentials = "valid password";
- source.setName(sourceName);
- source.setUsername(username);
- source.setPassword(credentials);
- source.setConfigurationSourceName(configurationSourceName);
- source.setConfigurationWorkspaceName("configSpace");
- source.setConfigurationSourcePath("/repos/RepoX");
- source.setSecurityDomain(securityDomain);
- source.initialize(repositoryContext);
-
- // Set up the configuration repository with its content ...
- configSource = new InMemoryRepositorySource();
- configSource.setName(configurationSourceName);
- config = Graph.create(configSource, context);
-
- // Set up the cache repository ...
- cacheSource = new InMemoryRepositorySource();
- cacheSource.setName("cache source");
- cache = Graph.create(cacheSource, context);
-
- // Set up the first source repository ...
- source1 = new InMemoryRepositorySource();
- source1.setName("source 1");
- repository1 = Graph.create(source1, context);
-
- // Set up the second source repository ...
- source2 = new InMemoryRepositorySource();
- source2.setName("source 2");
- repository2 = Graph.create(source2, context);
-
- // Set up the connection factory to return connections to the sources ...
- sources = new RepositorySource[] {spy(configSource), spy(cacheSource),
spy(source1), spy(source2)};
- for (final RepositorySource source : sources) {
- stub(connectionFactory.createConnection(source.getName())).toAnswer(new
Answer<RepositoryConnection>() {
- public RepositoryConnection answer( InvocationOnMock invocation ) throws
Throwable {
- return source.getConnection();
- }
- });
- }
- }
-
- protected static SecurityContext anySecurityContext() {
- return argThat(new ArgumentMatcher<SecurityContext>() {
- @Override
- public boolean matches( Object callback ) {
- return callback != null;
- }
- });
- }
-
- protected void assertNonExistant( Graph source,
- String path ) throws Exception {
- try {
- source.getNodeAt(path);
- fail("failed to find node in " + source + " in workspace
" + source.getCurrentWorkspaceName() + " at " + path);
- } catch (PathNotFoundException e) {
- // expected
- }
- }
-
- protected void assertChildren( Graph source,
- String path,
- String... children ) throws Exception {
- List<Location> childLocations = source.getChildren().of(path);
- if (children == null || children.length == 0) {
- assertThat(childLocations.isEmpty(), is(true));
- } else {
- // We can't use Location.equals(...), since we're only given the
expected paths and the actual
- // locations may have more than just paths. So, create a list of actual
locations that just have paths ...
- List<Location> actualPathOnlyChildren = new
ArrayList<Location>(childLocations.size());
- for (Location actualChild : childLocations) {
- actualPathOnlyChildren.add(Location.create(actualChild.getPath()));
- }
- // Now create the array of expected locations (that each contain only a path)
...
- Location[] expectedChildren = new Location[children.length];
- Path parentPath = context.getValueFactories().getPathFactory().create(path);
- int i = 0;
- for (String child : children) {
- Path.Segment segment =
context.getValueFactories().getPathFactory().createSegment(child);
- Path childPath =
context.getValueFactories().getPathFactory().create(parentPath, segment);
- expectedChildren[i++] = Location.create(childPath);
- }
- assertThat(actualPathOnlyChildren, hasItems(expectedChildren));
- }
- }
-
- protected void assertProperty( Graph source,
- String path,
- String propertyName,
- Object... values ) throws Exception {
- Property property = source.getProperty(propertyName).on(path);
- assertThat(property.getValuesAsArray(), is(values));
- }
-
- @Test
- public void shouldReturnCorrectConnectionForEachRepositorySource() throws Exception
{
- for (final RepositorySource source : sources) {
- // Get a connection from the factory ...
- RepositoryConnection connection =
connectionFactory.createConnection(source.getName());
- assertThat(connection, is(notNullValue()));
- // And check that the connection is for the correct source ...
- assertThat(connection.getSourceName(), is(source.getName()));
- // And close the connection (no need to do this in a finally, since it's
a SimpleRepository)
- connection.close();
- }
- // Now, assert that each source created one connection ...
- for (final RepositorySource source : sources) {
- verify(source, times(1)).getConnection();
- }
- }
-
- @Test
- public void
shouldProvideReadAccessToContentFederatedFromOneSourceThatMatchesTheContentFromTheSource()
throws Exception {
- // Set up the configuration to use a single source.
- config.createWorkspace().named("configSpace");
- Graph.Batch batch = config.batch();
- batch.create("/repos").and();
-
batch.create("/repos/RepoX").with(FederatedLexicon.DEFAULT_WORKSPACE_NAME,
"fedSpace").and();
- batch.create("/repos/RepoX/dna:workspaces").and();
- batch.create("/repos/RepoX/dna:workspaces/fedSpace").and();
- batch.create("/repos/RepoX/dna:workspaces/fedSpace/dna:cache")
- .with(FederatedLexicon.PROJECTION_RULES, "/ => /")
- .with(FederatedLexicon.SOURCE_NAME, "cache source")
- .with(FederatedLexicon.WORKSPACE_NAME, "cacheSpace")
- .with(FederatedLexicon.TIME_TO_EXPIRE, 100000)
- .and();
-
batch.create("/repos/RepoX/dna:workspaces/fedSpace/dna:projections").and();
-
batch.create("/repos/RepoX/dna:workspaces/fedSpace/dna:projections/projection1")
- .with(FederatedLexicon.PROJECTION_RULES, "/ => /s1")
- .with(FederatedLexicon.SOURCE_NAME, "source 1")
- .with(FederatedLexicon.WORKSPACE_NAME, "s1 workspace")
- .and();
- batch.execute();
-
- // Set up the cache ...
- cache.createWorkspace().named("cacheSpace");
-
- // Set up the content in the first source ...
- repository1.createWorkspace().named("s1 workspace");
- batch = repository1.batch();
- batch.create("/s1").and();
- batch.create("/s1/a").and();
- batch.create("/s1/a/a").and();
- batch.create("/s1/a/a/a").with("desc", "description for
/a/a/a").and();
- batch.create("/s1/a/a/b").with("desc", "description for
/a/a/b").and();
- batch.create("/s1/a/a/c").with("desc", "description for
/a/a/c").and();
- batch.create("/s1/a/b").and();
- batch.create("/s1/a/b/a").with("desc", "description for
/a/b/a").and();
- batch.create("/s1/a/b/b").with("desc", "description for
/a/b/b").and();
- batch.create("/s1/a/b/c").with("desc", "description for
/a/b/c").and();
- batch.create("/s1/b").and();
- batch.create("/s1/b/a").with("desc", "description for
/b/a").and();
- batch.create("/s1/b/b").with("desc", "description for
/b/b").and();
- batch.create("/s1/b/c").with("desc", "description for
/b/c").and();
- batch.execute();
-
- // Create a connection to the federated repository. Doing so will read the config
information.
- Graph source = Graph.create(this.source, context);
- source.useWorkspace("fedSpace");
- assertChildren(source, "/", "a", "b");
- assertChildren(source, "/a/", "a", "b");
- assertChildren(source, "/a/a", "a", "b",
"c");
- assertChildren(source, "/a/a/a");
- assertChildren(source, "/a/a/b");
- assertChildren(source, "/a/a/c");
- assertChildren(source, "/a/b", "a", "b",
"c");
- assertChildren(source, "/a/b/a");
- assertChildren(source, "/a/b/b");
- assertChildren(source, "/a/b/c");
- assertChildren(source, "/b", "a", "b",
"c");
- assertChildren(source, "/b/a");
- assertChildren(source, "/b/b");
- assertChildren(source, "/b/c");
- }
-
- @Test
- public void shouldProvideReadAccessToContentFederatedFromMultipleSources() throws
Exception {
- // Set up the configuration to use multiple sources.
- config.createWorkspace().named("configSpace");
- Graph.Batch batch = config.batch();
- batch.create("/repos").and();
- batch.create("/repos/RepoX").and();
- batch.create("/repos/RepoX/dna:workspaces").and();
- batch.create("/repos/RepoX/dna:workspaces/fedSpace").and();
- batch.create("/repos/RepoX/dna:workspaces/fedSpace/dna:cache")
- .with(FederatedLexicon.PROJECTION_RULES, "/ => /")
- .with(FederatedLexicon.SOURCE_NAME, "cache source")
- .with(FederatedLexicon.WORKSPACE_NAME, "cacheSpace")
- .with(FederatedLexicon.TIME_TO_EXPIRE, 100000)
- .and();
-
batch.create("/repos/RepoX/dna:workspaces/fedSpace/dna:projections").and();
-
batch.create("/repos/RepoX/dna:workspaces/fedSpace/dna:projections/projection1")
- .with(FederatedLexicon.PROJECTION_RULES, "/ => /s1")
- .with(FederatedLexicon.SOURCE_NAME, "source 1")
- .with(FederatedLexicon.WORKSPACE_NAME, "s1Space")
- .and();
-
batch.create("/repos/RepoX/dna:workspaces/fedSpace/dna:projections/projection2")
- .with(FederatedLexicon.PROJECTION_RULES, "/ => /s2")
- .with(FederatedLexicon.SOURCE_NAME, "source 2")
- .with(FederatedLexicon.WORKSPACE_NAME, "s2 workspace")
- .and();
- batch.execute();
-
- // Set up the cache ...
- cache.createWorkspace().named("cacheSpace");
-
- // Set up the content in the first source ...
- repository1.createWorkspace().named("s1Space");
- batch = repository1.batch();
- batch.create("/s1").and();
- batch.create("/s1/a").and();
- batch.create("/s1/a/a").and();
- batch.create("/s1/a/a/a").with("desc", "description for
/a/a/a").and();
- batch.create("/s1/a/a/b").with("desc", "description for
/a/a/b").and();
- batch.create("/s1/a/a/c").with("desc", "description for
/a/a/c").and();
- batch.create("/s1/a/b").and();
- batch.create("/s1/a/b/a").with("desc", "description for
/a/b/a").and();
- batch.create("/s1/a/b/b").with("desc", "description for
/a/b/b").and();
- batch.create("/s1/a/b/c").with("desc", "description for
/a/b/c").and();
- batch.create("/s1/b").and();
- batch.create("/s1/b/a").with("desc", "description for
/b/a").and();
- batch.create("/s1/b/b").with("desc", "description for
/b/b").and();
- batch.create("/s1/b/c").with("desc", "description for
/b/c").and();
- batch.execute();
-
- // Set up the content in the second source ...
- repository2.createWorkspace().named("s2 workspace");
- batch = repository2.batch();
- batch.create("/s2").and();
- batch.create("/s2/x").and();
- batch.create("/s2/x/x").and();
- batch.create("/s2/x/x/x").with("desc", "description for
/x/x/x").and();
- batch.create("/s2/x/x/y").with("desc", "description for
/x/x/y").and();
- batch.create("/s2/x/x/z").with("desc", "description for
/x/x/z").and();
- batch.create("/s2/x").and();
- batch.create("/s2/x/y").and();
- batch.create("/s2/x/y/x").with("desc", "description for
/x/y/x").and();
- batch.create("/s2/x/y/y").with("desc", "description for
/x/y/y").and();
- batch.create("/s2/x/y/z").with("desc", "description for
/x/y/z").and();
- batch.create("/s2/y").and();
- batch.create("/s2/y/x").with("desc", "description for
/y/x").and();
- batch.create("/s2/y/y").with("desc", "description for
/y/y").and();
- batch.create("/s2/y/z").with("desc", "description for
/y/z").and();
- batch.execute();
-
- // Create a connection to the federated repository. Doing so will read the config
information.
- Graph source = Graph.create(this.source, context);
- source.useWorkspace("fedSpace");
- assertChildren(source, "/", "a", "b",
"x", "y");
- assertChildren(source, "/a/", "a", "b");
- assertChildren(source, "/a/a", "a", "b",
"c");
- assertChildren(source, "/a/a/a");
- assertChildren(source, "/a/a/b");
- assertChildren(source, "/a/a/c");
- assertChildren(source, "/a/b", "a", "b",
"c");
- assertChildren(source, "/a/b/a");
- assertChildren(source, "/a/b/b");
- assertChildren(source, "/a/b/c");
- assertChildren(source, "/b", "a", "b",
"c");
- assertChildren(source, "/b/a");
- assertChildren(source, "/b/b");
- assertChildren(source, "/b/c");
- assertChildren(source, "/x/", "x", "y");
- assertChildren(source, "/x/x", "x", "y",
"z");
- assertChildren(source, "/x/x/x");
- assertChildren(source, "/x/x/y");
- assertChildren(source, "/x/x/z");
- assertChildren(source, "/x/y", "x", "y",
"z");
- assertChildren(source, "/x/y/x");
- assertChildren(source, "/x/y/y");
- assertChildren(source, "/x/y/z");
- assertChildren(source, "/y", "x", "y",
"z");
- assertChildren(source, "/y/x");
- assertChildren(source, "/y/y");
- assertChildren(source, "/y/z");
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositorySourceTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositorySourceTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositorySourceTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,322 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.notNullValue;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Matchers.argThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.stub;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Map;
-import javax.naming.Context;
-import javax.naming.Name;
-import javax.naming.RefAddr;
-import javax.naming.Reference;
-import javax.naming.spi.ObjectFactory;
-import javax.security.auth.login.LoginException;
-import org.jboss.dna.graph.DnaLexicon;
-import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.Graph;
-import org.jboss.dna.graph.JcrLexicon;
-import org.jboss.dna.graph.SecurityContext;
-import org.jboss.dna.graph.connector.RepositoryConnection;
-import org.jboss.dna.graph.connector.RepositoryConnectionFactory;
-import org.jboss.dna.graph.connector.RepositoryContext;
-import org.jboss.dna.graph.connector.RepositorySourceException;
-import org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.mockito.ArgumentMatcher;
-import org.mockito.MockitoAnnotations;
-import org.mockito.MockitoAnnotations.Mock;
-
-/**
- * @author Randall Hauch
- */
-@Ignore
-public class FederatedRepositorySourceTest {
-
- private FederatedRepositorySource source;
- private String sourceName;
- private String repositoryName;
- private String username;
- private String credentials;
- private String configurationSourceName;
- private String securityDomain;
- private InMemoryRepositorySource configRepositorySource;
- private RepositoryConnection configRepositoryConnection;
- private ExecutionContext context;
- @Mock
- private RepositoryConnection connection;
- @Mock
- private RepositoryConnectionFactory connectionFactory;
- @Mock
- private ExecutionContext executionContextFactory;
- @Mock
- private RepositoryContext repositoryContext;
-
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void beforeEach() throws Exception {
- MockitoAnnotations.initMocks(this);
- context = new ExecutionContext();
- context.getNamespaceRegistry().register(DnaLexicon.Namespace.PREFIX,
DnaLexicon.Namespace.URI);
- context.getNamespaceRegistry().register(JcrLexicon.Namespace.PREFIX,
JcrLexicon.Namespace.URI);
- configurationSourceName = "configuration";
- repositoryName = "Test Repository";
- securityDomain = "security domain";
- source = new FederatedRepositorySource(repositoryName);
- sourceName = "federated source";
- username = "valid username";
- credentials = "valid password";
- source.setName(sourceName);
- source.setUsername(username);
- source.setPassword(credentials);
- source.setConfigurationSourceName(configurationSourceName);
- source.setConfigurationWorkspaceName("configSpace");
- source.setConfigurationSourcePath("/a/b/Test Repository");
- source.setSecurityDomain(securityDomain);
- source.initialize(repositoryContext);
- configRepositorySource = new InMemoryRepositorySource();
- configRepositorySource.setName("Configuration Repository");
-
- Graph configRepository = Graph.create(configRepositorySource, context);
- configRepository.createWorkspace().named("configSpace");
- Graph.Batch batch = configRepository.batch();
- batch.create("/a").and();
- batch.create("/a/b").and();
- batch.create("/a/b/Test
Repository").with(FederatedLexicon.DEFAULT_WORKSPACE_NAME,
"fedSpace").and();
- batch.create("/a/b/Test Repository/dna:workspaces").and();
- batch.create("/a/b/Test Repository/dna:workspaces/fedSpace").and();
- batch.create("/a/b/Test Repository/dna:workspaces/fedSpace/dna:cache")
- .with(FederatedLexicon.PROJECTION_RULES, "/ => /")
- .with(FederatedLexicon.SOURCE_NAME, "cache source")
- .with(FederatedLexicon.WORKSPACE_NAME, "cacheSpace")
- .with(FederatedLexicon.TIME_TO_EXPIRE, 100000)
- .and();
- batch.create("/a/b/Test
Repository/dna:workspaces/fedSpace/dna:projections").and();
- batch.create("/a/b/Test
Repository/dna:workspaces/fedSpace/dna:projections/projection1")
- .with(FederatedLexicon.PROJECTION_RULES, "/ => /s1")
- .with(FederatedLexicon.SOURCE_NAME, "source 1")
- .with(FederatedLexicon.WORKSPACE_NAME, "s1 workspace")
- .and();
- batch.create("/a/b/Test
Repository/dna:workspaces/fedSpace/dna:projections/projection2")
- .with(FederatedLexicon.PROJECTION_RULES, "/ => /s2")
- .with(FederatedLexicon.SOURCE_NAME, "source 2")
- .with(FederatedLexicon.WORKSPACE_NAME, "s2 worskspace")
- .and();
- batch.execute();
-
- configRepositoryConnection = configRepositorySource.getConnection();
- stub(repositoryContext.getExecutionContext()).toReturn(executionContextFactory);
-
stub(repositoryContext.getRepositoryConnectionFactory()).toReturn(connectionFactory);
-
stub(connectionFactory.createConnection(configurationSourceName)).toReturn(configRepositoryConnection);
- stub(executionContextFactory.with(anySecurityContext())).toReturn(context);
- }
-
- protected static SecurityContext anySecurityContext() {
- return argThat(new ArgumentMatcher<SecurityContext>() {
- @Override
- public boolean matches( Object callback ) {
- return callback != null;
- }
- });
- }
-
- @Test
- public void shouldReturnNonNullCapabilities() {
- assertThat(source.getCapabilities(), is(notNullValue()));
- }
-
- @Test
- public void shouldSupportSameNameSiblings() {
- assertThat(source.getCapabilities().supportsSameNameSiblings(), is(true));
- }
-
- @Test
- public void shouldSupportUpdates() {
- assertThat(source.getCapabilities().supportsUpdates(), is(true));
- }
-
- @Test
- public void shouldCreateConnectionsByAuthenticateUsingFederationRepository() throws
Exception {
- connection = source.getConnection();
- assertThat(connection, is(notNullValue()));
- }
-
- @Test( expected = RepositorySourceException.class )
- public void shouldNotCreateConnectionWhenAuthenticationFails() throws Exception {
- // Stub the execution context factory to throw a LoginException to simulate
failed authentication
- stub(executionContextFactory.with(anySecurityContext())).toThrow(new
LoginException());
- source.getConnection();
- }
-
- @Test( expected = NullPointerException.class )
- public void
shouldPropogateAllExceptionsExceptLoginExceptionThrownFromExecutionContextFactory() throws
Exception {
- // Stub the execution context factory to throw a LoginException to simulate
failed authentication
- stub(executionContextFactory.with(anySecurityContext())).toThrow(new
NullPointerException());
- source.getConnection();
- }
-
- @Test
- public void shouldHaveNameSuppliedInConstructor() {
- source = new FederatedRepositorySource(repositoryName);
- assertThat(source.getRepositoryName(), is(repositoryName));
- }
-
- @Test
- public void shouldHaveNullSourceNameUponConstruction() {
- source = new FederatedRepositorySource(repositoryName);
- assertThat(source.getName(), is(nullValue()));
- }
-
- @Test
- public void shouldAllowSettingName() {
- source.setName("Something");
- assertThat(source.getName(), is("Something"));
- source.setName("another name");
- assertThat(source.getName(), is("another name"));
- }
-
- @Test
- public void shouldAllowSettingNameToNull() {
- source.setName("some name");
- source.setName(null);
- assertThat(source.getName(), is(nullValue()));
- }
-
- @Test
- public void shouldAllowSettingUsername() {
- source.setUsername("Something");
- assertThat(source.getUsername(), is("Something"));
- source.setUsername("another name");
- assertThat(source.getUsername(), is("another name"));
- }
-
- @Test
- public void shouldAllowSettingUsernameToNull() {
- source.setUsername("some name");
- source.setUsername(null);
- assertThat(source.getUsername(), is(nullValue()));
- }
-
- @Test
- public void shouldAllowSettingCredentials() {
- source.setPassword("Something");
- assertThat(source.getPassword(), is("Something"));
- source.setPassword("another name");
- assertThat(source.getPassword(), is("another name"));
- }
-
- @Test
- public void shouldAllowSettingCredentialsToNull() {
- source.setPassword("some name");
- source.setPassword(null);
- assertThat(source.getPassword(), is(nullValue()));
- }
-
- @Test
- public void shouldHaveDefaultRetryLimit() {
- assertThat(source.getRetryLimit(),
is(FederatedRepositorySource.DEFAULT_RETRY_LIMIT));
- }
-
- @Test
- public void shouldSetRetryLimitToZeroWhenSetWithNonPositiveValue() {
- source.setRetryLimit(0);
- assertThat(source.getRetryLimit(), is(0));
- source.setRetryLimit(-1);
- assertThat(source.getRetryLimit(), is(0));
- source.setRetryLimit(-100);
- assertThat(source.getRetryLimit(), is(0));
- }
-
- @Test
- public void shouldAllowRetryLimitToBeSet() {
- for (int i = 0; i != 100; ++i) {
- source.setRetryLimit(i);
- assertThat(source.getRetryLimit(), is(i));
- }
- }
-
- @Test
- public void shouldCreateJndiReferenceAndRecreatedObjectFromReference() throws
Exception {
- int retryLimit = 100;
- source.setPassword(credentials);
- source.setUsername(username);
- source.setRetryLimit(retryLimit);
- source.setName("Some source");
- source.setConfigurationSourceName("config source");
- source.setConfigurationSourcePath("/a/b/c");
-
- Reference ref = source.getReference();
- assertThat(ref.getClassName(), is(FederatedRepositorySource.class.getName()));
- assertThat(ref.getFactoryClassName(),
is(FederatedRepositorySource.class.getName()));
-
- Map<String, Object> refAttributes = new HashMap<String, Object>();
- Enumeration<RefAddr> enumeration = ref.getAll();
- while (enumeration.hasMoreElements()) {
- RefAddr addr = enumeration.nextElement();
- refAttributes.put(addr.getType(), addr.getContent());
- }
-
- assertThat((String)refAttributes.remove(FederatedRepositorySource.USERNAME),
is(username));
- assertThat((String)refAttributes.remove(FederatedRepositorySource.PASSWORD),
is(credentials));
- assertThat((String)refAttributes.remove(FederatedRepositorySource.SOURCE_NAME),
is(source.getName()));
-
assertThat((String)refAttributes.remove(FederatedRepositorySource.REPOSITORY_NAME),
is(repositoryName));
- assertThat((String)refAttributes.remove(FederatedRepositorySource.RETRY_LIMIT),
is(Integer.toString(retryLimit)));
-
assertThat((String)refAttributes.remove(FederatedRepositorySource.CONFIGURATION_SOURCE_NAME),
- is(source.getConfigurationSourceName()));
-
assertThat((String)refAttributes.remove(FederatedRepositorySource.CONFIGURATION_SOURCE_PATH),
is("/a/b/c/"));
-
assertThat((String)refAttributes.remove(FederatedRepositorySource.SECURITY_DOMAIN),
is(securityDomain));
- assertThat(refAttributes.isEmpty(), is(true));
-
- // Recreate the object, use a newly constructed source ...
- ObjectFactory factory = new FederatedRepositorySource();
- Name name = mock(Name.class);
- Context context = mock(Context.class);
- Hashtable<?, ?> env = new Hashtable<Object, Object>();
- FederatedRepositorySource recoveredSource =
(FederatedRepositorySource)factory.getObjectInstance(ref, name, context, env);
- assertThat(recoveredSource, is(notNullValue()));
-
- assertThat(recoveredSource.getName(), is(source.getName()));
- assertThat(recoveredSource.getUsername(), is(source.getUsername()));
- assertThat(recoveredSource.getPassword(), is(source.getPassword()));
- assertThat(recoveredSource.getRepositoryName(), is(source.getRepositoryName()));
- assertThat(recoveredSource.getRetryLimit(), is(source.getRetryLimit()));
- assertThat(recoveredSource.getConfigurationSourceName(),
is(source.getConfigurationSourceName()));
- assertThat(recoveredSource.getConfigurationSourcePath(),
is(source.getConfigurationSourcePath()));
- assertThat(recoveredSource.getSecurityDomain(), is(source.getSecurityDomain()));
-
- assertThat(recoveredSource.equals(source), is(true));
- assertThat(source.equals(recoveredSource), is(true));
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositoryTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositoryTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositoryTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,75 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.notNullValue;
-import static org.hamcrest.core.IsSame.sameInstance;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.stub;
-import java.util.ArrayList;
-import java.util.Collection;
-import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.connector.RepositoryConnectionFactory;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.MockitoAnnotations;
-import org.mockito.MockitoAnnotations.Mock;
-
-/**
- * @author Randall Hauch
- */
-public class FederatedRepositoryTest {
-
- private String name;
- private ExecutionContext context;
- private FederatedRepository repository;
- @Mock
- private FederatedWorkspace config;
- @Mock
- private RepositoryConnectionFactory connectionFactory;
-
- @Before
- public void beforeEach() {
- MockitoAnnotations.initMocks(this);
- name = "Repository";
- context = new ExecutionContext();
- stub(config.getName()).toReturn("workspace");
- Collection<FederatedWorkspace> configs = new
ArrayList<FederatedWorkspace>();
- configs.add(config);
- repository = new FederatedRepository(name, context, connectionFactory, configs);
- }
-
- @Test
- public void shouldHaveNameUponCreation() {
- assertThat(repository.getName(), is(name));
- }
-
- @Test
- public void shouldHaveConfigurationAfterInitialization() {
- assertThat(repository.getWorkspaceConfigurations(), is(notNullValue()));
- assertThat(repository.getWorkspaceConfigurations().get("workspace"),
is(sameInstance(config)));
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatingRequestProcessorTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatingRequestProcessorTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatingRequestProcessorTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,854 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.notNullValue;
-import static org.hamcrest.core.IsSame.sameInstance;
-import static org.jboss.dna.common.collection.IsIteratorContaining.hasItems;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.stub;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyNoMoreInteractions;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-import org.jboss.dna.connector.federation.contribution.Contribution;
-import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.Graph;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.cache.BasicCachePolicy;
-import org.jboss.dna.graph.cache.CachePolicy;
-import org.jboss.dna.graph.connector.RepositoryConnection;
-import org.jboss.dna.graph.connector.RepositoryConnectionFactory;
-import org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource;
-import org.jboss.dna.graph.property.DateTime;
-import org.jboss.dna.graph.property.Name;
-import org.jboss.dna.graph.property.Path;
-import org.jboss.dna.graph.property.PathFactory;
-import org.jboss.dna.graph.property.Property;
-import org.jboss.dna.graph.request.CopyBranchRequest;
-import org.jboss.dna.graph.request.CreateNodeRequest;
-import org.jboss.dna.graph.request.DeleteBranchRequest;
-import org.jboss.dna.graph.request.MoveBranchRequest;
-import org.jboss.dna.graph.request.ReadAllChildrenRequest;
-import org.jboss.dna.graph.request.ReadAllPropertiesRequest;
-import org.jboss.dna.graph.request.ReadPropertyRequest;
-import org.jboss.dna.graph.request.UnsupportedRequestException;
-import org.jboss.dna.graph.request.UpdatePropertiesRequest;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.MockitoAnnotations;
-import org.mockito.MockitoAnnotations.Mock;
-
-/**
- * @author Randall Hauch
- */
-public class FederatingRequestProcessorTest {
-
- private FederatingRequestProcessor executor;
- private ExecutionContext context;
- private PathFactory pathFactory;
- private String sourceName;
- private Projection cacheProjection;
- private CachePolicy cachePolicy;
- private List<Projection> sourceProjections;
- private Projection.Rule[] cacheProjectionRules = new Projection.Rule[] {};
- private Map<String, FederatedWorkspace> workspaces;
- private FederatedWorkspace defaultWorkspace;
- private InMemoryRepositorySource cacheSource;
- private InMemoryRepositorySource source1;
- private InMemoryRepositorySource source2;
- private InMemoryRepositorySource source3;
- @Mock
- private RepositoryConnectionFactory connectionFactory;
-
- @Before
- public void beforeEach() throws Exception {
- MockitoAnnotations.initMocks(this);
- context = new ExecutionContext();
- pathFactory = context.getValueFactories().getPathFactory();
- sourceName = "Federated Source";
- cachePolicy = new BasicCachePolicy(219L, TimeUnit.SECONDS);
- cacheSource = new InMemoryRepositorySource();
- cacheSource.setName("Cache");
- cacheSource.setDefaultWorkspaceName("cacheSpace");
- ProjectionParser ruleParser = ProjectionParser.getInstance();
- cacheProjectionRules = ruleParser.rulesFromStrings(context, "/ =>
/cache/repo/A");
- cacheProjection = new Projection(cacheSource.getName(), "cacheSpace",
cacheProjectionRules);
- source1 = new InMemoryRepositorySource();
- source2 = new InMemoryRepositorySource();
- source3 = new InMemoryRepositorySource();
- source1.setName("Source 1");
- source2.setName("Source 2");
- source3.setName("Source 3");
- // Set up the cache policies ...
- source1.setDefaultCachePolicy(new BasicCachePolicy(100, TimeUnit.SECONDS));
- source2.setDefaultCachePolicy(new BasicCachePolicy(200, TimeUnit.SECONDS));
- source3.setDefaultCachePolicy(new BasicCachePolicy(300, TimeUnit.SECONDS));
- sourceProjections = new ArrayList<Projection>();
- // Source 1 projects from '/source/one/a' into repository '/a'
- // and from '/source/one/b' into repository '/b'
- sourceProjections.add(new Projection(source1.getName(), "workspace1",
ruleParser.rulesFromStrings(context,
-
"/a => /source/one/a",
-
"/b => /source/one/b")));
- // Source 2 projects from '/source/two/a' into repository '/a'
- sourceProjections.add(new Projection(source2.getName(), "workspace2",
ruleParser.rulesFromStrings(context,
-
"/a => /source/two/a")));
- // Source 3 projects everything into repository at root
- sourceProjections.add(new Projection(source3.getName(), "workspace3",
ruleParser.rulesFromStrings(context, "/ => /")));
- workspaces = new HashMap<String, FederatedWorkspace>();
- defaultWorkspace = new FederatedWorkspace("fedSpace", cacheProjection,
sourceProjections, cachePolicy);
- workspaces.put(defaultWorkspace.getName(), defaultWorkspace);
- executor = new FederatingRequestProcessor(context, sourceName, workspaces,
defaultWorkspace, connectionFactory);
- //
stub(connectionFactory.createConnection(source1.getName())).toReturn(source1.getConnection());
-
doReturn(source1.getConnection()).when(connectionFactory).createConnection(source1.getName());
-
doReturn(source2.getConnection()).when(connectionFactory).createConnection(source2.getName());
-
doReturn(source3.getConnection()).when(connectionFactory).createConnection(source3.getName());
-
doReturn(cacheSource.getConnection()).when(connectionFactory).createConnection(cacheSource.getName());
- }
-
- protected Name name( String name ) {
- return context.getValueFactories().getNameFactory().create(name);
- }
-
- protected Path path( String path ) {
- return pathFactory.create(path);
- }
-
- protected Path.Segment segment( String path ) {
- return pathFactory.createSegment(path);
- }
-
- protected Property property( String name,
- Object... values ) {
- return context.getPropertyFactory().create(name(name), values);
- }
-
- protected Map<Name, Property> addProperty( Map<Name, Property>
properties,
- String name,
- Object... values ) {
- Property property = property(name, values);
- properties.put(property.getName(), property);
- return properties;
- }
-
- protected void assertNodeHasChildren( String path,
- String... expectedChildSegments ) {
- Location parent = Location.create(path(path));
- ReadAllChildrenRequest request = new ReadAllChildrenRequest(parent,
"fedSpace");
- executor.process(request);
- assertThat(request.hasError(), is(false));
- assertThat(request.getActualLocationOfNode().getPath(), is(path(path)));
- List<Location> actualChildLocations = request.getChildren();
- Path.Segment[] actualChildren = new Path.Segment[actualChildLocations.size()];
- for (int i = 0; i != actualChildren.length; ++i) {
- Path actualChildPath = actualChildLocations.get(i).getPath();
- actualChildren[i] = actualChildPath.getLastSegment();
- assertThat(actualChildPath.getParent(), is(path(path)));
- }
- Path.Segment[] expectedChildren = new
Path.Segment[expectedChildSegments.length];
- for (int i = 0; i != expectedChildren.length; ++i) {
- expectedChildren[i] = segment(expectedChildSegments[i]);
- }
- assertThat(actualChildren, is(expectedChildren));
- }
-
- protected void assertNodeHasProperty( String path,
- String propertyName,
- Object... expectedValues ) {
- Location parent = Location.create(path(path));
- ReadPropertyRequest request = new ReadPropertyRequest(parent,
"fedSpace", name(propertyName));
- executor.process(request);
- assertThat(request.hasError(), is(false));
- assertThat(request.getActualLocationOfNode().getPath(), is(path(path)));
- Object[] actualValues = request.getProperty().getValuesAsArray();
- String[] actualValuesAsStrings = new String[actualValues.length];
- for (int i = 0; i != actualValues.length; ++i) {
- actualValuesAsStrings[i] =
context.getValueFactories().getStringFactory().create(actualValues[i]);
- }
- String[] expectedValuesAsStrings = new String[expectedValues.length];
- for (int i = 0; i != expectedValues.length; ++i) {
- expectedValuesAsStrings[i] =
context.getValueFactories().getStringFactory().create(expectedValues[i]);
- }
- assertThat(actualValuesAsStrings, is(expectedValuesAsStrings));
- }
-
- protected void assertNodeHasNoProperty( String path,
- String propertyName ) {
- Location parent = Location.create(path(path));
- ReadAllPropertiesRequest request = new ReadAllPropertiesRequest(parent,
"fedSpace");
- executor.process(request);
- assertThat(request.hasError(), is(false));
- assertThat(request.getActualLocationOfNode().getPath(), is(path(path)));
- assertThat(request.getPropertiesByName().containsKey(name(propertyName)),
is(false));
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void shouldFailWhenExecutionContextIsNull() {
- context = null;
- executor = new FederatingRequestProcessor(context, sourceName, workspaces,
defaultWorkspace, connectionFactory);
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void shouldFailWhenSourceNameIsNull() {
- sourceName = null;
- executor = new FederatingRequestProcessor(context, sourceName, workspaces,
defaultWorkspace, connectionFactory);
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void shouldFailWhenSourceNameIsEmpty() {
- sourceName = "";
- executor = new FederatingRequestProcessor(context, sourceName, workspaces,
defaultWorkspace, connectionFactory);
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void shouldFailWhenSourceNameIsBlank() {
- sourceName = " ";
- executor = new FederatingRequestProcessor(context, sourceName, workspaces,
defaultWorkspace, connectionFactory);
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void shouldFailWhenConnectionFactoryIsNull() {
- connectionFactory = null;
- executor = new FederatingRequestProcessor(context, sourceName, workspaces,
defaultWorkspace, connectionFactory);
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void shouldFailWhenWorkspacesMapIsNull() {
- workspaces = null;
- executor = new FederatingRequestProcessor(context, sourceName, workspaces,
defaultWorkspace, connectionFactory);
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void shouldFailWhenWorkspacesMapIsEmpty() {
- workspaces.clear();
- executor = new FederatingRequestProcessor(context, sourceName, workspaces,
defaultWorkspace, connectionFactory);
- }
-
- @Test
- public void shouldNotFailWhenDefaultWorkspaceIsNull() {
- defaultWorkspace = null;
- executor = new FederatingRequestProcessor(context, sourceName, workspaces,
defaultWorkspace, connectionFactory);
- }
-
- @Test
- public void shouldHaveCurrentTimeInUtc() {
- DateTime currentTimeInUtc = executor.getCurrentTimeInUtc();
- assertThat(currentTimeInUtc, is(notNullValue()));
- assertThat(currentTimeInUtc.toUtcTimeZone(), is(currentTimeInUtc));
- }
-
- @Test
- public void shouldReturnSameExecutionContextSuppliedToConstructor() {
- assertThat(executor.getExecutionContext(), is(sameInstance(context)));
- }
-
- @Test
- public void shouldObtainCacheConnectionFromConnectionFactoryThenHoldOntoReference()
throws Exception {
- // Stub the connection factory to return a connection instance that we specify
...
- RepositoryConnection connection = mock(RepositoryConnection.class);
-
stub(connectionFactory.createConnection(cacheSource.getName())).toReturn(connection);
- // Obtain the connection to the cache ...
- assertThat(executor.getConnectionToCacheFor(defaultWorkspace),
is(sameInstance(connection)));
- verify(connectionFactory, times(1)).createConnection(cacheSource.getName());
- // Call it again, and should not ask the factory ...
- assertThat(executor.getConnectionToCacheFor(defaultWorkspace),
is(sameInstance(connection)));
- verifyNoMoreInteractions(connectionFactory);
- }
-
- @Test
- public void
shouldObtainRepositoryConnectionFromConnectionFactoryThenHoldOntoReference() throws
Exception {
- String sourceName = "Some source";
- Projection projection = mock(Projection.class);
- stub(projection.getSourceName()).toReturn(sourceName);
- RepositoryConnection connection = mock(RepositoryConnection.class);
- stub(connectionFactory.createConnection(sourceName)).toReturn(connection);
-
- assertThat(executor.getConnection(projection), is(sameInstance(connection)));
- verify(connectionFactory, times(1)).createConnection(sourceName);
- // Call it again, and should not ask the factory ...
- assertThat(executor.getConnection(projection), is(sameInstance(connection)));
- verifyNoMoreInteractions(connectionFactory);
- }
-
- @Test
- public void shouldCloseHavingNotOpenedConnections() throws Exception {
- assertThat(executor.getOpenConnections().isEmpty(), is(true));
- executor.close();
- assertThat(executor.getOpenConnections().isEmpty(), is(true));
- verifyNoMoreInteractions(connectionFactory);
- }
-
- @Test
- public void shouldCloseAllOpenConnectionsWhenClosingExecutor() throws Exception {
- // Load the connections
- assertThat(executor.getConnectionToCacheFor(defaultWorkspace),
is(notNullValue()));
- for (Projection projection : sourceProjections) {
- assertThat(executor.getConnection(projection), is(notNullValue()));
- }
- verify(connectionFactory).createConnection(cacheSource.getName());
- verify(connectionFactory).createConnection(source1.getName());
- verify(connectionFactory).createConnection(source2.getName());
- verify(connectionFactory).createConnection(source3.getName());
- assertThat(executor.getOpenConnections().isEmpty(), is(false));
- // Close the executor and verify all connections have been closed
- executor.close();
- assertThat(executor.getOpenConnections().isEmpty(), is(true));
- verifyNoMoreInteractions(connectionFactory);
- }
-
- @Test
- public void shouldLoadContributionsForRootNodeFromSources() throws Exception {
- // Set up the content of source 3
- Graph repository3 = Graph.create(source3, context);
- repository3.createWorkspace().named("workspace3");
- Graph.Batch batch = repository3.batch();
- batch.create("/x").and();
- batch.create("/x/y").with("desc", "y
description").and();
- batch.create("/x/y/zA").with("desc", "zA
description").and();
- batch.create("/x/y/zB").with("desc", "zB
description").and();
- batch.create("/x/y/zC").with("desc", "zC
description").and();
- batch.create("/b").and();
- batch.create("/b/by").with("desc", "by
description").and();
- batch.create("/b/by/bzA").with("desc", "bzA
description").and();
- batch.create("/b/by/bzB").with("desc", "bzB
description").and();
- batch.execute();
- Location nodeX = repository3.getNodeAt("/x").getLocation();
- Location nodeB = repository3.getNodeAt("/b").getLocation();
-
- Path path = pathFactory.createRootPath();
- List<Contribution> contributions = new LinkedList<Contribution>();
- executor.loadContributionsFromSources(Location.create(path), defaultWorkspace,
null, contributions);
-
- assertThat(contributions.size(), is(3)); // order is based upon order of
projections
- assertThat(contributions.get(0).getSourceName(), is(source1.getName()));
- assertThat(contributions.get(1).getSourceName(), is(source2.getName()));
- assertThat(contributions.get(2).getSourceName(), is(source3.getName()));
-
- Location childA = Location.create(pathFactory.create(path, "a"));
- Location childB = Location.create(pathFactory.create(path, "b"));
- assertThat(contributions.get(0).getChildren(), hasItems(childA, childB));
- assertThat(contributions.get(1).getChildren(), hasItems(childA));
- assertThat(contributions.get(2).getChildren(), hasItems(nodeX, nodeB));
- }
-
- protected void hasChildren( Contribution contribution,
- String... childNames ) {
- Location location = contribution.getLocationInSource();
- Iterator<Location> iter = contribution.getChildren();
- for (String childName : childNames) {
- Path expectedChildPath =
context.getValueFactories().getPathFactory().create(location.getPath(), childName);
- Location expectedChild = Location.create(expectedChildPath);
- Location next = iter.next();
- if (!next.isSame(expectedChild)) {
- assertThat(next, is(expectedChild));
- }
- }
- assertThat(iter.hasNext(), is(false));
- }
-
- @Test
- public void shouldLoadContributionsForNonRootNodeWithOneContributionFromSources()
throws Exception {
- // Set up the content of source 3
- Graph repository3 = Graph.create(source3, context);
- repository3.createWorkspace().named("workspace3");
- Graph.Batch batch = repository3.batch();
- batch.create("/x").and();
- batch.create("/x/y").with("desc", "y
description").and();
- batch.create("/x/y/zA").with("desc", "zA
description").and();
- batch.create("/x/y/zB").with("desc", "zB
description").and();
- batch.create("/x/y/zC").with("desc", "zC
description").and();
- batch.create("/b").and();
- batch.create("/b/by").with("desc", "by
description").and();
- batch.create("/b/by/bzA").with("desc", "bzA
description").and();
- batch.create("/b/by/bzB").with("desc", "bzB
description").and();
- batch.execute();
-
- Path path = pathFactory.create("/x/y"); // from source 3
- List<Contribution> contributions = new LinkedList<Contribution>();
- executor.loadContributionsFromSources(Location.create(path), defaultWorkspace,
null, contributions);
-
- assertThat(contributions.size(), is(3)); // order is based upon order of
projections
- assertThat(contributions.get(0).getSourceName(), is(source1.getName()));
- assertThat(contributions.get(1).getSourceName(), is(source2.getName()));
- assertThat(contributions.get(2).getSourceName(), is(source3.getName()));
-
- hasChildren(contributions.get(0));
- hasChildren(contributions.get(1));
- hasChildren(contributions.get(2), "zA", "zB",
"zC");
-
- path = pathFactory.create("/x"); // from source 3
- contributions.clear();
- executor.loadContributionsFromSources(Location.create(path), defaultWorkspace,
null, contributions);
-
- assertThat(contributions.size(), is(3)); // order is based upon order of
projections
- assertThat(contributions.get(0).getSourceName(), is(source1.getName()));
- assertThat(contributions.get(1).getSourceName(), is(source2.getName()));
- assertThat(contributions.get(2).getSourceName(), is(source3.getName()));
-
- hasChildren(contributions.get(0));
- hasChildren(contributions.get(1));
- hasChildren(contributions.get(2), "y");
- }
-
- @Test
- public void shouldLoadNonRootNodeWithTwoContributionFromSources() throws Exception {
- // Set up the content of source 1
- Graph repository1 = Graph.create(source1, context);
- repository1.createWorkspace().named("workspace1");
- Graph.Batch batch = repository1.batch();
- batch.create("/source").and();
- batch.create("/source/one").and();
- batch.create("/source/one/a").with("desc", "source 1
node a description").and();
- batch.create("/source/one/a/nA").with("desc", "source 1
node nA description").and();
- batch.create("/source/one/a/nB").with("desc", "source 1
node nB description").and();
- batch.create("/source/one/a/nC").with("desc", "source 1
node nC description").and();
- batch.create("/source/one/b").with("desc", "source 1
node b description").and();
- batch.create("/source/one/b/pA").with("desc", "source 1
node pA description").and();
- batch.create("/source/one/b/pB").with("desc", "source 1
node pB description").and();
- batch.create("/source/one/b/pC").with("desc", "source 1
node pC description").and();
- batch.execute();
-
- // Set up the content of source 2
- Graph repository2 = Graph.create(source2, context);
- repository2.createWorkspace().named("workspace2");
- batch = repository2.batch();
- batch.create("/source").and();
- batch.create("/source/two").and();
- batch.create("/source/two/a").with("desc", "source 2
node a description").and();
- batch.create("/source/two/a/qA").with("desc", "source 2
node qA description").and();
- batch.create("/source/two/a/qB").with("desc", "source 2
node qB description").and();
- batch.create("/source/two/a/qC").with("desc", "source 2
node qC description").and();
- batch.execute();
-
- // Set up the content of source 3
- Graph repository3 = Graph.create(source3, context);
- repository3.createWorkspace().named("workspace3");
- batch = repository3.batch();
- batch.create("/x").and();
- batch.create("/x/y").with("desc", "y
description").and();
- batch.create("/x/y/zA").with("desc", "zA
description").and();
- batch.create("/x/y/zB").with("desc", "zB
description").and();
- batch.create("/x/y/zC").with("desc", "zC
description").and();
- batch.create("/b").and();
- batch.create("/b/by").with("desc", "by
description").and();
- batch.create("/b/by/bzA").with("desc", "bzA
description").and();
- batch.create("/b/by/bzB").with("desc", "bzB
description").and();
- batch.execute();
-
- Path path = pathFactory.create("/b"); // from source 2 and source 3
- List<Contribution> contributions = new LinkedList<Contribution>();
- executor.loadContributionsFromSources(Location.create(path), defaultWorkspace,
null, contributions);
-
- assertThat(contributions.size(), is(3)); // order is based upon order of
projections
- assertThat(contributions.get(0).getSourceName(), is(source1.getName()));
- assertThat(contributions.get(1).getSourceName(), is(source2.getName()));
- assertThat(contributions.get(2).getSourceName(), is(source3.getName()));
-
- hasChildren(contributions.get(0), "pA", "pB",
"pC");
- hasChildren(contributions.get(1));
- hasChildren(contributions.get(2), "by");
-
- path = pathFactory.create("/b/by"); // from source 3
- contributions.clear();
- executor.loadContributionsFromSources(Location.create(path), defaultWorkspace,
null, contributions);
-
- assertThat(contributions.size(), is(2)); // order is based upon order of
projections
- assertThat(contributions.get(0).getSourceName(), is(source2.getName()));
- assertThat(contributions.get(1).getSourceName(), is(source3.getName()));
-
- hasChildren(contributions.get(0));
- hasChildren(contributions.get(1), "bzA", "bzB");
- }
-
- @Test
- public void shouldLoadNonRootNodeWithThreeContributionFromSources() throws Exception
{
- // Set up the content of source 1
- Graph repository1 = Graph.create(source1, context);
- repository1.createWorkspace().named("workspace1");
- Graph.Batch batch = repository1.batch();
- batch.create("/source").and();
- batch.create("/source/one").and();
- batch.create("/source/one/a").with("desc", "source 1
node a description").and();
- batch.create("/source/one/a/nA").with("desc", "source 1
node nA description").and();
- batch.create("/source/one/a/nB").with("desc", "source 1
node nB description").and();
- batch.create("/source/one/a/nC").with("desc", "source 1
node nC description").and();
- batch.create("/source/one/b").with("desc", "source 1
node b description").and();
- batch.create("/source/one/b/pA").with("desc", "source 1
node pA description").and();
- batch.create("/source/one/b/pB").with("desc", "source 1
node pB description").and();
- batch.create("/source/one/b/pC").with("desc", "source 1
node pC description").and();
- batch.execute();
-
- // Set up the content of source 2
- Graph repository2 = Graph.create(source2, context);
- repository2.createWorkspace().named("workspace2");
- batch = repository2.batch();
- batch.create("/source").and();
- batch.create("/source/two").and();
- batch.create("/source/two/a").with("desc", "source 2
node a description").and();
- batch.create("/source/two/a/qA").with("desc", "source 2
node qA description").and();
- batch.create("/source/two/a/qB").with("desc", "source 2
node qB description").and();
- batch.create("/source/two/a/qC").with("desc", "source 2
node qC description").and();
- batch.execute();
-
- // Set up the content of source 3
- Graph repository3 = Graph.create(source3, context);
- repository3.createWorkspace().named("workspace3");
- batch = repository3.batch();
- batch.create("/x").and();
- batch.create("/x/y").with("desc", "y
description").and();
- batch.create("/x/y/zA").with("desc", "zA
description").and();
- batch.create("/x/y/zB").with("desc", "zB
description").and();
- batch.create("/x/y/zC").with("desc", "zC
description").and();
- batch.create("/b").and();
- batch.create("/b/by").with("desc", "by
description").and();
- batch.create("/b/by/bzA").with("desc", "bzA
description").and();
- batch.create("/b/by/bzB").with("desc", "bzB
description").and();
- batch.create("/a").and();
- batch.create("/a/ay").with("desc", "ay
description").and();
- batch.create("/a/ay/azA").with("desc", "azA
description").and();
- batch.create("/a/ay/azB").with("desc", "azB
description").and();
- batch.execute();
-
- Path path = pathFactory.create("/a"); // from sources 1, 2 and 3
- List<Contribution> contributions = new LinkedList<Contribution>();
- executor.loadContributionsFromSources(Location.create(path), defaultWorkspace,
null, contributions);
-
- assertThat(contributions.size(), is(3)); // order is based upon order of
projections
- assertThat(contributions.get(0).getSourceName(), is(source1.getName()));
- assertThat(contributions.get(1).getSourceName(), is(source2.getName()));
- assertThat(contributions.get(2).getSourceName(), is(source3.getName()));
-
- hasChildren(contributions.get(0), "nA", "nB",
"nC");
- hasChildren(contributions.get(1), "qA", "qB",
"qC");
- hasChildren(contributions.get(2), "ay");
-
- path = pathFactory.create("/a/ay"); // from source 3
- contributions.clear();
- executor.loadContributionsFromSources(Location.create(path), defaultWorkspace,
null, contributions);
-
- assertThat(contributions.size(), is(1)); // order is based upon order of
projections
- assertThat(contributions.get(0).getSourceName(), is(source3.getName()));
- hasChildren(contributions.get(0), "azA", "azB");
- }
-
- @Test
- public void
shouldFailToLoadNodeFromSourcesWhenTheNodeDoesNotAppearInAnyOfTheSources() throws
Exception {
- Path nonExistant =
pathFactory.create("/nonExistant/Node/In/AnySource");
- List<Contribution> contributions = new LinkedList<Contribution>();
- executor.loadContributionsFromSources(Location.create(nonExistant),
defaultWorkspace, null, contributions);
- // All of the contributions should be empty ...
- for (Contribution contribution : contributions) {
- assertThat(contribution.isEmpty(), is(true));
- }
- }
-
- @Test
- public void
shouldComputeCachePolicyCorrectlyUsingCurrentTimeAndSourceDefaultCachePolicy() throws
Exception {
- // Set up the content of source 1
- Graph repository1 = Graph.create(source1, context);
- repository1.createWorkspace().named("workspace1");
- Graph.Batch batch = repository1.batch();
- batch.create("/source").and();
- batch.create("/source/one").and();
- batch.create("/source/one/a").with("desc", "source 1
node a description").and();
- batch.create("/source/one/a/nA").with("desc", "source 1
node nA description").and();
- batch.create("/source/one/a/nB").with("desc", "source 1
node nB description").and();
- batch.create("/source/one/a/nC").with("desc", "source 1
node nC description").and();
- batch.create("/source/one/b").with("desc", "source 1
node b description").and();
- batch.create("/source/one/b/pA").with("desc", "source 1
node pA description").and();
- batch.create("/source/one/b/pB").with("desc", "source 1
node pB description").and();
- batch.create("/source/one/b/pC").with("desc", "source 1
node pC description").and();
- batch.execute();
-
- // Set up the content of source 2
- Graph repository2 = Graph.create(source2, context);
- repository2.createWorkspace().named("workspace2");
- batch = repository2.batch();
- batch.create("/source").and();
- batch.create("/source/two").and();
- batch.create("/source/two/a").with("desc", "source 2
node a description").and();
- batch.create("/source/two/a/qA").with("desc", "source 2
node qA description").and();
- batch.create("/source/two/a/qB").with("desc", "source 2
node qB description").and();
- batch.create("/source/two/a/qC").with("desc", "source 2
node qC description").and();
- batch.execute();
-
- // Set up the content of source 3
- Graph repository3 = Graph.create(source3, context);
- repository3.createWorkspace().named("workspace3");
- batch = repository3.batch();
- batch.create("/x").and();
- batch.create("/x/y").with("desc", "y
description").and();
- batch.create("/x/y/zA").with("desc", "zA
description").and();
- batch.create("/x/y/zB").with("desc", "zB
description").and();
- batch.create("/x/y/zC").with("desc", "zC
description").and();
- batch.create("/b").and();
- batch.create("/b/by").with("desc", "by
description").and();
- batch.create("/b/by/bzA").with("desc", "bzA
description").and();
- batch.create("/b/by/bzB").with("desc", "bzB
description").and();
- batch.create("/a").and();
- batch.create("/a/ay").with("desc", "ay
description").and();
- batch.create("/a/ay/azA").with("desc", "azA
description").and();
- batch.create("/a/ay/azB").with("desc", "azB
description").and();
- batch.execute();
-
- Path path = pathFactory.create("/a"); // from sources 1, 2 and 3
- List<Contribution> contributions = new LinkedList<Contribution>();
- executor.loadContributionsFromSources(Location.create(path), defaultWorkspace,
null, contributions);
-
- // Check when the contributions expire ...
- DateTime nowInUtc = executor.getCurrentTimeInUtc();
- DateTime nowPlus10InUtc = nowInUtc.plusSeconds(10);
- DateTime nowPlus110InUtc = nowInUtc.plusSeconds(110);
- DateTime nowPlus210InUtc = nowInUtc.plusSeconds(210);
- DateTime nowPlus220InUtc = nowInUtc.plusSeconds(220);
- DateTime nowPlus310InUtc = nowInUtc.plusSeconds(310);
- assertThat(contributions.size(), is(3)); // order is based upon order of
projections
- assertThat(contributions.get(0).getSourceName(), is(source1.getName()));
- assertThat(contributions.get(1).getSourceName(), is(source2.getName()));
- assertThat(contributions.get(2).getSourceName(), is(source3.getName()));
- // Nothing should be expired in 10 seconds ...
- assertThat(contributions.get(0).isExpired(nowPlus10InUtc), is(false));
- assertThat(contributions.get(1).isExpired(nowPlus10InUtc), is(false));
- assertThat(contributions.get(2).isExpired(nowPlus10InUtc), is(false));
- assertThat(contributions.get(0).isExpired(nowPlus110InUtc), is(true)); // expired
by source
- assertThat(contributions.get(1).isExpired(nowPlus110InUtc), is(false));
- assertThat(contributions.get(2).isExpired(nowPlus110InUtc), is(false));
- assertThat(contributions.get(0).isExpired(nowPlus210InUtc), is(true)); // expired
by source @ 100
- assertThat(contributions.get(1).isExpired(nowPlus210InUtc), is(true)); // expired
by source @ 200
- assertThat(contributions.get(2).isExpired(nowPlus210InUtc), is(false));
- assertThat(contributions.get(0).isExpired(nowPlus220InUtc), is(true)); // expired
by source @ 100
- assertThat(contributions.get(1).isExpired(nowPlus220InUtc), is(true)); // expired
by source @ 200
- assertThat(contributions.get(2).isExpired(nowPlus220InUtc), is(true)); // expired
by cache @ 219
- assertThat(contributions.get(2).isExpired(nowPlus310InUtc), is(true)); // expired
by cache @ 219
- }
-
- /**
- * Set up the sources such that:
- * <ul>
- * <li>Source 1: "{@code /a => /source/one/a}", "{@code /b
=> /source/one/b}"</li>
- * <li>Source 2: "{@code /a => /source/two/a}"</li>
- * <li>Source 1: "{@code / => /}"</li>
- * </ul>
- */
- protected void initializeSourcesWithContent() {
- // Set up the content of source 1
- Graph repository1 = Graph.create(source1, context);
- repository1.createWorkspace().named("workspace1");
- Graph.Batch batch = repository1.batch();
- batch.create("/source").and();
- batch.create("/source/one").and();
- batch.create("/source/one/a").with("desc", "source 1
node a description").and();
- batch.create("/source/one/a/nA").with("desc", "source 1
node nA description").and();
- batch.create("/source/one/a/nB").with("desc", "source 1
node nB description").and();
- batch.create("/source/one/a/nC").with("desc", "source 1
node nC description").and();
- batch.create("/source/one/b").with("desc", "source 1
node b description").and();
- batch.create("/source/one/b/pA").with("desc", "source 1
node pA description").and();
- batch.create("/source/one/b/pB").with("desc", "source 1
node pB description").and();
- batch.create("/source/one/b/pC").with("desc", "source 1
node pC description").and();
- batch.execute();
-
- // Set up the content of source 2
- Graph repository2 = Graph.create(source2, context);
- repository2.createWorkspace().named("workspace2");
- batch = repository2.batch();
- batch.create("/source").and();
- batch.create("/source/two").and();
- batch.create("/source/two/a").with("desc", "source 2
node a description").and();
- batch.create("/source/two/a/qA").with("desc", "source 2
node qA description").and();
- batch.create("/source/two/a/qB").with("desc", "source 2
node qB description").and();
- batch.create("/source/two/a/qC").with("desc", "source 2
node qC description").and();
- batch.execute();
-
- // Set up the content of source 3
- Graph repository3 = Graph.create(source3, context);
- repository3.createWorkspace().named("workspace3");
- batch = repository3.batch();
- batch.create("/x").and();
- batch.create("/x/y").with("desc", "y
description").and();
- batch.create("/x/y/zA").with("desc", "zA
description").and();
- batch.create("/x/y/zB").with("desc", "zB
description").and();
- batch.create("/x/y/zC").with("desc", "zC
description").and();
- batch.create("/b").and();
- batch.create("/b/by").with("desc", "by
description").and();
- batch.create("/b/by/bzA").with("desc", "bzA
description").and();
- batch.create("/b/by/bzB").with("desc", "bzB
description").and();
- batch.create("/a").and();
- batch.create("/a/ay").with("desc", "ay
description").and();
- batch.create("/a/ay/azA").with("desc", "azA
description").and();
- batch.create("/a/ay/azB").with("desc", "azB
description").and();
- batch.execute();
-
- }
-
- @Test( expected = UnsupportedRequestException.class )
- public void shouldNotCreateNodeIfParentIsOutsideSingleProjection() throws Throwable
{
- initializeSourcesWithContent();
- Location parent = Location.create(path("/a")); // source 2 or 3?
- CreateNodeRequest request = new CreateNodeRequest(parent, "fedSpace",
name("child"));
- executor.process(request);
- if (request.hasError()) throw request.getError();
- }
-
- @Test
- public void shouldCreateNodeOnlyIfParentIsInsideSingleProjection() throws Throwable
{
- initializeSourcesWithContent();
- Location parent = Location.create(path("/a/ay")); // source 3
- CreateNodeRequest request = new CreateNodeRequest(parent, "fedSpace",
name("child"));
- executor.process(request);
- assertThat(request.hasError(), is(false));
- assertThat(request.getActualLocationOfNode().getPath(),
is(path("/a/ay/child")));
- assertNodeHasChildren("/a/ay", "azA", "azB",
"child");
- }
-
- @Test( expected = UnsupportedRequestException.class )
- public void shouldNotDestroyNodeIfOutsideSingleProjection() throws Throwable {
- initializeSourcesWithContent();
- Location location = Location.create(path("/a")); // source 2 or 3?
- DeleteBranchRequest request = new DeleteBranchRequest(location,
"fedSpace");
- executor.process(request);
- if (request.hasError()) throw request.getError();
- }
-
- @Test
- public void shouldDestroyNodeOnlyIfInsideSingleProjection() throws Throwable {
- initializeSourcesWithContent();
- assertNodeHasChildren("/a", "nA", "nB",
"nC", "qA", "qB", "qC", "ay");
- Location location = Location.create(path("/a/ay")); // source 3
- DeleteBranchRequest request = new DeleteBranchRequest(location,
"fedSpace");
- executor.process(request);
- assertThat(request.hasError(), is(false));
- assertThat(request.getActualLocationOfNode().getPath(),
is(path("/a/ay")));
- assertNodeHasChildren("/a", "nA", "nB",
"nC", "qA", "qB", "qC");
- }
-
- @Test( expected = UnsupportedRequestException.class )
- public void shouldNotUpdateNodeIfOutsideSingleProjection() throws Throwable {
- initializeSourcesWithContent();
- Location location = Location.create(path("/a")); // source 2 or 3?
- Map<Name, Property> properties = new HashMap<Name, Property>();
- addProperty(properties, "prop1", "value1");
- addProperty(properties, "prop2", "value2a",
"value2b");
- UpdatePropertiesRequest request = new UpdatePropertiesRequest(location,
"fedSpace", properties);
- executor.process(request);
- if (request.hasError()) throw request.getError();
- }
-
- @Test
- public void shouldUpdateNodeOnlyIfInsideSingleProjection() throws Throwable {
- initializeSourcesWithContent();
- // assertNodeHasChildren("/a", "nA", "nB",
"nC", "qA", "qB", "qC", "ay");
- assertNodeHasProperty("/a/ay", "desc", "ay
description");
- assertNodeHasNoProperty("/a/ay", "prop1");
- assertNodeHasNoProperty("/a/ay", "prop2");
- Location location = Location.create(path("/a/ay")); // source 3
- Map<Name, Property> properties = new HashMap<Name, Property>();
- addProperty(properties, "desc", "ay description 2");
- addProperty(properties, "prop1", "value1");
- addProperty(properties, "prop2", "value2a",
"value2b");
- UpdatePropertiesRequest request = new UpdatePropertiesRequest(location,
"fedSpace", properties);
- executor.process(request);
- assertThat(request.hasError(), is(false));
- assertThat(request.getActualLocationOfNode().getPath(),
is(path("/a/ay")));
- assertNodeHasChildren("/a", "nA", "nB",
"nC", "qA", "qB", "qC", "ay");
- assertNodeHasProperty("/a/ay", "desc", "ay description
2");
- assertNodeHasProperty("/a/ay", "prop1", "value1");
- assertNodeHasProperty("/a/ay", "prop2", "value2a",
"value2b");
- }
-
- @Test( expected = UnsupportedRequestException.class )
- public void shouldNotMoveNodeIfParentIsOutsideSingleProjection() throws Throwable {
- initializeSourcesWithContent();
- Location from = Location.create(path("/a/ay")); // source 3
- Location into = Location.create(path("/b")); // source 1 or source 3?
- assertNodeHasChildren("/a", "nA", "nB",
"nC", "qA", "qB", "qC", "ay");
- assertNodeHasChildren("/b", "pA", "pB",
"pC", "by");
- MoveBranchRequest request = new MoveBranchRequest(from, into,
"fedSpace");
- executor.process(request);
- if (request.hasError()) throw request.getError();
- }
-
- @Test
- public void shouldMoveNodeOnlyIfParentIsInsideSingleProjection() throws Throwable {
- initializeSourcesWithContent();
- Location from = Location.create(path("/a/ay")); // source 3
- Location into = Location.create(path("/b/by")); // source 3
- assertNodeHasChildren("/a", "nA", "nB",
"nC", "qA", "qB", "qC", "ay");
- assertNodeHasChildren("/b", "pA", "pB",
"pC", "by");
- assertNodeHasChildren("/b/by", "bzA", "bzB");
- MoveBranchRequest request = new MoveBranchRequest(from, into,
"fedSpace");
- executor.process(request);
- if (request.hasError()) {
- System.out.println(request.getError().getMessage());
- }
- assertThat(request.hasError(), is(false));
- assertThat(request.getActualLocationBefore().getPath(),
is(path("/a/ay")));
- assertThat(request.getActualLocationAfter().getPath(),
is(path("/b/by/ay")));
- assertNodeHasChildren("/a", "nA", "nB",
"nC", "qA", "qB", "qC");
- assertNodeHasChildren("/b/by", "bzA", "bzB",
"ay");
- }
-
- @Test( expected = UnsupportedRequestException.class )
- public void shouldNotCopyNodeIfParentIsOutsideSingleProjection() throws Throwable {
- initializeSourcesWithContent();
- Location from = Location.create(path("/a/ay")); // source 3
- Location into = Location.create(path("/b")); // source 1 or source 3?
- assertNodeHasChildren("/a", "nA", "nB",
"nC", "qA", "qB", "qC", "ay");
- assertNodeHasChildren("/b", "pA", "pB",
"pC", "by");
- CopyBranchRequest request = new CopyBranchRequest(from, "fedSpace",
into, "fedSpace");
- executor.process(request);
- if (request.hasError()) throw request.getError();
- }
-
- @Test
- public void shouldCopyNodeOnlyIfParentIsInsideSingleProjection() throws Throwable {
- initializeSourcesWithContent();
- Location from = Location.create(path("/a/ay")); // source 3
- Location into = Location.create(path("/b/by")); // source 3
- assertNodeHasChildren("/a", "nA", "nB",
"nC", "qA", "qB", "qC", "ay");
- assertNodeHasChildren("/a/ay", "azA", "azB");
- assertNodeHasChildren("/b", "pA", "pB",
"pC", "by");
- assertNodeHasChildren("/b/by", "bzA", "bzB");
- CopyBranchRequest request = new CopyBranchRequest(from, "fedSpace",
into, "fedSpace");
- executor.process(request);
- if (request.hasError()) {
- System.out.println(request.getError().getMessage());
- }
- assertThat(request.hasError(), is(false));
- assertThat(request.getActualLocationBefore().getPath(),
is(path("/a/ay")));
- assertThat(request.getActualLocationAfter().getPath(),
is(path("/b/by/ay")));
- assertNodeHasChildren("/a", "nA", "nB",
"nC", "qA", "qB", "qC", "ay");
- assertNodeHasChildren("/b/by", "bzA", "bzB",
"ay");
- assertNodeHasChildren("/b/by/ay", "azA", "azB");
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederationI18nTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederationI18nTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederationI18nTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,36 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation;
-
-import org.jboss.dna.common.AbstractI18nTest;
-
-/**
- * @author Randall Hauch
- */
-public class FederationI18nTest extends AbstractI18nTest {
-
- public FederationI18nTest() {
- super(FederationI18n.class);
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/ProjectionParserTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/ProjectionParserTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/ProjectionParserTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,43 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-import org.junit.Test;
-
-/**
- * @author Randall Hauch
- */
-public class ProjectionParserTest {
-
- private ProjectionParser parser;
-
- @Test
- public void shouldInitializeSingletonWithParserMethods() {
- parser = ProjectionParser.getInstance();
- assertThat(parser.getParserMethods().size(), is(1));
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/ProjectionPathRuleTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/ProjectionPathRuleTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/ProjectionPathRuleTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,250 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.hamcrest.core.IsSame.sameInstance;
-import static org.junit.Assert.assertThat;
-import static org.junit.matchers.JUnitMatchers.hasItems;
-import org.jboss.dna.common.text.TextEncoder;
-import org.jboss.dna.common.text.UrlEncoder;
-import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.property.NamespaceRegistry;
-import org.jboss.dna.graph.property.Path;
-import org.jboss.dna.graph.property.PathFactory;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author Randall Hauch
- */
-public class ProjectionPathRuleTest {
-
- private ExecutionContext context;
- private Projection.PathRule rule;
- private PathFactory pathFactory;
- private Path repositoryPath;
- private Path sourcePath;
- private Path[] validExceptions;
- private NamespaceRegistry registry;
- private TextEncoder encoder;
-
- @Before
- public void beforeEach() {
- context = new ExecutionContext();
- pathFactory = context.getValueFactories().getPathFactory();
- registry = context.getNamespaceRegistry();
- encoder = new UrlEncoder();
- repositoryPath = pathFactory.create("/a/b/c");
- sourcePath = pathFactory.create("/x/y");
- validExceptions = new Path[] {pathFactory.create("e/f"),
pathFactory.create("e/g")};
- rule = new Projection.PathRule(repositoryPath, sourcePath, validExceptions);
- }
-
- @Test
- public void
shouldCreateInstanceWithValidRepositoryPathAndValidSourcePathAndNoExceptions() {
- rule = new Projection.PathRule(repositoryPath, sourcePath);
- assertThat(rule.getPathInRepository(), is(sameInstance(repositoryPath)));
- assertThat(rule.getPathInSource(), is(sameInstance(sourcePath)));
- assertThat(rule.hasExceptionsToRule(), is(false));
- }
-
- @Test
- public void
shouldCreateInstanceWithValidRepositoryPathAndValidSourcePathAndValidExceptions() {
- rule = new Projection.PathRule(repositoryPath, sourcePath, validExceptions);
- assertThat(rule.getPathInRepository(), is(sameInstance(repositoryPath)));
- assertThat(rule.getPathInSource(), is(sameInstance(sourcePath)));
- assertThat(rule.hasExceptionsToRule(), is(true));
- assertThat(rule.getExceptionsToRule(), hasItems(validExceptions));
- }
-
- @Test( expected = AssertionError.class )
- public void
shouldFailToCreateInstanceWithNullRepositoryPathAndValidSourcePathAndNoExceptions() {
- repositoryPath = null;
- new Projection.PathRule(repositoryPath, sourcePath);
- }
-
- @Test( expected = AssertionError.class )
- public void
shouldFailToCreateInstanceWithValidRepositoryPathAndNullSourcePathAndNoExceptions() {
- sourcePath = null;
- new Projection.PathRule(repositoryPath, sourcePath);
- }
-
- @Test( expected = AssertionError.class )
- public void
shouldFailToCreateInstanceWithValidRepositoryPathAndValidSourcePathAndAbsoluteExceptions()
{
- Path relativePath = validExceptions[0];
- Path absolutePath = pathFactory.create("/j/k/l/m");
- new Projection.PathRule(repositoryPath, sourcePath, relativePath, absolutePath);
- }
-
- @Test
- public void shouldIncludeRepositoryPathsAtPathInRepository() {
- assertThat(rule.includes(sourcePath), is(true));
- }
-
- @Test
- public void shouldIncludeRepositoryPathsBelowPathInRepositoryThatAreNotExcluded() {
- assertThat(rule.includes(pathFactory.create(sourcePath, "m")),
is(true));
- assertThat(rule.includes(pathFactory.create(sourcePath, "m/n")),
is(true));
- assertThat(rule.includes(pathFactory.create(sourcePath, "o/p")),
is(true));
- assertThat(rule.includes(pathFactory.create(sourcePath, "e/e")),
is(true));
- assertThat(rule.includes(pathFactory.create(sourcePath, "e")),
is(true));
- }
-
- @Test
- public void shouldNotIncludeRepositoryPathsBelowPathInRepositoryThatAreExcluded() {
- assertThat(rule.includes(pathFactory.create(sourcePath, "e/f")),
is(false));
- assertThat(rule.includes(pathFactory.create(sourcePath, "e/g")),
is(false));
- assertThat(rule.includes(pathFactory.create(sourcePath, "e/f/g")),
is(false));
- assertThat(rule.includes(pathFactory.create(sourcePath, "e/g/h")),
is(false));
- }
-
- @Test
- public void shouldNotIncludeRepositoryPathsNotBelowPathInRepository() {
- assertThat(rule.includes(pathFactory.create("/m/n")), is(false));
- assertThat(rule.includes(pathFactory.create("/x/y[3]")), is(false));
- }
-
- @Test
- public void shouldProjectRepositoryPathIntoSourcePath() {
- assertThat(rule.projectPathInRepositoryToPathInSource(repositoryPath,
pathFactory), is(sourcePath));
- }
-
- @Test
- public void shouldProjectPathBelowRepositoryPathIntoPathBelowSourcePath() {
- Path pathInRepository = pathFactory.create(repositoryPath, "m/n");
- Path pathInSource = pathFactory.create(sourcePath, "m/n");
- assertThat(rule.projectPathInRepositoryToPathInSource(pathInRepository,
pathFactory), is(pathInSource));
-
- pathInRepository = pathFactory.create(repositoryPath, "m");
- pathInSource = pathFactory.create(sourcePath, "m");
- assertThat(rule.projectPathInRepositoryToPathInSource(pathInRepository,
pathFactory), is(pathInSource));
-
- pathInRepository = pathFactory.create(repositoryPath, "m/n[3]");
- pathInSource = pathFactory.create(sourcePath, "m/n[3]");
- assertThat(rule.projectPathInRepositoryToPathInSource(pathInRepository,
pathFactory), is(pathInSource));
- }
-
- @Test
- public void shouldProjectSourcePathIntoRepositoryPath() {
- assertThat(rule.projectPathInSourceToPathInRepository(sourcePath, pathFactory),
is(repositoryPath));
- }
-
- @Test
- public void shouldProjectPathBelowSourcePathIntoPathBelowRepositoryPath() {
- Path pathInRepository = pathFactory.create(repositoryPath, "m/n");
- Path pathInSource = pathFactory.create(sourcePath, "m/n");
- assertThat(rule.projectPathInSourceToPathInRepository(pathInSource, pathFactory),
is(pathInRepository));
-
- pathInRepository = pathFactory.create(repositoryPath, "m");
- pathInSource = pathFactory.create(sourcePath, "m");
- assertThat(rule.projectPathInSourceToPathInRepository(pathInSource, pathFactory),
is(pathInRepository));
-
- pathInRepository = pathFactory.create(repositoryPath, "m/n[3]");
- pathInSource = pathFactory.create(sourcePath, "m/n[3]");
- assertThat(rule.projectPathInSourceToPathInRepository(pathInSource, pathFactory),
is(pathInRepository));
- }
-
- @Test
- public void
shouldGetPathsInRepositoryGivenPathsInSourceAtOrBelowSourcePathIfNotExcluded() {
- assertThat(rule.getPathInRepository(sourcePath, pathFactory),
is(repositoryPath));
- assertThatGetPathInRepositoryReturnsCorrectPathInSource("");
- assertThatGetPathInRepositoryReturnsCorrectPathInSource("m/n");
- assertThatGetPathInRepositoryReturnsCorrectPathInSource("m[1]");
- assertThatGetPathInRepositoryReturnsCorrectPathInSource("m[1]/n/o/p");
- }
-
- protected void assertThatGetPathInRepositoryReturnsCorrectPathInSource( String
subpath ) {
- assertThat(rule.getPathInRepository(pathFactory.create(sourcePath, subpath),
pathFactory),
- is(pathFactory.create(repositoryPath, subpath)));
- }
-
- @Test
- public void
shouldGetNullPathInRepositoryGivenPathsInSourceAtOrBelowSourcePathIfExcluded() {
- assertThat(rule.getPathInRepository(pathFactory.create(sourcePath,
"e/f"), pathFactory), is(nullValue()));
- assertThat(rule.getPathInRepository(pathFactory.create(sourcePath,
"e/g"), pathFactory), is(nullValue()));
- assertThat(rule.getPathInRepository(pathFactory.create(sourcePath,
"e/f/h"), pathFactory), is(nullValue()));
- assertThat(rule.getPathInRepository(pathFactory.create(sourcePath,
"e/g/h"), pathFactory), is(nullValue()));
- }
-
- @Test
- public void
shouldGetNullPathInRepositoryGivenPathsInRepositoryNotAtOrBelowSourcePath() {
- assertThat(rule.getPathInRepository(pathFactory.create("/m/n"),
pathFactory), is(nullValue()));
- }
-
- @Test
- public void
shouldGetPathsInSourceGivenPathsInRepositoryAtOrBelowRepositoryPathIfNotExcluded() {
- assertThat(rule.getPathInSource(repositoryPath, pathFactory), is(sourcePath));
- assertThatGetPathInSourceReturnsCorrectPathInRepository("");
- assertThatGetPathInSourceReturnsCorrectPathInRepository("m/n");
- assertThatGetPathInSourceReturnsCorrectPathInRepository("m[1]");
- assertThatGetPathInSourceReturnsCorrectPathInRepository("m[1]/n/o/p");
-
- }
-
- protected void assertThatGetPathInSourceReturnsCorrectPathInRepository( String
subpath ) {
- assertThat(rule.getPathInSource(pathFactory.create(repositoryPath, subpath),
pathFactory),
- is(pathFactory.create(sourcePath, subpath)));
- }
-
- @Test
- public void
shouldGetNullPathInSourceGivenPathsInRepositoryAtOrBelowRepositoryPathIfExcluded() {
- assertThat(rule.getPathInSource(pathFactory.create(repositoryPath,
"e/f"), pathFactory), is(nullValue()));
- assertThat(rule.getPathInSource(pathFactory.create(repositoryPath,
"e/g"), pathFactory), is(nullValue()));
- assertThat(rule.getPathInSource(pathFactory.create(repositoryPath,
"e/f/h"), pathFactory), is(nullValue()));
- assertThat(rule.getPathInSource(pathFactory.create(repositoryPath,
"e/g/h"), pathFactory), is(nullValue()));
- }
-
- @Test
- public void
shouldGetNullPathInSourceGivenPathsInRepositoryNotAtOrBelowRepositoryPath() {
- assertThat(rule.getPathInSource(pathFactory.create("/m/n"),
pathFactory), is(nullValue()));
- }
-
- @Test
- public void shouldConvertToString() {
- assertThat(rule.getString(registry, encoder), is("/a/b/c => /x/y $ e/f $
e/g"));
-
- repositoryPath = pathFactory.create("/a/b/c");
- sourcePath = pathFactory.create("/");
- rule = new Projection.PathRule(repositoryPath, sourcePath, validExceptions);
- assertThat(rule.getString(registry, encoder), is("/a/b/c => / $ e/f $
e/g"));
-
- repositoryPath = pathFactory.create("/");
- sourcePath = pathFactory.create("/");
- rule = new Projection.PathRule(repositoryPath, sourcePath, validExceptions);
- assertThat(rule.getString(registry, encoder), is("/ => / $ e/f $
e/g"));
- }
-
- @Test
- public void shouldHaveToString() {
- assertThat(rule.toString(), is("/{}a/{}b/{}c => /{}x/{}y $ {}e/{}f $
{}e/{}g"));
-
- repositoryPath = pathFactory.create("/a/b/c");
- sourcePath = pathFactory.create("/");
- rule = new Projection.PathRule(repositoryPath, sourcePath, validExceptions);
- assertThat(rule.toString(), is("/{}a/{}b/{}c => / $ {}e/{}f $
{}e/{}g"));
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/ProjectionTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/ProjectionTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/ProjectionTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,288 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsInstanceOf.instanceOf;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.junit.Assert.assertThat;
-import static org.junit.matchers.JUnitMatchers.hasItems;
-import static org.mockito.Mockito.stub;
-import java.util.Set;
-import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.property.Path;
-import org.jboss.dna.graph.property.PathFactory;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.MockitoAnnotations;
-import org.mockito.MockitoAnnotations.Mock;
-
-/**
- * @author Randall Hauch
- */
-public class ProjectionTest {
-
- private ExecutionContext context;
- private String sourceName;
- private String workspaceName;
- private Projection.Rule[] rules;
- private Projection projection;
- private PathFactory pathFactory;
- @Mock
- private Projection.Rule mockRule1;
- @Mock
- private Projection.Rule mockRule2;
- @Mock
- private Projection.Rule mockRule3;
-
- @Before
- public void beforeEach() {
- MockitoAnnotations.initMocks(this);
- context = new ExecutionContext();
- pathFactory = context.getValueFactories().getPathFactory();
- sourceName = "Valid name";
- workspaceName = "Valid workspace";
- rules = new Projection.Rule[] {mockRule1, mockRule2, mockRule3};
- projection = new Projection(sourceName, workspaceName, rules);
- }
-
- @Test
- public void shouldCreateInstanceWithValidNameAndValidRules() {
- projection = new Projection(sourceName, workspaceName, rules);
- assertThat(projection.getSourceName(), is(sourceName));
- assertThat(projection.getWorkspaceName(), is(workspaceName));
- assertThat(projection.getRules().size(), is(rules.length));
- assertThat(projection.getRules(), hasItems(mockRule1, mockRule2, mockRule3));
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void shouldFailToCreateInstanceWithNullNameAndValidRules() {
- sourceName = null;
- projection = new Projection(sourceName, workspaceName, rules);
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void
shouldFailToCreateInstanceWithNullWorkspaceNameAndValidSourceNameAndRules() {
- sourceName = null;
- projection = new Projection(sourceName, workspaceName, rules);
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void shouldFailToCreateInstanceWithEmptyNameAndValidRules() {
- sourceName = "";
- projection = new Projection(sourceName, workspaceName, rules);
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void shouldFailToCreateInstanceWithBlankNameAndValidRules() {
- sourceName = " \t ";
- projection = new Projection(sourceName, workspaceName, rules);
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void shouldFailToCreateInstanceWithValidNameAndNullRules() {
- rules = null;
- projection = new Projection(sourceName, workspaceName, rules);
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void shouldFailToCreateInstanceWithValidNameAndEmptyRules() {
- rules = new Projection.Rule[] {};
- projection = new Projection(sourceName, workspaceName, rules);
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void shouldFailToCreateInstanceWithValidNameAndRulesArrayContainingAllNulls()
{
- projection = new Projection(sourceName, null, null, null);
- }
-
- @Test
- public void
shouldCreateInstanceWithValidNameAndRulesAndShouldPruneNullRuleReferences() {
- projection = new Projection(sourceName, workspaceName, mockRule1, null,
mockRule3);
- assertThat(projection.getRules().size(), is(2));
- assertThat(projection.getRules(), hasItems(mockRule1, mockRule3));
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void shouldFailToGetPathsInSourceGivenValidPathAndNullPathFactory() {
- Path pathInRepository = pathFactory.create("/a/b/c");
- projection.getPathsInSource(pathInRepository, null);
- }
-
- @Test
- public void shouldGetNoPathsInSourceGivenNullPathInRepository() {
- Set<Path> pathsInSource = projection.getPathsInSource(null, pathFactory);
- assertThat(pathsInSource.isEmpty(), is(true));
- }
-
- @Test
- public void shouldGetNoPathsInSourceGivenPathInRepositoryAndNoApplicableRules() {
- Path pathInRepository = pathFactory.create("/a/b/c");
- stub(mockRule1.getPathInSource(pathInRepository, pathFactory)).toReturn(null);
- stub(mockRule2.getPathInSource(pathInRepository, pathFactory)).toReturn(null);
- stub(mockRule3.getPathInSource(pathInRepository, pathFactory)).toReturn(null);
- Set<Path> pathsInSource = projection.getPathsInSource(pathInRepository,
pathFactory);
- assertThat(pathsInSource.isEmpty(), is(true));
- }
-
- @Test
- public void shouldGetPathInSourceGivenPathInRepositoryAndOneApplicableRules() {
- Path pathInRepository = pathFactory.create("/a/b/c");
- Path pathInSource = pathFactory.create("/d/e/f");
- stub(mockRule1.getPathInSource(pathInRepository,
pathFactory)).toReturn(pathInSource);
- stub(mockRule2.getPathInSource(pathInRepository, pathFactory)).toReturn(null);
- stub(mockRule3.getPathInSource(pathInRepository, pathFactory)).toReturn(null);
- Set<Path> pathsInSource = projection.getPathsInSource(pathInRepository,
pathFactory);
- assertThat(pathsInSource, hasItems(pathInSource));
- }
-
- @Test
- public void shouldGetPathsInSourceGivenPathInRepositoryAndMultipleApplicableRules()
{
- Path pathInRepository = pathFactory.create("/a/b/c");
- Path pathInSource1 = pathFactory.create("/d/e/f");
- Path pathInSource2 = pathFactory.create("/d/e/g");
- Path pathInSource3 = pathFactory.create("/d/e/h");
- stub(mockRule1.getPathInSource(pathInRepository,
pathFactory)).toReturn(pathInSource1);
- stub(mockRule2.getPathInSource(pathInRepository,
pathFactory)).toReturn(pathInSource2);
- stub(mockRule3.getPathInSource(pathInRepository,
pathFactory)).toReturn(pathInSource3);
- Set<Path> pathsInSource = projection.getPathsInSource(pathInRepository,
pathFactory);
- assertThat(pathsInSource, hasItems(pathInSource1, pathInSource2,
pathInSource3));
- }
-
- @Test
- public void
shouldGetPathsInSourceGivenPathInRepositoryAndMultipleApplicableRulesReturningDuplicatePathsInSource()
{
- Path pathInRepository = pathFactory.create("/a/b/c");
- Path pathInSource1 = pathFactory.create("/d/e/f");
- Path pathInSource23 = pathFactory.create("/d/e/g");
- stub(mockRule1.getPathInSource(pathInRepository,
pathFactory)).toReturn(pathInSource1);
- stub(mockRule2.getPathInSource(pathInRepository,
pathFactory)).toReturn(pathInSource23);
- stub(mockRule3.getPathInSource(pathInRepository,
pathFactory)).toReturn(pathInSource23);
- Set<Path> pathsInSource = projection.getPathsInSource(pathInRepository,
pathFactory);
- assertThat(pathsInSource, hasItems(pathInSource1, pathInSource23));
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void shouldFailToGetPathsInRepositoryGivenValidPathAndNullPathFactory() {
- Path pathInSource = pathFactory.create("/a/b/c");
- projection.getPathsInRepository(pathInSource, null);
- }
-
- @Test
- public void shouldGetNoPathsInRepositoryGivenNullPathInSource() {
- Set<Path> pathsInRepository = projection.getPathsInRepository(null,
pathFactory);
- assertThat(pathsInRepository.isEmpty(), is(true));
- }
-
- @Test
- public void shouldGetNoPathsInRepositoryGivenPathInSourceAndNoApplicableRules() {
- Path pathInSource = pathFactory.create("/d/e/f");
- stub(mockRule1.getPathInRepository(pathInSource, pathFactory)).toReturn(null);
- stub(mockRule2.getPathInRepository(pathInSource, pathFactory)).toReturn(null);
- stub(mockRule3.getPathInRepository(pathInSource, pathFactory)).toReturn(null);
- Set<Path> pathsInRepository = projection.getPathsInRepository(pathInSource,
pathFactory);
- assertThat(pathsInRepository.isEmpty(), is(true));
- }
-
- @Test
- public void shouldGetPathInRepositoryGivenPathInSourceAndOneApplicableRules() {
- Path pathInRepository = pathFactory.create("/a/b/c");
- Path pathInSource = pathFactory.create("/d/e/f");
- stub(mockRule1.getPathInRepository(pathInSource,
pathFactory)).toReturn(pathInRepository);
- stub(mockRule2.getPathInRepository(pathInSource, pathFactory)).toReturn(null);
- stub(mockRule3.getPathInRepository(pathInSource, pathFactory)).toReturn(null);
- Set<Path> pathsInRepository = projection.getPathsInRepository(pathInSource,
pathFactory);
- assertThat(pathsInRepository, hasItems(pathInRepository));
- }
-
- @Test
- public void shouldGetPathsInRepositoryGivenPathInSourceAndMultipleApplicableRules()
{
- Path pathInSource = pathFactory.create("/a/b/c");
- Path pathInRepository1 = pathFactory.create("/d/e/f");
- Path pathInRepository2 = pathFactory.create("/d/e/g");
- Path pathInRepository3 = pathFactory.create("/d/e/h");
- stub(mockRule1.getPathInRepository(pathInSource,
pathFactory)).toReturn(pathInRepository1);
- stub(mockRule2.getPathInRepository(pathInSource,
pathFactory)).toReturn(pathInRepository2);
- stub(mockRule3.getPathInRepository(pathInSource,
pathFactory)).toReturn(pathInRepository3);
- Set<Path> pathsInRepository = projection.getPathsInRepository(pathInSource,
pathFactory);
- assertThat(pathsInRepository, hasItems(pathInRepository1, pathInRepository2,
pathInRepository3));
- }
-
- @Test
- public void
shouldGetPathsInRepositoryGivenPathInSourceAndMultipleApplicableRulesReturningDuplicatePathsInRepository()
{
- Path pathInSource = pathFactory.create("/a/b/c");
- Path pathInRepository1 = pathFactory.create("/d/e/f");
- Path pathInRepository23 = pathFactory.create("/d/e/g");
- stub(mockRule1.getPathInRepository(pathInSource,
pathFactory)).toReturn(pathInRepository1);
- stub(mockRule2.getPathInRepository(pathInSource,
pathFactory)).toReturn(pathInRepository23);
- stub(mockRule3.getPathInRepository(pathInSource,
pathFactory)).toReturn(pathInRepository23);
- Set<Path> pathsInRepository = projection.getPathsInRepository(pathInSource,
pathFactory);
- assertThat(pathsInRepository, hasItems(pathInRepository1, pathInRepository23));
- }
-
- @Test
- public void
shouldParsePathRuleFromDefinitionWithNonRootRepositoryPathAndNonRootSourcePath() {
- Projection.Rule rule = Projection.parsePathRule("/a => /b",
context);
- assertThat(rule, is(instanceOf(Projection.PathRule.class)));
- Projection.PathRule pathRule = (Projection.PathRule)rule;
- assertThat(pathRule.getPathInRepository(),
is(pathFactory.create("/a")));
- assertThat(pathRule.getPathInSource(), is(pathFactory.create("/b")));
- }
-
- @Test
- public void
shouldParsePathRuleFromDefinitionWithRootRepositoryPathAndNonRootSourcePath() {
- Projection.Rule rule = Projection.parsePathRule("/ => /b",
context);
- assertThat(rule, is(instanceOf(Projection.PathRule.class)));
- Projection.PathRule pathRule = (Projection.PathRule)rule;
- assertThat(pathRule.getPathInRepository(), is(pathFactory.createRootPath()));
- assertThat(pathRule.getPathInSource(), is(pathFactory.create("/b")));
- }
-
- @Test
- public void
shouldParsePathRuleFromDefinitionWithNonRootRepositoryPathAndRootSourcePath() {
- Projection.Rule rule = Projection.parsePathRule("/a => /",
context);
- assertThat(rule, is(instanceOf(Projection.PathRule.class)));
- Projection.PathRule pathRule = (Projection.PathRule)rule;
- assertThat(pathRule.getPathInRepository(),
is(pathFactory.create("/a")));
- assertThat(pathRule.getPathInSource(), is(pathFactory.createRootPath()));
- }
-
- @Test
- public void
shouldParsePathRuleFromDefinitionWithRootRepositoryPathAndRootSourcePath() {
- Projection.Rule rule = Projection.parsePathRule("/ => /", context);
- assertThat(rule, is(instanceOf(Projection.PathRule.class)));
- Projection.PathRule pathRule = (Projection.PathRule)rule;
- assertThat(pathRule.getPathInRepository(), is(pathFactory.createRootPath()));
- assertThat(pathRule.getPathInSource(), is(pathFactory.createRootPath()));
- }
-
- @Test
- public void
shouldNotParsePathRuleFromDefinitionWithRootRepositoryPathAndNoSourcePath() {
- assertThat(Projection.parsePathRule("/", context), is(nullValue()));
- }
-
- @Test
- public void
shouldNotParsePathRuleFromDefinitionWithNonRootRepositoryPathAndNoSourcePath() {
- assertThat(Projection.parsePathRule("a/", context), is(nullValue()));
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/ContributionStatisticsTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/ContributionStatisticsTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/ContributionStatisticsTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,65 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.contribution;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-import java.util.List;
-import org.junit.Test;
-
-/**
- * @author Randall Hauch
- */
-public class ContributionStatisticsTest {
-
- /**
- * Statistics should be recorded ONLY during testing within an IDE, and should
<i>never</i> be committed to SVN with the
- * {@link ContributionStatistics#RECORD} set to <code>true</code>. This
test verifies this, and thus will fail only during IDE
- * testing.
- */
- @Test
- public void shouldNotRecordStatisticsUnlessMeasuringStatisticsInLocalTests() {
- assertThat(ContributionStatistics.RECORD, is(false));
- }
-
- @Test
- public void shouldRecordTopFiveStatistics() {
- if (!ContributionStatistics.RECORD) return;
- for (int j = 0; j != 10; ++j) {
- for (int i = 0; i != j; ++i)
- ContributionStatistics.record(i, 1);
- }
- List<ContributionStatistics.Data> topData =
ContributionStatistics.getTop(5);
- for (ContributionStatistics.Data data : topData) {
- System.out.println(data);
- }
- assertThat(topData.size(), is(5));
- assertThat(topData.get(0).getInstanceCount(), is(9l));
- assertThat(topData.get(1).getInstanceCount(), is(8l));
- assertThat(topData.get(2).getInstanceCount(), is(7l));
- assertThat(topData.get(3).getInstanceCount(), is(6l));
- assertThat(topData.get(4).getInstanceCount(), is(5l));
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/EmptyContributionTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/EmptyContributionTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/EmptyContributionTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,102 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.contribution;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.hamcrest.core.IsSame.sameInstance;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.mock;
-import org.jboss.dna.graph.property.DateTime;
-import org.jboss.dna.graph.property.Name;
-import org.jboss.dna.graph.property.basic.JodaDateTime;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author Randall Hauch
- */
-public class EmptyContributionTest {
-
- private static final long TWENTY_FOUR_HOURS_IN_MILLISECONDS = 24 * 60 * 60 * 1000;
- public static final DateTime NOW = new
JodaDateTime(System.currentTimeMillis()).toUtcTimeZone();
- public static final DateTime YESTERDAY = new JodaDateTime(NOW.getMilliseconds() -
TWENTY_FOUR_HOURS_IN_MILLISECONDS).toUtcTimeZone();
- public static final DateTime TOMORROW = new JodaDateTime(NOW.getMilliseconds() +
TWENTY_FOUR_HOURS_IN_MILLISECONDS).toUtcTimeZone();
-
- private String sourceName;
- private String workspaceName;
- private EmptyContribution contribution;
- private DateTime expiration;
-
- @Before
- public void beforeEach() throws Exception {
- sourceName = "some source";
- workspaceName = "some workspace";
- expiration = TOMORROW;
- contribution = new EmptyContribution(sourceName, workspaceName, expiration);
- }
-
- @Test
- public void shouldAllowNullExpiration() {
- expiration = null;
- contribution = new EmptyContribution(sourceName, workspaceName, expiration);
- assertThat(contribution.getExpirationTimeInUtc(), is(nullValue()));
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void shouldNotAllowExpirationTimeIfNotInUtcTime() {
- new EmptyContribution(sourceName, workspaceName, new
JodaDateTime(System.currentTimeMillis(), "CST"));
- }
-
- @Test
- public void shouldHaveSameExpirationTimeSetInConstructor() {
- assertThat(contribution.getExpirationTimeInUtc(), is(sameInstance(expiration)));
- }
-
- @Test
- public void shouldHaveSameSourceNameSetInConstructor() {
- assertThat(contribution.getSourceName(), is(sourceName));
- }
-
- @Test
- public void shouldNotBeExpiredIfExpirationIsInTheFuture() {
- contribution = new EmptyContribution(sourceName, workspaceName, NOW);
- assertThat(contribution.isExpired(YESTERDAY), is(false));
- assertThat(contribution.isExpired(TOMORROW), is(true));
- }
-
- @Test
- public void shouldHaveNoChildren() {
- assertThat(contribution.getChildrenCount(), is(0));
- assertThat(contribution.getChildren().hasNext(), is(false));
- }
-
- @Test
- public void shouldHaveNoProperties() {
- assertThat(contribution.getPropertyCount(), is(0));
- assertThat(contribution.getProperties().hasNext(), is(false));
- Name propertyName = mock(Name.class); // doesn't matter what the name
instance is
- assertThat(contribution.getProperty(propertyName), is(nullValue()));
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/MultiChildContributionTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/MultiChildContributionTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/MultiChildContributionTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,136 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.contribution;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.hamcrest.core.IsSame.sameInstance;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.mock;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.property.DateTime;
-import org.jboss.dna.graph.property.Name;
-import org.jboss.dna.graph.property.Path;
-import org.jboss.dna.graph.property.basic.JodaDateTime;
-import org.jboss.dna.graph.property.basic.RootPath;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author Randall Hauch
- */
-public class MultiChildContributionTest {
-
- private static final long TWENTY_FOUR_HOURS_IN_MILLISECONDS = 24 * 60 * 60 * 1000;
- public static final DateTime NOW = new
JodaDateTime(System.currentTimeMillis()).toUtcTimeZone();
- public static final DateTime YESTERDAY = new JodaDateTime(NOW.getMilliseconds() -
TWENTY_FOUR_HOURS_IN_MILLISECONDS).toUtcTimeZone();
- public static final DateTime TOMORROW = new JodaDateTime(NOW.getMilliseconds() +
TWENTY_FOUR_HOURS_IN_MILLISECONDS).toUtcTimeZone();
-
- private String sourceName;
- private String workspaceName;
- private Path pathInSource;
- private MultiChildContribution contribution;
- private DateTime expiration;
- private List<Location> children;
- private Location child1;
- private Location child2;
- private Location child3;
-
- @Before
- public void beforeEach() throws Exception {
- sourceName = "some source";
- workspaceName = "some workspace";
- pathInSource = RootPath.INSTANCE;
- expiration = TOMORROW;
- child1 = mock(Location.class);
- child2 = mock(Location.class);
- child3 = mock(Location.class);
- children = Arrays.asList(child1, child2, child3);
- contribution = new MultiChildContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, children);
- }
-
- @Test
- public void shouldAllowNullExpiration() {
- expiration = null;
- contribution = new MultiChildContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, children);
- assertThat(contribution.getExpirationTimeInUtc(), is(nullValue()));
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void shouldNotAllowExpirationTimeIfNotInUtcTime() {
- expiration = new JodaDateTime(System.currentTimeMillis(), "CST");
- contribution = new MultiChildContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, children);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldNotAllowNullChildren() {
- children = null;
- contribution = new MultiChildContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, children);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldNotAllowEmptyChildren() {
- children = Collections.emptyList();
- contribution = new MultiChildContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, children);
- }
-
- @Test
- public void shouldHaveSameExpirationTimeSetInConstructor() {
- assertThat(contribution.getExpirationTimeInUtc(), is(sameInstance(expiration)));
- }
-
- @Test
- public void shouldHaveSameSourceNameSetInConstructor() {
- assertThat(contribution.getSourceName(), is(sourceName));
- }
-
- @Test
- public void shouldNotBeExpiredIfExpirationIsInTheFuture() {
- contribution = new MultiChildContribution(sourceName, workspaceName,
Location.create(pathInSource), NOW, children);
- assertThat(contribution.isExpired(YESTERDAY), is(false));
- assertThat(contribution.isExpired(TOMORROW), is(true));
- }
-
- @Test
- public void shouldHaveChildren() {
- assertThat(contribution.getChildrenCount(), is(3));
- Iterator<Location> iter = contribution.getChildren();
- assertThat(iter.next(), is(child1));
- assertThat(iter.next(), is(child2));
- assertThat(iter.next(), is(child3));
- assertThat(iter.hasNext(), is(false));
- }
-
- @Test
- public void shouldHaveNoProperties() {
- assertThat(contribution.getPropertyCount(), is(0));
- assertThat(contribution.getProperties().hasNext(), is(false));
- Name propertyName = mock(Name.class); // doesn't matter what the name
instance is
- assertThat(contribution.getProperty(propertyName), is(nullValue()));
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/MultiPropertyContributionTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/MultiPropertyContributionTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/MultiPropertyContributionTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,148 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.contribution;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.hamcrest.core.IsSame.sameInstance;
-import static org.junit.Assert.assertThat;
-import static org.junit.matchers.JUnitMatchers.hasItems;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.property.DateTime;
-import org.jboss.dna.graph.property.Path;
-import org.jboss.dna.graph.property.Property;
-import org.jboss.dna.graph.property.basic.BasicName;
-import org.jboss.dna.graph.property.basic.BasicSingleValueProperty;
-import org.jboss.dna.graph.property.basic.JodaDateTime;
-import org.jboss.dna.graph.property.basic.RootPath;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author Randall Hauch
- */
-public class MultiPropertyContributionTest {
-
- private static final long TWENTY_FOUR_HOURS_IN_MILLISECONDS = 24 * 60 * 60 * 1000;
- public static final DateTime NOW = new
JodaDateTime(System.currentTimeMillis()).toUtcTimeZone();
- public static final DateTime YESTERDAY = new JodaDateTime(NOW.getMilliseconds() -
TWENTY_FOUR_HOURS_IN_MILLISECONDS).toUtcTimeZone();
- public static final DateTime TOMORROW = new JodaDateTime(NOW.getMilliseconds() +
TWENTY_FOUR_HOURS_IN_MILLISECONDS).toUtcTimeZone();
-
- private String sourceName;
- private String workspaceName;
- private Path pathInSource;
- private MultiPropertyContribution contribution;
- private DateTime expiration;
- private List<Property> properties;
- private Property property1;
- private Property property2;
- private Property property3;
-
- @Before
- public void beforeEach() throws Exception {
- sourceName = "some source";
- workspaceName = "some workspace";
- pathInSource = RootPath.INSTANCE;
- expiration = TOMORROW;
- String nsUri = "http://www.jboss.org/default";
- property1 = new BasicSingleValueProperty(new BasicName(nsUri,
"property1"), "value1");
- property2 = new BasicSingleValueProperty(new BasicName(nsUri,
"property2"), "value2");
- property3 = new BasicSingleValueProperty(new BasicName(nsUri,
"property3"), "value3");
- properties = Arrays.asList(property1, property2, property3);
- contribution = new MultiPropertyContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration,
- properties);
- }
-
- @Test
- public void shouldAllowNullExpiration() {
- expiration = null;
- contribution = new MultiPropertyContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration,
- properties);
- assertThat(contribution.getExpirationTimeInUtc(), is(nullValue()));
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void shouldNotAllowExpirationTimeIfNotInUtcTime() {
- expiration = new JodaDateTime(System.currentTimeMillis(), "CST");
- contribution = new MultiPropertyContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration,
- properties);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldNotAllowNullProperties() {
- properties = null;
- contribution = new MultiPropertyContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration,
- properties);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldNotAllowEmptyProperties() {
- properties = Collections.emptyList();
- contribution = new MultiPropertyContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration,
- properties);
- }
-
- @Test
- public void shouldHaveSameExpirationTimeSetInConstructor() {
- assertThat(contribution.getExpirationTimeInUtc(), is(sameInstance(expiration)));
- }
-
- @Test
- public void shouldHaveSameSourceNameSetInConstructor() {
- assertThat(contribution.getSourceName(), is(sourceName));
- }
-
- @Test
- public void shouldNotBeExpiredIfExpirationIsInTheFuture() {
- contribution = new MultiPropertyContribution(sourceName, workspaceName,
Location.create(pathInSource), NOW, properties);
- assertThat(contribution.isExpired(YESTERDAY), is(false));
- assertThat(contribution.isExpired(TOMORROW), is(true));
- }
-
- @Test
- public void shouldHaveNoChildren() {
- assertThat(contribution.getChildrenCount(), is(0));
- assertThat(contribution.getChildren().hasNext(), is(false));
- }
-
- @Test
- public void shouldHaveProperties() {
- assertThat(contribution.getPropertyCount(), is(3));
- assertThat(contribution.getProperty(property1.getName()),
is(sameInstance(property1)));
- assertThat(contribution.getProperty(property2.getName()),
is(sameInstance(property2)));
- assertThat(contribution.getProperty(property3.getName()),
is(sameInstance(property3)));
- assertThat(contribution.getProperty(new
BasicName("http://www.jboss.org/x", "propertyX")), is(nullValue()));
- List<Property> properties = new ArrayList<Property>();
- for (Iterator<Property> iter = contribution.getProperties();
iter.hasNext();) {
- properties.add(iter.next());
- }
- assertThat(properties, hasItems(property1, property2, property3));
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/NodeContributionTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/NodeContributionTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/NodeContributionTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,175 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.contribution;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.hamcrest.core.IsSame.sameInstance;
-import static org.junit.Assert.assertThat;
-import static org.junit.matchers.JUnitMatchers.hasItems;
-import static org.mockito.Mockito.mock;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.property.DateTime;
-import org.jboss.dna.graph.property.Path;
-import org.jboss.dna.graph.property.Property;
-import org.jboss.dna.graph.property.basic.BasicName;
-import org.jboss.dna.graph.property.basic.BasicSingleValueProperty;
-import org.jboss.dna.graph.property.basic.JodaDateTime;
-import org.jboss.dna.graph.property.basic.RootPath;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author Randall Hauch
- */
-public class NodeContributionTest {
-
- private static final long TWENTY_FOUR_HOURS_IN_MILLISECONDS = 24 * 60 * 60 * 1000;
- public static final DateTime NOW = new
JodaDateTime(System.currentTimeMillis()).toUtcTimeZone();
- public static final DateTime YESTERDAY = new JodaDateTime(NOW.getMilliseconds() -
TWENTY_FOUR_HOURS_IN_MILLISECONDS).toUtcTimeZone();
- public static final DateTime TOMORROW = new JodaDateTime(NOW.getMilliseconds() +
TWENTY_FOUR_HOURS_IN_MILLISECONDS).toUtcTimeZone();
-
- private String sourceName;
- private String workspaceName;
- private Path pathInSource;
- private NodeContribution contribution;
- private DateTime expiration;
- private List<Property> properties;
- private Property property1;
- private Property property2;
- private Property property3;
- private List<Location> children;
- private Location child1;
- private Location child2;
- private Location child3;
-
- @Before
- public void beforeEach() throws Exception {
- sourceName = "some source";
- workspaceName = "some workspace";
- pathInSource = RootPath.INSTANCE;
- expiration = TOMORROW;
- String nsUri = "http://www.jboss.org/default";
- property1 = new BasicSingleValueProperty(new BasicName(nsUri,
"property1"), "value1");
- property2 = new BasicSingleValueProperty(new BasicName(nsUri,
"property2"), "value2");
- property3 = new BasicSingleValueProperty(new BasicName(nsUri,
"property3"), "value3");
- properties = Arrays.asList(property1, property2, property3);
- child1 = mock(Location.class);
- child2 = mock(Location.class);
- child3 = mock(Location.class);
- children = Arrays.asList(child1, child2, child3);
- contribution = new NodeContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, properties,
- children);
- }
-
- @Test
- public void shouldAllowNullExpiration() {
- expiration = null;
- contribution = new NodeContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, properties,
- children);
- assertThat(contribution.getExpirationTimeInUtc(), is(nullValue()));
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void shouldNotAllowExpirationTimeIfNotInUtcTime() {
- expiration = new JodaDateTime(System.currentTimeMillis(), "CST");
- contribution = new NodeContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, properties,
- children);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldNotAllowNullProperties() {
- properties = null;
- contribution = new NodeContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, properties,
- children);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldNotAllowEmptyProperties() {
- properties = Collections.emptyList();
- contribution = new NodeContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, properties,
- children);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldNotAllowNullChildren() {
- children = null;
- contribution = new NodeContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, properties,
- children);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldNotAllowEmptyChildren() {
- children = Collections.emptyList();
- contribution = new NodeContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, properties,
- children);
- }
-
- @Test
- public void shouldHaveSameExpirationTimeSetInConstructor() {
- assertThat(contribution.getExpirationTimeInUtc(), is(sameInstance(expiration)));
- }
-
- @Test
- public void shouldHaveSameSourceNameSetInConstructor() {
- assertThat(contribution.getSourceName(), is(sourceName));
- }
-
- @Test
- public void shouldNotBeExpiredIfExpirationIsInTheFuture() {
- contribution = new NodeContribution(sourceName, workspaceName,
Location.create(pathInSource), NOW, properties, children);
- assertThat(contribution.isExpired(YESTERDAY), is(false));
- assertThat(contribution.isExpired(TOMORROW), is(true));
- }
-
- @Test
- public void shouldHaveChildren() {
- assertThat(contribution.getChildrenCount(), is(3));
- Iterator<Location> iter = contribution.getChildren();
- assertThat(iter.next(), is(child1));
- assertThat(iter.next(), is(child2));
- assertThat(iter.next(), is(child3));
- assertThat(iter.hasNext(), is(false));
- }
-
- @Test
- public void shouldHaveProperties() {
- assertThat(contribution.getPropertyCount(), is(3));
- assertThat(contribution.getProperty(property1.getName()),
is(sameInstance(property1)));
- assertThat(contribution.getProperty(property2.getName()),
is(sameInstance(property2)));
- assertThat(contribution.getProperty(property3.getName()),
is(sameInstance(property3)));
- assertThat(contribution.getProperty(new
BasicName("http://www.jboss.org/x", "propertyX")), is(nullValue()));
- List<Property> properties = new ArrayList<Property>();
- for (Iterator<Property> iter = contribution.getProperties();
iter.hasNext();) {
- properties.add(iter.next());
- }
- assertThat(properties, hasItems(property1, property2, property3));
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/OneChildContributionTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/OneChildContributionTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/OneChildContributionTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,119 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.contribution;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.hamcrest.core.IsSame.sameInstance;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.mock;
-import java.util.Iterator;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.property.DateTime;
-import org.jboss.dna.graph.property.Name;
-import org.jboss.dna.graph.property.Path;
-import org.jboss.dna.graph.property.basic.JodaDateTime;
-import org.jboss.dna.graph.property.basic.RootPath;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author Randall Hauch
- */
-public class OneChildContributionTest {
-
- private static final long TWENTY_FOUR_HOURS_IN_MILLISECONDS = 24 * 60 * 60 * 1000;
- public static final DateTime NOW = new
JodaDateTime(System.currentTimeMillis()).toUtcTimeZone();
- public static final DateTime YESTERDAY = new JodaDateTime(NOW.getMilliseconds() -
TWENTY_FOUR_HOURS_IN_MILLISECONDS).toUtcTimeZone();
- public static final DateTime TOMORROW = new JodaDateTime(NOW.getMilliseconds() +
TWENTY_FOUR_HOURS_IN_MILLISECONDS).toUtcTimeZone();
-
- private String sourceName;
- private String workspaceName;
- private Path pathInSource;
- private OneChildContribution contribution;
- private DateTime expiration;
- private Location child1;
-
- @Before
- public void beforeEach() throws Exception {
- sourceName = "some source";
- workspaceName = "some workspace";
- pathInSource = RootPath.INSTANCE;
- expiration = TOMORROW;
- child1 = mock(Location.class);
- contribution = new OneChildContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, child1);
- }
-
- @Test
- public void shouldAllowNullExpiration() {
- expiration = null;
- contribution = new OneChildContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, child1);
- assertThat(contribution.getExpirationTimeInUtc(), is(nullValue()));
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void shouldNotAllowExpirationTimeIfNotInUtcTime() {
- expiration = new JodaDateTime(System.currentTimeMillis(), "CST");
- contribution = new OneChildContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, child1);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldNotAllowNullChildren() {
- child1 = null;
- contribution = new OneChildContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, child1);
- }
-
- @Test
- public void shouldHaveSameExpirationTimeSetInConstructor() {
- assertThat(contribution.getExpirationTimeInUtc(), is(sameInstance(expiration)));
- }
-
- @Test
- public void shouldHaveSameSourceNameSetInConstructor() {
- assertThat(contribution.getSourceName(), is(sourceName));
- }
-
- @Test
- public void shouldNotBeExpiredIfExpirationIsInTheFuture() {
- contribution = new OneChildContribution(sourceName, workspaceName,
Location.create(pathInSource), NOW, child1);
- assertThat(contribution.isExpired(YESTERDAY), is(false));
- assertThat(contribution.isExpired(TOMORROW), is(true));
- }
-
- @Test
- public void shouldHaveChildren() {
- assertThat(contribution.getChildrenCount(), is(1));
- Iterator<Location> iter = contribution.getChildren();
- assertThat(iter.next(), is(child1));
- assertThat(iter.hasNext(), is(false));
- }
-
- @Test
- public void shouldHaveNoProperties() {
- assertThat(contribution.getPropertyCount(), is(0));
- assertThat(contribution.getProperties().hasNext(), is(false));
- Name propertyName = mock(Name.class); // doesn't matter what the name
instance is
- assertThat(contribution.getProperty(propertyName), is(nullValue()));
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/OnePropertyContributionTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/OnePropertyContributionTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/OnePropertyContributionTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,127 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.contribution;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.hamcrest.core.IsSame.sameInstance;
-import static org.junit.Assert.assertThat;
-import static org.junit.matchers.JUnitMatchers.hasItems;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.property.DateTime;
-import org.jboss.dna.graph.property.Path;
-import org.jboss.dna.graph.property.Property;
-import org.jboss.dna.graph.property.basic.BasicName;
-import org.jboss.dna.graph.property.basic.BasicSingleValueProperty;
-import org.jboss.dna.graph.property.basic.JodaDateTime;
-import org.jboss.dna.graph.property.basic.RootPath;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author Randall Hauch
- */
-public class OnePropertyContributionTest {
-
- private static final long TWENTY_FOUR_HOURS_IN_MILLISECONDS = 24 * 60 * 60 * 1000;
- public static final DateTime NOW = new
JodaDateTime(System.currentTimeMillis()).toUtcTimeZone();
- public static final DateTime YESTERDAY = new JodaDateTime(NOW.getMilliseconds() -
TWENTY_FOUR_HOURS_IN_MILLISECONDS).toUtcTimeZone();
- public static final DateTime TOMORROW = new JodaDateTime(NOW.getMilliseconds() +
TWENTY_FOUR_HOURS_IN_MILLISECONDS).toUtcTimeZone();
-
- private String sourceName;
- private String workspaceName;
- private Path pathInSource;
- private OnePropertyContribution contribution;
- private DateTime expiration;
- private Property property1;
-
- @Before
- public void beforeEach() throws Exception {
- sourceName = "some source";
- workspaceName = "some workspace";
- pathInSource = RootPath.INSTANCE;
- expiration = TOMORROW;
- String nsUri = "http://www.jboss.org/default";
- property1 = new BasicSingleValueProperty(new BasicName(nsUri,
"property1"), "value1");
- contribution = new OnePropertyContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, property1);
- }
-
- @Test
- public void shouldAllowNullExpiration() {
- expiration = null;
- contribution = new OnePropertyContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, property1);
- assertThat(contribution.getExpirationTimeInUtc(), is(nullValue()));
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void shouldNotAllowExpirationTimeIfNotInUtcTime() {
- expiration = new JodaDateTime(System.currentTimeMillis(), "CST");
- contribution = new OnePropertyContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, property1);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldNotAllowNullFirstProperty() {
- property1 = null;
- contribution = new OnePropertyContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, property1);
- }
-
- @Test
- public void shouldHaveSameExpirationTimeSetInConstructor() {
- assertThat(contribution.getExpirationTimeInUtc(), is(sameInstance(expiration)));
- }
-
- @Test
- public void shouldHaveSameSourceNameSetInConstructor() {
- assertThat(contribution.getSourceName(), is(sourceName));
- }
-
- @Test
- public void shouldNotBeExpiredIfExpirationIsInTheFuture() {
- contribution = new OnePropertyContribution(sourceName, workspaceName,
Location.create(pathInSource), NOW, property1);
- assertThat(contribution.isExpired(YESTERDAY), is(false));
- assertThat(contribution.isExpired(TOMORROW), is(true));
- }
-
- @Test
- public void shouldHaveNoChildren() {
- assertThat(contribution.getChildrenCount(), is(0));
- assertThat(contribution.getChildren().hasNext(), is(false));
- }
-
- @Test
- public void shouldHaveProperties() {
- assertThat(contribution.getPropertyCount(), is(1));
- assertThat(contribution.getProperty(property1.getName()),
is(sameInstance(property1)));
- assertThat(contribution.getProperty(new
BasicName("http://www.jboss.org/x", "propertyX")), is(nullValue()));
- List<Property> properties = new ArrayList<Property>();
- for (Iterator<Property> iter = contribution.getProperties();
iter.hasNext();) {
- properties.add(iter.next());
- }
- assertThat(properties, hasItems(property1));
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/ThreePropertyContributionTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/ThreePropertyContributionTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/ThreePropertyContributionTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,152 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.contribution;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.hamcrest.core.IsSame.sameInstance;
-import static org.junit.Assert.assertThat;
-import static org.junit.matchers.JUnitMatchers.hasItems;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.property.DateTime;
-import org.jboss.dna.graph.property.Path;
-import org.jboss.dna.graph.property.Property;
-import org.jboss.dna.graph.property.basic.BasicName;
-import org.jboss.dna.graph.property.basic.BasicSingleValueProperty;
-import org.jboss.dna.graph.property.basic.JodaDateTime;
-import org.jboss.dna.graph.property.basic.RootPath;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author Randall Hauch
- */
-public class ThreePropertyContributionTest {
-
- private static final long TWENTY_FOUR_HOURS_IN_MILLISECONDS = 24 * 60 * 60 * 1000;
- public static final DateTime NOW = new
JodaDateTime(System.currentTimeMillis()).toUtcTimeZone();
- public static final DateTime YESTERDAY = new JodaDateTime(NOW.getMilliseconds() -
TWENTY_FOUR_HOURS_IN_MILLISECONDS).toUtcTimeZone();
- public static final DateTime TOMORROW = new JodaDateTime(NOW.getMilliseconds() +
TWENTY_FOUR_HOURS_IN_MILLISECONDS).toUtcTimeZone();
-
- private String sourceName;
- private String workspaceName;
- private Path pathInSource;
- private ThreePropertyContribution contribution;
- private DateTime expiration;
- private Property property1;
- private Property property2;
- private Property property3;
-
- @Before
- public void beforeEach() throws Exception {
- sourceName = "some source";
- workspaceName = "some workspace";
- pathInSource = RootPath.INSTANCE;
- expiration = TOMORROW;
- String nsUri = "http://www.jboss.org/default";
- property1 = new BasicSingleValueProperty(new BasicName(nsUri,
"property1"), "value1");
- property2 = new BasicSingleValueProperty(new BasicName(nsUri,
"property2"), "value2");
- property3 = new BasicSingleValueProperty(new BasicName(nsUri,
"property3"), "value3");
- contribution = new ThreePropertyContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration,
- property1, property2, property3);
- }
-
- @Test
- public void shouldAllowNullExpiration() {
- expiration = null;
- contribution = new ThreePropertyContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration,
- property1, property2, property3);
- assertThat(contribution.getExpirationTimeInUtc(), is(nullValue()));
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void shouldNotAllowExpirationTimeIfNotInUtcTime() {
- expiration = new JodaDateTime(System.currentTimeMillis(), "CST");
- contribution = new ThreePropertyContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration,
- property1, property2, property3);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldNotAllowNullFirstProperty() {
- property1 = null;
- contribution = new ThreePropertyContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration,
- property1, property2, property3);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldNotAllowNullSecondProperty() {
- property2 = null;
- contribution = new ThreePropertyContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration,
- property1, property2, property3);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldNotAllowNullThirdProperty() {
- property3 = null;
- contribution = new ThreePropertyContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration,
- property1, property2, property3);
- }
-
- @Test
- public void shouldHaveSameExpirationTimeSetInConstructor() {
- assertThat(contribution.getExpirationTimeInUtc(), is(sameInstance(expiration)));
- }
-
- @Test
- public void shouldHaveSameSourceNameSetInConstructor() {
- assertThat(contribution.getSourceName(), is(sourceName));
- }
-
- @Test
- public void shouldNotBeExpiredIfExpirationIsInTheFuture() {
- contribution = new ThreePropertyContribution(sourceName, workspaceName,
Location.create(pathInSource), NOW, property1,
- property2, property3);
- assertThat(contribution.isExpired(YESTERDAY), is(false));
- assertThat(contribution.isExpired(TOMORROW), is(true));
- }
-
- @Test
- public void shouldHaveNoChildren() {
- assertThat(contribution.getChildrenCount(), is(0));
- assertThat(contribution.getChildren().hasNext(), is(false));
- }
-
- @Test
- public void shouldHaveProperties() {
- assertThat(contribution.getPropertyCount(), is(3));
- assertThat(contribution.getProperty(property1.getName()),
is(sameInstance(property1)));
- assertThat(contribution.getProperty(property2.getName()),
is(sameInstance(property2)));
- assertThat(contribution.getProperty(property3.getName()),
is(sameInstance(property3)));
- assertThat(contribution.getProperty(new
BasicName("http://www.jboss.org/x", "propertyX")), is(nullValue()));
- List<Property> properties = new ArrayList<Property>();
- for (Iterator<Property> iter = contribution.getProperties();
iter.hasNext();) {
- properties.add(iter.next());
- }
- assertThat(properties, hasItems(property1, property2, property3));
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/TwoChildContributionTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/TwoChildContributionTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/TwoChildContributionTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,128 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.contribution;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.hamcrest.core.IsSame.sameInstance;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.mock;
-import java.util.Iterator;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.property.DateTime;
-import org.jboss.dna.graph.property.Name;
-import org.jboss.dna.graph.property.Path;
-import org.jboss.dna.graph.property.basic.JodaDateTime;
-import org.jboss.dna.graph.property.basic.RootPath;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author Randall Hauch
- */
-public class TwoChildContributionTest {
-
- private static final long TWENTY_FOUR_HOURS_IN_MILLISECONDS = 24 * 60 * 60 * 1000;
- public static final DateTime NOW = new
JodaDateTime(System.currentTimeMillis()).toUtcTimeZone();
- public static final DateTime YESTERDAY = new JodaDateTime(NOW.getMilliseconds() -
TWENTY_FOUR_HOURS_IN_MILLISECONDS).toUtcTimeZone();
- public static final DateTime TOMORROW = new JodaDateTime(NOW.getMilliseconds() +
TWENTY_FOUR_HOURS_IN_MILLISECONDS).toUtcTimeZone();
-
- private String sourceName;
- private String workspaceName;
- private Path pathInSource;
- private TwoChildContribution contribution;
- private DateTime expiration;
- private Location child1;
- private Location child2;
-
- @Before
- public void beforeEach() throws Exception {
- sourceName = "some source";
- workspaceName = "some workspace";
- pathInSource = RootPath.INSTANCE;
- expiration = TOMORROW;
- child1 = mock(Location.class);
- child2 = mock(Location.class);
- contribution = new TwoChildContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, child1, child2);
- }
-
- @Test
- public void shouldAllowNullExpiration() {
- expiration = null;
- contribution = new TwoChildContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, child1, child2);
- assertThat(contribution.getExpirationTimeInUtc(), is(nullValue()));
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void shouldNotAllowExpirationTimeIfNotInUtcTime() {
- expiration = new JodaDateTime(System.currentTimeMillis(), "CST");
- contribution = new TwoChildContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, child1, child2);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldNotAllowNullFirstChild() {
- child1 = null;
- contribution = new TwoChildContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, child1, child2);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldNotAllowNullSecondChild() {
- child2 = null;
- contribution = new TwoChildContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, child1, child2);
- }
-
- @Test
- public void shouldHaveSameExpirationTimeSetInConstructor() {
- assertThat(contribution.getExpirationTimeInUtc(), is(sameInstance(expiration)));
- }
-
- @Test
- public void shouldHaveSameSourceNameSetInConstructor() {
- assertThat(contribution.getSourceName(), is(sourceName));
- }
-
- @Test
- public void shouldNotBeExpiredIfExpirationIsInTheFuture() {
- contribution = new TwoChildContribution(sourceName, workspaceName,
Location.create(pathInSource), NOW, child1, child2);
- assertThat(contribution.isExpired(YESTERDAY), is(false));
- assertThat(contribution.isExpired(TOMORROW), is(true));
- }
-
- @Test
- public void shouldHaveChildren() {
- assertThat(contribution.getChildrenCount(), is(2));
- Iterator<Location> iter = contribution.getChildren();
- assertThat(iter.next(), is(child1));
- assertThat(iter.next(), is(child2));
- assertThat(iter.hasNext(), is(false));
- }
-
- @Test
- public void shouldHaveNoProperties() {
- assertThat(contribution.getPropertyCount(), is(0));
- assertThat(contribution.getProperties().hasNext(), is(false));
- Name propertyName = mock(Name.class); // doesn't matter what the name
instance is
- assertThat(contribution.getProperty(propertyName), is(nullValue()));
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/TwoPropertyContributionTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/TwoPropertyContributionTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/contribution/TwoPropertyContributionTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,142 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.contribution;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.hamcrest.core.IsSame.sameInstance;
-import static org.junit.Assert.assertThat;
-import static org.junit.matchers.JUnitMatchers.hasItems;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.property.DateTime;
-import org.jboss.dna.graph.property.Path;
-import org.jboss.dna.graph.property.Property;
-import org.jboss.dna.graph.property.basic.BasicName;
-import org.jboss.dna.graph.property.basic.BasicSingleValueProperty;
-import org.jboss.dna.graph.property.basic.JodaDateTime;
-import org.jboss.dna.graph.property.basic.RootPath;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author Randall Hauch
- */
-public class TwoPropertyContributionTest {
-
- private static final long TWENTY_FOUR_HOURS_IN_MILLISECONDS = 24 * 60 * 60 * 1000;
- public static final DateTime NOW = new
JodaDateTime(System.currentTimeMillis()).toUtcTimeZone();
- public static final DateTime YESTERDAY = new JodaDateTime(NOW.getMilliseconds() -
TWENTY_FOUR_HOURS_IN_MILLISECONDS).toUtcTimeZone();
- public static final DateTime TOMORROW = new JodaDateTime(NOW.getMilliseconds() +
TWENTY_FOUR_HOURS_IN_MILLISECONDS).toUtcTimeZone();
-
- private String sourceName;
- private String workspaceName;
- private Path pathInSource;
- private TwoPropertyContribution contribution;
- private DateTime expiration;
- private Property property1;
- private Property property2;
-
- @Before
- public void beforeEach() throws Exception {
- sourceName = "some source";
- workspaceName = "some workspace";
- pathInSource = RootPath.INSTANCE;
- expiration = TOMORROW;
- String nsUri = "http://www.jboss.org/default";
- property1 = new BasicSingleValueProperty(new BasicName(nsUri,
"property1"), "value1");
- property2 = new BasicSingleValueProperty(new BasicName(nsUri,
"property2"), "value2");
- contribution = new TwoPropertyContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, property1,
- property2);
- }
-
- @Test
- public void shouldAllowNullExpiration() {
- expiration = null;
- contribution = new TwoPropertyContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, property1,
- property2);
- assertThat(contribution.getExpirationTimeInUtc(), is(nullValue()));
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void shouldNotAllowExpirationTimeIfNotInUtcTime() {
- expiration = new JodaDateTime(System.currentTimeMillis(), "CST");
- contribution = new TwoPropertyContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, property1,
- property2);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldNotAllowNullFirstProperty() {
- property1 = null;
- contribution = new TwoPropertyContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, property1,
- property2);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldNotAllowNullSecondProperty() {
- property2 = null;
- contribution = new TwoPropertyContribution(sourceName, workspaceName,
Location.create(pathInSource), expiration, property1,
- property2);
- }
-
- @Test
- public void shouldHaveSameExpirationTimeSetInConstructor() {
- assertThat(contribution.getExpirationTimeInUtc(), is(sameInstance(expiration)));
- }
-
- @Test
- public void shouldHaveSameSourceNameSetInConstructor() {
- assertThat(contribution.getSourceName(), is(sourceName));
- }
-
- @Test
- public void shouldNotBeExpiredIfExpirationIsInTheFuture() {
- contribution = new TwoPropertyContribution(sourceName, workspaceName,
Location.create(pathInSource), NOW, property1,
- property2);
- assertThat(contribution.isExpired(YESTERDAY), is(false));
- assertThat(contribution.isExpired(TOMORROW), is(true));
- }
-
- @Test
- public void shouldHaveNoChildren() {
- assertThat(contribution.getChildrenCount(), is(0));
- assertThat(contribution.getChildren().hasNext(), is(false));
- }
-
- @Test
- public void shouldHaveProperties() {
- assertThat(contribution.getPropertyCount(), is(2));
- assertThat(contribution.getProperty(property1.getName()),
is(sameInstance(property1)));
- assertThat(contribution.getProperty(property2.getName()),
is(sameInstance(property2)));
- assertThat(contribution.getProperty(new
BasicName("http://www.jboss.org/x", "propertyX")), is(nullValue()));
- List<Property> properties = new ArrayList<Property>();
- for (Iterator<Property> iter = contribution.getProperties();
iter.hasNext();) {
- properties.add(iter.next());
- }
- assertThat(properties, hasItems(property1, property2));
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/FederatedNodeTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/FederatedNodeTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/FederatedNodeTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,103 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.merge;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.hamcrest.core.IsSame.sameInstance;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.mock;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.property.Path;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.MockitoAnnotations;
-
-/**
- * @author Randall Hauch
- */
-public class FederatedNodeTest {
-
- private FederatedNode node;
- private Location location;
-
- @Before
- public void beforeEach() {
- MockitoAnnotations.initMocks(this);
- location = Location.create(mock(Path.class));
- node = new FederatedNode(location, "workspace");
- }
-
- @Test
- public void shouldHaveSamePathSuppliedToConstructor() {
- assertThat(node.at(), is(sameInstance(location)));
- assertThat(node.getActualLocationOfNode(), is(sameInstance(location)));
- }
-
- @Test
- public void shouldNotHaveMergePlanUponConstruction() {
- assertThat(node.getMergePlan(), is(nullValue()));
- }
-
- @Test
- public void shouldAllowSettingMergePlan() {
- MergePlan mergePlan = mock(MergePlan.class);
- node.setMergePlan(mergePlan);
- assertThat(node.getMergePlan(), is(sameInstance(mergePlan)));
- }
-
- // @Test
- // public void shouldHaveDefaultConflictBehaviorUponConstruction() {
- // assertThat(node.getConflictBehavior(),
is(FederatedNode.DEFAULT_CONFLICT_BEHAVIOR));
- // }
- //
- // @Test
- // public void shouldAllowSettingConflictBehavior() {
- // NodeConflictBehavior behavior = NodeConflictBehavior.REPLACE;
- // assertThat(node.getConflictBehavior(), is(not(behavior)));
- // node.setConflictBehavior(behavior);
- // assertThat(node.getConflictBehavior(), is(behavior));
- // }
- //
- // @Test
- // public void shouldAllowSettingConflictBehaviorToNull() {
- // node.setConflictBehavior(null);
- // assertThat(node.getConflictBehavior(),
is(FederatedNode.DEFAULT_CONFLICT_BEHAVIOR));
- //
- // // Set to something that is not the default, then set to null
- // NodeConflictBehavior behavior = NodeConflictBehavior.REPLACE;
- // assertThat(node.getConflictBehavior(), is(not(behavior)));
- // node.setConflictBehavior(behavior);
- // assertThat(node.getConflictBehavior(), is(behavior));
- // node.setConflictBehavior(null);
- // assertThat(node.getConflictBehavior(),
is(FederatedNode.DEFAULT_CONFLICT_BEHAVIOR));
- // }
-
- @Test
- public void shouldHaveHashCodeThatIsTheHashCodeOfTheLocation() {
- node = new FederatedNode(location, "workspace");
- assertThat(node.hashCode(), is(location.hashCode()));
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/FiveContributionMergePlanTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/FiveContributionMergePlanTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/FiveContributionMergePlanTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,135 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.merge;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.hamcrest.core.IsSame.sameInstance;
-import static org.junit.Assert.assertThat;
-import static org.junit.matchers.JUnitMatchers.hasItems;
-import static org.mockito.Mockito.stub;
-import org.jboss.dna.connector.federation.contribution.Contribution;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.MockitoAnnotations;
-import org.mockito.MockitoAnnotations.Mock;
-
-/**
- * @author Randall Hauch
- */
-public class FiveContributionMergePlanTest {
-
- private FiveContributionMergePlan plan;
- @Mock
- private Contribution contribution1;
- @Mock
- private Contribution contribution2;
- @Mock
- private Contribution contribution3;
- @Mock
- private Contribution contribution4;
- @Mock
- private Contribution contribution5;
-
- @Before
- public void beforeEach() throws Exception {
- MockitoAnnotations.initMocks(this);
- stub(contribution1.getSourceName()).toReturn("source1");
- stub(contribution2.getSourceName()).toReturn("source2");
- stub(contribution3.getSourceName()).toReturn("source3");
- stub(contribution4.getSourceName()).toReturn("source4");
- stub(contribution5.getSourceName()).toReturn("source5");
- plan = new FiveContributionMergePlan(contribution1, contribution2, contribution3,
contribution4, contribution5);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldFailWhenCreatingMergePlanWithNullFirstContribution() {
- contribution1 = null;
- plan = new FiveContributionMergePlan(contribution1, contribution2, contribution3,
contribution4, contribution5);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldFailWhenCreatingMergePlanWithNullSecondContribution() {
- contribution2 = null;
- plan = new FiveContributionMergePlan(contribution1, contribution2, contribution3,
contribution4, contribution5);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldFailWhenCreatingMergePlanWithNullThirdContribution() {
- contribution3 = null;
- plan = new FiveContributionMergePlan(contribution1, contribution2, contribution3,
contribution4, contribution5);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldFailWhenCreatingMergePlanWithNullFourthContribution() {
- contribution4 = null;
- plan = new FiveContributionMergePlan(contribution1, contribution2, contribution3,
contribution4, contribution5);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldFailWhenCreatingMergePlanWithNullFifthContribution() {
- contribution5 = null;
- plan = new FiveContributionMergePlan(contribution1, contribution2, contribution3,
contribution4, contribution5);
- }
-
- @Test( expected = AssertionError.class )
- public void
shouldFailWhenCreatingMergePlanWithMultipleContributionsFromTheSameSource() {
- stub(contribution5.getSourceName()).toReturn("source1");
- plan = new FiveContributionMergePlan(contribution1, contribution2, contribution3,
contribution4, contribution5);
- }
-
- @Test
- public void shouldReturnIteratorOverContributions() {
- assertThat(plan, hasItems(contribution1, contribution2, contribution3,
contribution4, contribution5));
- }
-
- @Test
- public void shouldHaveContributionCountOfFive() {
- assertThat(plan.getContributionCount(), is(5));
- }
-
- @Test
- public void shouldReturnContributionWhenSuppliedNameMatchesContributionsSourceName()
{
- assertThat(plan.getContributionFrom(contribution1.getSourceName()),
is(sameInstance(contribution1)));
- assertThat(plan.getContributionFrom(contribution2.getSourceName()),
is(sameInstance(contribution2)));
- assertThat(plan.getContributionFrom(contribution3.getSourceName()),
is(sameInstance(contribution3)));
- assertThat(plan.getContributionFrom(contribution4.getSourceName()),
is(sameInstance(contribution4)));
- assertThat(plan.getContributionFrom(contribution5.getSourceName()),
is(sameInstance(contribution5)));
- }
-
- @Test
- public void
shouldReturnNullContributionWhenSuppliedNameDoesNotMatchContributionsSourceName() {
- assertThat(plan.getContributionFrom("other source"), is(nullValue()));
- }
-
- @Test
- public void shouldCompareSourceNameOfContributionsWhenCallingIsSource() {
- assertThat(plan.isSource(contribution1.getSourceName()), is(true));
- assertThat(plan.isSource(contribution2.getSourceName()), is(true));
- assertThat(plan.isSource(contribution3.getSourceName()), is(true));
- assertThat(plan.isSource(contribution4.getSourceName()), is(true));
- assertThat(plan.isSource(contribution5.getSourceName()), is(true));
- assertThat(plan.isSource("other source"), is(false));
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/FourContributionMergePlanTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/FourContributionMergePlanTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/FourContributionMergePlanTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,123 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.merge;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.hamcrest.core.IsSame.sameInstance;
-import static org.junit.Assert.assertThat;
-import static org.junit.matchers.JUnitMatchers.hasItems;
-import static org.mockito.Mockito.stub;
-import org.jboss.dna.connector.federation.contribution.Contribution;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.MockitoAnnotations;
-import org.mockito.MockitoAnnotations.Mock;
-
-/**
- * @author Randall Hauch
- */
-public class FourContributionMergePlanTest {
-
- private FourContributionMergePlan plan;
- @Mock
- private Contribution contribution1;
- @Mock
- private Contribution contribution2;
- @Mock
- private Contribution contribution3;
- @Mock
- private Contribution contribution4;
-
- @Before
- public void beforeEach() throws Exception {
- MockitoAnnotations.initMocks(this);
- stub(contribution1.getSourceName()).toReturn("source1");
- stub(contribution2.getSourceName()).toReturn("source2");
- stub(contribution3.getSourceName()).toReturn("source3");
- stub(contribution4.getSourceName()).toReturn("source4");
- plan = new FourContributionMergePlan(contribution1, contribution2, contribution3,
contribution4);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldFailWhenCreatingMergePlanWithNullFirstContribution() {
- contribution1 = null;
- plan = new FourContributionMergePlan(contribution1, contribution2, contribution3,
contribution4);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldFailWhenCreatingMergePlanWithNullSecondContribution() {
- contribution2 = null;
- plan = new FourContributionMergePlan(contribution1, contribution2, contribution3,
contribution4);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldFailWhenCreatingMergePlanWithNullThirdContribution() {
- contribution3 = null;
- plan = new FourContributionMergePlan(contribution1, contribution2, contribution3,
contribution4);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldFailWhenCreatingMergePlanWithNullFourthContribution() {
- contribution4 = null;
- plan = new FourContributionMergePlan(contribution1, contribution2, contribution3,
contribution4);
- }
-
- @Test( expected = AssertionError.class )
- public void
shouldFailWhenCreatingMergePlanWithMultipleContributionsFromTheSameSource() {
- plan = new FourContributionMergePlan(contribution1, contribution1, contribution3,
contribution4);
- }
-
- @Test
- public void shouldReturnIteratorOverContributions() {
- assertThat(plan, hasItems(contribution1, contribution2, contribution3,
contribution4));
- }
-
- @Test
- public void shouldHaveContributionCountOfFour() {
- assertThat(plan.getContributionCount(), is(4));
- }
-
- @Test
- public void shouldReturnContributionWhenSuppliedNameMatchesContributionsSourceName()
{
- assertThat(plan.getContributionFrom(contribution1.getSourceName()),
is(sameInstance(contribution1)));
- assertThat(plan.getContributionFrom(contribution2.getSourceName()),
is(sameInstance(contribution2)));
- assertThat(plan.getContributionFrom(contribution3.getSourceName()),
is(sameInstance(contribution3)));
- assertThat(plan.getContributionFrom(contribution4.getSourceName()),
is(sameInstance(contribution4)));
- }
-
- @Test
- public void
shouldReturnNullContributionWhenSuppliedNameDoesNotMatchContributionsSourceName() {
- assertThat(plan.getContributionFrom("other source"), is(nullValue()));
- }
-
- @Test
- public void shouldCompareSourceNameOfContributionsWhenCallingIsSource() {
- assertThat(plan.isSource(contribution1.getSourceName()), is(true));
- assertThat(plan.isSource(contribution2.getSourceName()), is(true));
- assertThat(plan.isSource(contribution3.getSourceName()), is(true));
- assertThat(plan.isSource(contribution4.getSourceName()), is(true));
- assertThat(plan.isSource("other source"), is(false));
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/MergePlanTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/MergePlanTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/MergePlanTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,332 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.merge;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsInstanceOf.instanceOf;
-import static org.hamcrest.core.IsNot.not;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.hamcrest.core.IsSame.sameInstance;
-import static org.junit.Assert.assertThat;
-import static org.junit.matchers.JUnitMatchers.hasItems;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.stub;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyNoMoreInteractions;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.jboss.dna.connector.federation.contribution.Contribution;
-import org.jboss.dna.graph.property.DateTime;
-import org.jboss.dna.graph.property.Name;
-import org.jboss.dna.graph.property.Property;
-import org.jboss.dna.graph.property.basic.BasicEmptyProperty;
-import org.jboss.dna.graph.property.basic.BasicName;
-import org.jboss.dna.graph.property.basic.JodaDateTime;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author Randall Hauch
- */
-public class MergePlanTest {
-
- private MergePlan plan;
- private List<Contribution> contributions;
-
- @Before
- public void beforeEach() throws Exception {
- contributions = new ArrayList<Contribution>();
- }
-
- protected void addContributions( int number ) {
- for (int i = 0; i != number; ++i) {
- Contribution contribution = mock(Contribution.class);
- stub(contribution.getSourceName()).toReturn("source " + i);
- contributions.add(contribution);
- }
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void shouldFailToCreateMergePlanFromArrayWithNoContributions() {
- MergePlan.create(contributions.toArray(new Contribution[contributions.size()]));
- }
-
- @Test
- public void shouldCreateMergePlanFromArrayWithOneContribution() {
- addContributions(1);
- plan = MergePlan.create(contributions.toArray(new
Contribution[contributions.size()]));
- assertThat(plan, is(instanceOf(MergePlan.class)));
- assertThat(plan, is(instanceOf(OneContributionMergePlan.class)));
- assertThat(plan.getContributionCount(), is(1));
- assertThat(plan, hasItems(contributions.toArray(new
Contribution[contributions.size()])));
- }
-
- @Test
- public void shouldCreateMergePlanFromArrayWithTwoContributions() {
- addContributions(2);
- plan = MergePlan.create(contributions.toArray(new
Contribution[contributions.size()]));
- assertThat(plan, is(instanceOf(MergePlan.class)));
- assertThat(plan, is(instanceOf(TwoContributionMergePlan.class)));
- assertThat(plan.getContributionCount(), is(2));
- assertThat(plan, hasItems(contributions.toArray(new
Contribution[contributions.size()])));
- }
-
- @Test
- public void shouldCreateMergePlanFromArrayWithThreeContributions() {
- addContributions(3);
- plan = MergePlan.create(contributions.toArray(new
Contribution[contributions.size()]));
- assertThat(plan, is(instanceOf(MergePlan.class)));
- assertThat(plan, is(instanceOf(ThreeContributionMergePlan.class)));
- assertThat(plan.getContributionCount(), is(3));
- assertThat(plan, hasItems(contributions.toArray(new
Contribution[contributions.size()])));
- }
-
- @Test
- public void shouldCreateMergePlanFromArrayWithFourContributions() {
- addContributions(4);
- plan = MergePlan.create(contributions.toArray(new
Contribution[contributions.size()]));
- assertThat(plan, is(instanceOf(MergePlan.class)));
- assertThat(plan, is(instanceOf(FourContributionMergePlan.class)));
- assertThat(plan.getContributionCount(), is(4));
- assertThat(plan, hasItems(contributions.toArray(new
Contribution[contributions.size()])));
- }
-
- @Test
- public void shouldCreateMergePlanFromArrayWithFiveContributions() {
- addContributions(5);
- plan = MergePlan.create(contributions.toArray(new
Contribution[contributions.size()]));
- assertThat(plan, is(instanceOf(MergePlan.class)));
- assertThat(plan, is(instanceOf(FiveContributionMergePlan.class)));
- assertThat(plan.getContributionCount(), is(5));
- assertThat(plan, hasItems(contributions.toArray(new
Contribution[contributions.size()])));
- }
-
- @Test
- public void shouldCreateMergePlanFromArrayWithSixContributions() {
- addContributions(6);
- plan = MergePlan.create(contributions.toArray(new
Contribution[contributions.size()]));
- assertThat(plan, is(instanceOf(MergePlan.class)));
- assertThat(plan, is(instanceOf(MultipleContributionMergePlan.class)));
- assertThat(plan.getContributionCount(), is(6));
- assertThat(plan, hasItems(contributions.toArray(new
Contribution[contributions.size()])));
- }
-
- @Test
- public void shouldCreateMergePlanFromArrayWithManyContributions() {
- addContributions(100);
- plan = MergePlan.create(contributions.toArray(new
Contribution[contributions.size()]));
- assertThat(plan, is(instanceOf(MergePlan.class)));
- assertThat(plan, is(instanceOf(MultipleContributionMergePlan.class)));
- assertThat(plan.getContributionCount(), is(100));
- assertThat(plan, hasItems(contributions.toArray(new
Contribution[contributions.size()])));
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void shouldFailToCreateMergePlanFromListWithNoContributions() {
- MergePlan.create(contributions);
- }
-
- @Test
- public void shouldCreateMergePlanFromListWithOneContribution() {
- addContributions(1);
- plan = MergePlan.create(contributions);
- assertThat(plan, is(instanceOf(MergePlan.class)));
- assertThat(plan, is(instanceOf(OneContributionMergePlan.class)));
- assertThat(plan.getContributionCount(), is(1));
- assertThat(plan, hasItems(contributions.toArray(new
Contribution[contributions.size()])));
- }
-
- @Test
- public void shouldCreateMergePlanFromListWithTwoContributions() {
- addContributions(2);
- plan = MergePlan.create(contributions);
- assertThat(plan, is(instanceOf(MergePlan.class)));
- assertThat(plan, is(instanceOf(TwoContributionMergePlan.class)));
- assertThat(plan.getContributionCount(), is(2));
- assertThat(plan, hasItems(contributions.toArray(new
Contribution[contributions.size()])));
- }
-
- @Test
- public void shouldCreateMergePlanFromListWithThreeContributions() {
- addContributions(3);
- plan = MergePlan.create(contributions);
- assertThat(plan, is(instanceOf(MergePlan.class)));
- assertThat(plan, is(instanceOf(ThreeContributionMergePlan.class)));
- assertThat(plan.getContributionCount(), is(3));
- assertThat(plan, hasItems(contributions.toArray(new
Contribution[contributions.size()])));
- }
-
- @Test
- public void shouldCreateMergePlanFromListWithFourContributions() {
- addContributions(4);
- plan = MergePlan.create(contributions);
- assertThat(plan, is(instanceOf(MergePlan.class)));
- assertThat(plan, is(instanceOf(FourContributionMergePlan.class)));
- assertThat(plan.getContributionCount(), is(4));
- assertThat(plan, hasItems(contributions.toArray(new
Contribution[contributions.size()])));
- }
-
- @Test
- public void shouldCreateMergePlanFromListWithFiveContributions() {
- addContributions(5);
- plan = MergePlan.create(contributions);
- assertThat(plan, is(instanceOf(MergePlan.class)));
- assertThat(plan, is(instanceOf(FiveContributionMergePlan.class)));
- assertThat(plan.getContributionCount(), is(5));
- assertThat(plan, hasItems(contributions.toArray(new
Contribution[contributions.size()])));
- }
-
- @Test
- public void shouldCreateMergePlanFromListWithSixContributions() {
- addContributions(6);
- plan = MergePlan.create(contributions);
- assertThat(plan, is(instanceOf(MergePlan.class)));
- assertThat(plan, is(instanceOf(MultipleContributionMergePlan.class)));
- assertThat(plan.getContributionCount(), is(6));
- assertThat(plan, hasItems(contributions.toArray(new
Contribution[contributions.size()])));
- }
-
- @Test
- public void shouldCreateMergePlanFromListWithManyContributions() {
- addContributions(100);
- plan = MergePlan.create(contributions);
- assertThat(plan, is(instanceOf(MergePlan.class)));
- assertThat(plan, is(instanceOf(MultipleContributionMergePlan.class)));
- assertThat(plan.getContributionCount(), is(100));
- assertThat(plan, hasItems(contributions.toArray(new
Contribution[contributions.size()])));
- }
-
- @Test
- public void shouldComputeOnlyOnceTheExpirationTimeFromTheContributions() {
- DateTime nowInUtc = new JodaDateTime().toUtcTimeZone();
- DateTime nowPlus100InUtc = nowInUtc.plusSeconds(100);
- DateTime nowPlus200InUtc = nowInUtc.plusSeconds(200);
-
- addContributions(2);
- stub(contributions.get(0).getExpirationTimeInUtc()).toReturn(nowPlus100InUtc);
- stub(contributions.get(1).getExpirationTimeInUtc()).toReturn(nowPlus200InUtc);
-
- plan = MergePlan.create(contributions);
- DateTime expires = plan.getExpirationTimeInUtc();
- assertThat(expires, is(nowPlus100InUtc));
- verify(contributions.get(0), times(1)).getSourceName();
- verify(contributions.get(1), times(1)).getSourceName();
- verify(contributions.get(0), times(1)).getExpirationTimeInUtc();
- verify(contributions.get(1), times(1)).getExpirationTimeInUtc();
-
- DateTime expires2 = plan.getExpirationTimeInUtc();
- assertThat(expires2, is(nowPlus100InUtc));
- verifyNoMoreInteractions(contributions.get(0));
- verifyNoMoreInteractions(contributions.get(1));
- }
-
- @Test
- public void shouldDetermineIfExpired() {
- DateTime nowInUtc = new JodaDateTime().toUtcTimeZone();
- DateTime nowPlus100InUtc = nowInUtc.plusSeconds(100);
- DateTime nowPlus200InUtc = nowInUtc.plusSeconds(200);
- DateTime nowPlus300InUtc = nowInUtc.plusSeconds(300);
-
- addContributions(2);
- stub(contributions.get(0).getExpirationTimeInUtc()).toReturn(nowPlus100InUtc);
- stub(contributions.get(1).getExpirationTimeInUtc()).toReturn(nowPlus200InUtc);
-
- plan = MergePlan.create(contributions);
- DateTime expires = plan.getExpirationTimeInUtc();
- assertThat(expires, is(nowPlus100InUtc));
- verify(contributions.get(0), times(1)).getExpirationTimeInUtc();
- verify(contributions.get(1), times(1)).getExpirationTimeInUtc();
- assertThat(plan.isExpired(nowInUtc), is(false));
- assertThat(plan.isExpired(nowPlus100InUtc), is(false));
- assertThat(plan.isExpired(nowPlus200InUtc), is(true));
- assertThat(plan.isExpired(nowPlus300InUtc), is(true));
- }
-
- @Test
- public void shouldHaveNoAnnotationsUponConstruction() {
- addContributions(2);
- plan = MergePlan.create(contributions);
- assertThat(plan.getAnnotationCount(), is(0));
- }
-
- @Test
- public void
shouldAllowSettingAnnotationAndShouldReturnNullWhenSettingNullAnnotation() {
- addContributions(2);
- plan = MergePlan.create(contributions);
- assertThat(plan.setAnnotation(null), is(nullValue()));
- }
-
- @Test
- public void
shouldAllowSettingAnnotationAndShouldReturnPreviousPropertyWhenSettingAnnotation() {
- Property property = new BasicEmptyProperty(new BasicName("uri",
"name"));
- Property property2 = new BasicEmptyProperty(property.getName());
-
- addContributions(2);
- plan = MergePlan.create(contributions);
- assertThat(plan.setAnnotation(property), is(nullValue()));
- assertThat(plan.setAnnotation(property2), is(property));
- }
-
- @SuppressWarnings( "unchecked" )
- @Test
- public void shouldSetAnnotationsMapToNullIfPassedNullOrEmptyMap() {
- addContributions(2);
- plan = MergePlan.create(contributions);
- plan.setAnnotations(null);
- assertThat(plan.getAnnotationCount(), is(0));
-
- Map<Name, Property> newAnnotations = mock(Map.class);
- plan.setAnnotations(newAnnotations);
- assertThat(plan.getAnnotationCount(), is(0));
- verify(newAnnotations).size();
- }
-
- @SuppressWarnings( "unchecked" )
- @Test
- public void shouldSetAnnotationsMapToSameInstancePassedIn() {
- addContributions(2);
- plan = MergePlan.create(contributions);
- Map<Name, Property> newAnnotations = mock(Map.class);
- stub(newAnnotations.size()).toReturn(3);
- plan.setAnnotations(newAnnotations);
- assertThat(plan.getAnnotationCount(), is(3));
- verify(newAnnotations).size();
- }
-
- @Test
- public void shouldReturnCopyOfAnnotationsMapFromGetAnnotations() {
- Property property = new BasicEmptyProperty(new BasicName("uri",
"name"));
- Map<Name, Property> annotations = new HashMap<Name, Property>();
- annotations.put(property.getName(), property);
-
- addContributions(2);
- plan = MergePlan.create(contributions);
- plan.setAnnotations(annotations);
- Map<Name, Property> annotationsCopy = plan.getAnnotations();
- assertThat(annotationsCopy, is(not(sameInstance(annotations))));
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/MultipleContributionMergePlanTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/MultipleContributionMergePlanTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/MultipleContributionMergePlanTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,127 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.merge;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.hamcrest.core.IsSame.sameInstance;
-import static org.junit.Assert.assertThat;
-import static org.junit.matchers.JUnitMatchers.hasItems;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.stub;
-import java.util.LinkedList;
-import java.util.List;
-import org.jboss.dna.connector.federation.contribution.Contribution;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author Randall Hauch
- */
-public class MultipleContributionMergePlanTest {
-
- private MultipleContributionMergePlan plan;
- private List<Contribution> contributions;
-
- @Before
- public void beforeEach() throws Exception {
- contributions = new LinkedList<Contribution>();
- addContributions(10);
- plan = new MultipleContributionMergePlan(contributions);
- }
-
- protected void addContributions( int number ) {
- for (int i = 0; i != number; ++i) {
- Contribution contribution = mock(Contribution.class);
- stub(contribution.getSourceName()).toReturn("source " + i);
- contributions.add(contribution);
- }
- }
-
- @Test( expected = AssertionError.class )
- public void shouldFailWhenCreatingMergePlanWithNullFirstContribution() {
- contributions.add(0, null);
- plan = new MultipleContributionMergePlan(contributions);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldFailWhenCreatingMergePlanWithNullSecondContribution() {
- contributions.add(1, null);
- plan = new MultipleContributionMergePlan(contributions);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldFailWhenCreatingMergePlanWithNullThirdContribution() {
- contributions.add(2, null);
- plan = new MultipleContributionMergePlan(contributions);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldFailWhenCreatingMergePlanWithNullFourthContribution() {
- contributions.add(3, null);
- plan = new MultipleContributionMergePlan(contributions);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldFailWhenCreatingMergePlanWithNullFifthContribution() {
- contributions.add(4, null);
- plan = new MultipleContributionMergePlan(contributions);
- }
-
- @Test( expected = AssertionError.class )
- public void
shouldFailWhenCreatingMergePlanWithMultipleContributionsFromTheSameSource() {
- contributions.add(contributions.get(0));
- plan = new MultipleContributionMergePlan(contributions);
- }
-
- @Test
- public void shouldReturnIteratorOverContributions() {
- assertThat(plan, hasItems(contributions.toArray(new
Contribution[contributions.size()])));
- }
-
- @Test
- public void shouldHaveContributionCountOfFive() {
- assertThat(plan.getContributionCount(), is(contributions.size()));
- }
-
- @Test
- public void shouldReturnContributionWhenSuppliedNameMatchesContributionsSourceName()
{
- for (Contribution contribution : contributions) {
- assertThat(plan.getContributionFrom(contribution.getSourceName()),
is(sameInstance(contribution)));
- }
- }
-
- @Test
- public void
shouldReturnNullContributionWhenSuppliedNameDoesNotMatchContributionsSourceName() {
- assertThat(plan.getContributionFrom("other source"), is(nullValue()));
- }
-
- @Test
- public void shouldCompareSourceNameOfContributionsWhenCallingIsSource() {
- for (Contribution contribution : contributions) {
- assertThat(plan.isSource(contribution.getSourceName()), is(true));
- }
- assertThat(plan.isSource("other source"), is(false));
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/OneContributionMergePlanTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/OneContributionMergePlanTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/OneContributionMergePlanTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,90 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.merge;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.hamcrest.core.IsSame.sameInstance;
-import static org.junit.Assert.assertThat;
-import static org.junit.matchers.JUnitMatchers.hasItem;
-import static org.mockito.Mockito.stub;
-import java.util.Iterator;
-import org.jboss.dna.connector.federation.contribution.Contribution;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.MockitoAnnotations;
-import org.mockito.MockitoAnnotations.Mock;
-
-/**
- * @author Randall Hauch
- */
-public class OneContributionMergePlanTest {
-
- private OneContributionMergePlan plan;
- @Mock
- private Contribution contribution1;
-
- @Before
- public void beforeEach() throws Exception {
- MockitoAnnotations.initMocks(this);
- plan = new OneContributionMergePlan(contribution1);
- stub(contribution1.getSourceName()).toReturn("source");
- }
-
- @Test( expected = AssertionError.class )
- public void shouldFailWhenCreatingMergePlanWithNullFirstContribution() {
- contribution1 = null;
- plan = new OneContributionMergePlan(contribution1);
- }
-
- @Test
- public void shouldReturnIteratorOverContributions() {
- Iterator<Contribution> iter = plan.iterator();
- assertThat(iter.hasNext(), is(true));
- assertThat(iter.next(), is(sameInstance(contribution1)));
- assertThat(iter.hasNext(), is(false));
- assertThat(plan, hasItem(contribution1));
- }
-
- @Test
- public void shouldHaveContributionCountOfOne() {
- assertThat(plan.getContributionCount(), is(1));
- }
-
- @Test
- public void shouldReturnContributionWhenSuppliedNameMatchesContributionsSourceName()
{
- assertThat(plan.getContributionFrom(contribution1.getSourceName()),
is(sameInstance(contribution1)));
- }
-
- @Test
- public void
shouldReturnNullContributionWhenSuppliedNameDoesNotMatchContributionsSourceName() {
- assertThat(plan.getContributionFrom("other source"), is(nullValue()));
- }
-
- @Test
- public void shouldCompareSourceNameOfContributionsWhenCallingIsSource() {
- assertThat(plan.isSource(contribution1.getSourceName()), is(true));
- assertThat(plan.isSource("other source"), is(false));
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/ThreeContributionMergePlanTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/ThreeContributionMergePlanTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/ThreeContributionMergePlanTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,112 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.merge;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.hamcrest.core.IsSame.sameInstance;
-import static org.junit.Assert.assertThat;
-import static org.junit.matchers.JUnitMatchers.hasItems;
-import static org.mockito.Mockito.stub;
-import org.jboss.dna.connector.federation.contribution.Contribution;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.MockitoAnnotations;
-import org.mockito.MockitoAnnotations.Mock;
-
-/**
- * @author Randall Hauch
- */
-public class ThreeContributionMergePlanTest {
-
- private ThreeContributionMergePlan plan;
- @Mock
- private Contribution contribution1;
- @Mock
- private Contribution contribution2;
- @Mock
- private Contribution contribution3;
-
- @Before
- public void beforeEach() throws Exception {
- MockitoAnnotations.initMocks(this);
- stub(contribution1.getSourceName()).toReturn("source1");
- stub(contribution2.getSourceName()).toReturn("source2");
- stub(contribution3.getSourceName()).toReturn("source3");
- plan = new ThreeContributionMergePlan(contribution1, contribution2,
contribution3);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldFailWhenCreatingMergePlanWithNullFirstContribution() {
- contribution1 = null;
- plan = new ThreeContributionMergePlan(contribution1, contribution2,
contribution3);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldFailWhenCreatingMergePlanWithNullSecondContribution() {
- contribution2 = null;
- plan = new ThreeContributionMergePlan(contribution1, contribution2,
contribution3);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldFailWhenCreatingMergePlanWithNullThirdContribution() {
- contribution3 = null;
- plan = new ThreeContributionMergePlan(contribution1, contribution2,
contribution3);
- }
-
- @Test( expected = AssertionError.class )
- public void
shouldFailWhenCreatingMergePlanWithMultipleContributionsFromTheSameSource() {
- plan = new ThreeContributionMergePlan(contribution1, contribution2,
contribution1);
- }
-
- @Test
- public void shouldReturnIteratorOverContributions() {
- assertThat(plan, hasItems(contribution1, contribution2, contribution3));
- }
-
- @Test
- public void shouldHaveContributionCountOfThree() {
- assertThat(plan.getContributionCount(), is(3));
- }
-
- @Test
- public void shouldReturnContributionWhenSuppliedNameMatchesContributionsSourceName()
{
- assertThat(plan.getContributionFrom(contribution1.getSourceName()),
is(sameInstance(contribution1)));
- assertThat(plan.getContributionFrom(contribution2.getSourceName()),
is(sameInstance(contribution2)));
- assertThat(plan.getContributionFrom(contribution3.getSourceName()),
is(sameInstance(contribution3)));
- }
-
- @Test
- public void
shouldReturnNullContributionWhenSuppliedNameDoesNotMatchContributionsSourceName() {
- assertThat(plan.getContributionFrom("other source"), is(nullValue()));
- }
-
- @Test
- public void shouldCompareSourceNameOfContributionsWhenCallingIsSource() {
- assertThat(plan.isSource(contribution1.getSourceName()), is(true));
- assertThat(plan.isSource(contribution2.getSourceName()), is(true));
- assertThat(plan.isSource(contribution3.getSourceName()), is(true));
- assertThat(plan.isSource("other source"), is(false));
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/TwoContributionMergePlanTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/TwoContributionMergePlanTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/TwoContributionMergePlanTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,101 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.merge;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.hamcrest.core.IsSame.sameInstance;
-import static org.junit.Assert.assertThat;
-import static org.junit.matchers.JUnitMatchers.hasItems;
-import static org.mockito.Mockito.stub;
-import org.jboss.dna.connector.federation.contribution.Contribution;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.MockitoAnnotations;
-import org.mockito.MockitoAnnotations.Mock;
-
-/**
- * @author Randall Hauch
- */
-public class TwoContributionMergePlanTest {
-
- private TwoContributionMergePlan plan;
- @Mock
- private Contribution contribution1;
- @Mock
- private Contribution contribution2;
-
- @Before
- public void beforeEach() throws Exception {
- MockitoAnnotations.initMocks(this);
- stub(contribution1.getSourceName()).toReturn("source1");
- stub(contribution2.getSourceName()).toReturn("source2");
- plan = new TwoContributionMergePlan(contribution1, contribution2);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldFailWhenCreatingMergePlanWithNullFirstContribution() {
- contribution1 = null;
- plan = new TwoContributionMergePlan(contribution1, contribution2);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldFailWhenCreatingMergePlanWithNullSecondContribution() {
- contribution2 = null;
- plan = new TwoContributionMergePlan(contribution1, contribution2);
- }
-
- @Test( expected = AssertionError.class )
- public void
shouldFailWhenCreatingMergePlanWithMultipleContributionsFromTheSameSource() {
- plan = new TwoContributionMergePlan(contribution1, contribution1);
- }
-
- @Test
- public void shouldReturnIteratorOverContributions() {
- assertThat(plan, hasItems(contribution1, contribution2));
- }
-
- @Test
- public void shouldHaveContributionCountOfTwo() {
- assertThat(plan.getContributionCount(), is(2));
- }
-
- @Test
- public void shouldReturnContributionWhenSuppliedNameMatchesContributionsSourceName()
{
- assertThat(plan.getContributionFrom(contribution1.getSourceName()),
is(sameInstance(contribution1)));
- assertThat(plan.getContributionFrom(contribution2.getSourceName()),
is(sameInstance(contribution2)));
- }
-
- @Test
- public void
shouldReturnNullContributionWhenSuppliedNameDoesNotMatchContributionsSourceName() {
- assertThat(plan.getContributionFrom("other source"), is(nullValue()));
- }
-
- @Test
- public void shouldCompareSourceNameOfContributionsWhenCallingIsSource() {
- assertThat(plan.isSource(contribution1.getSourceName()), is(true));
- assertThat(plan.isSource(contribution2.getSourceName()), is(true));
- assertThat(plan.isSource("other source"), is(false));
- }
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/strategy/OneContributionMergeStrategyTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/strategy/OneContributionMergeStrategyTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/strategy/OneContributionMergeStrategyTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,215 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.merge.strategy;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNot.not;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.hamcrest.core.IsSame.sameInstance;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.stub;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import org.jboss.dna.connector.federation.contribution.Contribution;
-import org.jboss.dna.connector.federation.merge.FederatedNode;
-import org.jboss.dna.connector.federation.merge.MergePlan;
-import org.jboss.dna.graph.DnaLexicon;
-import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.JcrLexicon;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.property.Name;
-import org.jboss.dna.graph.property.Path;
-import org.jboss.dna.graph.property.Property;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.mockito.MockitoAnnotations;
-import org.mockito.MockitoAnnotations.Mock;
-
-/**
- * @author Randall Hauch
- */
-public class OneContributionMergeStrategyTest {
-
- private OneContributionMergeStrategy strategy;
- private List<Contribution> contributions;
- private ExecutionContext context;
- private FederatedNode node;
- private Map<Name, Property> properties;
- private List<Location> children;
- private Path parentPath;
- @Mock
- private Contribution contribution;
-
- @Before
- public void beforeEach() throws Exception {
- MockitoAnnotations.initMocks(this);
- strategy = new OneContributionMergeStrategy();
- contributions = new LinkedList<Contribution>();
- contributions.add(contribution);
- context = new ExecutionContext();
- context.getNamespaceRegistry().register(DnaLexicon.Namespace.PREFIX,
DnaLexicon.Namespace.URI);
- context.getNamespaceRegistry().register(JcrLexicon.Namespace.PREFIX,
JcrLexicon.Namespace.URI);
- parentPath =
context.getValueFactories().getPathFactory().create("/a/b/c");
- node = new FederatedNode(Location.create(parentPath), "some
workspace");
- stub(contribution.getSourceName()).toReturn("source name");
- children = new LinkedList<Location>();
- for (int i = 0; i != 10; ++i) {
- Path childPath =
context.getValueFactories().getPathFactory().create(parentPath, "a" + i);
- children.add(Location.create(childPath));
- }
- properties = new HashMap<Name, Property>();
- for (int i = 0; i != 10; ++i) {
- Name propertyName =
context.getValueFactories().getNameFactory().create("property" + i);
- properties.put(propertyName,
context.getPropertyFactory().create(propertyName, "value"));
- }
- }
-
- @Test
- public void shouldMergeTheChildrenFromTheFirstContribution() {
- stub(contribution.getChildren()).toReturn(children.iterator());
- stub(contribution.getProperties()).toReturn(properties.values().iterator());
- strategy.merge(node, contributions, context);
- assertThat(node.getChildren(), is(children));
- }
-
- @Test
- public void shouldMergeThePropertiesFromTheFirstContribution() {
- stub(contribution.getChildren()).toReturn(children.iterator());
- stub(contribution.getProperties()).toReturn(properties.values().iterator());
- stub(contribution.getProperties()).toReturn(properties.values().iterator());
- strategy.merge(node, contributions, context);
- properties.put(DnaLexicon.UUID,
node.getPropertiesByName().get(DnaLexicon.UUID));
- properties.put(DnaLexicon.MERGE_PLAN,
node.getPropertiesByName().get(DnaLexicon.MERGE_PLAN));
- assertThat(node.getPropertiesByName(), is(properties));
- }
-
- @Test
- public void shouldCreateMergePlanInTheFederatedNode() {
- stub(contribution.getChildren()).toReturn(children.iterator());
- stub(contribution.getProperties()).toReturn(properties.values().iterator());
- strategy.merge(node, contributions, context);
- MergePlan mergePlan = node.getMergePlan();
- assertThat(mergePlan.getContributionFrom(contribution.getSourceName()),
is(sameInstance(contribution)));
- assertThat(mergePlan.getContributionCount(), is(1));
- }
-
- @Test
- public void
shouldSetTheUuidOnTheNodeIfThereIsASingleValuedPropertyNamedUuidWithValueThatConvertsToUuidInstance()
{
- // Test the "dna:uuid" property ...
- UUID uuid = UUID.randomUUID();
- Property uuidProperty = context.getPropertyFactory().create(DnaLexicon.UUID,
uuid);
- properties.put(uuidProperty.getName(), uuidProperty);
- stub(contribution.getChildren()).toReturn(children.iterator());
- stub(contribution.getProperties()).toReturn(properties.values().iterator());
- assertThat(node.at().getUuid(), is(nullValue()));
- strategy.merge(node, contributions, context);
- assertThat(node.getActualLocationOfNode().getUuid(), is(uuid));
- properties.remove(uuidProperty.getName());
-
- // Test the "jcr:uuid" property ...
- uuid = UUID.randomUUID();
- uuidProperty = context.getPropertyFactory().create(JcrLexicon.UUID, uuid);
- properties.put(uuidProperty.getName(), uuidProperty);
- stub(contribution.getChildren()).toReturn(children.iterator());
- stub(contribution.getProperties()).toReturn(properties.values().iterator());
- assertThat(node.at().getUuid(), is(not(uuid)));
- strategy.merge(node, contributions, context);
- assertThat(node.getActualLocationOfNode().getUuid(), is(uuid));
- properties.remove(uuidProperty.getName());
-
- // Test the "uuid" property ...
- Name uuidName =
context.getValueFactories().getNameFactory().create("uuid");
- uuid = UUID.randomUUID();
- uuidProperty = context.getPropertyFactory().create(uuidName, uuid);
- properties.put(uuidProperty.getName(), uuidProperty);
- stub(contribution.getChildren()).toReturn(children.iterator());
- stub(contribution.getProperties()).toReturn(properties.values().iterator());
- assertThat(node.at().getUuid(), is(not(uuid)));
- strategy.merge(node, contributions, context);
- assertThat(node.getActualLocationOfNode().getUuid(), is(uuid));
- properties.remove(uuidProperty.getName());
-
- // Test the "uuid" property whose value is a String ...
- uuid = UUID.randomUUID();
- uuidProperty = context.getPropertyFactory().create(DnaLexicon.UUID,
uuid.toString());
- properties.put(uuidProperty.getName(), uuidProperty);
- stub(contribution.getChildren()).toReturn(children.iterator());
- stub(contribution.getProperties()).toReturn(properties.values().iterator());
- assertThat(node.at().getUuid(), is(not(uuid)));
- strategy.merge(node, contributions, context);
- assertThat(node.getActualLocationOfNode().getUuid(), is(uuid));
- properties.remove(uuidProperty.getName());
- }
-
- @Test
- public void shouldNotSetTheUuidOnTheNodeIfThereIsNoPropertyNamedUuid() {
- // Test the "dna:uuid" property ...
- Name uuidName =
context.getValueFactories().getNameFactory().create("dna:uuid");
- UUID uuid = UUID.randomUUID();
- Property uuidProperty = context.getPropertyFactory().create(uuidName, uuid);
- properties.put(uuidProperty.getName(), uuidProperty);
- stub(contribution.getChildren()).toReturn(children.iterator());
- stub(contribution.getProperties()).toReturn(properties.values().iterator());
- assertThat(node.at().getUuid(), is(not(uuid)));
- strategy.merge(node, contributions, context);
- assertThat(node.getActualLocationOfNode().getUuid(), is(uuid));
- properties.remove(uuidProperty.getName());
- }
-
- @Ignore
- @Test
- public void shouldNotSetTheUuidOnTheNodeIfThereIsAMultiValuedPropertyNamedUuid() {
- final UUID originalUuid = node.at().getUuid();
- // Test the "dna:uuid" property ...
- Name uuidName =
context.getValueFactories().getNameFactory().create("dna:uuid");
- Property uuidProperty = context.getPropertyFactory().create(uuidName,
- UUID.randomUUID(),
- UUID.randomUUID(),
- UUID.randomUUID());
- properties.put(uuidProperty.getName(), uuidProperty);
- stub(contribution.getChildren()).toReturn(children.iterator());
- stub(contribution.getProperties()).toReturn(properties.values().iterator());
- strategy.merge(node, contributions, context);
- assertThat(node.getActualLocationOfNode().getUuid(), is(originalUuid));
- }
-
- @Ignore
- @Test
- public void
shouldNotSetTheUuidOnTheNodeIfThereIsASingleValuedPropertyNamedUuidWithValueThatDoesNotConvertToUuidInstance()
{
- final UUID originalUuid = node.at().getUuid();
- // Test the "dna:uuid" property ...
- Name uuidName =
context.getValueFactories().getNameFactory().create("dna:uuid");
- Property uuidProperty = context.getPropertyFactory().create(uuidName, 3.33d);
- properties.put(uuidProperty.getName(), uuidProperty);
- stub(contribution.getChildren()).toReturn(children.iterator());
- stub(contribution.getProperties()).toReturn(properties.values().iterator());
- strategy.merge(node, contributions, context);
- assertThat(node.getActualLocationOfNode().getUuid(), is(originalUuid));
- }
-
-}
Deleted:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/strategy/SimpleMergeStrategyTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/strategy/SimpleMergeStrategyTest.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/merge/strategy/SimpleMergeStrategyTest.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,300 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.federation.merge.strategy;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsEqual.equalTo;
-import static org.hamcrest.core.IsNull.notNullValue;
-import static org.hamcrest.core.IsSame.sameInstance;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.stub;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import org.hamcrest.Matcher;
-import org.jboss.dna.common.collection.IsIteratorContaining;
-import org.jboss.dna.connector.federation.contribution.Contribution;
-import org.jboss.dna.connector.federation.merge.FederatedNode;
-import org.jboss.dna.graph.DnaLexicon;
-import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.property.Name;
-import org.jboss.dna.graph.property.Path;
-import org.jboss.dna.graph.property.Property;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-
-/**
- * @author Randall Hauch
- */
-public class SimpleMergeStrategyTest {
-
- private SimpleMergeStrategy strategy;
- private List<Contribution> contributions;
- private ExecutionContext context;
- private FederatedNode node;
- private String workspaceName;
- protected Path parentPath;
-
- @Before
- public void beforeEach() throws Exception {
- MockitoAnnotations.initMocks(this);
- strategy = new SimpleMergeStrategy();
- contributions = new LinkedList<Contribution>();
- context = new ExecutionContext();
- context.getNamespaceRegistry().register("dna",
"http://www.jboss.org/dna/something");
- context.getNamespaceRegistry().register("jcr",
"http://www.jcr.org");
- parentPath =
context.getValueFactories().getPathFactory().create("/a/b/c");
- workspaceName = "some workspace";
- node = new FederatedNode(Location.create(parentPath), workspaceName);
- }
-
- @Test
- public void shouldAddChildrenFromOneContribution() {
- addContribution("source1").addChildren("childA",
"childB[1]", "childB[2]");
- strategy.merge(node, contributions, context);
- assertThat(node.getChildren(), hasChildLocations("childA",
"childB[1]", "childB[2]"));
- }
-
- @Test
- public void shouldCombinePropertiesFromOneContribution() {
- addContribution("source1").setProperty("p1", "p1
value");
- strategy.merge(node, contributions, context);
- assertThat(node.getProperties().size(), is(3));
- assertThat(node.getPropertiesByName().get(DnaLexicon.UUID), is(notNullValue()));
- assertThat(node.getPropertiesByName().get(DnaLexicon.MERGE_PLAN),
is(notNullValue()));
- assertThat(node.getPropertiesByName().get(name("p1")),
is(property("p1", "p1 value")));
- }
-
- @Test
- public void
shouldAddChildrenFromMultipleContributionsInOrderAndShouldNotChangeSameNameSiblingIndexesWhenChildrenDoNotShareNamesWithChildrenFromDifferentContributions()
{
- addContribution("source1").addChildren("childA",
"childB[1]", "childB[2]");
- addContribution("source2").addChildren("childX",
"childY[1]", "childY[2]");
- strategy.merge(node, contributions, context);
- assertThat(node.getChildren(), hasChildLocations("childA",
"childB[1]", "childB[2]", "childX", "childY[1]",
"childY[2]"));
- }
-
- @Test
- public void
shouldAddChildrenFromMultipleContributionsInOrderAndShouldChangeSameNameSiblingIndexesWhenChildrenDoShareNamesWithChildrenFromDifferentContributions()
{
- addContribution("source1").addChildren("childA",
"childB[1]", "childB[2]");
- addContribution("source2").addChildren("childX",
"childB", "childY");
- addContribution("source3").addChildren("childX",
"childB");
- strategy.merge(node, contributions, context);
- assertThat(node.getChildren(), hasChildLocations("childA",
- "childB[1]",
- "childB[2]",
- "childX[1]",
- "childB[3]",
- "childY",
- "childX[2]",
- "childB[4]"));
- }
-
- @Test
- public void
shouldCombinePropertiesFromMultipleContributionsAndRemoveNoValuesWhenNoContributionsContainSameProperty()
{
- addContribution("source1").setProperty("p1", "p1
value");
- addContribution("source2").setProperty("p2", "p2
value");
- strategy.merge(node, contributions, context);
- assertThat(node.getProperties().size(), is(4));
- assertThat(node.getPropertiesByName().get(DnaLexicon.UUID), is(notNullValue()));
- assertThat(node.getPropertiesByName().get(DnaLexicon.MERGE_PLAN),
is(notNullValue()));
- assertThat(node.getPropertiesByName().get(name("p1")),
is(property("p1", "p1 value")));
- assertThat(node.getPropertiesByName().get(name("p2")),
is(property("p2", "p2 value")));
- }
-
- @Test
- public void
shouldCombinePropertiesFromMultipleContributionsAndRemoveDuplicateValuesWhenContributionsContainSameProperty()
{
- addContribution("source1").setProperty("p1", "p1
value").setProperty("p12", "1", "2", "3");
- addContribution("source2").setProperty("p2", "p2
value").setProperty("p12", "3", "4");
- strategy.merge(node, contributions, context);
- assertThat(node.getProperties().size(), is(5));
- assertThat(node.getPropertiesByName().get(DnaLexicon.UUID), is(notNullValue()));
- assertThat(node.getPropertiesByName().get(DnaLexicon.MERGE_PLAN),
is(notNullValue()));
- assertThat(node.getPropertiesByName().get(name("p1")),
is(property("p1", "p1 value")));
- assertThat(node.getPropertiesByName().get(name("p2")),
is(property("p2", "p2 value")));
- assertThat(node.getPropertiesByName().get(name("p12")),
is(property("p12", "1", "2", "3",
"4")));
- }
-
- @Test
- public void
shouldCombinePropertiesFromMultipleContributionsAndMaintainAllValuesForEveryProperty() {
- addContribution("source1").setProperty("p1", "p1
value").setProperty("p12", "1", "2", "3");
- addContribution("source2").setProperty("p2", "p2
value").setProperty("p12", "3", "4");
- strategy.merge(node, contributions, context);
- assertThat(node.getProperties().size(), is(5));
- assertThat(node.getPropertiesByName().get(DnaLexicon.MERGE_PLAN),
is(notNullValue()));
- assertThat(node.getPropertiesByName().get(DnaLexicon.UUID), is(notNullValue()));
- for (Contribution contribution : contributions) {
- Iterator<Property> iter = contribution.getProperties();
- while (iter.hasNext()) {
- Property contributionProperty = iter.next();
- Property mergedProperty =
node.getPropertiesByName().get(contributionProperty.getName());
- assertThat(mergedProperty, is(notNullValue()));
- // Make sure that the merged property has each value ...
- for (Object contributedValue : contributionProperty.getValuesAsArray())
{
- boolean foundValue = false;
- for (Object mergedValue : mergedProperty.getValuesAsArray()) {
- if (mergedValue.equals(contributedValue)) {
- foundValue = true;
- break;
- }
- }
- assertThat(foundValue, is(true));
- }
- }
- }
- }
-
- @Test
- public void
shouldCombinePropertiesFromMultipleContributionsWhenPropertyValuesAreOfDifferentPropertyTypes()
{
- addContribution("source1").setProperty("p1", "p1
value").setProperty("p12", "1", "2", "3");
- addContribution("source2").setProperty("p2", "p2
value").setProperty("p12", 3, 4);
- strategy.merge(node, contributions, context);
- assertThat(node.getProperties().size(), is(5));
- assertThat(node.getPropertiesByName().get(DnaLexicon.UUID), is(notNullValue()));
- assertThat(node.getPropertiesByName().get(DnaLexicon.MERGE_PLAN),
is(notNullValue()));
- assertThat(node.getPropertiesByName().get(name("p1")),
is(property("p1", "p1 value")));
- assertThat(node.getPropertiesByName().get(name("p2")),
is(property("p2", "p2 value")));
- assertThat(node.getPropertiesByName().get(name("p12")),
is(property("p12", "1", "2", "3", 4)));
- }
-
- @Test
- public void shouldCreateMergePlanWhenMergingContributions() {
- addContribution("source1").addChildren("childA",
"childB[1]", "childB[2]").setProperty("p1", "p1
value");
- addContribution("source2").addChildren("childX",
"childB", "childY").setProperty("p2", "p2
value");
- strategy.merge(node, contributions, context);
- assertThat(node.getMergePlan(), is(notNullValue()));
- assertThat(node.getMergePlan().getContributionCount(), is(2));
- assertThat(node.getMergePlan().getContributionFrom("source1"),
is(sameInstance(contributions.get(0))));
- assertThat(node.getMergePlan().getContributionFrom("source2"),
is(sameInstance(contributions.get(1))));
- }
-
- @Test
- public void shouldCorrectlyBuildMockUsingContributionBuilder() {
- assertThat(contributions.size(), is(0));
- addContribution("source1").addChildren("childA",
"childB[1]", "childB[2]").setProperty("p1", "p1
value");
- assertThat(contributions.size(), is(1));
- assertThat(contributions.get(0).getChildren(),
hasLocationIterator("childA", "childB[1]", "childB[2]"));
- }
-
- protected Matcher<List<Location>> hasChildLocations( String... childNames
) {
- List<Location> locations = new ArrayList<Location>();
- for (String childName : childNames) {
-
locations.add(Location.create(context.getValueFactories().getPathFactory().create(parentPath,
childName)));
- }
- return equalTo(locations);
- }
-
- protected Matcher<Iterator<Location>> hasLocationIterator( String...
childNames ) {
- Location[] locations = new Location[childNames.length];
- int index = 0;
- for (String childName : childNames) {
- locations[index++] =
Location.create(context.getValueFactories().getPathFactory().create(parentPath,
childName));
- }
- return IsIteratorContaining.hasItems(locations);
- }
-
- protected Name name( String name ) {
- return context.getValueFactories().getNameFactory().create(name);
- }
-
- protected Property property( String name,
- Object... values ) {
- return context.getPropertyFactory().create(name(name), values);
- }
-
- protected ContributionBuilder addContribution( String sourceName ) {
- ContributionBuilder builder = new ContributionBuilder(context, sourceName,
contributions);
- contributions.add(builder.getMock());
- return builder;
- }
-
- protected class ContributionBuilder {
- protected final Contribution mockContribution;
- protected final ExecutionContext context;
- protected final Map<Name, Property> properties = new HashMap<Name,
Property>();
- protected final List<Location> children = new ArrayList<Location>();
-
- protected ContributionBuilder( ExecutionContext context,
- String name,
- List<Contribution> contributions ) {
- this.context = context;
- this.mockContribution = Mockito.mock(Contribution.class);
-
stub(mockContribution.getLocationInSource()).toReturn(Location.create(parentPath));
- stub(mockContribution.getSourceName()).toReturn(name);
- stub(mockContribution.getChildren()).toAnswer(new
Answer<Iterator<Location>>() {
- public Iterator<Location> answer( InvocationOnMock invocation )
throws Throwable {
- return ContributionBuilder.this.children.iterator();
- }
- });
- stub(mockContribution.getChildrenCount()).toAnswer(new
Answer<Integer>() {
- public Integer answer( InvocationOnMock invocation ) throws Throwable {
- return ContributionBuilder.this.children.size();
- }
- });
- stub(mockContribution.getProperties()).toAnswer(new
Answer<Iterator<Property>>() {
- public Iterator<Property> answer( InvocationOnMock invocation )
throws Throwable {
- return ContributionBuilder.this.properties.values().iterator();
- }
- });
- stub(mockContribution.getPropertyCount()).toAnswer(new
Answer<Integer>() {
- public Integer answer( InvocationOnMock invocation ) throws Throwable {
- return ContributionBuilder.this.properties.size();
- }
- });
- }
-
- public Contribution getMock() {
- return this.mockContribution;
- }
-
- public ContributionBuilder addChildren( String... pathsForChildren ) {
- for (String childPath : pathsForChildren) {
- Path path =
context.getValueFactories().getPathFactory().create(parentPath, childPath);
- children.add(Location.create(path));
- }
- return this;
- }
-
- public ContributionBuilder setProperty( String name,
- Object... values ) {
- Name propertyName =
context.getValueFactories().getNameFactory().create(name);
- Property property = context.getPropertyFactory().create(propertyName,
values);
- stub(mockContribution.getProperty(propertyName)).toReturn(property);
- if (values != null && values.length > 0) {
- properties.put(propertyName, property);
- } else {
- properties.remove(propertyName);
- }
- return this;
- }
- }
-
-}
Deleted: trunk/extensions/dna-connector-federation/src/test/resources/log4j.properties
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/resources/log4j.properties 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-federation/src/test/resources/log4j.properties 2009-09-12
17:55:25 UTC (rev 1218)
@@ -1,12 +0,0 @@
-# Direct log messages to stdout
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %m%n
-
-# Root logger option
-log4j.rootLogger=INFO, stdout
-
-# Set up the default logging to be INFO level, then override specific units
-log4j.logger.org.jboss.dna=INFO
-log4j.logger.org.jboss.dna.connector.federation=TRACE
Modified:
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemConnection.java
===================================================================
---
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemConnection.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemConnection.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -39,8 +39,6 @@
/**
* The {@link RepositoryConnection} implementation for the file system connector. The
bulk of the work is performed by the
* {@link FileSystemRequestProcessor}.
- *
- * @author Randall Hauch
*/
public class FileSystemConnection implements RepositoryConnection {
Modified:
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemI18n.java
===================================================================
---
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemI18n.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemI18n.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,7 +28,7 @@
import org.jboss.dna.common.i18n.I18n;
/**
- * @author Randall Hauch
+ * The internationalized string constants for the
<code>org.jboss.dna.connector.filesystem*</code> packages.
*/
public final class FileSystemI18n {
@@ -51,7 +51,7 @@
public static I18n sourceIsReadOnly;
public static I18n pathIsReadOnly;
public static I18n unableToCreateWorkspaces;
-
+
// Writable messages
public static I18n parentIsReadOnly;
public static I18n fileAlreadyExists;
Modified:
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRequestProcessor.java
===================================================================
---
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRequestProcessor.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRequestProcessor.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -86,8 +86,6 @@
/**
* The {@link RequestProcessor} implementation for the file systme connector. This is the
class that does the bulk of the work in
* the file system connector, since it processes all requests.
- *
- * @author Randall Hauch
*/
public class FileSystemRequestProcessor extends RequestProcessor {
Modified:
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemSource.java
===================================================================
---
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemSource.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemSource.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -56,8 +56,6 @@
* The {@link RepositorySource} for the connector that exposes an area of the local file
system as content in a repository. This
* source considers a workspace name to be the path to the directory on the file system
that represents the root of that
* workspace. New workspaces can be created, as long as the names represent valid paths
to existing directories.
- *
- * @author Randall Hauch
*/
@ThreadSafe
public class FileSystemSource implements RepositorySource, ObjectFactory {
Copied:
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/package-info.java
(from rev 1217,
trunk/dna-repository/src/main/java/org/jboss/dna/repository/service/AdministeredService.java)
===================================================================
---
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/package-info.java
(rev 0)
+++
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The classes that make up the connector that accesses the files and directories on a
local file system and exposes them as content in a repository.
+ */
+
+package org.jboss.dna.connector.filesystem;
+
Modified:
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/InfinispanConnectorI18n.java
===================================================================
---
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/InfinispanConnectorI18n.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/InfinispanConnectorI18n.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -4,6 +4,9 @@
import java.util.Set;
import org.jboss.dna.common.i18n.I18n;
+/**
+ * The internationalized string constants for the
<code>org.jboss.dna.connector.infinispan*</code> packages.
+ */
public final class InfinispanConnectorI18n {
public static I18n connectorName;
@@ -19,7 +22,6 @@
public static I18n workspaceNameWasNotValidConfiguration;
public static I18n defaultCacheManagerConfigurationNameWasNotValidConfiguration;
-
static {
try {
I18n.initialize(InfinispanConnectorI18n.class);
Modified:
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/InfinispanRepository.java
===================================================================
---
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/InfinispanRepository.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/InfinispanRepository.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -9,6 +9,9 @@
import org.jboss.dna.graph.connector.map.MapRepository;
import org.jboss.dna.graph.connector.map.MapWorkspace;
+/**
+ * The repository that uses an Infinispan instance.
+ */
public class InfinispanRepository extends MapRepository {
private final CacheManager cacheManager;
Copied:
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/package-info.java
(from rev 1217,
trunk/dna-graph/src/main/java/org/jboss/dna/graph/NodeConflictBehavior.java)
===================================================================
---
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/package-info.java
(rev 0)
+++
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,33 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The classes that make up the connector that stores content in a deployed instance of
Infinispan.
+ * Infinispan is an extremely scalable, highly available data grid platform that
distributes the data across
+ * the nodes in the grid. This connector makes it possible for repository content to be
stored in a very efficient,
+ * fast, higly-concurrent (essentially lock- and synchronization-free) and reliable
manner, even when the content
+ * size grows to massive sizes.
+ */
+
+package org.jboss.dna.connector.infinispan;
+
Modified:
trunk/extensions/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheConnectorI18n.java
===================================================================
---
trunk/extensions/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheConnectorI18n.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheConnectorI18n.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,7 +28,7 @@
import org.jboss.dna.common.i18n.I18n;
/**
- * @author Randall Hauch
+ * The internationalized string constants for the
<code>org.jboss.dna.connector.jbosscache*</code> packages.
*/
public final class JBossCacheConnectorI18n {
Modified:
trunk/extensions/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheRepository.java
===================================================================
---
trunk/extensions/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheRepository.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheRepository.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -10,6 +10,9 @@
import org.jboss.dna.graph.connector.map.MapRepository;
import org.jboss.dna.graph.connector.map.MapWorkspace;
+/**
+ * A repository implementation that uses JBoss Cache.
+ */
public class JBossCacheRepository extends MapRepository {
private final Cache<UUID, MapNode> cache;
Modified:
trunk/extensions/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheSource.java
===================================================================
---
trunk/extensions/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheSource.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheSource.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -81,8 +81,6 @@
* Like other {@link RepositorySource} classes, instances of JBossCacheSource can be
placed into JNDI and do support the creation
* of {@link Referenceable JNDI referenceable} objects and resolution of references into
JBossCacheSource.
* </p>
- *
- * @author Randall Hauch
*/
@ThreadSafe
public class JBossCacheSource implements MapRepositorySource, ObjectFactory {
Copied:
trunk/extensions/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/package-info.java
(from rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ClassMetadata.java)
===================================================================
---
trunk/extensions/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/package-info.java
(rev 0)
+++
trunk/extensions/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The classes that make up the connector that stores content in a JBoss Cache instance.
+ */
+
+package org.jboss.dna.connector.jbosscache;
+
Modified:
trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/JdbcMetadataI18n.java
===================================================================
---
trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/JdbcMetadataI18n.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/JdbcMetadataI18n.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,8 +28,7 @@
import org.jboss.dna.common.i18n.I18n;
/**
- * I18N
- * @author <a href="mailto:litsenko_sergey@yahoo.com">Sergiy
Litsenko</a>
+ * The internationalized string constants for the
<code>org.jboss.dna.connector.jdbc*</code> packages.
*/
public class JdbcMetadataI18n {
public static I18n connectorName;
Copied:
trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/package-info.java
(from rev 1217,
trunk/dna-repository/src/main/java/org/jboss/dna/repository/service/AdministeredService.java)
===================================================================
---
trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/package-info.java
(rev 0)
+++
trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The classes that make up the connector that accesses schema and database metadata from
JDBC databases, exposing that as content in a repository.
+ */
+
+package org.jboss.dna.connector.jdbc;
+
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaConnection.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaConnection.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaConnection.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -36,7 +36,7 @@
import org.jboss.dna.graph.request.processor.RequestProcessor;
/**
- * @author Randall Hauch
+ * The repository connection to JPA repository sources.
*/
public class JpaConnection implements RepositoryConnection {
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaConnectorI18n.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaConnectorI18n.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaConnectorI18n.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -25,11 +25,13 @@
import java.util.Locale;
import java.util.Set;
+import net.jcip.annotations.Immutable;
import org.jboss.dna.common.i18n.I18n;
/**
- * @author Randall Hauch
+ * The internationalized string constants for the
<code>org.jboss.dna.connector.store.jpa*</code> packages.
*/
+@Immutable
public final class JpaConnectorI18n {
public static I18n connectorName;
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaSource.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaSource.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaSource.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -65,8 +65,6 @@
* The {@link RepositorySource} for the connector that stores content in a (custom)
relational database. This connector uses Java
* Persistence API as the interface to the database, with Hibernate as the JPA
implementation. (Note that some Hibernate-specific
* features are used.)
- *
- * @author Randall Hauch
*/
public class JpaSource implements RepositorySource, ObjectFactory {
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/Model.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/Model.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/Model.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -40,7 +40,6 @@
* @see JpaSource.Models#addModel(Model)
* @see JpaSource#setModel(String)
* @see JpaSource#getModel()
- * @author Randall Hauch
*/
public abstract class Model {
private final String name;
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/BasicModel.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/BasicModel.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/BasicModel.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -90,8 +90,6 @@
* requests requires knowledge of the subgraph, and in fact all but the
<code>ReadBranchRequest</code> need to know the complete
* subgraph.
* </p>
- *
- * @author Randall Hauch
*/
public class BasicModel extends Model {
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/BasicRequestProcessor.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/BasicRequestProcessor.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/BasicRequestProcessor.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -109,7 +109,7 @@
import org.jboss.dna.graph.request.processor.RequestProcessor;
/**
- * @author Randall Hauch
+ * A {@link RequestProcessor} implementation for the JPA connector.
*/
@NotThreadSafe
public class BasicRequestProcessor extends RequestProcessor {
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/ChildEntity.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/ChildEntity.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/ChildEntity.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -44,8 +44,6 @@
* nodes, this entity also maintains the indexInParent of the indexInParent within the
parent node's list of all children, the
* child's name ( {@link #getChildName() local part} and {@link #getChildNamespace()
namespace}), and the same-name-sibling
* indexInParent (if there is one).
- *
- * @author Randall Hauch
*/
@Entity
@Table( name = "DNA_BASIC_CHILDREN" )
@@ -312,15 +310,15 @@
@SuppressWarnings( "unchecked" )
public static int adjustSnsIndexesAndIndexes( EntityManager entities,
- Long workspaceId,
- String uuidParent,
- int afterIndex,
- int untilIndex,
- long childNamespaceIndex,
- String childName,
- int modifier ) {
+ Long workspaceId,
+ String uuidParent,
+ int afterIndex,
+ int untilIndex,
+ long childNamespaceIndex,
+ String childName,
+ int modifier ) {
int snsCount = 0;
-
+
// Decrement the 'indexInParent' index values for all nodes above the
previously removed sibling ...
Query query =
entities.createNamedQuery("ChildEntity.findChildrenAfterIndexUnderParent");
query.setParameter("workspaceId", workspaceId);
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/ChildId.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/ChildId.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/ChildId.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -31,8 +31,6 @@
/**
* A unique identifier for a parent-child relationship.
- *
- * @author Randall Hauch
*/
@Embeddable
@Immutable
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/LargeValueEntity.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/LargeValueEntity.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/LargeValueEntity.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -39,8 +39,6 @@
* A single property value that is too large to be stored on the individual node, and
which will be shared among all properties
* that have the same value. Note that the large values are stored independently of
workspace, so one large value may be shared by
* properties of nodes in different workspaces.
- *
- * @author Randall Hauch
*/
@Entity
@Table( name = "DNA_BASIC_LARGE_VALUES" )
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/LargeValueId.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/LargeValueId.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/LargeValueId.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -32,8 +32,6 @@
* A unique identifer for a large value, which is the 160-bit SHA-1 hash of this value,
in hex form (40-bytes). The SHA-1
* algorithm is fast and has not yet proven to have any duplicates. Even if SHA-2 and
SHA-3 are better for cryptographically
* secure purposes, it is doubtful whether a repository needs more than SHA-1 for
identity purposes.
- *
- * @author Randall Hauch
*/
@Embeddable
@Immutable
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/NodeId.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/NodeId.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/NodeId.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -33,8 +33,6 @@
* An identifier for a node, comprised of a single {@link UUID}, and {@link Embeddable
embeddable} in a persistent entity. The
* identifier takes the form of two <code>long</code> columns: one for the
UUID's {@link UUID#getMostSignificantBits() most
* significant bits} and one for its {@link UUID#getLeastSignificantBits() least
significant bits}.
- *
- * @author Randall Hauch
*/
@Embeddable
@Immutable
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/PropertiesEntity.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/PropertiesEntity.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/PropertiesEntity.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -44,8 +44,6 @@
* but nothing else. The PropertiesEntity doesn't even have the name. This is because
this class is used to read, modify, and save
* the properties of a node. Finding a node by its name or working with the children,
however, requires working with the
* {@link ChildEntity node children}.
- *
- * @author Randall Hauch
*/
@Entity
@Table( name = "DNA_BASIC_NODEPROPS" )
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/ReferenceEntity.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/ReferenceEntity.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/ReferenceEntity.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -37,8 +37,6 @@
/**
* A record of a reference from one node to another.
- *
- * @author Randall Hauch
*/
@Entity
@Table( name = "DNA_BASIC_REFERENCES" )
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/ReferenceId.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/ReferenceId.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/ReferenceId.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -32,8 +32,6 @@
/**
* An identifier for a reference, comprised of a single {@link NodeId} of the node
containing the reference and a single
* {@link NodeId} of the node being referenced.
- *
- * @author Randall Hauch
*/
@Embeddable
@Immutable
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/SubgraphNodeEntity.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/SubgraphNodeEntity.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/SubgraphNodeEntity.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -36,7 +36,6 @@
/**
* Represents a single node that appears in a subgraph.
*
- * @author Randall Hauch
* @see SubgraphQueryEntity
*/
@Entity
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/SubgraphQuery.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/SubgraphQuery.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/SubgraphQuery.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -47,8 +47,6 @@
* The use of database joins also produces another benefit: the number of SQL statements
necessary to build the set of nodes in a
* subgraph is equal to the depth of the subgraph, regardless of the number of child
nodes at any level.
* </p>
- *
- * @author Randall Hauch
*/
public class SubgraphQuery {
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/SubgraphQueryEntity.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/SubgraphQueryEntity.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/SubgraphQueryEntity.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -31,8 +31,6 @@
/**
* Represents a temporary working area for a query that retrieves the nodes in a
subgraph.
- *
- * @author Randall Hauch
*/
@Entity( name = "DNA_SUBGRAPH_QUERIES" )
public class SubgraphQueryEntity {
Copied:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/package-info.java
(from rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavadocMetadata.java)
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/package-info.java
(rev 0)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The classes that define the "basic" storage model for the JPA connector.
+ */
+
+package org.jboss.dna.connector.store.jpa.model.basic;
+
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/common/ChangeLogEntity.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/common/ChangeLogEntity.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/common/ChangeLogEntity.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -39,8 +39,6 @@
/**
* Represents a record of the changes that have been made to the repository. The actual
change events are serialized and stored in
* a binary (and compressed) format.
- *
- * @author Randall Hauch
*/
@Entity
@Table( name = "DNA_CHANGELOG" )
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/common/NamespaceEntity.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/common/NamespaceEntity.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/common/NamespaceEntity.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -40,8 +40,6 @@
/**
* A NamespaceEntity represents a namespace that has been used in the store.
NamespaceEntity records are immutable and shared by
* one or more enities.
- *
- * @author Randall Hauch
*/
@Entity
@Table( name = "DNA_NAMESPACES" )
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/common/WorkspaceEntity.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/common/WorkspaceEntity.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/common/WorkspaceEntity.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -43,8 +43,6 @@
/**
* A WorkspaceEntity represents a workspace that has been create in the store.
WorkspaceEntity records are immutable and shared by
* one or more enities.
- *
- * @author Randall Hauch
*/
@Entity
@Table( name = "DNA_WORKSPACES" )
Copied:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/common/package-info.java
(from rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ModifierMetadata.java)
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/common/package-info.java
(rev 0)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/common/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The classes that define the common JPA entities used in multiple storage models.
+ */
+
+package org.jboss.dna.connector.store.jpa.model.common;
+
Copied:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/package-info.java
(from rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/InterfaceMetadata.java)
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/package-info.java
(rev 0)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The classes that make up the connector that stores content in a relational database
via JDBC and JPA.
+ */
+
+package org.jboss.dna.connector.store.jpa;
+
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/Namespaces.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/Namespaces.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/Namespaces.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -30,7 +30,7 @@
import org.jboss.dna.connector.store.jpa.model.common.NamespaceEntity;
/**
- * @author Randall Hauch
+ * A utility that wraps the {@link NamespaceEntity} objects appearing within an {@link
EntityManager}.
*/
@NotThreadSafe
public class Namespaces {
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/RequestProcessorCache.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/RequestProcessorCache.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/RequestProcessorCache.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -43,8 +43,6 @@
/**
* Represents a cache of the known node information, including a node's actual {@link
Location} and the complete set of children.
- *
- * @author Randall Hauch
*/
@NotThreadSafe
public class RequestProcessorCache {
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/Serializer.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/Serializer.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/Serializer.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -56,7 +56,7 @@
import org.jboss.dna.graph.property.ValueFormatException;
/**
- * @author Randall Hauch
+ * A class that is responsible for serializing and deserializing properties.
*/
public class Serializer {
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/StoreOptionEntity.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/StoreOptionEntity.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/StoreOptionEntity.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -39,8 +39,6 @@
* This JPA entity is always added to the {@link Ejb3Configuration} in the {@link
JpaSource#getConnection() JpaSource}, and
* therefore should not be {@link Model#configure(Ejb3Configuration) added to the
configuration} by a {@link Model}.
* </p>
- *
- * @author Randall Hauch
*/
@Entity( name = "DNA_OPTIONS" )
@NamedQueries( {@NamedQuery( name = "StoreOptionEntity.findAll", query =
"SELECT option FROM DNA_OPTIONS AS option" )} )
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/StoreOptions.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/StoreOptions.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/StoreOptions.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -29,7 +29,7 @@
import org.jboss.dna.connector.store.jpa.Model;
/**
- * @author Randall Hauch
+ * A utility class that provides easy access to the options stored within a database.
*/
public class StoreOptions {
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/Workspaces.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/Workspaces.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/Workspaces.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -32,8 +32,6 @@
/**
* A manager and cache for {@link WorkspaceEntity} objects.
- *
- * @author Randall Hauch
*/
@NotThreadSafe
public class Workspaces {
Copied:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/package-info.java
(from rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/InterfaceMetadata.java)
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/package-info.java
(rev 0)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/util/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The classes that define the utility JPA entities that are not part of any storage
model.
+ */
+
+package org.jboss.dna.connector.store.jpa.util;
+
Modified:
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/scm/ScmAction.java
===================================================================
---
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/scm/ScmAction.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/scm/ScmAction.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,9 +24,8 @@
package org.jboss.dna.connector.scm;
/**
- * @author Serge Pagop
*
*/
public interface ScmAction {
- public void applyAction(Object context) throws Exception;
+ public void applyAction( Object context ) throws Exception;
}
Modified:
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/scm/ScmActionExecutor.java
===================================================================
---
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/scm/ScmActionExecutor.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/scm/ScmActionExecutor.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,7 +24,6 @@
package org.jboss.dna.connector.scm;
/**
- * @author Serge Pagop
*
*/
public interface ScmActionExecutor {
Modified:
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/scm/ScmActionFactory.java
===================================================================
---
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/scm/ScmActionFactory.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/scm/ScmActionFactory.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,11 +24,9 @@
package org.jboss.dna.connector.scm;
/**
- * @author Serge Pagop
*/
public interface ScmActionFactory {
-
public ScmAction addFile( String path,
String file,
byte[] content );
Copied:
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/scm/package-info.java
(from rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavadocMetadata.java)
===================================================================
---
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/scm/package-info.java
(rev 0)
+++
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/scm/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The classes that define the SVN actions.
+ */
+
+package org.jboss.dna.connector.scm;
+
Modified:
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNActionExecutor.java
===================================================================
---
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNActionExecutor.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNActionExecutor.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -32,7 +32,6 @@
import org.tmatesoft.svn.core.io.SVNRepository;
/**
- * @author Serge Pagop
*/
public class SVNActionExecutor implements ScmActionExecutor {
Modified:
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNProtocol.java
===================================================================
---
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNProtocol.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNProtocol.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,7 +24,6 @@
package org.jboss.dna.connector.svn;
/**
- * @author Serge Pagop
*/
public enum SVNProtocol {
FILE("file"),
Modified:
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryConnection.java
===================================================================
---
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryConnection.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryConnection.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -41,8 +41,6 @@
/**
* The defaultRepository connection to a SVN Repository instance.
- *
- * @author Serge Pagop
*/
public class SVNRepositoryConnection implements RepositoryConnection {
@@ -53,10 +51,10 @@
private final Set<String> availableWorkspaceNames;
private final boolean creatingWorkspacesAllowed;
private final RepositoryAccessData accessData;
-
+
/**
- * default workspace must can be a root repository or any folders from the root
directory.
- * available workspace names must consist of URLs from repository folders.
+ * default workspace must can be a root repository or any folders from the root
directory. available workspace names must
+ * consist of URLs from repository folders.
*
* @param sourceName
* @param defaultWorkspace
@@ -71,13 +69,14 @@
Set<String> availableWorkspaceNames,
boolean creatingWorkspacesAllowed,
CachePolicy cachePolicy,
- boolean updatesAllowed, RepositoryAccessData
accessData ) {
+ boolean updatesAllowed,
+ RepositoryAccessData accessData ) {
CheckArg.isNotNull(defaultWorkspace, "defaultWorkspace");
CheckArg.isNotEmpty(sourceName, "sourceName");
assert availableWorkspaceNames != null;
assert accessData != null;
-
+
// Check if the default workspace is a folder.
SVNNodeKind nodeKind = null;
try {
@@ -168,10 +167,9 @@
public void execute( final ExecutionContext context,
final Request request ) throws RepositorySourceException {
-
- RequestProcessor processor = new SVNRepositoryRequestProcessor(sourceName,
defaultWorkspace,
-
availableWorkspaceNames, creatingWorkspacesAllowed,
- context,
updatesAllowed, accessData);
+ RequestProcessor processor = new SVNRepositoryRequestProcessor(sourceName,
defaultWorkspace, availableWorkspaceNames,
+
creatingWorkspacesAllowed, context, updatesAllowed,
+ accessData);
try {
processor.process(request);
} finally {
Modified:
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryConnectorI18n.java
===================================================================
---
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryConnectorI18n.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryConnectorI18n.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,7 +28,7 @@
import org.jboss.dna.common.i18n.I18n;
/**
- * @author Serge Pagop
+ * The internationalized string constants for the
<code>org.jboss.dna.connector.svn*</code> packages.
*/
public final class SVNRepositoryConnectorI18n {
Modified:
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryLexicon.java
===================================================================
---
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryLexicon.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryLexicon.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -26,11 +26,8 @@
import org.jboss.dna.graph.property.Name;
import org.jboss.dna.graph.property.basic.BasicName;
-
/**
* The namespace and property names used within a {@link SVNRepositorySource} to store
internal information.
- *
- * @author Serge Pagop
*/
public class SVNRepositoryLexicon {
Modified:
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryRequestProcessor.java
===================================================================
---
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryRequestProcessor.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryRequestProcessor.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -86,8 +86,6 @@
/**
* The {@link RequestProcessor} implementation for the file subversion repository
connector. This is the class that does the bulk
* of the work in the subversion repository connector, since it processes all requests.
- *
- * @author Serge Pagop
*/
public class SVNRepositoryRequestProcessor extends RequestProcessor implements
ScmActionFactory {
Modified:
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositorySource.java
===================================================================
---
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositorySource.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositorySource.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -54,8 +54,6 @@
* repository. This source considers a workspace name to be the path to the directory on
the repository's root directory location
* that represents the root of that workspace. New workspaces can be created, as long as
the names represent valid paths to
* existing directories.
- *
- * @author Serge Pagop
*/
@ThreadSafe
public class SVNRepositorySource implements RepositorySource, ObjectFactory {
Modified:
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryUtil.java
===================================================================
---
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryUtil.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryUtil.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -17,7 +17,6 @@
import org.tmatesoft.svn.core.wc.SVNWCUtil;
/**
- * @author Serge Pagop
*/
public class SVNRepositoryUtil {
Copied:
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/package-info.java
(from rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ClassMetadata.java)
===================================================================
---
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/package-info.java
(rev 0)
+++
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The classes that make up the connector that accesses content from an SVN repository.
+ */
+
+package org.jboss.dna.connector.svn;
+
Modified:
trunk/extensions/dna-mimetype-detector-aperture/src/main/java/org/jboss/dna/mimetype/aperture/ApertureMimeTypeDetector.java
===================================================================
---
trunk/extensions/dna-mimetype-detector-aperture/src/main/java/org/jboss/dna/mimetype/aperture/ApertureMimeTypeDetector.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-mimetype-detector-aperture/src/main/java/org/jboss/dna/mimetype/aperture/ApertureMimeTypeDetector.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -31,7 +31,7 @@
import org.semanticdesktop.aperture.util.IOUtil;
/**
- * @author jverhaeg
+ * A {@link MimeTypeDetector} that uses the Aperture library.
*/
public class ApertureMimeTypeDetector implements MimeTypeDetector {
Copied:
trunk/extensions/dna-mimetype-detector-aperture/src/main/java/org/jboss/dna/mimetype/aperture/package-info.java
(from rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavadocMetadata.java)
===================================================================
---
trunk/extensions/dna-mimetype-detector-aperture/src/main/java/org/jboss/dna/mimetype/aperture/package-info.java
(rev 0)
+++
trunk/extensions/dna-mimetype-detector-aperture/src/main/java/org/jboss/dna/mimetype/aperture/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The classes that make up the Aperture MIME type detector.
+ */
+
+package org.jboss.dna.mimetype.aperture;
+
Modified:
trunk/extensions/dna-sequencer-cnd/src/main/java/org/jboss/dna/sequencer/cnd/CndSequencer.java
===================================================================
---
trunk/extensions/dna-sequencer-cnd/src/main/java/org/jboss/dna/sequencer/cnd/CndSequencer.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-cnd/src/main/java/org/jboss/dna/sequencer/cnd/CndSequencer.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -31,12 +31,12 @@
import org.jboss.dna.graph.io.Destination;
import org.jboss.dna.graph.property.Path;
import org.jboss.dna.graph.property.Property;
-import org.jboss.dna.graph.sequencer.StreamSequencerContext;
import org.jboss.dna.graph.sequencer.SequencerOutput;
import org.jboss.dna.graph.sequencer.StreamSequencer;
+import org.jboss.dna.graph.sequencer.StreamSequencerContext;
/**
- *
+ * A sequencer of CND files.
*/
public class CndSequencer implements StreamSequencer {
Modified:
trunk/extensions/dna-sequencer-cnd/src/main/java/org/jboss/dna/sequencer/cnd/CndSequencerI18n.java
===================================================================
---
trunk/extensions/dna-sequencer-cnd/src/main/java/org/jboss/dna/sequencer/cnd/CndSequencerI18n.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-cnd/src/main/java/org/jboss/dna/sequencer/cnd/CndSequencerI18n.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,7 +28,7 @@
import org.jboss.dna.common.i18n.I18n;
/**
- * @author Randall Hauch
+ * The internationalized string constants for the
<code>org.jboss.dna.sequencer.cnd*</code> packages.
*/
public final class CndSequencerI18n {
Copied:
trunk/extensions/dna-sequencer-cnd/src/main/java/org/jboss/dna/sequencer/cnd/package-info.java
(from rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavadocMetadata.java)
===================================================================
---
trunk/extensions/dna-sequencer-cnd/src/main/java/org/jboss/dna/sequencer/cnd/package-info.java
(rev 0)
+++
trunk/extensions/dna-sequencer-cnd/src/main/java/org/jboss/dna/sequencer/cnd/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The classes that make up the JCR Compact Node Definition (CND) file sequencer.
+ */
+
+package org.jboss.dna.sequencer.cnd;
+
Modified:
trunk/extensions/dna-sequencer-images/src/main/java/org/jboss/dna/sequencer/image/ImageMetadataSequencer.java
===================================================================
---
trunk/extensions/dna-sequencer-images/src/main/java/org/jboss/dna/sequencer/image/ImageMetadataSequencer.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-images/src/main/java/org/jboss/dna/sequencer/image/ImageMetadataSequencer.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -27,9 +27,9 @@
import org.jboss.dna.graph.property.NameFactory;
import org.jboss.dna.graph.property.Path;
import org.jboss.dna.graph.property.PathFactory;
-import org.jboss.dna.graph.sequencer.StreamSequencerContext;
import org.jboss.dna.graph.sequencer.SequencerOutput;
import org.jboss.dna.graph.sequencer.StreamSequencer;
+import org.jboss.dna.graph.sequencer.StreamSequencerContext;
/**
* A sequencer that processes the binary content of an image file, extracts the metadata
for the image, and then writes that image
@@ -63,9 +63,6 @@
* vendors to store custom metadata. This structure could be mapped with each directory
(e.g. "EXIF" or "Nikon Makernote" or
* "IPTC") as the name of a child node, with the EXIF tags values stored as
either properties or child nodes.
* </p>
- *
- * @author Randall Hauch
- * @author John Verhaeg
*/
public class ImageMetadataSequencer implements StreamSequencer {
Modified:
trunk/extensions/dna-sequencer-images/src/main/java/org/jboss/dna/sequencer/image/ImageSequencerI18n.java
===================================================================
---
trunk/extensions/dna-sequencer-images/src/main/java/org/jboss/dna/sequencer/image/ImageSequencerI18n.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-images/src/main/java/org/jboss/dna/sequencer/image/ImageSequencerI18n.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,7 +28,7 @@
import org.jboss.dna.common.i18n.I18n;
/**
- * @author Randall Hauch
+ * The internationalized string constants for the
<code>org.jboss.dna.sequencer.image*</code> packages.
*/
public final class ImageSequencerI18n {
Copied:
trunk/extensions/dna-sequencer-images/src/main/java/org/jboss/dna/sequencer/image/package-info.java
(from rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavadocMetadata.java)
===================================================================
---
trunk/extensions/dna-sequencer-images/src/main/java/org/jboss/dna/sequencer/image/package-info.java
(rev 0)
+++
trunk/extensions/dna-sequencer-images/src/main/java/org/jboss/dna/sequencer/image/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The classes that make up the image sequencer.
+ */
+
+package org.jboss.dna.sequencer.image;
+
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/AbstractJavaMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/AbstractJavaMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/AbstractJavaMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -72,8 +72,6 @@
/**
* Abstract definition of a <code>JavaMetadata<code>. This class exposes some
useful methods, that can
* be used to create meta data of a compilation unit. Methods can also separately be
used.
- *
- * @author Serge Pagop
*/
public abstract class AbstractJavaMetadata {
@@ -320,11 +318,13 @@
// TODO
}
if (type.isSimpleType()) {
- SimpleTypeFieldMetadata simpleTypeFieldMetadata =
(SimpleTypeFieldMetadata)processVariableDeclaration(singleVariableDeclaration, type);
+ SimpleTypeFieldMetadata simpleTypeFieldMetadata =
(SimpleTypeFieldMetadata)processVariableDeclaration(singleVariableDeclaration,
+
type);
methodMetadata.getParameters().add(simpleTypeFieldMetadata);
}
if (type.isArrayType()) {
- ArrayTypeFieldMetadata arrayTypeFieldMetadata =
(ArrayTypeFieldMetadata)processVariableDeclaration(singleVariableDeclaration, type);
+ ArrayTypeFieldMetadata arrayTypeFieldMetadata =
(ArrayTypeFieldMetadata)processVariableDeclaration(singleVariableDeclaration,
+
type);
methodMetadata.getParameters().add(arrayTypeFieldMetadata);
}
if (type.isWildcardType()) {
@@ -364,14 +364,14 @@
}
return primitiveFieldMetadata;
}
- if(type.isSimpleType()) {
+ if (type.isSimpleType()) {
SimpleType simpleType = (SimpleType)type;
SimpleTypeFieldMetadata simpleTypeFieldMetadata = new
SimpleTypeFieldMetadata();
simpleTypeFieldMetadata.setType(JavaMetadataUtil.getName(simpleType.getName()));
variable = new Variable();
variable.setName(JavaMetadataUtil.getName(singleVariableDeclaration.getName()));
simpleTypeFieldMetadata.getVariables().add(variable);
- for (IExtendedModifier simpleTypeExtendedModifier :
(List<IExtendedModifier> )singleVariableDeclaration.modifiers()) {
+ for (IExtendedModifier simpleTypeExtendedModifier :
(List<IExtendedModifier>)singleVariableDeclaration.modifiers()) {
ModifierMetadata modifierMetadata = new ModifierMetadata();
if (simpleTypeExtendedModifier.isAnnotation()) {
// TODO
@@ -392,32 +392,32 @@
parameterizedTypeFieldMetadata.getVariables().add(variable);
for (IExtendedModifier parameterizedExtendedModifier :
(List<IExtendedModifier>)singleVariableDeclaration.modifiers()) {
ModifierMetadata modifierMetadata = new ModifierMetadata();
- if(parameterizedExtendedModifier.isAnnotation()) {
+ if (parameterizedExtendedModifier.isAnnotation()) {
// TODO
} else {
Modifier modifier = (Modifier)parameterizedExtendedModifier;
modifierMetadata.setName(modifier.getKeyword().toString());
- parameterizedTypeFieldMetadata.getModifiers().add(modifierMetadata);
+ parameterizedTypeFieldMetadata.getModifiers().add(modifierMetadata);
}
}
return parameterizedTypeFieldMetadata;
}
- if(type.isArrayType()) {
+ if (type.isArrayType()) {
ArrayTypeFieldMetadata arrayTypeFieldMetadata = new
ArrayTypeFieldMetadata();
ArrayType arrayType = (ArrayType)type;
arrayTypeFieldMetadata.setType(getTypeName(arrayType));
variable = new Variable();
variable.setName(JavaMetadataUtil.getName(singleVariableDeclaration.getName()));
arrayTypeFieldMetadata.getVariables().add(variable);
-
+
for (IExtendedModifier arrayTypeExtendedModifier :
(List<IExtendedModifier>)singleVariableDeclaration.modifiers()) {
ModifierMetadata modifierMetadata = new ModifierMetadata();
- if(arrayTypeExtendedModifier.isAnnotation()) {
+ if (arrayTypeExtendedModifier.isAnnotation()) {
// TODO
} else {
Modifier modifier = (Modifier)arrayTypeExtendedModifier;
modifierMetadata.setName(modifier.getKeyword().toString());
- arrayTypeFieldMetadata.getModifiers().add(modifierMetadata);
+ arrayTypeFieldMetadata.getModifiers().add(modifierMetadata);
}
}
return arrayTypeFieldMetadata;
@@ -442,19 +442,19 @@
SimpleType simpleType = (SimpleType)type;
return JavaMetadataUtil.getName(simpleType.getName());
}
- if(type.isArrayType()) {
+ if (type.isArrayType()) {
ArrayType arrayType = (ArrayType)type;
// the element type is never an array type
Type elementType = arrayType.getElementType();
if (elementType.isPrimitiveType()) {
- return ((PrimitiveType)elementType).getPrimitiveTypeCode().toString();
+ return ((PrimitiveType)elementType).getPrimitiveTypeCode().toString();
}
// can't be an array type
if (elementType.isSimpleType()) {
return JavaMetadataUtil.getName(((SimpleType)elementType).getName());
}
-
+
}
return null;
}
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/ArrayTypeFieldMetadataSequencer.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/ArrayTypeFieldMetadataSequencer.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/ArrayTypeFieldMetadataSequencer.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -34,8 +34,6 @@
/**
* Sequencer for array types.
- *
- * @author Serge Pagop
*/
public class ArrayTypeFieldMetadataSequencer implements JavaSourceCndDefinition {
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/CompilationUnitParser.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/CompilationUnitParser.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/CompilationUnitParser.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -29,8 +29,6 @@
/**
* The Parser, that process the a compilation unit.
- *
- * @author Serge Pagop
*/
public class CompilationUnitParser {
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataI18n.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataI18n.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataI18n.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,7 +28,7 @@
import org.jboss.dna.common.i18n.I18n;
/**
- * @author Serge Pagop
+ * The internationalized string constants for the
<code>org.jboss.dna.sequencer.java*</code> packages.
*/
public class JavaMetadataI18n {
public static I18n sequencerTaskName;
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataSequencer.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataSequencer.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataSequencer.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -29,9 +29,9 @@
import org.jboss.dna.graph.property.NameFactory;
import org.jboss.dna.graph.property.Path;
import org.jboss.dna.graph.property.PathFactory;
-import org.jboss.dna.graph.sequencer.StreamSequencerContext;
import org.jboss.dna.graph.sequencer.SequencerOutput;
import org.jboss.dna.graph.sequencer.StreamSequencer;
+import org.jboss.dna.graph.sequencer.StreamSequencerContext;
import org.jboss.dna.sequencer.java.metadata.AnnotationMetadata;
import org.jboss.dna.sequencer.java.metadata.ArrayTypeFieldMetadata;
import org.jboss.dna.sequencer.java.metadata.ClassMetadata;
@@ -165,9 +165,6 @@
* </li>
* </ul>
* </p>
- *
- * @author Serge Pagop
- * @author John Verhaeg
*/
public class JavaMetadataSequencer implements JavaSourceCndDefinition, StreamSequencer {
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataUtil.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataUtil.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataUtil.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -30,7 +30,7 @@
import org.jboss.dna.common.util.CheckArg;
/**
- * @author Serge Pagop
+ * Utility class for working with metadata.
*/
public class JavaMetadataUtil {
/**
@@ -70,7 +70,7 @@
CheckArg.isNotNull(name, "name");
return name.getFullyQualifiedName();
}
-
+
/**
* Create a path for the tree with index.
*
@@ -80,7 +80,7 @@
* @throws IllegalArgumentException if the path is null, blank or empty, or if the
index is not a positive value
*/
public static String createPathWithIndex( String path,
- int index ) {
+ int index ) {
CheckArg.isNotEmpty(path, "path");
CheckArg.isPositive(index, "index");
return path + "[" + index + "]";
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaSourceCndDefinition.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaSourceCndDefinition.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaSourceCndDefinition.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -25,8 +25,6 @@
/**
* JavaSourceCndDefinition defines each elements and sub elements, that must be found in
the java source cnd document.
- *
- * @author Serge Pagop
*/
public interface JavaSourceCndDefinition {
@@ -120,19 +118,19 @@
public static final String JAVA_SIMPLE_TYPE_NAME = "java:simpleTypeName";
public static final String JAVA_SIMPLE_TYPE_VARIABLE =
"java:simpleTypeVariable";
public static final String JAVA_SIMPLE_TYPE_MODIFIER_CHILD_NODE =
"java:simpleTypeModifier";
-
+
// Parameterized type
- public static final String
JAVA_PARAMETERIZED_TYPE_CHILD_NODE="java:parameterizedType";
- public static final String JAVA_PARAMETERIZED_TYPE_DESCRIPTION
="java:parameterizedTypeDescription";
- public static final String JAVA_PARAMETERIZED_TYPE_MODIFIER_CHILD_NODE
="java:parameterizedTypeModifier";
- public static final String JAVA_PARAMETERIZED_TYPE_NAME
="java:parameterizedTypeName";
- public static final String JAVA_PARAMETERIZED_TYPE_VARIABLE
="java:parameterizedTypeVariable";
-
+ public static final String JAVA_PARAMETERIZED_TYPE_CHILD_NODE =
"java:parameterizedType";
+ public static final String JAVA_PARAMETERIZED_TYPE_DESCRIPTION =
"java:parameterizedTypeDescription";
+ public static final String JAVA_PARAMETERIZED_TYPE_MODIFIER_CHILD_NODE =
"java:parameterizedTypeModifier";
+ public static final String JAVA_PARAMETERIZED_TYPE_NAME =
"java:parameterizedTypeName";
+ public static final String JAVA_PARAMETERIZED_TYPE_VARIABLE =
"java:parameterizedTypeVariable";
+
// Array type
- public static final String JAVA_ARRAY_TYPE_CHILD_NODE="java:arrayType";
- public static final String JAVA_ARRAY_TYPE_DESCRIPTION
="java:arrayTypeDescription";
- public static final String JAVA_ARRAY_TYPE_MODIFIER_CHILD_NODE
="java:arrayTypeModifier";
- public static final String JAVA_ARRAY_TYPE_NAME ="java:arrayTypeName";
- public static final String JAVA_ARRAY_TYPE_VARIABLE
="java:arrayTypeVariable";
+ public static final String JAVA_ARRAY_TYPE_CHILD_NODE = "java:arrayType";
+ public static final String JAVA_ARRAY_TYPE_DESCRIPTION =
"java:arrayTypeDescription";
+ public static final String JAVA_ARRAY_TYPE_MODIFIER_CHILD_NODE =
"java:arrayTypeModifier";
+ public static final String JAVA_ARRAY_TYPE_NAME = "java:arrayTypeName";
+ public static final String JAVA_ARRAY_TYPE_VARIABLE =
"java:arrayTypeVariable";
}
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/MethodMetadataSequencer.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/MethodMetadataSequencer.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/MethodMetadataSequencer.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -29,24 +29,20 @@
/**
* Sequencer for a {@link MethodMetadata}.
- *
- * @author Serge PAgop
- *
*/
public class MethodMetadataSequencer implements JavaSourceCndDefinition {
-
+
/**
- * Create a path of method/constructor parameter.
+ * Create a path of method/constructor parameter.
+ *
* @param pathFactory - {@link PathFactory}.
* @param rootPath - Root path of the method/constructor.
* @return the path of the parameter.
*/
public static Path createMethodParamPath( PathFactory pathFactory,
- String rootPath ) {
- String methodPrimitiveParamVariablePath = JavaMetadataUtil.createPath(rootPath
- + SLASH
- +
JAVA_PRIMITIVE_TYPE_VARIABLE
- + SLASH +
JAVA_VARIABLE);
+ String rootPath ) {
+ String methodPrimitiveParamVariablePath = JavaMetadataUtil.createPath(rootPath +
SLASH + JAVA_PRIMITIVE_TYPE_VARIABLE
+ + SLASH +
JAVA_VARIABLE);
Path methodParamChildNode =
pathFactory.create(methodPrimitiveParamVariablePath);
return methodParamChildNode;
}
@@ -59,8 +55,8 @@
*/
public static String createMethodParamRootPath( String constructorParameterRootPath )
{
String constructPrimitiveFormalParamRootPath =
JavaMetadataUtil.createPath(constructorParameterRootPath + SLASH
- +
JAVA_TYPE_CHILD_NODE + SLASH
- +
JAVA_PRIMITIVE_TYPE_CHILD_NODE);
+ +
JAVA_TYPE_CHILD_NODE + SLASH
+ +
JAVA_PRIMITIVE_TYPE_CHILD_NODE);
return constructPrimitiveFormalParamRootPath;
}
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/ParameterizedTypeFieldMetadataSequencer.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/ParameterizedTypeFieldMetadataSequencer.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/ParameterizedTypeFieldMetadataSequencer.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -32,8 +32,6 @@
/**
* Sequencer for all paths of a {@link ParameterizedTypeFieldMetadata}.
- *
- * @author Serge Pagop
*/
public class ParameterizedTypeFieldMetadataSequencer implements JavaSourceCndDefinition
{
@@ -45,13 +43,15 @@
*/
public static String getParameterizedTypeFieldRootPath( int parameterizedIndex ) {
String simpleTypeFieldRootPath =
JavaMetadataUtil.createPathWithIndex(JAVA_COMPILATION_UNIT_NODE + SLASH
- +
JAVA_UNIT_TYPE_CHILD_NODE + SLASH
- +
JAVA_CLASS_DECLARATION_CHILD_NODE + SLASH
- +
JAVA_NORMAL_CLASS_CHILD_NODE + SLASH
- +
JAVA_NORMAL_CLASS_DECLARATION_CHILD_NODE + SLASH
- +
JAVA_FIELD_CHILD_NODE + SLASH + JAVA_FIELD_TYPE_CHILD_NODE
- + SLASH +
JAVA_TYPE_CHILD_NODE + SLASH
- +
JAVA_PARAMETERIZED_TYPE_CHILD_NODE, parameterizedIndex);
+ +
JAVA_UNIT_TYPE_CHILD_NODE + SLASH
+ +
JAVA_CLASS_DECLARATION_CHILD_NODE + SLASH
+ +
JAVA_NORMAL_CLASS_CHILD_NODE + SLASH
+ +
JAVA_NORMAL_CLASS_DECLARATION_CHILD_NODE + SLASH
+ +
JAVA_FIELD_CHILD_NODE + SLASH
+ +
JAVA_FIELD_TYPE_CHILD_NODE + SLASH
+ +
JAVA_TYPE_CHILD_NODE + SLASH
+ +
JAVA_PARAMETERIZED_TYPE_CHILD_NODE,
+
parameterizedIndex);
return simpleTypeFieldRootPath;
}
@@ -85,9 +85,10 @@
public static String getParameterizedTypeFieldRModifierPath( String
parameterizedTypeFieldRootPath,
int
parameterizedTypeModifierIndex ) {
String parameterizedTypeModifierPath =
JavaMetadataUtil.createPathWithIndex(parameterizedTypeFieldRootPath + SLASH
- +
JAVA_PARAMETERIZED_TYPE_MODIFIER_CHILD_NODE + SLASH
- +
JAVA_MODIFIER_DECLARATION_CHILD_NODE,
-
parameterizedTypeModifierIndex);
+ +
JAVA_PARAMETERIZED_TYPE_MODIFIER_CHILD_NODE
+ +
SLASH
+ +
JAVA_MODIFIER_DECLARATION_CHILD_NODE,
+
parameterizedTypeModifierIndex);
return parameterizedTypeModifierPath;
}
@@ -121,12 +122,12 @@
String
parameterizedTypeFieldRootPath,
int
parameterizedTypeVariableIndex ) {
String variablePath =
JavaMetadataUtil.createPathWithIndex(parameterizedTypeFieldRootPath + SLASH
- +
JAVA_PARAMETERIZED_TYPE_VARIABLE + SLASH + JAVA_VARIABLE,
-
parameterizedTypeVariableIndex);
+ +
JAVA_PARAMETERIZED_TYPE_VARIABLE + SLASH + JAVA_VARIABLE,
+
parameterizedTypeVariableIndex);
Path parameterizedTypeVariableChildNode = pathFactory.create(variablePath);
return parameterizedTypeVariableChildNode;
}
-
+
private ParameterizedTypeFieldMetadataSequencer() {
// prevent constructor
}
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/SimpleTypeMetadataSequencer.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/SimpleTypeMetadataSequencer.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/SimpleTypeMetadataSequencer.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -32,8 +32,6 @@
/**
* The sequencer of the {@link SimpleTypeFieldMetadata}
- *
- * @author Serge Pagop
*/
public class SimpleTypeMetadataSequencer implements JavaSourceCndDefinition {
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/VariableSequencer.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/VariableSequencer.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/VariableSequencer.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -30,11 +30,9 @@
/**
* Sequencer for variabels.
- * @author Perge Pagop
- *
*/
public class VariableSequencer implements JavaSourceCndDefinition {
-
+
/**
* Sequence a variable.
*
@@ -44,9 +42,9 @@
* @param path - the path
*/
public static void sequenceTheVariable( SequencerOutput output,
- NameFactory nameFactory,
- Variable variable,
- Path path ) {
+ NameFactory nameFactory,
+ Variable variable,
+ Path path ) {
output.setProperty(path, nameFactory.create(JAVA_VARIABLE_NAME),
variable.getName());
}
}
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/AnnotationMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/AnnotationMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/AnnotationMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,7 +24,7 @@
package org.jboss.dna.sequencer.java.metadata;
/**
- * @author Serge Pagop
+ * Abstract class for annotations.
*/
public abstract class AnnotationMetadata {
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ArrayTypeFieldMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ArrayTypeFieldMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ArrayTypeFieldMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,17 +23,14 @@
*/
package org.jboss.dna.sequencer.java.metadata;
-
/**
* ArrayTypeFieldMetadata represents the meta data for an array type.
- *
- * @author Serge Pagop
*/
public class ArrayTypeFieldMetadata extends FieldMetadata {
-
+
/**
* {@inheritDoc}
- *
+ *
* @see org.jboss.dna.sequencer.java.metadata.FieldMetadata#isArrayType()
*/
@Override
@@ -41,14 +38,14 @@
return true;
}
- // Element type
+ // Element type
private FieldMetadata elementType;
-
+
// Component type
private FieldMetadata componentType;
public ArrayTypeFieldMetadata() {
-
+
}
/**
@@ -81,7 +78,7 @@
/**
* {@inheritDoc}
- *
+ *
* @see java.lang.Object#toString()
*/
@Override
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ClassMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ClassMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ClassMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,7 +24,7 @@
package org.jboss.dna.sequencer.java.metadata;
/**
- * @author Serge Pagop
+ * Class metadata.
*/
public class ClassMetadata extends TypeMetadata {
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ConstructorMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ConstructorMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ConstructorMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,7 +24,7 @@
package org.jboss.dna.sequencer.java.metadata;
/**
- *
+ * Constructor metadata.
*/
public class ConstructorMetadata extends MethodMetadata {
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/FieldMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/FieldMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/FieldMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,8 +28,6 @@
/**
* FieldMetadata is the base class of all fields.
- *
- * @author Serge Pagop
*/
public class FieldMetadata {
@@ -82,7 +80,7 @@
public void setModifiers( List<ModifierMetadata> modifierMetadatas ) {
this.modifierMetadatas = modifierMetadatas;
}
-
+
/**
* Find out if a field is primitive type or not.
*
@@ -91,7 +89,7 @@
public boolean isPrimitiveType() {
return false;
}
-
+
/**
* Find out if a field is a simple type or not.
*
@@ -100,7 +98,7 @@
public boolean isSimpleType() {
return false;
}
-
+
/**
* Find out if a field is a array type or not.
*
@@ -118,7 +116,7 @@
public boolean isQualifiedType() {
return false;
}
-
+
/**
* Find out if a field is a parameterized type or not.
*
@@ -127,7 +125,7 @@
public boolean isParameterizedType() {
return false;
}
-
+
/**
* Find out if a field is a wild card type or not.
*
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ImportMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ImportMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ImportMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,7 +24,7 @@
package org.jboss.dna.sequencer.java.metadata;
/**
- * @author Serge Pagop
+ * Import metadata.
*/
public abstract class ImportMetadata {
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ImportOnDemandMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ImportOnDemandMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ImportOnDemandMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,7 +24,7 @@
package org.jboss.dna.sequencer.java.metadata;
/**
- * @author Serge Pagop
+ * On-demand import metadata.
*/
public class ImportOnDemandMetadata extends ImportMetadata {
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/InterfaceMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/InterfaceMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/InterfaceMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,7 +24,7 @@
package org.jboss.dna.sequencer.java.metadata;
/**
- * @author Serge Pagop
+ * Interface metadata.
*/
public class InterfaceMetadata extends TypeMetadata {
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavaMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavaMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavaMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -31,8 +31,7 @@
import org.jboss.dna.sequencer.java.JavaMetadataUtil;
/**
- * @author Serge Pagop
- * @author John Verhaeg
+ * Metadata for a Java source file.
*/
public class JavaMetadata extends AbstractJavaMetadata {
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavadocMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavadocMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavadocMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,7 +24,7 @@
package org.jboss.dna.sequencer.java.metadata;
/**
- *
+ * JavaDoc metadata.
*/
public class JavadocMetadata {
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/MarkerAnnotationMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/MarkerAnnotationMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/MarkerAnnotationMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,7 +24,7 @@
package org.jboss.dna.sequencer.java.metadata;
/**
- *
+ * Metadata for marker annotations.
*/
public class MarkerAnnotationMetadata extends AnnotationMetadata {
private boolean marker;
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/MethodTypeMemberMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/MethodTypeMemberMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/MethodTypeMemberMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,7 +24,7 @@
package org.jboss.dna.sequencer.java.metadata;
/**
- *
+ * Metadata for method type members.
*/
public class MethodTypeMemberMetadata extends MethodMetadata {
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ModifierMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ModifierMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ModifierMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,7 +24,7 @@
package org.jboss.dna.sequencer.java.metadata;
/**
- *
+ * Metadata for modifiers.
*/
public class ModifierMetadata extends AnnotationMetadata {
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/NormalAnnotationMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/NormalAnnotationMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/NormalAnnotationMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,7 +24,7 @@
package org.jboss.dna.sequencer.java.metadata;
/**
- *
+ * Metadata for normal annotations.
*/
public class NormalAnnotationMetadata extends AnnotationMetadata {
private boolean normal;
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/PackageMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/PackageMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/PackageMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,8 +28,6 @@
/**
* Package meta data.
- *
- * @author Serge Pagop.
*/
public class PackageMetadata {
private JavadocMetadata javadocMetadata;
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ParameterizedTypeFieldMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ParameterizedTypeFieldMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ParameterizedTypeFieldMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -25,16 +25,15 @@
/**
* ParameterizedTypeFieldMetadata is a meta data for a parameterized type.
- *
- * @author Serge Pagop
*/
public class ParameterizedTypeFieldMetadata extends FieldMetadata {
-
- public ParameterizedTypeFieldMetadata() {}
+ public ParameterizedTypeFieldMetadata() {
+ }
+
/**
* {@inheritDoc}
- *
+ *
* @see org.jboss.dna.sequencer.java.metadata.FieldMetadata#isParameterizedType()
*/
@Override
@@ -44,14 +43,12 @@
/**
* {@inheritDoc}
- *
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "ParameterizedTypeFieldMetadata [ " + getType() + "
]";
}
-
-
}
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/QualifiedTypeFieldMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/QualifiedTypeFieldMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/QualifiedTypeFieldMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,11 +23,8 @@
*/
package org.jboss.dna.sequencer.java.metadata;
-
/**
* QualifiedTypeFieldMetadata meta data for a qualified type.
- *
- * @author Serge Pagop
*/
public class QualifiedTypeFieldMetadata extends FieldMetadata {
@@ -36,7 +33,7 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.jboss.dna.sequencer.java.metadata.FieldMetadata#isQualifiedType()
*/
@Override
@@ -46,7 +43,7 @@
/**
* {@inheritDoc}
- *
+ *
* @see java.lang.Object#toString()
*/
@Override
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/SimpleTypeFieldMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/SimpleTypeFieldMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/SimpleTypeFieldMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,17 +24,14 @@
package org.jboss.dna.sequencer.java.metadata;
/**
- * SimpleTypeFieldMetadata is a meta data for simple class type reference ,
- * a simple interface type reference, or a simple type variable.
- *
- * @author serge pagop
- *
+ * SimpleTypeFieldMetadata is a meta data for simple class type reference , a simple
interface type reference, or a simple type
+ * variable.
*/
public class SimpleTypeFieldMetadata extends FieldMetadata {
/**
* {@inheritDoc}
- *
+ *
* @see org.jboss.dna.sequencer.java.metadata.FieldMetadata#isSimpleType()
*/
@Override
@@ -44,12 +41,12 @@
/**
* {@inheritDoc}
- *
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "SimpleTypeFieldMetadata [ " + getType() + "]" ;
+ return "SimpleTypeFieldMetadata [ " + getType() + "]";
}
}
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/SingleImportMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/SingleImportMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/SingleImportMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,7 +24,7 @@
package org.jboss.dna.sequencer.java.metadata;
/**
- * Serge Pagop
+ * Single-import metadata.
*/
public class SingleImportMetadata extends ImportMetadata {
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/SingleMemberAnnotationMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/SingleMemberAnnotationMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/SingleMemberAnnotationMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,7 +24,7 @@
package org.jboss.dna.sequencer.java.metadata;
/**
- *
+ * Metadata for single member annotations.
*/
public class SingleMemberAnnotationMetadata extends AnnotationMetadata {
private boolean single;
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/TypeMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/TypeMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/TypeMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,8 +28,6 @@
/**
* Exposes meta data of a top level type.
- *
- * @author Serge Pagop
*/
public class TypeMetadata {
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/WildcardTypeFieldMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/WildcardTypeFieldMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/WildcardTypeFieldMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,15 +23,12 @@
*/
package org.jboss.dna.sequencer.java.metadata;
-
/**
* WildcardTypeFieldMetadata represents meta data for wild card type.
* <p>
* It is important to know that, it is nonsense if a wild card type appears anywhere
other than as an argument of a
* <code>ParameterizedTypeFieldMetadata</code> node.
* </p>
- *
- * @author Serge Pagop
*/
public class WildcardTypeFieldMetadata extends FieldMetadata {
@@ -40,7 +37,7 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.jboss.dna.sequencer.java.metadata.FieldMetadata#isWildcardType()
*/
@Override
@@ -50,7 +47,7 @@
/**
* {@inheritDoc}
- *
+ *
* @see java.lang.Object#toString()
*/
@Override
Copied:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/package-info.java
(from rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ClassMetadata.java)
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/package-info.java
(rev 0)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The classes that make up the metadata definitions for the Java source file sequencer.
+ */
+
+package org.jboss.dna.sequencer.java.metadata;
+
Copied:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/package-info.java
(from rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavadocMetadata.java)
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/package-info.java
(rev 0)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The classes that make up the Java source file sequencer.
+ */
+
+package org.jboss.dna.sequencer.java;
+
Copied:
trunk/extensions/dna-sequencer-jbpm-jpdl/src/main/java/org/jboss/dna/sequencer/jpdl3/package-info.java
(from rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavadocMetadata.java)
===================================================================
---
trunk/extensions/dna-sequencer-jbpm-jpdl/src/main/java/org/jboss/dna/sequencer/jpdl3/package-info.java
(rev 0)
+++
trunk/extensions/dna-sequencer-jbpm-jpdl/src/main/java/org/jboss/dna/sequencer/jpdl3/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The classes that make up the jPDL3 file sequencer.
+ */
+
+package org.jboss.dna.sequencer.jpdl3;
+
Modified:
trunk/extensions/dna-sequencer-mp3/src/main/java/org/jboss/dna/sequencer/mp3/Mp3Metadata.java
===================================================================
---
trunk/extensions/dna-sequencer-mp3/src/main/java/org/jboss/dna/sequencer/mp3/Mp3Metadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-mp3/src/main/java/org/jboss/dna/sequencer/mp3/Mp3Metadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -33,8 +33,6 @@
/**
* Utility for extracting metadata from MP3 files.
- *
- * @author Stefano Maestri
*/
public class Mp3Metadata {
Modified:
trunk/extensions/dna-sequencer-mp3/src/main/java/org/jboss/dna/sequencer/mp3/Mp3MetadataSequencer.java
===================================================================
---
trunk/extensions/dna-sequencer-mp3/src/main/java/org/jboss/dna/sequencer/mp3/Mp3MetadataSequencer.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-mp3/src/main/java/org/jboss/dna/sequencer/mp3/Mp3MetadataSequencer.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,9 +24,9 @@
package org.jboss.dna.sequencer.mp3;
import java.io.InputStream;
-import org.jboss.dna.graph.sequencer.StreamSequencerContext;
import org.jboss.dna.graph.sequencer.SequencerOutput;
import org.jboss.dna.graph.sequencer.StreamSequencer;
+import org.jboss.dna.graph.sequencer.StreamSequencerContext;
/**
* A sequencer that processes the binary content of an MP3 audio file, extracts the
metadata for the file, and then writes that
@@ -45,10 +45,6 @@
* </li>
* </ul>
* </p>
- *
- * @author Stefano Maestri
- * @author Randall Hauch
- * @author John Verhaeg
*/
public class Mp3MetadataSequencer implements StreamSequencer {
Copied:
trunk/extensions/dna-sequencer-mp3/src/main/java/org/jboss/dna/sequencer/mp3/package-info.java
(from rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavadocMetadata.java)
===================================================================
---
trunk/extensions/dna-sequencer-mp3/src/main/java/org/jboss/dna/sequencer/mp3/package-info.java
(rev 0)
+++
trunk/extensions/dna-sequencer-mp3/src/main/java/org/jboss/dna/sequencer/mp3/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The classes that make up the MP3 file sequencer.
+ */
+
+package org.jboss.dna.sequencer.mp3;
+
Modified:
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/MSOfficeMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/MSOfficeMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/MSOfficeMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -30,6 +30,9 @@
import org.apache.poi.poifs.eventfilesystem.POIFSReaderListener;
import org.jboss.dna.common.util.Logger;
+/**
+ * Metadata about an Microsoft Office file.
+ */
public class MSOfficeMetadata implements POIFSReaderListener {
private String title;
Modified:
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/MSOfficeMetadataI18n.java
===================================================================
---
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/MSOfficeMetadataI18n.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/MSOfficeMetadataI18n.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,13 +23,12 @@
*/
package org.jboss.dna.sequencer.msoffice;
-import org.jboss.dna.common.i18n.I18n;
-
import java.util.Locale;
import java.util.Set;
+import org.jboss.dna.common.i18n.I18n;
/**
- * @author Randall Hauch
+ * The internationalized string constants for the
<code>org.jboss.dna.sequencer.msoffice*</code> packages.
*/
public final class MSOfficeMetadataI18n {
@@ -54,4 +53,4 @@
public static Set<String> getLocalizationProblems( Locale locale ) {
return I18n.getLocalizationProblems(MSOfficeMetadataI18n.class, locale);
}
-}
\ No newline at end of file
+}
Modified:
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/MSOfficeMetadataReader.java
===================================================================
---
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/MSOfficeMetadataReader.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/MSOfficeMetadataReader.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,18 +23,15 @@
*/
package org.jboss.dna.sequencer.msoffice;
-
import java.io.InputStream;
-import org.apache.poi.poifs.eventfilesystem.*;
+import org.apache.poi.poifs.eventfilesystem.POIFSReader;
-
/**
* Utility for extracting metadata from Excel files
- * @author Michael Trezzi
*/
public class MSOfficeMetadataReader {
- public static MSOfficeMetadata instance( InputStream stream ) {
+ public static MSOfficeMetadata instance( InputStream stream ) {
try {
POIFSReader r = new POIFSReader();
MSOfficeMetadata MSOfficeMetadataListener = new MSOfficeMetadata();
Modified:
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/MSOfficeMetadataSequencer.java
===================================================================
---
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/MSOfficeMetadataSequencer.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/MSOfficeMetadataSequencer.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -27,9 +27,9 @@
import java.io.InputStream;
import java.util.Iterator;
import java.util.List;
-import org.jboss.dna.graph.sequencer.StreamSequencerContext;
import org.jboss.dna.graph.sequencer.SequencerOutput;
import org.jboss.dna.graph.sequencer.StreamSequencer;
+import org.jboss.dna.graph.sequencer.StreamSequencerContext;
import org.jboss.dna.sequencer.msoffice.excel.ExcelMetadata;
import org.jboss.dna.sequencer.msoffice.excel.ExcelMetadataReader;
import org.jboss.dna.sequencer.msoffice.powerpoint.PowerPointMetadataReader;
@@ -76,9 +76,6 @@
* </li>
* </ul>
* </p>
- *
- * @author Michael Trezzi
- * @author John Verhaeg
*/
public class MSOfficeMetadataSequencer implements StreamSequencer {
@@ -112,7 +109,7 @@
// Excel specific
public static final String EXCEL_FULL_CONTENT = "msoffice:full_contents";
public static final String EXCEL_SHEET_NAME = "msoffice:sheet_name";
-
+
// Word specific
public static final String WORD_HEADING_NODE = "msoffice:heading";
public static final String WORD_HEADING_NAME = "msoffice:heading_name";
@@ -176,14 +173,14 @@
try {
WordMetadata wordMetadata = WordMetadataReader.instance(stream);
- for (Iterator<WordMetadata.WordHeading> iter =
wordMetadata.getHeadings().iterator(); iter.hasNext(); ) {
+ for (Iterator<WordMetadata.WordHeading> iter =
wordMetadata.getHeadings().iterator(); iter.hasNext();) {
WordMetadata.WordHeading heading = iter.next();
-
+
output.setProperty(METADATA_NODE + "/" + WORD_HEADING_NODE,
WORD_HEADING_NAME, heading.getText());
- output.setProperty(METADATA_NODE + "/" + WORD_HEADING_NODE,
WORD_HEADING_LEVEL, heading.getHeaderLevel());
-
+ output.setProperty(METADATA_NODE + "/" + WORD_HEADING_NODE,
WORD_HEADING_LEVEL, heading.getHeaderLevel());
+
}
-
+
} catch (IOException e) {
// There was an error reading, so log and continue ...
context.getLogger(this.getClass()).debug(e, "Error while extracting
the Word document metadata");
Modified:
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/excel/ExcelMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/excel/ExcelMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/excel/ExcelMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -26,8 +26,7 @@
import java.util.List;
/**
- * @author Michael Trezzi
- * @description Metadata for Excel (Full text contents and list of sheet names
+ * Metadata for Excel (Full text contents and list of sheet names)
*/
public class ExcelMetadata {
@@ -35,7 +34,7 @@
return text;
}
- public void setText(String text) {
+ public void setText( String text ) {
this.text = text;
}
@@ -43,7 +42,7 @@
return sheets;
}
- public void setSheets(List<String> sheets) {
+ public void setSheets( List<String> sheets ) {
this.sheets = sheets;
}
Modified:
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/excel/ExcelMetadataReader.java
===================================================================
---
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/excel/ExcelMetadataReader.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/excel/ExcelMetadataReader.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -27,7 +27,6 @@
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
-
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFComment;
import org.apache.poi.hssf.usermodel.HSSFRow;
@@ -36,82 +35,80 @@
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
/**
- * @author Michael Trezzi
- * @description Extracts data and some metadata from excel files
+ * Extracts data and some metadata from Excel files
*/
public class ExcelMetadataReader {
- /** The character to output after each row. */
- private static final char ROW_DELIMITER_CHAR = '\n';
- /** The character to output after each cell (column). */
- private static final char CELL_DELIMITER_CHAR = '\t';
-
+ /** The character to output after each row. */
+ private static final char ROW_DELIMITER_CHAR = '\n';
+ /** The character to output after each cell (column). */
+ private static final char CELL_DELIMITER_CHAR = '\t';
+
public static ExcelMetadata instance( InputStream stream ) throws IOException {
ExcelMetadata metadata = new ExcelMetadata();
HSSFWorkbook wb = new HSSFWorkbook(new POIFSFileSystem(stream));
StringBuffer buff = new StringBuffer();
List<String> sheets = new ArrayList<String>();
-
+
for (int sheetInd = 0; sheetInd < wb.getNumberOfSheets(); sheetInd++) {
sheets.add(wb.getSheetName(sheetInd));
HSSFSheet worksheet = wb.getSheetAt(sheetInd);
int lastRowNum = worksheet.getLastRowNum();
-
+
for (int rowNum = worksheet.getFirstRowNum(); rowNum <= lastRowNum;
rowNum++) {
- HSSFRow row = worksheet.getRow(rowNum);
-
- // Empty rows are returned as null
- if (row == null) {
- continue;
- }
-
- int lastCellNum = row.getLastCellNum();
- for (int cellNum = row.getFirstCellNum(); cellNum < lastCellNum;
cellNum++) {
- HSSFCell cell = row.getCell(cellNum);
-
- /*
- * Builds a string of body content from all string, numeric,
- * and formula values in the body of each worksheet.
- *
- * This code currently duplicates the POI 3.1 ExcelExtractor behavior of
- * combining the body text from all worksheets into a single string.
- */
- switch (cell.getCellType()) {
- case HSSFCell.CELL_TYPE_STRING:
- buff.append(cell.getRichStringCellValue().getString());
- break;
- case HSSFCell.CELL_TYPE_NUMERIC:
- buff.append(cell.getNumericCellValue());
- break;
- case HSSFCell.CELL_TYPE_FORMULA:
- buff.append(cell.getCellFormula());
- break;
- }
+ HSSFRow row = worksheet.getRow(rowNum);
- HSSFComment comment = cell.getCellComment();
- if (comment != null) {
- // Filter out row delimiter characters from comment
- String commentText =
comment.getString().getString().replace(ROW_DELIMITER_CHAR, ' ');
-
- buff.append(" [");
- buff.append(commentText);
- buff.append(" by ");
- buff.append(comment.getAuthor());
- buff.append(']');
- }
-
- if (cellNum < lastCellNum - 1) {
- buff.append(CELL_DELIMITER_CHAR);
- }
- else {
- buff.append(ROW_DELIMITER_CHAR);
- }
- }
+ // Empty rows are returned as null
+ if (row == null) {
+ continue;
+ }
+
+ int lastCellNum = row.getLastCellNum();
+ for (int cellNum = row.getFirstCellNum(); cellNum < lastCellNum;
cellNum++) {
+ HSSFCell cell = row.getCell(cellNum);
+
+ /*
+ * Builds a string of body content from all string, numeric,
+ * and formula values in the body of each worksheet.
+ *
+ * This code currently duplicates the POI 3.1 ExcelExtractor
behavior of
+ * combining the body text from all worksheets into a single
string.
+ */
+ switch (cell.getCellType()) {
+ case HSSFCell.CELL_TYPE_STRING:
+ buff.append(cell.getRichStringCellValue().getString());
+ break;
+ case HSSFCell.CELL_TYPE_NUMERIC:
+ buff.append(cell.getNumericCellValue());
+ break;
+ case HSSFCell.CELL_TYPE_FORMULA:
+ buff.append(cell.getCellFormula());
+ break;
+ }
+
+ HSSFComment comment = cell.getCellComment();
+ if (comment != null) {
+ // Filter out row delimiter characters from comment
+ String commentText =
comment.getString().getString().replace(ROW_DELIMITER_CHAR, ' ');
+
+ buff.append(" [");
+ buff.append(commentText);
+ buff.append(" by ");
+ buff.append(comment.getAuthor());
+ buff.append(']');
+ }
+
+ if (cellNum < lastCellNum - 1) {
+ buff.append(CELL_DELIMITER_CHAR);
+ } else {
+ buff.append(ROW_DELIMITER_CHAR);
+ }
+ }
}
}
-
+
metadata.setText(buff.toString());
metadata.setSheets(sheets);
return metadata;
Copied:
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/excel/package-info.java
(from rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavadocMetadata.java)
===================================================================
---
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/excel/package-info.java
(rev 0)
+++
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/excel/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The classes for reading Microsoft Excel metadata.
+ */
+
+package org.jboss.dna.sequencer.msoffice.excel;
+
Copied:
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/package-info.java
(from rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavadocMetadata.java)
===================================================================
---
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/package-info.java
(rev 0)
+++
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The classes that make up the sequencer of Microsoft Office files.
+ */
+
+package org.jboss.dna.sequencer.msoffice;
+
Modified:
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/powerpoint/PowerPointMetadataReader.java
===================================================================
---
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/powerpoint/PowerPointMetadataReader.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/powerpoint/PowerPointMetadataReader.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -23,20 +23,22 @@
*/
package org.jboss.dna.sequencer.msoffice.powerpoint;
-import java.util.List;
-import java.io.*;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
-import java.awt.*;
-import java.awt.geom.Rectangle2D;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
import java.util.ArrayList;
-import org.apache.poi.hslf.usermodel.SlideShow;
+import java.util.List;
import org.apache.poi.hslf.model.Slide;
import org.apache.poi.hslf.model.TextRun;
+import org.apache.poi.hslf.usermodel.SlideShow;
/**
* Utility for extracting metadata from PowerPoint files
- *
- * @author Michael Trezzi
*/
public class PowerPointMetadataReader {
Modified:
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/powerpoint/SlideMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/powerpoint/SlideMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/powerpoint/SlideMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -24,7 +24,7 @@
package org.jboss.dna.sequencer.msoffice.powerpoint;
/**
- * @author Michael Trezzi
+ * Metadata for Microsoft Office PowerPoint slides.
*/
public class SlideMetadata {
private String title;
@@ -36,7 +36,7 @@
return title;
}
- public void setTitle(String title) {
+ public void setTitle( String title ) {
this.title = title;
}
@@ -44,7 +44,7 @@
return text;
}
- public void setText(String text) {
+ public void setText( String text ) {
this.text = text;
}
@@ -52,16 +52,15 @@
return thumbnail;
}
- public void setThumbnail(byte[] thumbnail) {
+ public void setThumbnail( byte[] thumbnail ) {
this.thumbnail = thumbnail;
}
-
public String getNotes() {
return notes;
}
- public void setNotes(String notes) {
+ public void setNotes( String notes ) {
this.notes = notes;
}
}
Copied:
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/powerpoint/package-info.java
(from rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavadocMetadata.java)
===================================================================
---
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/powerpoint/package-info.java
(rev 0)
+++
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/powerpoint/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The classes for reading Microsoft PowerPoint metadata.
+ */
+
+package org.jboss.dna.sequencer.msoffice.powerpoint;
+
Modified:
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/word/WordMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/word/WordMetadata.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/word/WordMetadata.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -27,46 +27,46 @@
import java.util.List;
/**
- * @author Michael Trezzi
+ * Metadata for Microsoft Word documents.
*/
public class WordMetadata {
- private List<WordMetadata.WordHeading> headings;
+ private List<WordMetadata.WordHeading> headings;
- public List<WordMetadata.WordHeading> getHeadings() {
- return headings;
- }
+ public List<WordMetadata.WordHeading> getHeadings() {
+ return headings;
+ }
- public void setHeadings(List<WordMetadata.WordHeading> headings) {
- this.headings = headings;
- }
+ public void setHeadings( List<WordMetadata.WordHeading> headings ) {
+ this.headings = headings;
+ }
+ public static class WordHeading {
+ private String text;
+ private int headingLevel;
- public static class WordHeading {
- private String text;
- private int headingLevel;
+ public WordHeading( String text,
+ int headerLevel ) {
+ super();
+ this.text = text;
+ this.headingLevel = headerLevel;
+ }
- public WordHeading(String text, int headerLevel) {
- super();
- this.text = text;
- this.headingLevel = headerLevel;
- }
+ public String getText() {
+ return text;
+ }
- public String getText() {
- return text;
- }
-
- public void setText(String text) {
- this.text = text;
- }
-
- public int getHeaderLevel() {
- return headingLevel;
- }
-
- public void setHeaderLevel(int headerLevel) {
- this.headingLevel = headerLevel;
- }
-
- }
+ public void setText( String text ) {
+ this.text = text;
+ }
+
+ public int getHeaderLevel() {
+ return headingLevel;
+ }
+
+ public void setHeaderLevel( int headerLevel ) {
+ this.headingLevel = headerLevel;
+ }
+
+ }
}
Modified:
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/word/WordMetadataReader.java
===================================================================
---
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/word/WordMetadataReader.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/word/WordMetadataReader.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -28,7 +28,6 @@
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
-
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.model.StyleSheet;
import org.apache.poi.hwpf.usermodel.Paragraph;
@@ -36,54 +35,50 @@
import org.jboss.dna.common.util.Logger;
/**
- * Infers table of contents from Word document by reading all paragraphs
- * with style <code>Heading*</code>. This is analogous to the default
- * behavior of Word when generating a table of contents.
- *
- * @author Michael Trezzi
+ * Infers table of contents from Word document by reading all paragraphs with style
<code>Heading*</code>. This is analogous to
+ * the default behavior of Word when generating a table of contents.
*/
public class WordMetadataReader {
- private static final Logger log = Logger.getLogger(WordMetadataReader.class);
-
- /** Prefix for styles that will be extracted and treated as outline information for the
document */
- private static final String HEADER_PREFIX = "Heading";
-
+ private static final Logger log = Logger.getLogger(WordMetadataReader.class);
+
+ /** Prefix for styles that will be extracted and treated as outline information for
the document */
+ private static final String HEADER_PREFIX = "Heading";
+
public static WordMetadata instance( InputStream stream ) throws IOException {
- WordMetadata metadata = new WordMetadata();
+ WordMetadata metadata = new WordMetadata();
List<WordMetadata.WordHeading> headings = new
ArrayList<WordMetadata.WordHeading>();
HWPFDocument document = new HWPFDocument(stream);
Range range = document.getRange();
StyleSheet stylesheet = document.getStyleSheet();
-
+
for (int i = 0; i < range.numParagraphs(); i++) {
- Paragraph paragraph = range.getParagraph(i);
-
- String styleName =
stylesheet.getStyleDescription(paragraph.getStyleIndex()).getName();
-
- if (styleName.startsWith(HEADER_PREFIX)) {
- String rawLevelNum = styleName.substring(HEADER_PREFIX.length() + 1).trim();
- int levelNum = 0;
-
- try {
- levelNum = Integer.parseInt(rawLevelNum);
- }
- catch (NumberFormatException nfe) {
- log.debug("Could not parse heading level from: " + styleName);
- }
+ Paragraph paragraph = range.getParagraph(i);
- String text = Paragraph.stripFields(paragraph.text());
-
- if ('\r' == text.charAt(text.length() - 1)) {
- text = text.substring(0, text.length() - 1);
- }
-
- headings.add(new WordMetadata.WordHeading(text, levelNum));
- }
+ String styleName =
stylesheet.getStyleDescription(paragraph.getStyleIndex()).getName();
+
+ if (styleName.startsWith(HEADER_PREFIX)) {
+ String rawLevelNum = styleName.substring(HEADER_PREFIX.length() +
1).trim();
+ int levelNum = 0;
+
+ try {
+ levelNum = Integer.parseInt(rawLevelNum);
+ } catch (NumberFormatException nfe) {
+ log.debug("Could not parse heading level from: " +
styleName);
+ }
+
+ String text = Paragraph.stripFields(paragraph.text());
+
+ if ('\r' == text.charAt(text.length() - 1)) {
+ text = text.substring(0, text.length() - 1);
+ }
+
+ headings.add(new WordMetadata.WordHeading(text, levelNum));
+ }
}
-
+
metadata.setHeadings(headings);
return metadata;
}
Copied:
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/word/package-info.java
(from rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavadocMetadata.java)
===================================================================
---
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/word/package-info.java
(rev 0)
+++
trunk/extensions/dna-sequencer-msoffice/src/main/java/org/jboss/dna/sequencer/msoffice/word/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The classes for reading Microsoft Word metadata.
+ */
+
+package org.jboss.dna.sequencer.msoffice.word;
+
Modified:
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/DnaDtdLexicon.java
===================================================================
---
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/DnaDtdLexicon.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/DnaDtdLexicon.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -27,7 +27,7 @@
import org.jboss.dna.graph.property.basic.BasicName;
/**
- * @author Randall Hauch
+ * Lexicon of names for XML DTD concepts.
*/
public class DnaDtdLexicon {
Modified:
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/DnaXmlLexicon.java
===================================================================
---
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/DnaXmlLexicon.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/DnaXmlLexicon.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -27,7 +27,7 @@
import org.jboss.dna.graph.property.basic.BasicName;
/**
- * @author Randall Hauch
+ * Lexicon of names for XML concepts.
*/
public class DnaXmlLexicon {
Modified:
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/InheritingXmlSequencer.java
===================================================================
---
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/InheritingXmlSequencer.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/InheritingXmlSequencer.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -27,8 +27,6 @@
* An XML sequencer that is a specialization of {@link XmlSequencer} by inheriting
unqualified attribute namespaces
* {@link XmlSequencer.AttributeScoping#INHERIT_ELEMENT_NAMESPACE from the element}
rather than from the
* {@link XmlSequencer.AttributeScoping#USE_DEFAULT_NAMESPACE default namespace}.
- *
- * @author Randall Hauch
*/
public class InheritingXmlSequencer extends XmlSequencer {
Modified:
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/XmlSequencer.java
===================================================================
---
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/XmlSequencer.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/XmlSequencer.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -27,9 +27,9 @@
import org.jboss.dna.common.text.TextDecoder;
import org.jboss.dna.graph.JcrNtLexicon;
import org.jboss.dna.graph.property.Name;
-import org.jboss.dna.graph.sequencer.StreamSequencerContext;
import org.jboss.dna.graph.sequencer.SequencerOutput;
import org.jboss.dna.graph.sequencer.StreamSequencer;
+import org.jboss.dna.graph.sequencer.StreamSequencerContext;
import org.xml.sax.InputSource;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
@@ -41,8 +41,6 @@
* the {@link XmlSequencer.AttributeScoping#USE_DEFAULT_NAMESPACE default namespace} for
unqualified attribute rather than
* {@link XmlSequencer.AttributeScoping#INHERIT_ELEMENT_NAMESPACE inheriting the
namespace from the element}. (See also
* {@link InheritingXmlSequencer}.
- *
- * @author John Verhaeg
*/
public class XmlSequencer implements StreamSequencer {
Modified:
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/XmlSequencerHandler.java
===================================================================
---
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/XmlSequencerHandler.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/XmlSequencerHandler.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -43,14 +43,14 @@
import org.jboss.dna.graph.property.PropertyFactory;
import org.jboss.dna.graph.property.ValueFormatException;
import org.jboss.dna.graph.property.basic.LocalNamespaceRegistry;
+import org.jboss.dna.graph.sequencer.SequencerOutput;
import org.jboss.dna.graph.sequencer.StreamSequencerContext;
-import org.jboss.dna.graph.sequencer.SequencerOutput;
import org.xml.sax.Attributes;
import org.xml.sax.SAXParseException;
import org.xml.sax.ext.DefaultHandler2;
/**
- * @author Randall Hauch
+ * A {@link DefaultHandler2} implementation that is used by the sequencer.
*/
public class XmlSequencerHandler extends DefaultHandler2 {
Modified:
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/XmlSequencerI18n.java
===================================================================
---
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/XmlSequencerI18n.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/XmlSequencerI18n.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -29,8 +29,7 @@
import org.jboss.dna.common.i18n.I18n;
/**
- * @author Randall Hauch
- * @author John Verhaeg
+ * The internationalized string constants for the
<code>org.jboss.dna.sequencer.xml*</code> packages.
*/
public final class XmlSequencerI18n {
Copied:
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/package-info.java
(from rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavadocMetadata.java)
===================================================================
---
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/package-info.java
(rev 0)
+++
trunk/extensions/dna-sequencer-xml/src/main/java/org/jboss/dna/sequencer/xml/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The classes that make up the XML sequencer.
+ */
+
+package org.jboss.dna.sequencer.xml;
+
Modified:
trunk/extensions/dna-sequencer-zip/src/main/java/org/jboss/dna/sequencer/zip/ZipSequencer.java
===================================================================
---
trunk/extensions/dna-sequencer-zip/src/main/java/org/jboss/dna/sequencer/zip/ZipSequencer.java 2009-09-12
17:43:41 UTC (rev 1217)
+++
trunk/extensions/dna-sequencer-zip/src/main/java/org/jboss/dna/sequencer/zip/ZipSequencer.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -35,8 +35,7 @@
import org.jboss.dna.graph.sequencer.StreamSequencerContext;
/**
- * @author Michael Trezzi
- * @author John Verhaeg
+ * A sequencer that processes and extract metadata from ZIP files.
*/
public class ZipSequencer implements StreamSequencer {
@@ -66,15 +65,13 @@
} else { // If entry is File, create nt:file
output.setProperty("zip:content/" + entry.getName(),
"jcr:primaryType", "nt:file");
output.setProperty("zip:content/" + entry.getName() +
"/jcr:content", "jcr:primaryType", "dna:resource");
- int n;
+ int n;
ByteArrayOutputStream baout = new ByteArrayOutputStream();
while ((n = in.read(buf, 0, 1024)) > -1) {
baout.write(buf, 0, n);
}
byte[] bytes = baout.toByteArray();
- output.setProperty("zip:content/" + entry.getName() +
"/jcr:content",
- "jcr:data",
- binaryFactory.create(bytes));
+ output.setProperty("zip:content/" + entry.getName() +
"/jcr:content", "jcr:data", binaryFactory.create(bytes));
// all other nt:file properties should be generated by other
sequencers (mimetype, encoding,...) but we'll
// default them here
output.setProperty("zip:content/" + entry.getName() +
"/jcr:content", "jcr:encoding", "binary");
Copied:
trunk/extensions/dna-sequencer-zip/src/main/java/org/jboss/dna/sequencer/zip/package-info.java
(from rev 1217,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/JavadocMetadata.java)
===================================================================
---
trunk/extensions/dna-sequencer-zip/src/main/java/org/jboss/dna/sequencer/zip/package-info.java
(rev 0)
+++
trunk/extensions/dna-sequencer-zip/src/main/java/org/jboss/dna/sequencer/zip/package-info.java 2009-09-12
17:55:25 UTC (rev 1218)
@@ -0,0 +1,29 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+/**
+ * The classes that make up the ZIP file sequencer.
+ */
+
+package org.jboss.dna.sequencer.zip;
+
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-09-12 17:43:41 UTC (rev 1217)
+++ trunk/pom.xml 2009-09-12 17:55:25 UTC (rev 1218)
@@ -126,15 +126,14 @@
<module>extensions/dna-sequencer-msoffice</module>
<module>extensions/dna-sequencer-xml</module>
<module>extensions/dna-sequencer-zip</module>
- <module>extensions/dna-connector-federation</module>
<module>extensions/dna-connector-filesystem</module>
<module>extensions/dna-connector-infinispan</module>
<module>extensions/dna-connector-jbosscache</module>
<module>extensions/dna-connector-svn</module>
<module>extensions/dna-connector-store-jpa</module>
<module>extensions/dna-mimetype-detector-aperture</module>
- <module>extensions/dna-common-jdbc</module>
- <module>extensions/dna-connector-jdbc-metadata</module>
+ <!--module>extensions/dna-common-jdbc</module-->
+ <!--module>extensions/dna-connector-jdbc-metadata</module-->
<module>web/dna-web-jcr-rest</module>
<module>web/dna-web-jcr-rest-war</module>
</modules>
@@ -232,6 +231,64 @@
</descriptors>
</configuration>
</plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.5</version>
+ <executions>
+ <execution>
+ <id>generate-javadoc</id>
+ <phase>package</phase>
+ <goals>
+ <goal>javadoc</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <doclet>org.jboss.apiviz.APIviz</doclet>
+ <docletArtifact>
+ <groupId>org.jboss.apiviz</groupId>
+ <artifactId>apiviz</artifactId>
+ <version>1.3.0.GA</version>
+ </docletArtifact>
+ <attach>false</attach>
+
<!--stylesheetfile>${basedir}/src/javadoc/stylesheet.css</stylesheetfile-->
+ <useStandardDocletOptions>true</useStandardDocletOptions>
+
<outputDirectory>${project.build.directory}/api</outputDirectory>
+
<reportOutputDirectory>${project.build.directory}/api</reportOutputDirectory>
+ <destDir>api</destDir>
+ <charset>UTF-8</charset>
+ <docencoding>UTF-8</docencoding>
+ <breakiterator>true</breakiterator>
+ <version>true</version>
+ <author>true</author>
+ <keywords>true</keywords>
+ <overview>${basedir}/src/javadoc/overview.html</overview>
+ <doctitle>${project.name} API Reference
(${project.version})</doctitle>
+ <windowtitle>${project.name} API Reference
(${project.version})</windowtitle>
+ <maxmemory>1024m</maxmemory>
+ <additionalparam>
+ -link
http://java.sun.com/javase/6/docs/api/
+ -link
http://java.sun.com/products/servlet/2.5/docs/servlet-2_5-mr2/
+ -link
http://www.slf4j.org/apidocs/
+ -link
http://logging.apache.org/log4j/1.2/apidocs/
+
+ -group "JCR implementation"
${project.groupId}.jcr*:${project.groupId}.cnd*
+ -group "Repository engine" ${project.groupId}.repository*
+ -group "Graph API"
${project.groupId}.graph:${project.groupId}.graph.io*:${project.groupId}.graph.property*:${project.groupId}.graph.request*:${project.groupId}.graph.session*:${project.groupId}.graph.xml*
+ -group "Connectors"
${project.groupId}.graph.cache*:${project.groupId}.graph.connector*:${project.groupId}.connector*
+ -group "Observation" ${project.groupId}.graph.observation*
+ -group "Sequencers"
${project.groupId}.graph.sequencer*:${project.groupId}.sequencer*
+ -group "MIME type detectors"
${project.groupId}.graph.mimetype*:${project.groupId}.mimetype*
+ -group "Web services" ${project.groupId}.web*
+ -group "Common utilities" ${project.groupId}.common*
+
+ -nopackagediagram
+ </additionalparam>
+ <encoding>UTF-8</encoding>
+ <locale>en_US</locale>
+
<excludePackageNames>${project.groupId}.test*:org.jboss.example.dna*</excludePackageNames>
+ </configuration>
+ </plugin>
</plugins>
</build>
<modules>
@@ -345,64 +402,6 @@
</archive>
</configuration>
</plugin>
- <plugin>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>2.5</version>
- <executions>
- <execution>
- <id>generate-javadoc</id>
- <phase>package</phase>
- <goals>
- <goal>javadoc</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <doclet>org.jboss.apiviz.APIviz</doclet>
- <docletArtifact>
- <groupId>org.jboss.apiviz</groupId>
- <artifactId>apiviz</artifactId>
- <version>1.3.0.GA</version>
- </docletArtifact>
- <attach>false</attach>
-
<!--stylesheetfile>${basedir}/src/javadoc/stylesheet.css</stylesheetfile-->
- <useStandardDocletOptions>true</useStandardDocletOptions>
- <outputDirectory>${project.build.directory}/api</outputDirectory>
-
<reportOutputDirectory>${project.build.directory}/api</reportOutputDirectory>
- <destDir>api</destDir>
- <charset>UTF-8</charset>
- <docencoding>UTF-8</docencoding>
- <breakiterator>true</breakiterator>
- <version>true</version>
- <author>true</author>
- <keywords>true</keywords>
- <overview>${basedir}/src/javadoc/overview.html</overview>
- <doctitle>${project.name} API Reference
(${project.version})</doctitle>
- <windowtitle>${project.name} API Reference
(${project.version})</windowtitle>
- <maxmemory>1024m</maxmemory>
- <additionalparam>
- -link
http://java.sun.com/javase/6/docs/api/
- -link
http://java.sun.com/products/servlet/2.5/docs/servlet-2_5-mr2/
- -link
http://www.slf4j.org/apidocs/
- -link
http://logging.apache.org/log4j/1.2/apidocs/
-
- -group "JCR implementation"
${project.groupId}.jcr*:${project.groupId}.cnd*
- -group "Repository engine" ${project.groupId}.repository*
- -group "Graph API"
${project.groupId}.graph:${project.groupId}.graph.io*:${project.groupId}.graph.property*:${project.groupId}.graph.request*:${project.groupId}.graph.session*:${project.groupId}.graph.xml*
- -group "Connectors"
${project.groupId}.graph.cache*:${project.groupId}.graph.connector*:${project.groupId}.connector*
- -group "Observation" ${project.groupId}.graph.observation*
- -group "Sequencers"
${project.groupId}.graph.sequencer*:${project.groupId}.sequencer*
- -group "MIME type detectors"
${project.groupId}.graph.mimetype*:${project.groupId}.mimetype*
- -group "Web services" ${project.groupId}.web*
- -group "Common utilities" ${project.groupId}.common*
-
- -nopackagediagram
- </additionalparam>
- <encoding>UTF-8</encoding>
- <locale>en_US</locale>
-
<excludePackageNames>${project.groupId}.test*:org.jboss.example.dna*</excludePackageNames>
- </configuration>
- </plugin>
</plugins>
</build>
<!--
@@ -449,11 +448,6 @@
</dependency>
<dependency>
<groupId>org.jboss.dna</groupId>
- <artifactId>dna-connector-federation</artifactId>
- <version>${pom.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.dna</groupId>
<artifactId>dna-connector-jbosscache</artifactId>
<version>${pom.version}</version>
</dependency>