http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/extensions/entitystore-rmi/src/main/java/org/qi4j/entitystore/rmi/ServerRemoteEntityStoreMixin.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-rmi/src/main/java/org/qi4j/entitystore/rmi/ServerRemoteEntityStoreMixin.java b/extensions/entitystore-rmi/src/main/java/org/qi4j/entitystore/rmi/ServerRemoteEntityStoreMixin.java deleted file mode 100644 index 93c2e59..0000000 --- a/extensions/entitystore-rmi/src/main/java/org/qi4j/entitystore/rmi/ServerRemoteEntityStoreMixin.java +++ /dev/null @@ -1,216 +0,0 @@ -/* Copyright 2008 Rickard Ãberg. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.qi4j.entitystore.rmi; - -import java.io.IOException; -import java.rmi.registry.Registry; -import java.rmi.server.UnicastRemoteObject; -import java.util.concurrent.locks.ReadWriteLock; -import org.qi4j.api.injection.scope.Service; -import org.qi4j.api.injection.scope.Structure; -import org.qi4j.api.injection.scope.This; -import org.qi4j.api.injection.scope.Uses; -import org.qi4j.api.service.ServiceActivation; -import org.qi4j.api.service.ServiceDescriptor; -import org.qi4j.api.service.ServiceReference; -import org.qi4j.api.structure.Module; -import org.qi4j.library.locking.WriteLock; -import org.qi4j.spi.Qi4jSPI; -import org.qi4j.spi.entity.EntityState; -import org.qi4j.spi.entity.QualifiedIdentity; -import org.qi4j.spi.entitystore.EntityStore; -import org.qi4j.spi.entitystore.EntityStoreException; - -/** - * RMI server implementation of EntityStore - */ -public class ServerRemoteEntityStoreMixin - implements RemoteEntityStore, ServiceActivation -{ - @Uses - private ServiceDescriptor descriptor; - - @This - private RemoteEntityStore remote; - - @This - private ReadWriteLock lock; - - @Structure - private Module module; - - @Structure - private Qi4jSPI spi; - - @Service - private EntityStore entityStore; - - @Service - private ServiceReference<Registry> registry; - - // Activatable implementation - public void activateService() - throws Exception - { - RemoteEntityStore stub = (RemoteEntityStore) UnicastRemoteObject.exportObject( remote, 0 ); - registry.get().bind( descriptor.identity(), stub ); - } - - public void passivateService() - throws Exception - { - if( registry.isActive() ) - { - registry.get().unbind( descriptor.identity() ); - } - UnicastRemoteObject.unexportObject( remote, true ); - } - - // EntityStore implementation - @WriteLock - public EntityState getEntityState( QualifiedIdentity identity ) - throws IOException - { -// EntityState state = getEntityState( entityStore, identity ); -// -// Map<QualifiedName, Object> properties = copyProperties( state ); -// Map<QualifiedName, QualifiedIdentity> associations = copyAssociations( state ); -// Map<QualifiedName, Collection<QualifiedIdentity>> manyAssociations = copyManyAssociations( state ); -// -// return new DefaultEntityState( state.version(), -// state.lastModified(), -// identity, -// state.status(), -// getEntityType( identity ), -// properties, -// associations, -// manyAssociations ); - return null; - } - -// private Map<QualifiedName, Collection<QualifiedIdentity>> copyManyAssociations( EntityState state ) -// { -// Map<QualifiedName, Collection<QualifiedIdentity>> manyAssociations = new HashMap<QualifiedName, Collection<QualifiedIdentity>>(); -// for( QualifiedName associationName : state.manyAssociationNames() ) -// { -// Collection<QualifiedIdentity> idCollection = state.getManyAssociation( associationName ); -// if( idCollection instanceof Set ) -// { -// Set<QualifiedIdentity> collectionCopy = new HashSet<QualifiedIdentity>( idCollection ); -// manyAssociations.put( associationName, collectionCopy ); -// } -// else if( idCollection instanceof List ) -// { -// List<QualifiedIdentity> collectionCopy = new ArrayList<QualifiedIdentity>( idCollection ); -// manyAssociations.put( associationName, collectionCopy ); -// } -// } -// return manyAssociations; -// } - -// private Map<QualifiedName, QualifiedIdentity> copyAssociations( EntityState state ) -// { -// Map<QualifiedName, QualifiedIdentity> associations = new HashMap<QualifiedName, QualifiedIdentity>(); -// for( QualifiedName associationName : state.associationNames() ) -// { -// QualifiedIdentity id = state.getAssociation( associationName ); -// associations.put( associationName, id ); -// } -// return associations; -// } -// -// private Map<QualifiedName, Object> copyProperties( EntityState state ) -// { -// Map<QualifiedName, Object> properties = new HashMap<QualifiedName, Object>(); -// for( QualifiedName propertyName : state.propertyNames() ) -// { -// Object value = state.getProperty( propertyName ); -// properties.put( propertyName, value ); -// } -// return properties; -// } - -// private EntityType getEntityType( QualifiedIdentity identity ) -// { -// final String typeName = identity.type(); -// try -// { -// return spi.getEntityDescriptor( module.classLoader().loadClass( typeName ), module ).entityType(); -// } -// catch( ClassNotFoundException e ) -// { -// throw new EntityStoreException( "Error accessing CompositeType for type " + typeName, e ); -// } -// } - - public void prepare( Iterable<EntityState> newStates, - Iterable<EntityState> loadedStates, - Iterable<QualifiedIdentity> removedStates - ) - { -// lock.writeLock().lock(); -// try -// { -// final StateCommitter committer = entityStore.prepare( newStates, loadedStates, removedStates ); -// try -// { -// committer.commit(); -// } -// catch( EntityStoreException e ) -// { -// committer.cancel(); -// throw e; -// } -// -// } -// -// finally -// { -// lock.writeLock().unlock(); -// } - } - - public EntityState getEntityState( EntityStore entityStore, QualifiedIdentity qid ) - throws EntityStoreException - { - EntityState entityState = null; -// do -// { -// try -// { -// entityState = entityStore.getEntityState( qid ); -// } -// catch( UnknownEntityTypeException e ) -// { -// // Check if it is this type that the store doesn't understand -// EntityType entityType = getEntityType( qid ); -// if( e.getMessage().equals( entityType.type() ) ) -// { -// entityStore.registerEntityType( entityType ); -// // Try again -// } -// else -// { -// throw e; // ??? -// } -// } -// } -// while( entityState == null ); - - return entityState; - } -} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/extensions/entitystore-rmi/src/main/java/org/qi4j/entitystore/rmi/ServerRmiEntityStoreService.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-rmi/src/main/java/org/qi4j/entitystore/rmi/ServerRmiEntityStoreService.java b/extensions/entitystore-rmi/src/main/java/org/qi4j/entitystore/rmi/ServerRmiEntityStoreService.java deleted file mode 100644 index f3850e6..0000000 --- a/extensions/entitystore-rmi/src/main/java/org/qi4j/entitystore/rmi/ServerRmiEntityStoreService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright 2008 Rickard Ãberg. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.qi4j.entitystore.rmi; - -import org.qi4j.api.mixin.Mixins; -import org.qi4j.api.service.ServiceActivation; -import org.qi4j.library.locking.LockingAbstractComposite; - -/** - * EntityStore service for remote access of another EntityStore. - */ - -@Mixins( { ServerRemoteEntityStoreMixin.class } ) -public interface ServerRmiEntityStoreService - extends ServiceActivation, LockingAbstractComposite -{ -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/extensions/entitystore-rmi/src/main/resources/org/qi4j/entitystore/rmi/RegistryService.properties ---------------------------------------------------------------------- diff --git a/extensions/entitystore-rmi/src/main/resources/org/qi4j/entitystore/rmi/RegistryService.properties b/extensions/entitystore-rmi/src/main/resources/org/qi4j/entitystore/rmi/RegistryService.properties deleted file mode 100644 index 57e7110..0000000 --- a/extensions/entitystore-rmi/src/main/resources/org/qi4j/entitystore/rmi/RegistryService.properties +++ /dev/null @@ -1 +0,0 @@ -port=1099 http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/extensions/entitystore-s3/.gitignore ---------------------------------------------------------------------- diff --git a/extensions/entitystore-s3/.gitignore b/extensions/entitystore-s3/.gitignore deleted file mode 100644 index 2f7896d..0000000 --- a/extensions/entitystore-s3/.gitignore +++ /dev/null @@ -1 +0,0 @@ -target/ http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/extensions/entitystore-s3/LICENSE ---------------------------------------------------------------------- diff --git a/extensions/entitystore-s3/LICENSE b/extensions/entitystore-s3/LICENSE deleted file mode 100644 index f433b1a..0000000 --- a/extensions/entitystore-s3/LICENSE +++ /dev/null @@ -1,177 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/extensions/entitystore-s3/NOTICE ---------------------------------------------------------------------- diff --git a/extensions/entitystore-s3/NOTICE b/extensions/entitystore-s3/NOTICE deleted file mode 100644 index d6d182a..0000000 --- a/extensions/entitystore-s3/NOTICE +++ /dev/null @@ -1,22 +0,0 @@ -Qi4j Amazon S3 Persistence Extension -Copyright 2007-2008, The Qi4j Development Team of individuals. - -See http://www.qi4j.org/contributors.html for list of of individuals. -Also see each file for additional information of Copyright claims. - -Qi4j is a community aggregated works under Copyright law. -All parts of the original works at Qi4j is licensed under the -Apache License ver 2.0 http://www.apache.org/licenses - -Below follows a list of binary dependencies and their licenses; ----------------------------------------------------------------- - -This module uses Apache Commons Logging, software developed at The Apache -Software Foundation (http://www.apache.org/). -See licenses/commons-logging.license - -This module uses JetS3t, software developed at https://jets3t.dev.java.net/ -See licenses/jets3t.license - - -END OF NOTICE \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/extensions/entitystore-s3/dev-status.xml ---------------------------------------------------------------------- diff --git a/extensions/entitystore-s3/dev-status.xml b/extensions/entitystore-s3/dev-status.xml deleted file mode 100644 index 0c93156..0000000 --- a/extensions/entitystore-s3/dev-status.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<module xmlns="http://www.qi4j.org/schemas/2008/dev-status/1"> - <status> - <codebase>early</codebase> - <!--none,early,beta,stable,mature--> - <documentation>none</documentation> - <!-- none, brief, good, complete --> - <unittests>some</unittests> - <!-- none, some, good, complete --> - </status> - <licenses> - <license>ALv2</license> - </licenses> -</module> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/extensions/entitystore-s3/licenses/commons-logging.license ---------------------------------------------------------------------- diff --git a/extensions/entitystore-s3/licenses/commons-logging.license b/extensions/entitystore-s3/licenses/commons-logging.license deleted file mode 100644 index f433b1a..0000000 --- a/extensions/entitystore-s3/licenses/commons-logging.license +++ /dev/null @@ -1,177 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/extensions/entitystore-s3/licenses/jets3t.license ---------------------------------------------------------------------- diff --git a/extensions/entitystore-s3/licenses/jets3t.license b/extensions/entitystore-s3/licenses/jets3t.license deleted file mode 100644 index f433b1a..0000000 --- a/extensions/entitystore-s3/licenses/jets3t.license +++ /dev/null @@ -1,177 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/extensions/entitystore-s3/osgi.bundle ---------------------------------------------------------------------- diff --git a/extensions/entitystore-s3/osgi.bundle b/extensions/entitystore-s3/osgi.bundle deleted file mode 100644 index 2156ebb..0000000 --- a/extensions/entitystore-s3/osgi.bundle +++ /dev/null @@ -1,28 +0,0 @@ -Bundle-Activator: - -Private-Package: - -Ignore-Package: com_cenqua_clover - -Import-Package: org.jets3t.service, \ - org.jets3t.service.impl.rest.httpclient, \ - org.jets3t.service.model, \ - org.qi4j.api.mixin, \ - org.jets3t.service.security, \ - org.qi4j.api.composite, \ - org.qi4j.api.configuration, \ - org.qi4j.api.entity, \ - org.qi4j.api.injection.scope, \ - org.qi4j.api.io, \ - org.qi4j.entitystore.map, \ - org.qi4j.library.locking, \ - org.qi4j.api.property, \ - org.qi4j.api.service, \ - org.qi4j.spi.composite, \ - org.qi4j.spi.entity, \ - org.qi4j.spi.entity.helpers, \ - org.qi4j.spi.entitystore, \ - org.qi4j.spi.serialization, \ - org.qi4j.api.structure - -Export-Package: org.qi4j.entitystore.s3 http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/extensions/entitystore-s3/pom.xml ---------------------------------------------------------------------- diff --git a/extensions/entitystore-s3/pom.xml b/extensions/entitystore-s3/pom.xml deleted file mode 100644 index e5506ed..0000000 --- a/extensions/entitystore-s3/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ -<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.qi4j.sandbox</groupId> - <artifactId>qi4j-sandbox-extensions</artifactId> - <version>0-SNAPSHOT</version> - </parent> - <groupId>org.qi4j.extension</groupId> - <artifactId>qi4j-entitystore-s3</artifactId> - <name>Qi4j Extension - EntityStore - Amazon S3</name> - <packaging>jar</packaging> - - <dependencies> - <dependency> - <groupId>org.qi4j.core</groupId> - <artifactId>org.qi4j.core.api</artifactId> - </dependency> - <dependency> - <groupId>org.qi4j.core</groupId> - <artifactId>org.qi4j.core.spi</artifactId> - </dependency> - <dependency> - <groupId>org.qi4j.library</groupId> - <artifactId>org.qi4j.library.locking</artifactId> - </dependency> - <dependency> - <groupId>net.java.dev.jets3t</groupId> - <artifactId>jets3t</artifactId> - <version>0.6.0</version> - </dependency> - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - <version>1.1</version> - </dependency> - - <!-- For Tests --> - <dependency> - <groupId>org.qi4j.core</groupId> - <artifactId>org.qi4j.core.testsupport</artifactId> - <scope>test</scope> - </dependency> - </dependencies> -</project> http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/extensions/entitystore-s3/src/main/java/org/qi4j/entitystore/s3/S3Configuration.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-s3/src/main/java/org/qi4j/entitystore/s3/S3Configuration.java b/extensions/entitystore-s3/src/main/java/org/qi4j/entitystore/s3/S3Configuration.java deleted file mode 100644 index 1d23d15..0000000 --- a/extensions/entitystore-s3/src/main/java/org/qi4j/entitystore/s3/S3Configuration.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.qi4j.entitystore.s3; - -import org.qi4j.api.configuration.ConfigurationComposite; -import org.qi4j.api.property.Property; - -/** - * Configuration for the Amazon S3 EntityStore - */ -public interface S3Configuration - extends ConfigurationComposite -{ - Property<String> accessKey(); - - Property<String> secretKey(); -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/extensions/entitystore-s3/src/main/java/org/qi4j/entitystore/s3/S3EntityStoreService.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-s3/src/main/java/org/qi4j/entitystore/s3/S3EntityStoreService.java b/extensions/entitystore-s3/src/main/java/org/qi4j/entitystore/s3/S3EntityStoreService.java deleted file mode 100644 index 37f925a..0000000 --- a/extensions/entitystore-s3/src/main/java/org/qi4j/entitystore/s3/S3EntityStoreService.java +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright 2008 Rickard Ãberg. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.qi4j.entitystore.s3; - -import org.qi4j.api.mixin.Mixins; -import org.qi4j.api.service.ServiceActivation; -import org.qi4j.library.locking.LockingAbstractComposite; -import org.qi4j.spi.entitystore.EntityStore; - -/** - * EntityStore service backed by Amazon S3 store. - */ - -@Mixins( { S3SerializationStoreMixin.class } ) -public interface S3EntityStoreService - extends EntityStore, ServiceActivation, LockingAbstractComposite - -{ -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/extensions/entitystore-s3/src/main/java/org/qi4j/entitystore/s3/S3SerializationStoreMixin.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-s3/src/main/java/org/qi4j/entitystore/s3/S3SerializationStoreMixin.java b/extensions/entitystore-s3/src/main/java/org/qi4j/entitystore/s3/S3SerializationStoreMixin.java deleted file mode 100644 index 82640bb..0000000 --- a/extensions/entitystore-s3/src/main/java/org/qi4j/entitystore/s3/S3SerializationStoreMixin.java +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright 2008 Rickard �berg. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.qi4j.entitystore.s3; - -import org.jets3t.service.S3Service; -import org.jets3t.service.impl.rest.httpclient.RestS3Service; -import org.jets3t.service.model.S3Bucket; -import org.jets3t.service.security.AWSCredentials; -import org.qi4j.api.configuration.Configuration; -import org.qi4j.api.entity.EntityReference; -import org.qi4j.api.injection.scope.This; -import org.qi4j.io.Input; -import org.qi4j.io.Output; -import org.qi4j.spi.entitystore.EntityStoreException; - -import java.io.IOException; -import java.io.Reader; -import org.qi4j.api.service.ServiceActivation; -import org.qi4j.spi.entitystore.helpers.MapEntityStore; - -/** - * Amazon S3 implementation of SerializationStore. - * <p/> - * To use this you must supply your own access key and secret key for your Amazon S3 account. - */ -public class S3SerializationStoreMixin - implements ServiceActivation, MapEntityStore -{ - - @This - private Configuration<S3Configuration> configuration; - - private S3Service s3Service; - private S3Bucket entityBucket; - - // Activatable implementation - public void activateService() - throws Exception - { - String awsAccessKey = configuration.get().accessKey().get(); - String awsSecretKey = configuration.get().secretKey().get(); - - if( awsAccessKey == null || awsSecretKey == null ) - { - throw new IllegalStateException( "No S3 keys configured" ); - } - - AWSCredentials awsCredentials = - new AWSCredentials( awsAccessKey, awsSecretKey ); - s3Service = new RestS3Service( awsCredentials ); - - S3Bucket[] s3Buckets = s3Service.listAllBuckets(); - System.out.println( "How many buckets do I have in S3? " + s3Buckets.length ); - - if( s3Buckets.length == 0 ) - { - entityBucket = s3Service.createBucket( "entity-bucket" ); - System.out.println( "Created entity bucket: " + entityBucket.getName() ); - } - else - { - entityBucket = s3Buckets[ 0 ]; - } - } - - public void passivateService() - throws Exception - { - } - - public Reader get( EntityReference entityReference ) - throws EntityStoreException - { - return null; //To change body of implemented methods use File | Settings | File Templates. - } - - public Input<Reader, IOException> entityStates() - { - return new Input<Reader, IOException>() - { - public <ReceiverThrowableType extends Throwable> void transferTo( Output<? super Reader, ReceiverThrowableType> output ) - throws IOException, ReceiverThrowableType - { - // TODO Implement this - throw new UnsupportedOperationException( "Not supported yet." ); - } - }; - } - - public void applyChanges( MapChanges changes ) - throws IOException - { - //To change body of implemented methods use File | Settings | File Templates. - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/extensions/entitystore-s3/src/test/java/org/qi4j/entitystore/s3/S3EntityStoreTest.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-s3/src/test/java/org/qi4j/entitystore/s3/S3EntityStoreTest.java b/extensions/entitystore-s3/src/test/java/org/qi4j/entitystore/s3/S3EntityStoreTest.java deleted file mode 100644 index 7afe3ec..0000000 --- a/extensions/entitystore-s3/src/test/java/org/qi4j/entitystore/s3/S3EntityStoreTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright 2008 Rickard Ãberg. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.qi4j.entitystore.s3; - -import org.junit.Test; -import org.qi4j.api.common.Visibility; -import org.qi4j.bootstrap.AssemblyException; -import org.qi4j.bootstrap.ModuleAssembly; -import org.qi4j.entitystore.memory.MemoryEntityStoreService; -import org.qi4j.test.entity.AbstractEntityStoreTest; - -/** - * Amazon S3 EntityStore test - */ -public abstract class S3EntityStoreTest - extends AbstractEntityStoreTest -{ - public void assemble( ModuleAssembly module ) throws AssemblyException - { - super.assemble( module ); - module.addServices( S3EntityStoreService.class ).instantiateOnStartup(); - - ModuleAssembly config = module.layer().module( "config" ); - config.entities( S3Configuration.class ).visibleIn( Visibility.layer ); - config.services( MemoryEntityStoreService.class ); - } - - @Test - public void dummyTest() - { - // All tests are disabled since by default the S3 store doesn't work due to missing account keys! - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/extensions/entitystore-s3/src/test/resources/org/qi4j/entitystore/s3/S3EntityStoreComposite.properties ---------------------------------------------------------------------- diff --git a/extensions/entitystore-s3/src/test/resources/org/qi4j/entitystore/s3/S3EntityStoreComposite.properties b/extensions/entitystore-s3/src/test/resources/org/qi4j/entitystore/s3/S3EntityStoreComposite.properties deleted file mode 100644 index 66d19ff..0000000 --- a/extensions/entitystore-s3/src/test/resources/org/qi4j/entitystore/s3/S3EntityStoreComposite.properties +++ /dev/null @@ -1,2 +0,0 @@ -accessKey=yourkey -secretKey=yoursecretkey http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/extensions/entitystore-swift/osgi.bundle ---------------------------------------------------------------------- diff --git a/extensions/entitystore-swift/osgi.bundle b/extensions/entitystore-swift/osgi.bundle deleted file mode 100644 index 6571e76..0000000 --- a/extensions/entitystore-swift/osgi.bundle +++ /dev/null @@ -1,33 +0,0 @@ -Bundle-Activator: - -Private-Package: - -Ignore-Package: com_cenqua_clover - -Import-Package: org.qi4j.api.composite, \ - org.qi4j.api.common, \ - org.qi4j.api.concern, \ - org.qi4j.api.configuration, \ - org.qi4j.api.entity, \ - org.qi4j.api.injection.scope, \ - org.qi4j.api.io, \ - org.qi4j.api.mixin, \ - org.qi4j.api.property, \ - org.qi4j.api.sideeffect, \ - org.qi4j.api.service, \ - org.qi4j.api.structure, \ - org.qi4j.bootstrap, \ - org.qi4j.entitystore.memory, \ - org.qi4j.entitystore.map, \ - org.qi4j.library.locking, \ - org.qi4j.spi, \ - org.qi4j.spi.composite, \ - org.qi4j.spi.entity, \ - org.qi4j.spi.entity.helpers, \ - org.qi4j.spi.entitystore, \ - org.qi4j.spi.query, \ - org.qi4j.spi.service, \ - org.qi4j.spi.uuid, \ - org.qi4j.spi.serialization - -Export-Package: org.qi4j.entitystore.swift http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/extensions/entitystore-swift/pom.xml ---------------------------------------------------------------------- diff --git a/extensions/entitystore-swift/pom.xml b/extensions/entitystore-swift/pom.xml deleted file mode 100644 index 95a6cbf..0000000 --- a/extensions/entitystore-swift/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ -<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"> - <parent> - <groupId>org.qi4j.sandbox</groupId> - <artifactId>qi4j-sandbox-extensions</artifactId> - <version>0-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <groupId>org.qi4j.extension</groupId> - <artifactId>qi4j-entitystore-swift</artifactId> - <name>Qi4j Extension - EntityStore - Swift</name> - <packaging>jar</packaging> - - <properties> - <version.qi4j-tests>1.3</version.qi4j-tests> - </properties> - - <dependencies> - <dependency> - <groupId>org.qi4j.core</groupId> - <artifactId>org.qi4j.core.spi</artifactId> - </dependency> - <dependency> - <groupId>org.qi4j.core</groupId> - <artifactId>org.qi4j.core.bootstrap</artifactId> - </dependency> - <dependency> - <groupId>org.qi4j.core</groupId> - <artifactId>org.qi4j.core.testsupport</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.qi4j.library</groupId> - <artifactId>org.qi4j.library.locking</artifactId> - </dependency> - <dependency> - <groupId>org.qi4j.core</groupId> - <artifactId>org.qi4j.core.runtime</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.qi4j.test</groupId> - <artifactId>org.qi4j.test.performance</artifactId> - <version>1.3.0.RC1</version> - <scope>test</scope> - </dependency> - </dependencies> -</project> http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/extensions/entitystore-swift/src/main/java/org/qi4j/entitystore/swift/BucketManager.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-swift/src/main/java/org/qi4j/entitystore/swift/BucketManager.java b/extensions/entitystore-swift/src/main/java/org/qi4j/entitystore/swift/BucketManager.java deleted file mode 100644 index 82eb3aa..0000000 --- a/extensions/entitystore-swift/src/main/java/org/qi4j/entitystore/swift/BucketManager.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright 2008 Niclas Hedhman. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.qi4j.entitystore.swift; - -import java.io.File; -import java.io.IOException; -import java.io.RandomAccessFile; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.LinkedList; -import org.qi4j.spi.entitystore.EntityStoreException; - -public class BucketManager - implements Runnable -{ - private HashMap<Integer, LruEntry> cache; - private File bucketdir; - private Thread cleanUpThread; - private boolean running; - - public BucketManager( File bucketdir ) - { - cache = new HashMap<Integer, LruEntry>(); - this.bucketdir = bucketdir; - bucketdir.mkdirs(); - cleanUpThread = new Thread( this, "SwiftEntityStore-cleanup" ); - cleanUpThread.start(); - } - - synchronized RandomAccessFile get( int hash ) - throws IOException - { - LruEntry entry = cache.get( hash ); - if( entry != null ) - { - return entry.file; - } - File bucketFile = new File( bucketdir, Integer.toHexString( hash ) ); - RandomAccessFile bucket = new RandomAccessFile( bucketFile, "rw" ); - entry = new LruEntry( bucket, hash ); - cache.put( hash, entry ); - return bucket; - } - - synchronized void close() - throws IOException - { - running = false; - cleanUpThread.interrupt(); - for( LruEntry entry : cache.values() ) - { - entry.file.close(); - } - } - - private void cleanUp() - throws IOException - { - if( cache.size() < 30 ) - { - return; - } - LinkedList<LruEntry> sorting = new LinkedList<LruEntry>(); - sorting.addAll( cache.values() ); - Collections.sort( sorting, new Comparator<LruEntry>() - { - public int compare( LruEntry lruEntry1, LruEntry lruEntry2 ) - { - if( lruEntry1.created == lruEntry2.created ) - { - return 0; - } - if( lruEntry1.created > lruEntry2.created ) - { - return 1; - } - - return -1; - } - } ); - while( cache.size() > 20 ) - { - LruEntry entry = sorting.removeFirst(); // Check if this is at the right end; - entry.file.close(); - cache.remove( entry.hash ); - } - } - - public void run() - { - running = true; - try - { - while( running ) - { - synchronized( this ) - { - wait( 15000 ); - cleanUp(); - } - } - } - catch( InterruptedException e ) - { - // ignore, normal shutdown - } - catch( IOException e ) - { - throw new EntityStoreException( "What the hell!!!???", e ); - } - } - - private static class LruEntry - { - private long created; - private RandomAccessFile file; - private int hash; - - public LruEntry( RandomAccessFile bucket, int hash ) - { - this.file = bucket; - this.hash = hash; - created = System.currentTimeMillis(); - } - } -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/extensions/entitystore-swift/src/main/java/org/qi4j/entitystore/swift/DataBlock.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-swift/src/main/java/org/qi4j/entitystore/swift/DataBlock.java b/extensions/entitystore-swift/src/main/java/org/qi4j/entitystore/swift/DataBlock.java deleted file mode 100644 index fee55d4..0000000 --- a/extensions/entitystore-swift/src/main/java/org/qi4j/entitystore/swift/DataBlock.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2008 Niclas Hedhman. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.qi4j.entitystore.swift; - -import org.qi4j.spi.entity.QualifiedIdentity; -import org.qi4j.api.entity.EntityReference; - -import java.util.Arrays; - -class DataBlock -{ - EntityReference reference; - byte[] data; - long instanceVersion; - int schemaVersion; - - public DataBlock( EntityReference reference, byte[] data, long instanceVersion, int schemaVersion ) - { - this.reference = reference; - this.data = data; - this.instanceVersion = instanceVersion; - this.schemaVersion = schemaVersion; - } - - public boolean equals( Object o ) - { - if( this == o ) - { - return true; - } - if( o == null || getClass() != o.getClass() ) - { - return false; - } - - DataBlock dataBlock = (DataBlock) o; - - if( instanceVersion != dataBlock.instanceVersion ) - { - return false; - } - if( schemaVersion != dataBlock.schemaVersion ) - { - return false; - } - if( !Arrays.equals( data, dataBlock.data ) ) - { - return false; - } - if( !reference.equals( dataBlock.reference ) ) - { - return false; - } - - return true; - } - - public int hashCode() - { - int result; - result = reference.hashCode(); - result = 31 * result + Arrays.hashCode( data ); - result = 31 * result + (int) ( instanceVersion ^ ( instanceVersion >>> 32 ) ); - result = 31 * result + schemaVersion; - return result; - } - - public String toString() - { - StringBuffer buf = new StringBuffer(); - buf.append( schemaVersion ); - buf.append( '[' ); - buf.append( reference ); - buf.append( ':' ); - buf.append( instanceVersion ); - buf.append( '{' ); - boolean first = true; - for( byte b : data ) - { - if( !first ) - { - buf.append( ',' ); - } - first = false; - buf.append( toHex( b ) ); - } - buf.append( '}' ); - buf.append( ']' ); - return buf.toString(); - } - - private String toHex( byte b ) - { - int data = b; - - if( data < 0 ) - { - data = data + 256; - } - if( data < 16 ) - { - return "0" + Integer.toHexString( data ); - } - return Integer.toHexString( data ); - } -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/extensions/entitystore-swift/src/main/java/org/qi4j/entitystore/swift/DataStore.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-swift/src/main/java/org/qi4j/entitystore/swift/DataStore.java b/extensions/entitystore-swift/src/main/java/org/qi4j/entitystore/swift/DataStore.java deleted file mode 100644 index 8364c2e..0000000 --- a/extensions/entitystore-swift/src/main/java/org/qi4j/entitystore/swift/DataStore.java +++ /dev/null @@ -1,480 +0,0 @@ -/* - * Copyright 2008 Niclas Hedhman. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.qi4j.entitystore.swift; - -import org.qi4j.api.entity.EntityReference; -import org.qi4j.io.Input; -import org.qi4j.io.Output; -import org.qi4j.io.Receiver; -import org.qi4j.io.Sender; -import org.qi4j.spi.entitystore.EntityStoreException; - -import java.io.*; - -/** - * This class handles the Heap Data file. - * The format of the file is as follows; - * <p/> - * <code><pre> - * At OFFSET = 0 - * [cleanShutDown] 1 byte - * [formatVersion] 4 bytes - * [noOfEntries] 4 bytes - * [noOfIDentries] 4 bytes - * <p/> - * At OFFSET 256 - * [blockSize] 4 bytes - * [usage] 1 byte (0=Unused, 1=prime, 2=mirror, 3=primeChanged, 4=mirrorChanged) - * [instanceVersion] 8 bytes - * [schemaVersion] 4 bytes - * [identitySize] 1 byte - * [identity] IDENTITY_MAX_LENGTH bytes - * [mirrorPointer] 8 bytes - * [primeDataLength] 4 bytes - * [primeData] n bytes - * [mirrorDataLength] 4 bytes - * [mirrorData] n bytes - * <p/> - * At OFFSET 256 + [blockSize] - * same as above, repeat until [blockSize] == -1 marking end of DataArea. - * </pre></code> - * The <b>mirrorPointer</b> points to the mirrorData block. - */ -public class DataStore -{ - static final long DATA_AREA_OFFSET = 256; - private static final int BLOCK_OVERHEAD = 26; - private static final int CURRENT_VERSION = 1; - private static final String HEAP_DATA_FILENAME = "heap.data"; - - private static final int USAGE_UNUSED = 0; - private static final int USAGE_PRIME = 1; - private static final int USAGE_MIRROR = 2; - private static final int USAGE_PRIMECHANGE = 3; - private static final int USAGE_MIRRORCHANGE = 4; - - private RandomAccessFile dataFile; - private IdentityFile identityFile; - private int identityMaxLength; - private UndoManager undoManager; - private int entries; - private File dataDir; - - public DataStore( File dataDirectory, UndoManager undoManager ) - throws IOException - { - this.undoManager = undoManager; - identityMaxLength = 128; // Default value... - this.dataDir = dataDirectory.getAbsoluteFile(); - dataDir.mkdirs(); - File file = new File( dataDir, HEAP_DATA_FILENAME ); - if (!file.exists()) - { - file.createNewFile(); - } - dataFile = new RandomAccessFile( file, "rw" ); - boolean cleanShutDown; - if (file.length() > 0) - { - dataFile.seek( 0 ); - cleanShutDown = dataFile.readBoolean(); - dataFile.seek( 0 ); - dataFile.writeBoolean( false ); - dataFile.writeInt( CURRENT_VERSION ); // Write Version. - entries = dataFile.readInt(); - identityMaxLength = dataFile.readInt(); - } else - { - cleanShutDown = false; - dataFile.writeBoolean( false ); - entries = 0; - dataFile.writeInt( CURRENT_VERSION ); // Write Version. - dataFile.writeInt( entries ); - dataFile.writeInt( identityMaxLength ); - dataFile.seek( DATA_AREA_OFFSET - 1 ); - dataFile.writeByte( 0 ); - dataFile.seek( DATA_AREA_OFFSET ); - dataFile.writeInt( -1 ); // EOF marker - } - // Ensure full flush, then reopen... - dataFile.close(); - - dataFile = new RandomAccessFile( file, "rw" ); - - if (!cleanShutDown) - { - reIndex(); - } else - { - File idDir = new File( dataDir, "idx" ); - try - { - identityFile = IdentityFile.use( idDir ); - } - catch (MalformedIdentityDirectoryException e) - { - reIndex(); - } - } - if (identityFile.entries() < entries * 2) - { - reIndex(); - } - } - - RandomAccessFile dataFile() - { - return dataFile; - } - - IdentityFile identityFile() - { - return identityFile; - } - - DataBlock readData( EntityReference reference ) - throws IOException - { - long pos = identityFile.find( reference ); - if (pos < 0) - { - return null; - } - dataFile.seek( pos ); - dataFile.skipBytes( 4 ); // Skip BlockSize - return readDataBlock( reference ); - } - - void putData( DataBlock data ) - throws IOException - { - long pos = identityFile.find( data.reference ); - if (pos < 0) - { - putNewData( data ); - } else - { - dataFile.seek( pos ); - int blockSize = dataFile.readInt(); - long usagePointer = dataFile.getFilePointer(); - byte usage = dataFile.readByte(); - dataFile.skipBytes( -1 ); - dataFile.writeByte( usage == USAGE_PRIME ? USAGE_PRIMECHANGE : USAGE_MIRRORCHANGE ); - int dataAreaSize = (blockSize - BLOCK_OVERHEAD) / 2 - 4; - if (dataAreaSize < data.data.length) - { - putTooLarge( data, pos, usagePointer, usage ); - } else - { - putOver( data, pos, usagePointer, usage ); - } - } - } - - /* In this case we need to write the new data to the opposite of the current active block. */ - - private void putOver( DataBlock data, long pos, long usagePointer, byte usage ) - throws IOException - { - dataFile.seek( usagePointer ); // Point to "usage" - dataFile.skipBytes( 13 ); // Skip usage, instanceVersion and schemaVersion - EntityReference existingReference = readReference(); - if (!existingReference.equals( data.reference )) - { - throw new EntityStoreException( "Inconsistent Data Heap: was " + existingReference + ", expected " + data.reference ); - } - long mirror = dataFile.readLong(); - if (usage == USAGE_PRIME) - { - dataFile.seek( mirror ); - } - UndoModifyCommand undoModifyCommand = new UndoModifyCommand( pos, usage, data.instanceVersion, data.schemaVersion ); - undoManager.saveUndoCommand( undoModifyCommand ); - - dataFile.writeInt( data.data.length ); - dataFile.write( data.data ); - dataFile.seek( usagePointer ); - dataFile.writeByte( usage == USAGE_PRIME ? USAGE_MIRROR : USAGE_PRIME ); - } - - /* This case is when the data doesn't fit in the pre-allocated extra space. Write it to the end, and mark the - previous block unused. - */ - - private void putTooLarge( DataBlock data, long pos, long usagePointer, byte usage ) - throws IOException - { - long newPosition = addData( data ); - UndoModifyCommand undoModifyCommand = new UndoModifyCommand( pos, usage, data.instanceVersion, data.schemaVersion ); - undoManager.saveUndoCommand( undoModifyCommand ); - dataFile.seek( usagePointer ); - dataFile.writeByte( USAGE_UNUSED ); - UndoDropIdentityCommand undoDropIdentityCommand = new UndoDropIdentityCommand( data.reference, pos ); - undoManager.saveUndoCommand( undoDropIdentityCommand ); - identityFile.remember( data.reference, newPosition ); - } - - private void putNewData( DataBlock data ) - throws IOException - { - long pos; - pos = addData( data ); - UndoNewIdentityCommand undoNewIdentityCommand = new UndoNewIdentityCommand( data.reference ); - undoManager.saveUndoCommand( undoNewIdentityCommand ); - identityFile.remember( data.reference, pos ); - } - - public void delete( EntityReference reference ) - throws IOException - { - long pos = identityFile.find( reference ); - if (pos < 0) - { - // Doesn't exist. - return; - } - dataFile.seek( pos ); - dataFile.skipBytes( 4 ); // Skip BlockSize - byte usage = dataFile.readByte(); - if (usage == USAGE_UNUSED) - { - // Not used?? Why is the IdentityFile pointing to it then?? Should the following line actually be - // executed here. - // identityFile.drop( identity ); - return; - } - UndoDropIdentityCommand undoDropIdentityCommand = new UndoDropIdentityCommand( reference, pos ); - undoManager.saveUndoCommand( undoDropIdentityCommand ); - - UndoDeleteCommand undoDeleteCommand = new UndoDeleteCommand( pos, usage ); - undoManager.saveUndoCommand( undoDeleteCommand ); - - identityFile.drop( reference ); - dataFile.skipBytes( -1 ); - dataFile.writeByte( USAGE_UNUSED ); // Mark Unused block - } - - void flush() - throws IOException - { -// dataFile.getFD().sync(); - } - - void close() - throws IOException - { - identityFile.close(); - dataFile.seek( 0 ); - dataFile.writeBoolean( true ); - dataFile.writeInt( entries ); - dataFile.close(); - } - - private long addData( DataBlock block ) - throws IOException - { - dataFile.seek( dataFile.length() - 4 ); // last 4 bytes contain a -1 - long blockStart = dataFile.getFilePointer(); - - // Allow each datablock to grow to twice its size, and provide a primary and mirror allocation. - int dataAreaSize = (block.data.length * 2 + 4) * 2; - UndoExtendCommand undoExtendCommand = new UndoExtendCommand( blockStart ); - undoManager.saveUndoCommand( undoExtendCommand ); - - int blockSize = dataAreaSize + identityMaxLength + BLOCK_OVERHEAD; - dataFile.writeInt( blockSize ); - long usagePointer = dataFile.getFilePointer(); - dataFile.writeByte( USAGE_PRIMECHANGE ); // In-progress - dataFile.writeLong( block.instanceVersion ); - dataFile.writeInt( block.schemaVersion ); - writeIdentity( block.reference ); - - long mirrorPosition = blockStart + BLOCK_OVERHEAD + identityMaxLength + dataAreaSize / 2; - dataFile.writeLong( mirrorPosition ); - dataFile.writeInt( block.data.length ); - dataFile.write( block.data ); - dataFile.seek( blockStart + blockSize ); - dataFile.writeInt( -1 ); // Write EOF marker. - dataFile.seek( usagePointer ); - dataFile.write( USAGE_PRIME ); - return blockStart; - } - - private void writeIdentity( EntityReference reference ) - throws IOException - { - byte[] idBytes = reference.identity().getBytes( "UTF-8" ); - if (idBytes.length > identityMaxLength) - { - throw new EntityStoreException( "Identity is too long. Only " + identityMaxLength + " characters are allowed in this EntityStore." ); - } - byte[] id = new byte[identityMaxLength]; - System.arraycopy( idBytes, 0, id, 0, idBytes.length ); - dataFile.writeByte( idBytes.length ); - dataFile.write( id ); - } - - private void compact() - throws IOException - { -/* - File newFileName = new File( dataDir, "heap-compacting.data" ); - RandomAccessFile newFile = new RandomAccessFile( newFileName, "rw" ); - File oldFileName = new File( dataDir, "heap.data" ); - RandomAccessFile oldFile = new RandomAccessFile( oldFileName, "r" ); - - oldFile.seek( DATA_AREA_OFFSET ); // Skip initial bytes; - newFile.seek( DATA_AREA_OFFSET ); // Skip initial bytes; - - int counter = 0; - - // Move the Records!! - - entries = counter; - - newFile.writeBoolean( false ); - newFile.writeInt( CURRENT_VERSION ); // Write Version. - - newFile.writeInt( entries ); - reIndex( dataDir ); - dataFile.close(); - newFile.close(); - - File standardFilename = new File( dataDir, "heap.data" ); - newFileName.renameTo( standardFilename ); - dataFile = new RandomAccessFile( standardFilename, "rw" ); -*/ - } - - private void reIndex() - throws IOException - { - identityFile = IdentityFile.create( new File( dataDir, "idx" ), identityMaxLength + 16, entries < 5000 ? 10000 : entries * 2 ); - - dataFile.seek( DATA_AREA_OFFSET ); - while (dataFile.getFilePointer() < dataFile.length()) - { - long blockStart = dataFile.getFilePointer(); - int blockSize = dataFile.readInt(); - if (blockSize == -1) - { - break; - } - byte usage = dataFile.readByte(); - dataFile.skipBytes( 12 ); // Skip instanceVersion and schemaVersion - EntityReference reference = readReference(); - if (usage != USAGE_UNUSED) - { - identityFile.remember( reference, blockStart ); - } - dataFile.seek( blockStart + blockSize ); - } - } - - public Input<Reader, IOException> data() - { - return new Input<Reader, IOException>() - { - public <ReceiverThrowableType extends Throwable> void transferTo( Output<? super Reader, ReceiverThrowableType> output ) - throws IOException, ReceiverThrowableType - { - output.receiveFrom( - new Sender<Reader, IOException>() - { - public <ReceiverThrowableType extends Throwable> void sendTo( Receiver<? super Reader, ReceiverThrowableType> receiver ) - throws ReceiverThrowableType, IOException - { - long position = DATA_AREA_OFFSET; - while( position < dataFile.length() ) - { - dataFile.seek( position ); - int blockSize = dataFile.readInt(); - if( blockSize == -1 ) // EOF marker - { - return; - } - if( blockSize == 0 ) - { - // TODO This is a bug. Why does it occur?? - throw new InternalError(); - } - position = position + blockSize; // position for next round... - DataBlock block = readDataBlock( null ); - if( block != null ) - { - receiver.receive( new StringReader( new String( block.data, "UTF-8" ) ) ); - } - } - } - } - ); - } - }; - } - - private DataBlock readDataBlock( EntityReference reference ) - throws IOException - { - byte usage = dataFile.readByte(); - if (usage == USAGE_UNUSED) - { - return null; - } - long instanceVersion = dataFile.readLong(); - int schemaVersion = dataFile.readInt(); - EntityReference existingReference = readReference(); - if (reference == null) - { - reference = existingReference; - } - if (!existingReference.equals( reference )) - { - throw new EntityStoreException( "Inconsistent Data Heap." ); - } - if (usage == USAGE_MIRROR) - { - long mirror = dataFile.readLong(); - dataFile.seek( mirror ); - } else - { - dataFile.skipBytes( 8 ); // skip the MirrorPointer - } - int dataSize = dataFile.readInt(); - if (dataSize < 0) - { - throw new InternalError(); - } - byte[] data = new byte[dataSize]; - dataFile.read( data ); - return new DataBlock( reference, data, instanceVersion, schemaVersion ); - } - - private EntityReference readReference() - throws IOException - { - int idSize = dataFile.readByte(); - if (idSize < 0) - { - idSize = idSize + 256; // Fix 2's-complement negative values of bytes into unsigned 8 bit. - } - byte[] idData = new byte[idSize]; - dataFile.read( idData ); - dataFile.skipBytes( identityMaxLength - idSize ); - return new EntityReference( new String( idData ) ); - } -} http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/extensions/entitystore-swift/src/main/java/org/qi4j/entitystore/swift/FileUtils.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-swift/src/main/java/org/qi4j/entitystore/swift/FileUtils.java b/extensions/entitystore-swift/src/main/java/org/qi4j/entitystore/swift/FileUtils.java deleted file mode 100644 index 14f77f7..0000000 --- a/extensions/entitystore-swift/src/main/java/org/qi4j/entitystore/swift/FileUtils.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2008 Niclas Hedhman. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.qi4j.entitystore.swift; - -import java.io.File; - -public class FileUtils -{ - - public static void delete( File file ) - { - if( !file.exists() ) - { - return; - } - if( file.isDirectory() ) - { - for( File child : file.listFiles() ) - { - delete( child ); - } - } - file.delete(); - } - -}
