You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by pa...@apache.org on 2015/04/21 13:50:23 UTC
[11/18] zest-sandbox git commit: Move Qi4j related projects in a
`qi4j/` subfolder
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/executor/src/main/java/org/qi4j/library/executor/ExecutorSideEffect.java
----------------------------------------------------------------------
diff --git a/libraries/executor/src/main/java/org/qi4j/library/executor/ExecutorSideEffect.java b/libraries/executor/src/main/java/org/qi4j/library/executor/ExecutorSideEffect.java
deleted file mode 100644
index 9f6be86..0000000
--- a/libraries/executor/src/main/java/org/qi4j/library/executor/ExecutorSideEffect.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2008, Rickard Öberg. All Rights Reserved.
- *
- * 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.library.executor;
-
-import org.qi4j.api.common.AppliesTo;
-import org.qi4j.api.injection.scope.Invocation;
-import org.qi4j.api.injection.scope.Service;
-import org.qi4j.api.injection.scope.Structure;
-import org.qi4j.api.sideeffect.GenericSideEffect;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.concurrent.Executor;
-import org.qi4j.api.structure.Module;
-
-/**
- * JAVADOC
- */
-@AppliesTo( ExecuteSideEffect.class )
-public class ExecutorSideEffect extends GenericSideEffect
-{
- @Structure Module module;
- @Service Executor executor;
-
- @Invocation ExecuteSideEffect execute;
-
- @Override public Object invoke( final Object target, final Method method, final Object[] objects ) throws Throwable
- {
- executor.execute( new SideEffectRunnable( target, method, objects ) );
-
- return super.invoke( target, method, objects );
- }
-
- private class SideEffectRunnable implements Runnable
- {
- private final Object target;
- private final Method method;
- private final Object[] objects;
-
- public SideEffectRunnable( Object target, Method method, Object[] objects )
- {
- this.target = target;
- this.method = method;
- this.objects = objects;
- }
-
- public void run()
- {
- try
- {
- try
- {
- Object executed = module.newObject( execute.value() );
- runSideEffect( executed );
- }
- catch( InvocationTargetException e )
- {
- throw e.getTargetException();
- }
- }
- catch( Throwable t )
- {
- t.printStackTrace();
- }
- }
-
- private void runSideEffect( Object executed )
- throws Throwable
- {
- if( executed instanceof InvocationHandler )
- {
- InvocationHandler handler = (InvocationHandler) executed;
- handler.invoke( target, method, objects );
- }
- else
- {
- method.invoke( executed, objects );
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/executor/src/test/java/org/qi4j/library/framework/executor/ExecuteSideEffectTest.java
----------------------------------------------------------------------
diff --git a/libraries/executor/src/test/java/org/qi4j/library/framework/executor/ExecuteSideEffectTest.java b/libraries/executor/src/test/java/org/qi4j/library/framework/executor/ExecuteSideEffectTest.java
deleted file mode 100644
index 4e89593..0000000
--- a/libraries/executor/src/test/java/org/qi4j/library/framework/executor/ExecuteSideEffectTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.qi4j.library.framework.executor;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.concurrent.CountDownLatch;
-import static junit.framework.Assert.assertTrue;
-import org.junit.Test;
-import org.qi4j.api.composite.TransientComposite;
-import org.qi4j.api.mixin.Mixins;
-import org.qi4j.api.sideeffect.SideEffects;
-import org.qi4j.bootstrap.AssemblyException;
-import org.qi4j.bootstrap.ModuleAssembly;
-import org.qi4j.library.executor.ExecuteService;
-import org.qi4j.library.executor.ExecuteSideEffect;
-import org.qi4j.library.executor.ExecutorSideEffect;
-import org.qi4j.test.AbstractQi4jTest;
-
-/**
- * JAVADOC
- */
-public class ExecuteSideEffectTest
- extends AbstractQi4jTest
-{
- private static final CountDownLatch latch = new CountDownLatch( 1 );
-
- public void assemble( ModuleAssembly module ) throws AssemblyException
- {
- module.transients( TestComposite.class );
- module.objects( LogCall.class );
- module.services( ExecuteService.class ).instantiateOnStartup();
- }
-
- @Test
- public void givenMethodWithAnnotationWhenCallThenExecuteSideEffect()
- throws InterruptedException
- {
- TestComposite instance = module.newTransient( TestComposite.class );
- System.out.println( instance.doStuff() );
- latch.await();
- assertTrue( "doStuff sideeffect called", LogCall.methodsCalled.contains( "doStuff" ) );
- }
-
- @SideEffects( ExecutorSideEffect.class )
- @Mixins( TestMixin.class )
- public interface TestComposite
- extends TransientComposite
- {
- @ExecuteSideEffect( LogCall.class ) String doStuff();
- }
-
- public static abstract class TestMixin
- implements TestComposite
- {
- public String doStuff()
- {
- return "Foo";
- }
- }
-
- public static class LogCall
- implements InvocationHandler
- {
- static Collection<String> methodsCalled = new ArrayList<String>();
-
- public Object invoke( Object o, Method method, Object[] objects ) throws Throwable
- {
- methodsCalled.add( method.getName() );
- System.out.println( "method = " + method );
- latch.countDown();
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/ldap/client/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldap/client/pom.xml b/libraries/ldap/client/pom.xml
deleted file mode 100644
index da660d6..0000000
--- a/libraries/ldap/client/pom.xml
+++ /dev/null
@@ -1,19 +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.library</groupId>
- <artifactId>org.qi4j.library.ldap</artifactId>
- <version>0-SNAPSHOT</version>
- </parent>
- <groupId>org.qi4j.library</groupId>
- <artifactId>org.qi4j.library.ldap-client</artifactId>
- <name>Qi4j Library - LDAP Client</name>
-
- <dependencies>
- <dependency>
- <groupId>org.qi4j.core</groupId>
- <artifactId>org.qi4j.core.api</artifactId>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/ldap/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldap/pom.xml b/libraries/ldap/pom.xml
deleted file mode 100644
index c309da0..0000000
--- a/libraries/ldap/pom.xml
+++ /dev/null
@@ -1,19 +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-libraries</artifactId>
- <version>0-SNAPSHOT</version>
- </parent>
- <groupId>org.qi4j.library</groupId>
- <artifactId>org.qi4j.library.ldap</artifactId>
- <name>Qi4j Library - LDAP - Build POM</name>
- <packaging>pom</packaging>
- <!-- This POM is ONLY to initiate the modules to be built. -->
- <modules>
- <module>client</module>
- <module>server</module>
- </modules>
-
-</project>
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/ldap/server/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldap/server/pom.xml b/libraries/ldap/server/pom.xml
deleted file mode 100644
index 43313d1..0000000
--- a/libraries/ldap/server/pom.xml
+++ /dev/null
@@ -1,40 +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.library</groupId>
- <artifactId>org.qi4j.library.ldap</artifactId>
- <version>0-SNAPSHOT</version>
- </parent>
- <groupId>org.qi4j.library</groupId>
- <artifactId>org.qi4j.library.ldap-server</artifactId>
- <name>Qi4j Library - LDAP Server</name>
-
- <dependencies>
- <dependency>
- <groupId>org.qi4j.core</groupId>
- <artifactId>org.qi4j.core.api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.directory.server</groupId>
- <artifactId>apacheds-all</artifactId>
- <version>1.5.4</version>
- </dependency>
- <dependency>
- <groupId>org.qi4j.core</groupId>
- <artifactId>org.qi4j.core.runtime</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.qi4j.core</groupId>
- <artifactId>org.qi4j.core.testsupport</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <version>1.4.2</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/ldap/server/src/main/java/org/qi4j/library/ldap/server/ApacheDirectoryServiceMixin.java
----------------------------------------------------------------------
diff --git a/libraries/ldap/server/src/main/java/org/qi4j/library/ldap/server/ApacheDirectoryServiceMixin.java b/libraries/ldap/server/src/main/java/org/qi4j/library/ldap/server/ApacheDirectoryServiceMixin.java
deleted file mode 100644
index d8b959f..0000000
--- a/libraries/ldap/server/src/main/java/org/qi4j/library/ldap/server/ApacheDirectoryServiceMixin.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright 2009 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.library.ldap.server;
-
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.directory.server.core.DefaultDirectoryService;
-import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.partition.Partition;
-import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
-import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
-import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.qi4j.api.configuration.Configuration;
-import org.qi4j.api.injection.scope.This;
-import org.qi4j.api.service.ServiceActivation;
-
-public class ApacheDirectoryServiceMixin
- implements ServiceActivation, Ldap
-{
- @This private Configuration<LdapConfiguration> configuration;
-
- /**
- * The directory service
- */
- private DirectoryService service;
- private boolean running;
-
- public ApacheDirectoryServiceMixin()
- {
- System.out.println( "Starting LDAP." );
- }
-
- public void activateService()
- throws Exception
- {
- // Initialize the LDAP service
- service = new DefaultDirectoryService();
-
- // Disable the ChangeLog system
- service.getChangeLog().setEnabled( false );
-
-
- LdapConfiguration conf = configuration.get();
- String partitionId = conf.partitionId().get();
- Partition partition = addPartition( partitionId, conf.partitionDn().get() );
-
- // Index some attributes on the apache partition
- String[] attrs = { "objectClass", "ou", "uid" };
- addIndex( partition, attrs );
- addIndex( partition, configAttributes() );
-
- // Inject the apache root entry if it does not already exist
- try
- {
- service.getAdminSession().lookup( partition.getSuffixDn() );
- }
- catch( LdapNameNotFoundException lnnfe )
- {
-
- LdapDN dnApache = new LdapDN( "dc=Apache,dc=Org" );
- ServerEntry entryApache = service.newEntry( dnApache );
- entryApache.add( "objectClass", "top", "domain", "extensibleObject" );
- entryApache.add( "dc", "Apache" );
- service.getAdminSession().add( entryApache );
- }
- service.startup();
- running = true;
- }
-
- private String[] configAttributes()
- {
- String attrs = configuration.get().indexAttributes().get();
- return attrs.split( "," );
- }
-
- public void passivateService()
- throws Exception
- {
- running = false;
- service.shutdown();
- }
-
-
- /**
- * Add a new partition to the server
- *
- * @param partitionId The partition Id
- * @param partitionDn The partition DN
- * @return The newly added partition
- * @throws Exception If the partition can't be added
- */
- private Partition addPartition( String partitionId, String partitionDn ) throws Exception
- {
- Partition partition = new JdbmPartition();
- partition.setId( partitionId );
- partition.setSuffix( partitionDn );
- service.addPartition( partition );
-
- return partition;
- }
-
- /**
- * Add a new set of index on the given attributes
- *
- * @param partition The partition on which we want to add index
- * @param attrs The list of attributes to index
- */
- private void addIndex( Partition partition, String... attrs )
- {
- // Index some attributes on the apache partition
- Set indexedAttributes = new HashSet();
-
- for( String attribute : attrs )
- {
- indexedAttributes.add( new JdbmIndex<String, ServerEntry>( attribute ) );
- }
-
- ( (JdbmPartition) partition ).setIndexedAttributes( indexedAttributes );
- }
-
- public boolean isRunning()
- {
- return running;
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/ldap/server/src/main/java/org/qi4j/library/ldap/server/Ldap.java
----------------------------------------------------------------------
diff --git a/libraries/ldap/server/src/main/java/org/qi4j/library/ldap/server/Ldap.java b/libraries/ldap/server/src/main/java/org/qi4j/library/ldap/server/Ldap.java
deleted file mode 100644
index e31392e..0000000
--- a/libraries/ldap/server/src/main/java/org/qi4j/library/ldap/server/Ldap.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2009 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.library.ldap.server;
-
-public interface Ldap
-{
- boolean isRunning();
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/ldap/server/src/main/java/org/qi4j/library/ldap/server/LdapConfiguration.java
----------------------------------------------------------------------
diff --git a/libraries/ldap/server/src/main/java/org/qi4j/library/ldap/server/LdapConfiguration.java b/libraries/ldap/server/src/main/java/org/qi4j/library/ldap/server/LdapConfiguration.java
deleted file mode 100644
index 4973f27..0000000
--- a/libraries/ldap/server/src/main/java/org/qi4j/library/ldap/server/LdapConfiguration.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2009 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.library.ldap.server;
-
-import org.qi4j.api.common.Optional;
-import org.qi4j.api.configuration.ConfigurationComposite;
-import org.qi4j.api.property.Property;
-
-public interface LdapConfiguration extends ConfigurationComposite
-{
- Property<String> partitionId();
-
- Property<String> partitionDn();
-
- @Optional Property<String> indexAttributes();
-
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/ldap/server/src/main/java/org/qi4j/library/ldap/server/LdapService.java
----------------------------------------------------------------------
diff --git a/libraries/ldap/server/src/main/java/org/qi4j/library/ldap/server/LdapService.java b/libraries/ldap/server/src/main/java/org/qi4j/library/ldap/server/LdapService.java
deleted file mode 100644
index fceab2d..0000000
--- a/libraries/ldap/server/src/main/java/org/qi4j/library/ldap/server/LdapService.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright 2009 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.library.ldap.server;
-
-import org.qi4j.api.mixin.Mixins;
-import org.qi4j.api.service.ServiceActivation;
-
-@Mixins( ApacheDirectoryServiceMixin.class )
-public interface LdapService extends Ldap, ServiceActivation
-{
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/ldap/server/src/test/java/org/qi4j/library/ldap/server/LdapServerTest.java
----------------------------------------------------------------------
diff --git a/libraries/ldap/server/src/test/java/org/qi4j/library/ldap/server/LdapServerTest.java b/libraries/ldap/server/src/test/java/org/qi4j/library/ldap/server/LdapServerTest.java
deleted file mode 100644
index 2b808ee..0000000
--- a/libraries/ldap/server/src/test/java/org/qi4j/library/ldap/server/LdapServerTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2009 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.library.ldap.server;
-
-import org.junit.Ignore;
-import org.junit.Test;
-import org.qi4j.bootstrap.AssemblyException;
-import org.qi4j.bootstrap.ModuleAssembly;
-import org.qi4j.test.AbstractQi4jTest;
-
-public class LdapServerTest
- extends AbstractQi4jTest
-{
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.services( LdapService.class ).instantiateOnStartup();
- module.entities( LdapConfiguration.class );
- }
-
- @Test
- @Ignore
- public void keepServerRunning()
- throws Exception
- {
- long time = System.currentTimeMillis() + 120000;
- while( true )
- {
- if( System.currentTimeMillis() > time )
- {
- break;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/ldap/server/src/test/resources/org/qi4j/library/ldap/server/LdapService.properties
----------------------------------------------------------------------
diff --git a/libraries/ldap/server/src/test/resources/org/qi4j/library/ldap/server/LdapService.properties b/libraries/ldap/server/src/test/resources/org/qi4j/library/ldap/server/LdapService.properties
deleted file mode 100644
index 12555b1..0000000
--- a/libraries/ldap/server/src/test/resources/org/qi4j/library/ldap/server/LdapService.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-partitionId=qi4j
-partitionDn=dc=qi4j,dc=org
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/observations/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/observations/pom.xml b/libraries/observations/pom.xml
deleted file mode 100644
index db4f755..0000000
--- a/libraries/observations/pom.xml
+++ /dev/null
@@ -1,24 +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-libraries</artifactId>
- <version>0-SNAPSHOT</version>
- </parent>
- <groupId>org.qi4j.library</groupId>
- <artifactId>org.qi4j.library.observations</artifactId>
- <name>Qi4j Library - Event/Observation Handling</name>
-
- <dependencies>
- <dependency>
- <groupId>org.qi4j.core</groupId>
- <artifactId>org.qi4j.core.api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.qi4j.library</groupId>
- <artifactId>org.qi4j.library.exception</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/observations/src/main/java/org/qi4j/library/observations/MulticastObserver.java
----------------------------------------------------------------------
diff --git a/libraries/observations/src/main/java/org/qi4j/library/observations/MulticastObserver.java b/libraries/observations/src/main/java/org/qi4j/library/observations/MulticastObserver.java
deleted file mode 100644
index 6996319..0000000
--- a/libraries/observations/src/main/java/org/qi4j/library/observations/MulticastObserver.java
+++ /dev/null
@@ -1,99 +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.library.observations;
-
-import org.qi4j.api.common.Optional;
-import org.qi4j.api.composite.Composite;
-import org.qi4j.api.injection.scope.Service;
-import org.qi4j.api.injection.scope.This;
-import org.qi4j.library.exception.ExceptionHandling;
-
-import java.util.ArrayList;
-
-class MulticastObserver<T extends Observation>
- implements Observer<T>, Observable<T>
-{
- @Optional @Service private ExceptionHandling exceptionHandling;
- @This private Composite meAsComposite;
-
- private ArrayList<Observer<T>> observers;
-
- public MulticastObserver( Observer<T> existing )
- {
- observers = new ArrayList<Observer<T>>();
- observers.add( existing );
- }
-
- public void notify( T observation )
- {
- for( Observer<T> observer : observers )
- {
- try
- {
- observer.notify( observation );
- }
- catch( Exception e )
- {
- handleException( e, observer );
- }
- }
- }
-
- private void handleException( Exception exception, Observer<T> observer )
- {
- if( exceptionHandling != null )
- {
- exceptionHandling.exceptionOccurred( "Exception in observer: " + observer, meAsComposite, exception );
- }
- else
- {
- }
- }
-
- public void addObserver( Observer<T> observer )
- {
- synchronized( this )
- {
- ArrayList<Observer<T>> clone = new ArrayList<Observer<T>>();
- clone.addAll( observers );
- clone.add( observer );
- observers = clone;
- }
- }
-
- public void removeObserver( Observer<T> observer )
- {
- synchronized( this )
- {
- ArrayList<Observer<T>> clone = new ArrayList<Observer<T>>();
- clone.addAll( observers );
- clone.remove( observer );
- observers = clone;
- }
- }
-
- boolean isOnlyOneLeft()
- {
- return observers.size() == 1;
- }
-
- Observer<T> getFirstOne()
- {
- return observers.get( 0 );
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/observations/src/main/java/org/qi4j/library/observations/Observable.java
----------------------------------------------------------------------
diff --git a/libraries/observations/src/main/java/org/qi4j/library/observations/Observable.java b/libraries/observations/src/main/java/org/qi4j/library/observations/Observable.java
deleted file mode 100644
index bd1cde4..0000000
--- a/libraries/observations/src/main/java/org/qi4j/library/observations/Observable.java
+++ /dev/null
@@ -1,29 +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.library.observations;
-
-import org.qi4j.api.mixin.Mixins;
-
-
-@Mixins( ObservableMixin.class )
-public interface Observable<T extends Observation>
-{
- void addObserver( Observer<T> observer );
-
- void removeObserver( Observer<T> observer );
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/observations/src/main/java/org/qi4j/library/observations/ObservableMixin.java
----------------------------------------------------------------------
diff --git a/libraries/observations/src/main/java/org/qi4j/library/observations/ObservableMixin.java b/libraries/observations/src/main/java/org/qi4j/library/observations/ObservableMixin.java
deleted file mode 100644
index 840523d..0000000
--- a/libraries/observations/src/main/java/org/qi4j/library/observations/ObservableMixin.java
+++ /dev/null
@@ -1,99 +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.library.observations;
-
-import org.qi4j.api.common.Optional;
-import org.qi4j.api.composite.Composite;
-import org.qi4j.api.injection.scope.Service;
-import org.qi4j.api.injection.scope.This;
-import org.qi4j.library.exception.ExceptionHandling;
-
-public class ObservableMixin<T extends Observation>
- implements Observable<T>, Observer<T>
-{
- @Optional @Service private ExceptionHandling exceptionHandling;
- @This private Composite meAsComposite;
-
- private Observer<T> observer;
-
- public void addObserver( Observer<T> observer )
- {
- synchronized( this )
- {
- if( this.observer == null )
- {
- this.observer = observer;
- return;
- }
- if( this.observer instanceof MulticastObserver )
- {
- ( (MulticastObserver<T>) this.observer ).addObserver( observer );
- return;
- }
- Observer<T> existing = this.observer;
- this.observer = new MulticastObserver<T>( existing );
- }
- }
-
- public void removeObserver( Observer<T> observer )
- {
- synchronized( this )
- {
- if( this.observer == null )
- {
- return;
- }
- if( this.observer instanceof MulticastObserver )
- {
- MulticastObserver<T> multicastObserver = (MulticastObserver<T>) this.observer;
- multicastObserver.removeObserver( observer );
- if( multicastObserver.isOnlyOneLeft() )
- {
- this.observer = multicastObserver.getFirstOne();
- }
- return;
- }
- if( this.observer.equals( observer ) )
- {
- this.observer = null;
- }
- }
- }
-
- public void notify( T observation )
- {
- if( observer == null )
- {
- return;
- }
- try
- {
- observer.notify( observation );
- }
- catch( Exception e )
- {
- if( exceptionHandling != null )
- {
- exceptionHandling.exceptionOccurred( "Exception in observer: " + observer, meAsComposite, e );
- }
- else
- {
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/observations/src/main/java/org/qi4j/library/observations/Observation.java
----------------------------------------------------------------------
diff --git a/libraries/observations/src/main/java/org/qi4j/library/observations/Observation.java b/libraries/observations/src/main/java/org/qi4j/library/observations/Observation.java
deleted file mode 100644
index 6ba0cf4..0000000
--- a/libraries/observations/src/main/java/org/qi4j/library/observations/Observation.java
+++ /dev/null
@@ -1,22 +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.library.observations;
-
-public interface Observation
-{
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/observations/src/main/java/org/qi4j/library/observations/Observer.java
----------------------------------------------------------------------
diff --git a/libraries/observations/src/main/java/org/qi4j/library/observations/Observer.java b/libraries/observations/src/main/java/org/qi4j/library/observations/Observer.java
deleted file mode 100644
index a9e2d18..0000000
--- a/libraries/observations/src/main/java/org/qi4j/library/observations/Observer.java
+++ /dev/null
@@ -1,23 +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.library.observations;
-
-public interface Observer<T extends Observation>
-{
- void notify( T observation );
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/pom.xml b/libraries/pom.xml
deleted file mode 100644
index e7297e7..0000000
--- a/libraries/pom.xml
+++ /dev/null
@@ -1,26 +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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.qi4j.sandbox</groupId>
- <artifactId>qi4j-sandbox</artifactId>
- <version>0-SNAPSHOT</version>
- </parent>
- <artifactId>qi4j-sandbox-libraries</artifactId>
- <name>Qi4j Sandbox Libraries - Build POM</name>
- <packaging>pom</packaging>
-
- <modules>
- <module>beans</module>
- <module>entityproxy</module>
- <module>exception</module>
- <module>executor</module>
- <module>ldap</module>
- <module>observations</module>
- <module>registry</module>
- <module>rmi</module>
- <module>thread</module>
- <module>unitofwork</module>
- <module>validation</module>
- </modules>
-</project>
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/registry/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/registry/dev-status.xml b/libraries/registry/dev-status.xml
deleted file mode 100644
index 1e523b4..0000000
--- a/libraries/registry/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>none</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/libraries/registry/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/registry/pom.xml b/libraries/registry/pom.xml
deleted file mode 100644
index 6a8493d..0000000
--- a/libraries/registry/pom.xml
+++ /dev/null
@@ -1,24 +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-libraries</artifactId>
- <version>0-SNAPSHOT</version>
- </parent>
- <groupId>org.qi4j.library</groupId>
- <artifactId>org.qi4j.library.registry</artifactId>
- <name>Qi4j Library - Registry</name>
-
- <dependencies>
- <dependency>
- <groupId>org.qi4j.core</groupId>
- <artifactId>org.qi4j.core.api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.qi4j.library</groupId>
- <artifactId>org.qi4j.library.exception</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/registry/src/main/java/org/qi4j/library/registry/Registry.java
----------------------------------------------------------------------
diff --git a/libraries/registry/src/main/java/org/qi4j/library/registry/Registry.java b/libraries/registry/src/main/java/org/qi4j/library/registry/Registry.java
deleted file mode 100644
index a01c7b0..0000000
--- a/libraries/registry/src/main/java/org/qi4j/library/registry/Registry.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2008 Niclas Hedhman. All rights Reserved.
- *
- * 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.library.registry;
-
-public interface Registry<K, V>
-{
- V lookup( K key );
-
- void register( K key, V value );
-
- void unregister( K key );
-
- void addRegistryObserver( RegistryObserver<K, V> observer );
-
- void removeRegistryObserver( RegistryObserver<K, V> observer );
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/registry/src/main/java/org/qi4j/library/registry/RegistryAssembler.java
----------------------------------------------------------------------
diff --git a/libraries/registry/src/main/java/org/qi4j/library/registry/RegistryAssembler.java b/libraries/registry/src/main/java/org/qi4j/library/registry/RegistryAssembler.java
deleted file mode 100644
index 7de4d9c..0000000
--- a/libraries/registry/src/main/java/org/qi4j/library/registry/RegistryAssembler.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2008 Niclas Hedhman. All rights Reserved.
- *
- * 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.library.registry;
-
-import org.qi4j.bootstrap.Assembler;
-import org.qi4j.bootstrap.AssemblyException;
-import org.qi4j.bootstrap.ModuleAssembly;
-
-public class RegistryAssembler
- implements Assembler
-{
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.addServices( RegistryService.class );
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/registry/src/main/java/org/qi4j/library/registry/RegistryMixin.java
----------------------------------------------------------------------
diff --git a/libraries/registry/src/main/java/org/qi4j/library/registry/RegistryMixin.java b/libraries/registry/src/main/java/org/qi4j/library/registry/RegistryMixin.java
deleted file mode 100644
index 80ee8cf..0000000
--- a/libraries/registry/src/main/java/org/qi4j/library/registry/RegistryMixin.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright 2008 Niclas Hedhman. All rights Reserved.
- *
- * 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.library.registry;
-
-import org.qi4j.api.common.Optional;
-import org.qi4j.api.injection.scope.Service;
-import org.qi4j.library.exception.ExceptionHandling;
-
-import java.util.HashMap;
-import java.util.LinkedList;
-
-public class RegistryMixin<K, V>
- implements Registry<K, V>
-{
- @Optional @Service private ExceptionHandling exceptionHandling;
-
- private final HashMap<K, V> registrations;
- private LinkedList<RegistryObserver<K, V>> observers;
-
- public RegistryMixin()
- {
- this.registrations = new HashMap<K, V>();
- }
-
- public V lookup( K key )
- {
- V compositeType;
- synchronized( registrations )
- {
- compositeType = registrations.get( key );
- }
- return compositeType;
- }
-
- public void register( K key, V value )
- {
- synchronized( registrations )
- {
- registrations.put( key, value );
- for( RegistryObserver<K, V> observer : observers )
- {
- sendNotification( key, value, observer );
- }
- }
- }
-
- public void unregister( K key )
- {
- synchronized( registrations )
- {
- registrations.remove( key );
- }
- }
-
- public void addRegistryObserver( RegistryObserver<K, V> observer )
- {
- synchronized( this )
- {
- LinkedList<RegistryObserver<K, V>> clone;
- clone = new LinkedList<RegistryObserver<K, V>>();
- if( observers != null )
- {
- clone.addAll( observers );
- }
- clone.add( observer );
- observers = clone;
- }
- }
-
- public void removeRegistryObserver( RegistryObserver<K, V> observer )
- {
- synchronized( this )
- {
- if( observers == null )
- {
- return;
- }
- if( observers.contains( observer ) )
- {
- if( observers.size() == 1 )
- {
- observers = null;
- return;
- }
- LinkedList<RegistryObserver<K, V>> clone = new LinkedList<RegistryObserver<K, V>>();
- clone.addAll( observers );
- observers = clone;
- }
- }
- }
-
- private void sendNotification( K key, V value, RegistryObserver<K, V> observer )
- {
- try
- {
- observer.registration( this, key, value );
- }
- catch( Exception e )
- {
- if( exceptionHandling != null )
- {
- exceptionHandling.exceptionOccurred( "Observer " + observer + " threw an exception", this, e );
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/registry/src/main/java/org/qi4j/library/registry/RegistryObserver.java
----------------------------------------------------------------------
diff --git a/libraries/registry/src/main/java/org/qi4j/library/registry/RegistryObserver.java b/libraries/registry/src/main/java/org/qi4j/library/registry/RegistryObserver.java
deleted file mode 100644
index 1af9336..0000000
--- a/libraries/registry/src/main/java/org/qi4j/library/registry/RegistryObserver.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2008 Niclas Hedhman. All rights Reserved.
- *
- * 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.library.registry;
-
-
-public interface RegistryObserver<K, V>
-{
- void registration( Registry<K, V> source, K key, V value );
-
- void deregistration( Registry<K, V> source, K key, V value );
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/registry/src/main/java/org/qi4j/library/registry/RegistryService.java
----------------------------------------------------------------------
diff --git a/libraries/registry/src/main/java/org/qi4j/library/registry/RegistryService.java b/libraries/registry/src/main/java/org/qi4j/library/registry/RegistryService.java
deleted file mode 100644
index 9f9a75c..0000000
--- a/libraries/registry/src/main/java/org/qi4j/library/registry/RegistryService.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2008 Niclas Hedhman. All rights Reserved.
- *
- * 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.library.registry;
-
-import org.qi4j.api.mixin.Mixins;
-import org.qi4j.api.service.ServiceComposite;
-
-@Mixins( RegistryMixin.class )
-public interface RegistryService extends Registry, ServiceComposite
-{
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/rmi/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/rmi/dev-status.xml b/libraries/rmi/dev-status.xml
deleted file mode 100644
index 0c93156..0000000
--- a/libraries/rmi/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/libraries/rmi/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/rmi/pom.xml b/libraries/rmi/pom.xml
deleted file mode 100644
index e3caafe..0000000
--- a/libraries/rmi/pom.xml
+++ /dev/null
@@ -1,42 +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-libraries</artifactId>
- <version>0-SNAPSHOT</version>
- </parent>
- <groupId>org.qi4j.library</groupId>
- <artifactId>org.qi4j.library.rmi</artifactId>
- <name>Qi4j Library - RMI</name>
-
- <dependencies>
- <dependency>
- <groupId>org.qi4j.core</groupId>
- <artifactId>org.qi4j.core.api</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.runtime</artifactId>
- <scope>test</scope>
- </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.cache</artifactId>
- <version>${version.qi4j}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/rmi/src/main/java/org/qi4j/library/rmi/RMIMixin.java
----------------------------------------------------------------------
diff --git a/libraries/rmi/src/main/java/org/qi4j/library/rmi/RMIMixin.java b/libraries/rmi/src/main/java/org/qi4j/library/rmi/RMIMixin.java
deleted file mode 100644
index add281c..0000000
--- a/libraries/rmi/src/main/java/org/qi4j/library/rmi/RMIMixin.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2007 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.library.rmi;
-
-import org.qi4j.api.common.AppliesTo;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.rmi.Remote;
-import java.rmi.registry.LocateRegistry;
-import java.rmi.registry.Registry;
-
-/**
- * Generic mixin that looks up and invokes an object through RMI
- */
-@AppliesTo( Remote.class )
-public class RMIMixin
- implements InvocationHandler
-{
- private Object remote;
-
- public Object invoke( Object proxy, Method method, Object[] args )
- throws Throwable
- {
- if( remote == null )
- {
- Registry registry = LocateRegistry.getRegistry( "localhost" );
- remote = registry.lookup( method.getDeclaringClass().getSimpleName() );
- }
-
- try
- {
- return method.invoke( remote, args );
- }
- catch( InvocationTargetException e )
- {
- remote = null;
- throw e.getTargetException();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/rmi/src/test/java/org/qi4j/library/rmi/RMIMixinTest.java
----------------------------------------------------------------------
diff --git a/libraries/rmi/src/test/java/org/qi4j/library/rmi/RMIMixinTest.java b/libraries/rmi/src/test/java/org/qi4j/library/rmi/RMIMixinTest.java
deleted file mode 100644
index 5eeb948..0000000
--- a/libraries/rmi/src/test/java/org/qi4j/library/rmi/RMIMixinTest.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2007 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.library.rmi;
-
-import junit.framework.Assert;
-import org.junit.Test;
-import org.qi4j.bootstrap.AssemblyException;
-import org.qi4j.bootstrap.ModuleAssembly;
-import org.qi4j.library.rmi.remote.RemoteInterface;
-import org.qi4j.library.rmi.remote.RemoteInterfaceComposite;
-import org.qi4j.library.rmi.remote.RemoteInterfaceImpl;
-import org.qi4j.test.AbstractQi4jTest;
-
-import java.io.IOException;
-import java.rmi.registry.LocateRegistry;
-import java.rmi.registry.Registry;
-import java.rmi.server.UnicastRemoteObject;
-
-/**
- * JAVADOC
- */
-public class RMIMixinTest
- extends AbstractQi4jTest
-{
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.transients( RemoteInterfaceComposite.class );
- }
-
- @Test
- public void testRMIMixin()
- throws Exception
- {
- // Instantiate, export, and bind server object
- RemoteInterfaceImpl remoteObject = new RemoteInterfaceImpl();
- RemoteInterface stub = (RemoteInterface) UnicastRemoteObject.exportObject( remoteObject, 0 );
- Registry registry = LocateRegistry.createRegistry( 1099 );
- registry.rebind( RemoteInterface.class.getSimpleName(), stub );
-
- RemoteInterface remote = module.newTransient( RemoteInterfaceComposite.class );
-
- // MethodCallExpression remote interface
- System.out.println( remote.foo( "Bar" ) );
-// System.out.println( remote.foo( "Bar" ) );
-// System.out.println( remote.foo( "Xyz" ) );
-
- try
- {
- System.out.println( remote.foo( "Zyx" ) );
- Assert.fail( "Should have thrown IOException " );
- }
- catch( IOException e )
- {
- // Ok!
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/rmi/src/test/java/org/qi4j/library/rmi/remote/RemoteInterface.java
----------------------------------------------------------------------
diff --git a/libraries/rmi/src/test/java/org/qi4j/library/rmi/remote/RemoteInterface.java b/libraries/rmi/src/test/java/org/qi4j/library/rmi/remote/RemoteInterface.java
deleted file mode 100644
index 1698113..0000000
--- a/libraries/rmi/src/test/java/org/qi4j/library/rmi/remote/RemoteInterface.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2007 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.library.rmi.remote;
-
-import org.qi4j.library.cache.Cached;
-
-import java.io.IOException;
-import java.rmi.Remote;
-
-/**
- * JAVADOC
- */
-@Cached
-public interface RemoteInterface
- extends Remote
-{
- String foo( String aBar )
- throws IOException;
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/rmi/src/test/java/org/qi4j/library/rmi/remote/RemoteInterfaceComposite.java
----------------------------------------------------------------------
diff --git a/libraries/rmi/src/test/java/org/qi4j/library/rmi/remote/RemoteInterfaceComposite.java b/libraries/rmi/src/test/java/org/qi4j/library/rmi/remote/RemoteInterfaceComposite.java
deleted file mode 100644
index 29e1d57..0000000
--- a/libraries/rmi/src/test/java/org/qi4j/library/rmi/remote/RemoteInterfaceComposite.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2007 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.library.rmi.remote;
-
-import org.qi4j.api.composite.Composite;
-import org.qi4j.api.composite.TransientComposite;
-import org.qi4j.api.mixin.Mixins;
-import org.qi4j.library.cache.InvocationCacheAbstractComposite;
-import org.qi4j.library.rmi.RMIMixin;
-
-/**
- * Implement the RemoteInterface by using RMI.
- * Results of RMI calls are cached, so if an
- * IOException occurs we can reuse a previous result
- * if possible.
- */
-@Mixins( RMIMixin.class )
-public interface RemoteInterfaceComposite
- extends RemoteInterface, InvocationCacheAbstractComposite, TransientComposite
-{
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/rmi/src/test/java/org/qi4j/library/rmi/remote/RemoteInterfaceImpl.java
----------------------------------------------------------------------
diff --git a/libraries/rmi/src/test/java/org/qi4j/library/rmi/remote/RemoteInterfaceImpl.java b/libraries/rmi/src/test/java/org/qi4j/library/rmi/remote/RemoteInterfaceImpl.java
deleted file mode 100644
index a379b55..0000000
--- a/libraries/rmi/src/test/java/org/qi4j/library/rmi/remote/RemoteInterfaceImpl.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2007 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.library.rmi.remote;
-
-import java.io.IOException;
-
-/**
- * Implementation of RemoteInterface.
- */
-public class RemoteInterfaceImpl
- implements RemoteInterface
-{
- int count = 0;
-
- // RemoteInterface implementation --------------------------------
- public String foo( String aBar )
- throws IOException
- {
- count++;
-
- if( count % 2 == 0 )
- {
- throw new IOException( "Something went wrong" );
- }
-
- return "Foo:" + aBar;
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/thread/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/thread/dev-status.xml b/libraries/thread/dev-status.xml
deleted file mode 100644
index 4d9940b..0000000
--- a/libraries/thread/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>none</codebase>
- <!--none,early,beta,stable,mature-->
- <documentation>none</documentation>
- <!-- none, brief, good, complete -->
- <unittests>none</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/libraries/thread/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/thread/pom.xml b/libraries/thread/pom.xml
deleted file mode 100644
index e166576..0000000
--- a/libraries/thread/pom.xml
+++ /dev/null
@@ -1,43 +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-libraries</artifactId>
- <version>0-SNAPSHOT</version>
- </parent>
- <groupId>org.qi4j.library</groupId>
- <artifactId>org.qi4j.library.thread</artifactId>
- <name>Qi4j Library - Thread</name>
-
- <dependencies>
- <dependency>
- <groupId>org.qi4j.core</groupId>
- <artifactId>org.qi4j.core.api</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.core</groupId>
- <artifactId>org.qi4j.core.runtime</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.qi4j.library</groupId>
- <artifactId>org.qi4j.library.constraints</artifactId>
- <version>${version.qi4j}</version>
- </dependency>
- <dependency>
- <groupId>org.qi4j.library</groupId>
- <artifactId>org.qi4j.library.uid</artifactId>
- <version>${version.qi4j}</version>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/thread/src/main/java/org/qi4j/library/thread/MaximumThreadsException.java
----------------------------------------------------------------------
diff --git a/libraries/thread/src/main/java/org/qi4j/library/thread/MaximumThreadsException.java b/libraries/thread/src/main/java/org/qi4j/library/thread/MaximumThreadsException.java
deleted file mode 100644
index 6a5fa89..0000000
--- a/libraries/thread/src/main/java/org/qi4j/library/thread/MaximumThreadsException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2008 Niclas Hedhman. All rights Reserved.
- *
- * 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.library.thread;
-
-public class MaximumThreadsException extends RuntimeException
-{
- private final int limit;
-
- public MaximumThreadsException( int limit )
- {
- super( "Maximum number of threads has been created: " + limit );
- this.limit = limit;
- }
-
- public int limit()
- {
- return limit;
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/thread/src/main/java/org/qi4j/library/thread/NewThreadServiceComposite.java
----------------------------------------------------------------------
diff --git a/libraries/thread/src/main/java/org/qi4j/library/thread/NewThreadServiceComposite.java b/libraries/thread/src/main/java/org/qi4j/library/thread/NewThreadServiceComposite.java
deleted file mode 100644
index ac050a7..0000000
--- a/libraries/thread/src/main/java/org/qi4j/library/thread/NewThreadServiceComposite.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2008 Niclas Hedhman. All rights Reserved.
- *
- * 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.library.thread;
-
-import org.qi4j.api.mixin.Mixins;
-import org.qi4j.api.service.ServiceComposite;
-
-@Mixins( NewThreadServiceMixin.class )
-public interface NewThreadServiceComposite extends ThreadService, ServiceComposite
-{
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/thread/src/main/java/org/qi4j/library/thread/NewThreadServiceMixin.java
----------------------------------------------------------------------
diff --git a/libraries/thread/src/main/java/org/qi4j/library/thread/NewThreadServiceMixin.java b/libraries/thread/src/main/java/org/qi4j/library/thread/NewThreadServiceMixin.java
deleted file mode 100644
index 00455d1..0000000
--- a/libraries/thread/src/main/java/org/qi4j/library/thread/NewThreadServiceMixin.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright 2008 Niclas Hedhman. All rights Reserved.
- *
- * 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.library.thread;
-
-import org.qi4j.api.configuration.Configuration;
-import org.qi4j.api.injection.scope.Service;
-import org.qi4j.api.injection.scope.This;
-import org.qi4j.library.uid.sequence.Sequencing;
-
-public class NewThreadServiceMixin
- implements ThreadService
-{
- private @This Configuration<ThreadServiceConfiguration> config;
- private int threadCount;
- @Service private Sequencing sequence;
- @Service private ThreadGroupService threadGroupService;
-
- public Thread newThread( Runnable runnable )
- {
- synchronized( this )
- {
- Integer max = config.get().maxThreads().get();
- if( threadCount >= max )
- {
- throw new MaximumThreadsException( max );
- }
- ThreadServiceConfiguration configuration = config.get();
- String name = configuration.threadBaseName().get() + sequence.newSequenceValue();
- String tgName = configuration.threadGroupName().get();
- ThreadGroup threadGroup = threadGroupService.getThreadGroup( tgName );
- return new Thread( threadGroup, new RunnableWrapper( runnable ), name );
- }
- }
-
- public ThreadServiceConfiguration configuration()
- {
- return config.get();
- }
-
- public class RunnableWrapper
- implements Runnable
- {
- private Runnable runnable;
-
- public RunnableWrapper( Runnable runnable )
- {
- this.runnable = runnable;
- threadCount++;
- }
-
- public void run()
- {
- runnable.run();
- threadCount--;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/thread/src/main/java/org/qi4j/library/thread/PooledThreadServiceComposite.java
----------------------------------------------------------------------
diff --git a/libraries/thread/src/main/java/org/qi4j/library/thread/PooledThreadServiceComposite.java b/libraries/thread/src/main/java/org/qi4j/library/thread/PooledThreadServiceComposite.java
deleted file mode 100644
index e6c498e..0000000
--- a/libraries/thread/src/main/java/org/qi4j/library/thread/PooledThreadServiceComposite.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2008 Niclas Hedhman. All rights Reserved.
- *
- * 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.library.thread;
-
-import org.qi4j.api.mixin.Mixins;
-import org.qi4j.api.service.ServiceActivation;
-
-@Mixins( PooledThreadServiceMixin.class )
-public interface PooledThreadServiceComposite extends ThreadService, ServiceActivation
-{
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/thread/src/main/java/org/qi4j/library/thread/PooledThreadServiceMixin.java
----------------------------------------------------------------------
diff --git a/libraries/thread/src/main/java/org/qi4j/library/thread/PooledThreadServiceMixin.java b/libraries/thread/src/main/java/org/qi4j/library/thread/PooledThreadServiceMixin.java
deleted file mode 100644
index 3c05bcf..0000000
--- a/libraries/thread/src/main/java/org/qi4j/library/thread/PooledThreadServiceMixin.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright 2008 Niclas Hedhman. All rights Reserved.
- *
- * 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.library.thread;
-
-import java.util.LinkedList;
-import org.qi4j.api.configuration.Configuration;
-import org.qi4j.api.injection.scope.Service;
-import org.qi4j.api.injection.scope.This;
-import org.qi4j.api.service.ServiceActivation;
-import org.qi4j.library.uid.sequence.Sequencing;
-
-public class PooledThreadServiceMixin
- implements ThreadService, ServiceActivation
-{
- @This private Configuration<ThreadServiceConfiguration> config;
- @Service private Sequencing sequence;
- @Service private ThreadGroupService threadGroupService;
- private LinkedList<RunnableThread> pool;
- private int threadCount;
-
- public PooledThreadServiceMixin()
- {
- pool = new LinkedList<RunnableThread>();
- threadCount = 0;
- }
-
- public Thread newThread( Runnable runnable )
- {
- synchronized( this )
- {
- if( pool.isEmpty() )
- {
- Integer max = config.get().maxThreads().get();
- if( threadCount >= max )
- {
- throw new MaximumThreadsException( max );
- }
- createNewThread();
- }
- RunnableThread rt = pool.removeFirst();
- rt.runnable.currentRunnable( runnable );
- return rt.thread;
- }
- }
-
- public ThreadServiceConfiguration configuration()
- {
- return config.get();
- }
-
- public void activateService()
- throws Exception
- {
- pool = new LinkedList<RunnableThread>();
- int prefered = config.get().preferedNumberOfThreads().get();
- for( int i = 0; i < prefered; i++ )
- {
- createNewThread();
- }
- }
-
- private void createNewThread()
- {
- ThreadServiceConfiguration configuration = config.get();
- String tgName = configuration.threadGroupName().get();
- ThreadGroup group = threadGroupService.getThreadGroup( tgName );
- String name = configuration.threadBaseName().get() + "-" + sequence.newSequenceValue();
- PooledRunnableWrapper runnable = new PooledRunnableWrapper();
- Thread t = new Thread( group, runnable, name );
- RunnableThread runnableThread = new RunnableThread( t, runnable );
- runnable.poolInstance = runnableThread;
- threadCount++;
- pool.add( runnableThread );
- }
-
- public void passivateService()
- throws Exception
- {
- for( RunnableThread thread : pool )
- {
- threadCount = 0;
- thread.runnable.run = false;
- thread.thread.interrupt();
- }
- }
-
- public static class RunnableThread
- {
- private final Thread thread;
- private final PooledRunnableWrapper runnable;
-
- public RunnableThread( Thread thread, PooledRunnableWrapper runnable )
- {
- this.thread = thread;
- this.runnable = runnable;
- }
- }
-
- public class PooledRunnableWrapper
- implements Runnable
- {
- private boolean run;
- private Runnable current;
- private RunnableThread poolInstance;
-
- public void currentRunnable( Runnable current )
- {
- this.current = current;
- synchronized( this )
- {
- notifyAll();
- }
- }
-
- public void run()
- {
- run = true;
- while( run )
- {
- try
- {
- synchronized( this )
- {
- while( current == null )
- {
- wait( 1000 );
- }
- }
- current.run();
- pool.addLast( poolInstance );
- }
- catch( InterruptedException e )
- {
- run = false;
- }
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadGroupConfiguration.java
----------------------------------------------------------------------
diff --git a/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadGroupConfiguration.java b/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadGroupConfiguration.java
deleted file mode 100644
index 7db1086..0000000
--- a/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadGroupConfiguration.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2008 Niclas Hedhman. All rights Reserved.
- *
- * 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.library.thread;
-
-import org.qi4j.api.property.Property;
-
-/**
- * JAVADOC Add JavaDoc
- */
-public interface ThreadGroupConfiguration
-{
- Property<String> rootGroupName();
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadGroupConfigurationEntity.java
----------------------------------------------------------------------
diff --git a/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadGroupConfigurationEntity.java b/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadGroupConfigurationEntity.java
deleted file mode 100644
index 8fda462..0000000
--- a/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadGroupConfigurationEntity.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2008 Niclas Hedhman. All rights Reserved.
- *
- * 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.library.thread;
-
-import org.qi4j.api.configuration.ConfigurationComposite;
-
-public interface ThreadGroupConfigurationEntity extends ThreadGroupConfiguration, ConfigurationComposite
-{
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadGroupService.java
----------------------------------------------------------------------
diff --git a/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadGroupService.java b/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadGroupService.java
deleted file mode 100644
index ad2ac95..0000000
--- a/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadGroupService.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2008 Niclas Hedhman. All rights Reserved.
- *
- * 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.library.thread;
-
-public interface ThreadGroupService
-{
- ThreadGroup getThreadGroup( String name );
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadGroupServiceComposite.java
----------------------------------------------------------------------
diff --git a/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadGroupServiceComposite.java b/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadGroupServiceComposite.java
deleted file mode 100644
index 0f6afb9..0000000
--- a/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadGroupServiceComposite.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2008 Niclas Hedhman. All rights Reserved.
- *
- * 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.library.thread;
-
-import org.qi4j.api.mixin.Mixins;
-import org.qi4j.api.service.ServiceComposite;
-
-@Mixins( ThreadGroupServiceMixin.class )
-public interface ThreadGroupServiceComposite extends ThreadGroupService, ServiceComposite
-{
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadGroupServiceMixin.java
----------------------------------------------------------------------
diff --git a/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadGroupServiceMixin.java b/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadGroupServiceMixin.java
deleted file mode 100644
index 88a9372..0000000
--- a/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadGroupServiceMixin.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2008 Niclas Hedhman. All rights Reserved.
- *
- * 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.library.thread;
-
-import org.qi4j.api.configuration.Configuration;
-import org.qi4j.api.injection.scope.This;
-import org.qi4j.api.property.Property;
-
-import java.util.HashMap;
-
-public class ThreadGroupServiceMixin
- implements ThreadGroupService
-{
- private ThreadGroup rootGroup;
- private HashMap<String, ThreadGroup> groups;
-
- public ThreadGroupServiceMixin( @This Configuration<ThreadGroupConfiguration> config )
- {
- ThreadGroupConfiguration configuration = config.get();
- Property<String> rootName = configuration.rootGroupName();
- String name = rootName.get();
- groups = new HashMap<String, ThreadGroup>();
- rootGroup = new ThreadGroup( name );
- }
-
- public ThreadGroup getThreadGroup( String name )
- {
- synchronized( this )
- {
- ThreadGroup tg = groups.get( name );
- if( tg == null )
- {
- tg = new ThreadGroup( rootGroup, name );
- groups.put( name, tg );
- }
- return tg;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadService.java
----------------------------------------------------------------------
diff --git a/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadService.java b/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadService.java
deleted file mode 100644
index 0574dc1..0000000
--- a/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadService.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright 2008 Niclas Hedhman. All rights Reserved.
- *
- * 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.library.thread;
-
-public interface ThreadService
-{
- Thread newThread( Runnable runnable );
-
- ThreadServiceConfiguration configuration();
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadServiceConfiguration.java
----------------------------------------------------------------------
diff --git a/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadServiceConfiguration.java b/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadServiceConfiguration.java
deleted file mode 100644
index 90d209c..0000000
--- a/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadServiceConfiguration.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2008 Niclas Hedhman. All rights Reserved.
- *
- * 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.library.thread;
-
-import org.qi4j.api.property.Property;
-
-/**
- * JAVADOC Add JavaDoc
- */
-public interface ThreadServiceConfiguration
-{
- Property<String> threadGroupName();
-
- Property<String> threadBaseName();
-
- Property<Integer> maxThreads();
-
- // Should probably have a Constraint @Range( min = 1, max = 100 )
- Property<Integer> preferedNumberOfThreads();
-}
http://git-wip-us.apache.org/repos/asf/zest-sandbox/blob/d4dd9c17/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadServiceConfigurationEntity.java
----------------------------------------------------------------------
diff --git a/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadServiceConfigurationEntity.java b/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadServiceConfigurationEntity.java
deleted file mode 100644
index c24a4ea..0000000
--- a/libraries/thread/src/main/java/org/qi4j/library/thread/ThreadServiceConfigurationEntity.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2008 Niclas Hedhman. All rights Reserved.
- *
- * 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.library.thread;
-
-import org.qi4j.api.configuration.ConfigurationComposite;
-
-public interface ThreadServiceConfigurationEntity extends ThreadServiceConfiguration, ConfigurationComposite
-{
-}