You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2016/10/23 14:24:02 UTC
[21/28] zest-java git commit: ZEST-180, ZEST-186, ZEST-187,
ZEST-188 Big Identity refactoring UnitOfWorkFactory is auto added to
all modules that doesn't declare one IdentityGenerator is auto-added to all
modules that deosn't declare one. Removed DCI/DDD
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/alarm/src/main/java/org/apache/zest/library/alarm/StandardAlarmModelService.java
----------------------------------------------------------------------
diff --git a/libraries/alarm/src/main/java/org/apache/zest/library/alarm/StandardAlarmModelService.java b/libraries/alarm/src/main/java/org/apache/zest/library/alarm/StandardAlarmModelService.java
index 91a28aa..1abd854 100644
--- a/libraries/alarm/src/main/java/org/apache/zest/library/alarm/StandardAlarmModelService.java
+++ b/libraries/alarm/src/main/java/org/apache/zest/library/alarm/StandardAlarmModelService.java
@@ -25,7 +25,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
-import org.apache.zest.api.entity.Identity;
+import org.apache.zest.api.identity.Identity;
import org.apache.zest.api.injection.scope.Structure;
import org.apache.zest.api.mixin.Mixins;
import org.apache.zest.api.service.ServiceComposite;
@@ -220,7 +220,7 @@ public interface StandardAlarmModelService extends AlarmModel, ServiceComposite
( oldStatus.name( null ).equals( AlarmPoint.STATUS_DEACTIVATED ) ) )
{
AlarmStatus newStatus = createStatus( AlarmPoint.STATUS_ACTIVATED );
- return createEvent( ( (Identity) alarm ), oldStatus, newStatus, AlarmPoint.EVENT_ACTIVATION );
+ return createEvent( alarm.identity().get(), oldStatus, newStatus, AlarmPoint.EVENT_ACTIVATION );
}
return null;
}
@@ -238,12 +238,12 @@ public interface StandardAlarmModelService extends AlarmModel, ServiceComposite
if( oldStatus.name( null ).equals( AlarmPoint.STATUS_ACKNOWLEDGED ) )
{
AlarmStatus newStatus = createStatus( AlarmPoint.STATUS_NORMAL );
- return createEvent( ( (Identity) alarm ), oldStatus, newStatus, AlarmPoint.EVENT_DEACTIVATION );
+ return createEvent( alarm.identity().get(), oldStatus, newStatus, AlarmPoint.EVENT_DEACTIVATION );
}
else if( oldStatus.name( null ).equals( AlarmPoint.STATUS_ACTIVATED ) )
{
AlarmStatus newStatus = createStatus( AlarmPoint.STATUS_DEACTIVATED );
- return createEvent( ( (Identity) alarm ), oldStatus, newStatus, AlarmPoint.EVENT_DEACTIVATION );
+ return createEvent( alarm.identity().get(), oldStatus, newStatus, AlarmPoint.EVENT_DEACTIVATION );
}
return null;
}
@@ -261,12 +261,12 @@ public interface StandardAlarmModelService extends AlarmModel, ServiceComposite
if( oldStatus.name( null ).equals( AlarmPoint.STATUS_DEACTIVATED ) )
{
AlarmStatus newStatus = createStatus( AlarmPoint.STATUS_NORMAL );
- return createEvent( ( (Identity) alarm ), oldStatus, newStatus, AlarmPoint.EVENT_ACKNOWLEDGEMENT );
+ return createEvent( alarm.identity().get(), oldStatus, newStatus, AlarmPoint.EVENT_ACKNOWLEDGEMENT );
}
else if( oldStatus.name( null ).equals( AlarmPoint.STATUS_ACTIVATED ) )
{
AlarmStatus newStatus = createStatus( AlarmPoint.STATUS_ACKNOWLEDGED );
- return createEvent( ( (Identity) alarm ), oldStatus, newStatus, AlarmPoint.EVENT_ACKNOWLEDGEMENT );
+ return createEvent( alarm.identity().get(), oldStatus, newStatus, AlarmPoint.EVENT_ACKNOWLEDGEMENT );
}
return null;
}
@@ -288,7 +288,7 @@ public interface StandardAlarmModelService extends AlarmModel, ServiceComposite
{
ValueBuilder<AlarmEvent> builder = vbf.newValueBuilder( AlarmEvent.class );
AlarmEvent prototype = builder.prototype();
- prototype.alarmIdentity().set( alarmId.identity().get() );
+ prototype.identity().set( alarmId );
prototype.eventTime().set( Instant.now() );
prototype.newStatus().set( newStatus );
prototype.oldStatus().set( oldStatus );
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/alarm/src/test/java/org/apache/zest/library/alarm/AlarmProxyTest.java
----------------------------------------------------------------------
diff --git a/libraries/alarm/src/test/java/org/apache/zest/library/alarm/AlarmProxyTest.java b/libraries/alarm/src/test/java/org/apache/zest/library/alarm/AlarmProxyTest.java
index e14679d..d1cd9ae 100644
--- a/libraries/alarm/src/test/java/org/apache/zest/library/alarm/AlarmProxyTest.java
+++ b/libraries/alarm/src/test/java/org/apache/zest/library/alarm/AlarmProxyTest.java
@@ -20,6 +20,7 @@
package org.apache.zest.library.alarm;
+import org.apache.zest.api.identity.StringIdentity;
import org.junit.Test;
import org.apache.zest.api.injection.scope.Service;
import org.apache.zest.api.unitofwork.UnitOfWork;
@@ -59,7 +60,7 @@ public class AlarmProxyTest extends AbstractZestTest
try
{
// START SNIPPET: documentation
- myAlarmPoint = factory.create( "This Alarm Identity", "ProActiveCRM", "Sales", AlarmClass.B );
+ myAlarmPoint = factory.create( new StringIdentity( "This Alarm Identity" ), "ProActiveCRM", "Sales", AlarmClass.B );
myAlarmPoint.history().maxSize().set( 20 );
// END SNIPPET: documentation
@@ -70,7 +71,7 @@ public class AlarmProxyTest extends AbstractZestTest
assertThat( myAlarmPoint.history().activateCounter(), equalTo( 1 ) );
AlarmEvent event = myAlarmPoint.history().firstEvent();
assertThat( event, notNullValue() );
- assertThat( event.alarmIdentity().get(), equalTo( "This Alarm Identity" ) );
+ assertThat( event.identity().get(), equalTo( new StringIdentity( "This Alarm Identity" ) ) );
assertThat( event.newStatus().get().name( null ), equalTo( "Activated" ) );
assertThat( event.oldStatus().get().name( null ), equalTo( "Normal" ) );
}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/alarm/src/test/java/org/apache/zest/library/alarm/ExtendedAlarmModelTest.java
----------------------------------------------------------------------
diff --git a/libraries/alarm/src/test/java/org/apache/zest/library/alarm/ExtendedAlarmModelTest.java b/libraries/alarm/src/test/java/org/apache/zest/library/alarm/ExtendedAlarmModelTest.java
index 4fd6599..bd8f946 100644
--- a/libraries/alarm/src/test/java/org/apache/zest/library/alarm/ExtendedAlarmModelTest.java
+++ b/libraries/alarm/src/test/java/org/apache/zest/library/alarm/ExtendedAlarmModelTest.java
@@ -22,6 +22,7 @@ package org.apache.zest.library.alarm;
import java.time.Instant;
import java.util.List;
import java.util.Locale;
+import org.apache.zest.api.identity.Identity;
import org.junit.Test;
import org.apache.zest.api.entity.EntityBuilder;
import org.apache.zest.api.mixin.Mixins;
@@ -461,7 +462,7 @@ public class ExtendedAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_ACTIVATED, newstate.name( null ) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -480,7 +481,7 @@ public class ExtendedAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_DEACTIVATED, newstate.name( null ) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -500,7 +501,7 @@ public class ExtendedAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_ACKNOWLEDGED, newstate.name( null ) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -521,7 +522,7 @@ public class ExtendedAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_NORMAL, newstate.name( null ) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -542,7 +543,7 @@ public class ExtendedAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_NORMAL, newstate.name( null ) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -563,7 +564,7 @@ public class ExtendedAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_NORMAL, newstate.name( null ) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -584,7 +585,7 @@ public class ExtendedAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_NORMAL, newstate.name( null ) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -603,7 +604,7 @@ public class ExtendedAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_BLOCKED, newstate.name( null ) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -623,7 +624,7 @@ public class ExtendedAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_BLOCKED, newstate.name( null ) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -644,7 +645,7 @@ public class ExtendedAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_BLOCKED, newstate.name( null ) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -665,7 +666,7 @@ public class ExtendedAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_BLOCKED, newstate.name( null ) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -684,7 +685,7 @@ public class ExtendedAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_DISABLED, newstate.name( null ) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -704,7 +705,7 @@ public class ExtendedAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_DISABLED, newstate.name( null ) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -725,7 +726,7 @@ public class ExtendedAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_DISABLED, newstate.name( null ) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -746,7 +747,7 @@ public class ExtendedAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_DISABLED, newstate.name( null ) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -767,7 +768,7 @@ public class ExtendedAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_DISABLED, newstate.name( null ) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -788,7 +789,7 @@ public class ExtendedAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_DISABLED, newstate.name( null ) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -818,7 +819,7 @@ public class ExtendedAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_ACTIVATED, newstate.name( null ) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -838,7 +839,7 @@ public class ExtendedAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_DEACTIVATED, newstate.name( null ) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -961,7 +962,7 @@ public class ExtendedAlarmModelTest
return builder.newInstance();
}
- private AlarmPoint getAlarm( String identity )
+ private AlarmPoint getAlarm( Identity identity )
{
UnitOfWork uow = unitOfWorkFactory.currentUnitOfWork();
return uow.get( AlarmPoint.class, identity );
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/alarm/src/test/java/org/apache/zest/library/alarm/SimpleAlarmModelTest.java
----------------------------------------------------------------------
diff --git a/libraries/alarm/src/test/java/org/apache/zest/library/alarm/SimpleAlarmModelTest.java b/libraries/alarm/src/test/java/org/apache/zest/library/alarm/SimpleAlarmModelTest.java
index ae68817..4fc36d8 100644
--- a/libraries/alarm/src/test/java/org/apache/zest/library/alarm/SimpleAlarmModelTest.java
+++ b/libraries/alarm/src/test/java/org/apache/zest/library/alarm/SimpleAlarmModelTest.java
@@ -22,6 +22,7 @@ package org.apache.zest.library.alarm;
import java.time.Instant;
import java.util.List;
import java.util.Locale;
+import org.apache.zest.api.identity.Identity;
import org.junit.Test;
import org.apache.zest.api.entity.EntityBuilder;
import org.apache.zest.api.mixin.Mixins;
@@ -229,7 +230,7 @@ public class SimpleAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_ACTIVATED, newstate.name(null) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -248,7 +249,7 @@ public class SimpleAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_NORMAL, newstate.name(null) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -276,7 +277,7 @@ public class SimpleAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_ACTIVATED, newstate.name(null) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -295,7 +296,7 @@ public class SimpleAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_NORMAL, newstate.name(null) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -346,7 +347,7 @@ public class SimpleAlarmModelTest
return builder.newInstance();
}
- private AlarmPoint getAlarm( String identity )
+ private AlarmPoint getAlarm( Identity identity )
{
UnitOfWork uow = unitOfWorkFactory.currentUnitOfWork();
return uow.get( AlarmPoint.class, identity );
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/alarm/src/test/java/org/apache/zest/library/alarm/StandardAlarmModelTest.java
----------------------------------------------------------------------
diff --git a/libraries/alarm/src/test/java/org/apache/zest/library/alarm/StandardAlarmModelTest.java b/libraries/alarm/src/test/java/org/apache/zest/library/alarm/StandardAlarmModelTest.java
index 0fc022a..b02c36e 100644
--- a/libraries/alarm/src/test/java/org/apache/zest/library/alarm/StandardAlarmModelTest.java
+++ b/libraries/alarm/src/test/java/org/apache/zest/library/alarm/StandardAlarmModelTest.java
@@ -23,6 +23,7 @@ package org.apache.zest.library.alarm;
import java.time.Instant;
import java.util.List;
import java.util.Locale;
+import org.apache.zest.api.identity.Identity;
import org.junit.Assert;
import org.junit.Test;
import org.apache.zest.api.entity.EntityBuilder;
@@ -283,7 +284,7 @@ public class StandardAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
Assert.assertEquals( AlarmPoint.STATUS_ACTIVATED, newstate.name( null ) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -302,7 +303,7 @@ public class StandardAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
Assert.assertEquals( AlarmPoint.STATUS_DEACTIVATED, newstate.name( null ) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -321,7 +322,7 @@ public class StandardAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
Assert.assertEquals( AlarmPoint.STATUS_ACKNOWLEDGED, newstate.name( null ) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -341,7 +342,7 @@ public class StandardAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_NORMAL, newstate.name( null ) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -361,7 +362,7 @@ public class StandardAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_NORMAL, newstate.name( null ) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -389,7 +390,7 @@ public class StandardAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_ACTIVATED, newstate.name( null ) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -408,7 +409,7 @@ public class StandardAlarmModelTest
AlarmStatus newstate = event.newStatus().get();
assertEquals( AlarmPoint.STATUS_DEACTIVATED, newstate.name( null ) );
- AlarmPoint eventalarm = getAlarm( event.alarmIdentity().get() );
+ AlarmPoint eventalarm = getAlarm( event.identity().get() );
assertEquals( underTest, eventalarm );
}
@@ -473,7 +474,7 @@ public class StandardAlarmModelTest
return builder.newInstance();
}
- private AlarmPoint getAlarm( String identity )
+ private AlarmPoint getAlarm( Identity identity )
{
UnitOfWork uow = unitOfWorkFactory.currentUnitOfWork();
return uow.get( AlarmPoint.class, identity );
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/appbrowser/src/test/java/org/apache/zest/library/appbrowser/AppBrowserTest.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/test/java/org/apache/zest/library/appbrowser/AppBrowserTest.java b/libraries/appbrowser/src/test/java/org/apache/zest/library/appbrowser/AppBrowserTest.java
index 34fc11c..b8447bf 100644
--- a/libraries/appbrowser/src/test/java/org/apache/zest/library/appbrowser/AppBrowserTest.java
+++ b/libraries/appbrowser/src/test/java/org/apache/zest/library/appbrowser/AppBrowserTest.java
@@ -26,7 +26,7 @@ import org.apache.zest.api.association.ManyAssociation;
import org.apache.zest.api.common.Optional;
import org.apache.zest.api.concern.ConcernOf;
import org.apache.zest.api.concern.Concerns;
-import org.apache.zest.api.entity.Identity;
+import org.apache.zest.api.identity.HasIdentity;
import org.apache.zest.api.injection.scope.Service;
import org.apache.zest.api.injection.scope.This;
import org.apache.zest.api.mixin.Mixins;
@@ -62,7 +62,7 @@ public class AppBrowserTest extends AbstractZestTest
@Mixins( Person.Mixin.class )
@Concerns( Person.AgeLimitConcern.class )
- public interface Person extends Identity
+ public interface Person extends HasIdentity
{
String name();
@@ -150,14 +150,14 @@ public class AppBrowserTest extends AbstractZestTest
public interface AgeCheckService
{
- boolean checkAge( Property<String> identity, int years );
+ boolean checkAge( Property<Identity> identity, int years );
class AgeCheckerMixin
implements AgeCheckService
{
@Override
- public boolean checkAge( Property<String> identity, int years )
+ public boolean checkAge( Property<Identity> identity, int years )
{
double probabiility = years/(Math.random()*120+1);
return probabiility < 0.9;
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/circuitbreaker/src/main/java/org/apache/zest/library/circuitbreaker/jmx/CircuitBreakerManagement.java
----------------------------------------------------------------------
diff --git a/libraries/circuitbreaker/src/main/java/org/apache/zest/library/circuitbreaker/jmx/CircuitBreakerManagement.java b/libraries/circuitbreaker/src/main/java/org/apache/zest/library/circuitbreaker/jmx/CircuitBreakerManagement.java
index 2f63527..a18c356 100644
--- a/libraries/circuitbreaker/src/main/java/org/apache/zest/library/circuitbreaker/jmx/CircuitBreakerManagement.java
+++ b/libraries/circuitbreaker/src/main/java/org/apache/zest/library/circuitbreaker/jmx/CircuitBreakerManagement.java
@@ -19,8 +19,6 @@
*/
package org.apache.zest.library.circuitbreaker.jmx;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
import java.util.HashMap;
import java.util.Map;
import javax.management.JMException;
@@ -29,6 +27,7 @@ import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import org.apache.zest.api.activation.ActivatorAdapter;
import org.apache.zest.api.activation.Activators;
+import org.apache.zest.api.identity.Identity;
import org.apache.zest.api.injection.scope.Service;
import org.apache.zest.api.injection.scope.Structure;
import org.apache.zest.api.mixin.Mixins;
@@ -89,7 +88,7 @@ public interface CircuitBreakerManagement
private static final Logger LOGGER = LoggerFactory.getLogger( CircuitBreakerManagement.class );
- private final Map<CircuitBreaker, ObjectName> registeredCircuitBreakers = new HashMap<CircuitBreaker, ObjectName>();
+ private final Map<CircuitBreaker, ObjectName> registeredCircuitBreakers = new HashMap<>();
@Structure
private Application application;
@@ -121,12 +120,12 @@ public interface CircuitBreakerManagement
registeredCircuitBreakers.clear();
}
- private void registerCircuitBreaker( final CircuitBreaker circuitBreaker, final String name )
+ private void registerCircuitBreaker( final CircuitBreaker circuitBreaker, final Identity name )
throws JMException
{
- ObjectName mbeanObjectName = null;
+ ObjectName mbeanObjectName;
- ObjectName serviceName = ZestMBeans.findServiceName( server, application.name(), name );
+ ObjectName serviceName = ZestMBeans.findServiceName( server, application.name(), name.toString() );
if ( serviceName != null )
{
mbeanObjectName = new ObjectName( serviceName.toString() + ",name=Circuit breaker" );
@@ -149,26 +148,20 @@ public interface CircuitBreakerManagement
registeredCircuitBreakers.put( circuitBreaker, mbeanObjectName );
// Add logger
- circuitBreaker.addPropertyChangeListener( new PropertyChangeListener()
+ circuitBreaker.addPropertyChangeListener(evt ->
{
-
- @Override
- public void propertyChange( PropertyChangeEvent evt )
+ if ( "status".equals( evt.getPropertyName() ) )
{
- if ( "status".equals( evt.getPropertyName() ) )
+ if ( CircuitBreaker.Status.on.equals( evt.getNewValue() ) )
+ {
+ LOGGER.info( "Circuit breaker " + name + " is now on" );
+ }
+ else
{
- if ( CircuitBreaker.Status.on.equals( evt.getNewValue() ) )
- {
- LOGGER.info( "Circuit breaker " + name + " is now on" );
- }
- else
- {
- LOGGER.error( "Circuit breaker " + name + " is now off" );
- }
+ LOGGER.error( "Circuit breaker " + name + " is now off" );
}
}
-
- } );
+ });
}
}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/fileconfig/src/main/java/org/apache/zest/library/fileconfig/FileConfigurationAssembler.java
----------------------------------------------------------------------
diff --git a/libraries/fileconfig/src/main/java/org/apache/zest/library/fileconfig/FileConfigurationAssembler.java b/libraries/fileconfig/src/main/java/org/apache/zest/library/fileconfig/FileConfigurationAssembler.java
index a019937..7c8adae 100644
--- a/libraries/fileconfig/src/main/java/org/apache/zest/library/fileconfig/FileConfigurationAssembler.java
+++ b/libraries/fileconfig/src/main/java/org/apache/zest/library/fileconfig/FileConfigurationAssembler.java
@@ -45,7 +45,7 @@ public class FileConfigurationAssembler
ServiceDeclaration service = module.services( FileConfigurationService.class ).visibleIn( visibility() );
if( hasIdentity() )
{
- service.identifiedBy( identity() );
+ service.identifiedBy( identity().toString() );
}
if( override != null )
{
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/http/src/main/java/org/apache/zest/library/http/AbstractJettyMixin.java
----------------------------------------------------------------------
diff --git a/libraries/http/src/main/java/org/apache/zest/library/http/AbstractJettyMixin.java b/libraries/http/src/main/java/org/apache/zest/library/http/AbstractJettyMixin.java
index d9e5346..ad559d9 100644
--- a/libraries/http/src/main/java/org/apache/zest/library/http/AbstractJettyMixin.java
+++ b/libraries/http/src/main/java/org/apache/zest/library/http/AbstractJettyMixin.java
@@ -25,6 +25,7 @@ import javax.management.MBeanServer;
import javax.servlet.Filter;
import javax.servlet.Servlet;
import javax.servlet.ServletContextListener;
+import org.apache.zest.api.identity.Identity;
import org.eclipse.jetty.jmx.MBeanContainer;
import org.eclipse.jetty.security.SecurityHandler;
import org.eclipse.jetty.server.Connector;
@@ -53,7 +54,7 @@ public abstract class AbstractJettyMixin
implements HttpService, JettyActivation
{
- private final String identity;
+ private final Identity identity;
private final Iterable<ServiceReference<ServletContextListener>> contextListeners;
@@ -65,11 +66,11 @@ public abstract class AbstractJettyMixin
private Server server;
- public AbstractJettyMixin( String identity, Server jettyServer,
- Iterable<ServiceReference<ServletContextListener>> contextListeners,
- Iterable<ServiceReference<Servlet>> servlets,
- Iterable<ServiceReference<Filter>> filters,
- MBeanServer mBeanServer )
+ public AbstractJettyMixin(Identity identity, Server jettyServer,
+ Iterable<ServiceReference<ServletContextListener>> contextListeners,
+ Iterable<ServiceReference<Servlet>> servlets,
+ Iterable<ServiceReference<Filter>> filters,
+ MBeanServer mBeanServer )
{
this.identity = identity;
this.server = jettyServer;
@@ -109,7 +110,7 @@ public abstract class AbstractJettyMixin
buildSecurityHandler(),
new ServletHandler(),
new ErrorHandler() );
- root.setDisplayName( identity );
+ root.setDisplayName( identity.toString() );
configureContext( root, configuration() );
// Register ContextListeners, Servlets and Filters
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/http/src/main/java/org/apache/zest/library/http/JettyMixin.java
----------------------------------------------------------------------
diff --git a/libraries/http/src/main/java/org/apache/zest/library/http/JettyMixin.java b/libraries/http/src/main/java/org/apache/zest/library/http/JettyMixin.java
index f4f7e93..307722f 100644
--- a/libraries/http/src/main/java/org/apache/zest/library/http/JettyMixin.java
+++ b/libraries/http/src/main/java/org/apache/zest/library/http/JettyMixin.java
@@ -23,10 +23,10 @@ import javax.management.MBeanServer;
import javax.servlet.Filter;
import javax.servlet.Servlet;
import javax.servlet.ServletContextListener;
+import org.apache.zest.api.identity.HasIdentity;
import org.eclipse.jetty.server.Server;
import org.apache.zest.api.common.Optional;
import org.apache.zest.api.configuration.Configuration;
-import org.apache.zest.api.entity.Identity;
import org.apache.zest.api.injection.scope.Service;
import org.apache.zest.api.injection.scope.This;
import org.apache.zest.api.service.ServiceReference;
@@ -39,7 +39,7 @@ public class JettyMixin
@This
private Configuration<JettyConfiguration> configuration;
- public JettyMixin( @This Identity meAsIdentity,
+ public JettyMixin( @This HasIdentity meAsIdentity,
@Service Server jettyServer,
@Service Iterable<ServiceReference<ServletContextListener>> contextListeners,
@Service Iterable<ServiceReference<Servlet>> servlets,
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/http/src/main/java/org/apache/zest/library/http/JettyServiceAssembler.java
----------------------------------------------------------------------
diff --git a/libraries/http/src/main/java/org/apache/zest/library/http/JettyServiceAssembler.java b/libraries/http/src/main/java/org/apache/zest/library/http/JettyServiceAssembler.java
index 226d99a..7cf9357 100644
--- a/libraries/http/src/main/java/org/apache/zest/library/http/JettyServiceAssembler.java
+++ b/libraries/http/src/main/java/org/apache/zest/library/http/JettyServiceAssembler.java
@@ -61,7 +61,7 @@ public class JettyServiceAssembler
instantiateOnStartup();
if( hasIdentity() )
{
- service.identifiedBy( identity() );
+ service.identifiedBy( identity().toString() );
}
if( hasConfig() )
{
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/http/src/main/java/org/apache/zest/library/http/SecureJettyMixin.java
----------------------------------------------------------------------
diff --git a/libraries/http/src/main/java/org/apache/zest/library/http/SecureJettyMixin.java b/libraries/http/src/main/java/org/apache/zest/library/http/SecureJettyMixin.java
index c9cb925..20c3253 100644
--- a/libraries/http/src/main/java/org/apache/zest/library/http/SecureJettyMixin.java
+++ b/libraries/http/src/main/java/org/apache/zest/library/http/SecureJettyMixin.java
@@ -23,6 +23,7 @@ import javax.management.MBeanServer;
import javax.servlet.Filter;
import javax.servlet.Servlet;
import javax.servlet.ServletContextListener;
+import org.apache.zest.api.identity.HasIdentity;
import org.eclipse.jetty.security.ConstraintMapping;
import org.eclipse.jetty.security.ConstraintSecurityHandler;
import org.eclipse.jetty.security.SecurityHandler;
@@ -34,7 +35,6 @@ import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.SslConnectionFactory;
import org.apache.zest.api.common.Optional;
import org.apache.zest.api.configuration.Configuration;
-import org.apache.zest.api.entity.Identity;
import org.apache.zest.api.injection.scope.Service;
import org.apache.zest.api.injection.scope.This;
import org.apache.zest.api.service.ServiceReference;
@@ -53,7 +53,7 @@ public class SecureJettyMixin
@Service
private Iterable<ConstraintService> constraintServices;
- public SecureJettyMixin( @This Identity meAsIdentity,
+ public SecureJettyMixin( @This HasIdentity meAsIdentity,
@Service Server jettyServer,
@Service Iterable<ServiceReference<ServletContextListener>> contextListeners,
@Service Iterable<ServiceReference<Servlet>> servlets,
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/jmx/src/main/java/org/apache/zest/library/jmx/ApplicationManagerService.java
----------------------------------------------------------------------
diff --git a/libraries/jmx/src/main/java/org/apache/zest/library/jmx/ApplicationManagerService.java b/libraries/jmx/src/main/java/org/apache/zest/library/jmx/ApplicationManagerService.java
index ac12faf..bd49b92 100644
--- a/libraries/jmx/src/main/java/org/apache/zest/library/jmx/ApplicationManagerService.java
+++ b/libraries/jmx/src/main/java/org/apache/zest/library/jmx/ApplicationManagerService.java
@@ -64,7 +64,7 @@ import static org.apache.zest.functional.Iterables.first;
* <pre>
* Zest:application=MyApp,layer=Application,module=MyModule,class=Service,service=MyService,name=Configuration
* </pre>
- * Use the following snippet to find the ObjectName of a service with a given identity:
+ * Use the following snippet to find the ObjectName of a service with a given reference:
* <pre>
* ObjectName serviceName = ZestMBeans.findService(mbeanServer, applicationName, serviceId);
* </pre>
@@ -169,7 +169,7 @@ public interface ApplicationManagerService
ObjectName objectName = new ObjectName( names.peek()
.toString() + ",class=Service,service=" + serviceDescriptor
.identity() );
- RequiredModelMBean mbean = new ModelMBeanBuilder( objectName, serviceDescriptor.identity(), ServiceBean.class
+ RequiredModelMBean mbean = new ModelMBeanBuilder( objectName, serviceDescriptor.identity().toString(), ServiceBean.class
.getName() ).
attribute( "Id", "Service id", String.class.getName(), "Id of service", "getId", null ).
attribute( "Visibility", "Service visibility", String.class.getName(), "Visibility of service", "getVisibility", null )
@@ -195,7 +195,7 @@ public interface ApplicationManagerService
ObjectName objectName = new ObjectName( names.peek()
.toString() + ",class=Imported service,importedservice=" + importedServiceDescriptor
.identity() );
- RequiredModelMBean mbean = new ModelMBeanBuilder( objectName, importedServiceDescriptor.identity(), ImportedServiceBean.class
+ RequiredModelMBean mbean = new ModelMBeanBuilder( objectName, importedServiceDescriptor.identity().toString(), ImportedServiceBean.class
.getName() ).
attribute( "Id", "Service id", String.class.getName(), "Id of service", "getId", null ).
attribute( "Visibility", "Service visibility", String.class.getName(), "Visibility of service", "getVisibility", null )
@@ -289,7 +289,7 @@ public interface ApplicationManagerService
public String getId()
{
- return serviceDescriptor.identity();
+ return serviceDescriptor.identity().toString();
}
public String getVisibility()
@@ -310,7 +310,7 @@ public interface ApplicationManagerService
public boolean isActive()
{
Class<?> mainType = serviceDescriptor.types().findFirst().orElse( null );
- ServiceReference<?> first = first( filter( withId( serviceDescriptor.identity() ),
+ ServiceReference<?> first = first( filter( withId( serviceDescriptor.identity().toString() ),
module.findServices( mainType ) )
);
return first != null && first.isActive();
@@ -319,7 +319,7 @@ public interface ApplicationManagerService
public boolean isAvailable()
{
Class<?> mainType = serviceDescriptor.types().findFirst().orElse( null );
- ServiceReference<?> first = first( filter( withId( serviceDescriptor.identity() ),
+ ServiceReference<?> first = first( filter( withId( serviceDescriptor.identity().toString() ),
module.findServices( mainType ) )
);
return first != null && first.isAvailable();
@@ -328,7 +328,7 @@ public interface ApplicationManagerService
public String restart()
{
Iterable<?> services = module.findServices( serviceDescriptor.types().findFirst().orElse( null ) );
- ServiceReference<?> serviceRef = (ServiceReference) first( filter( withId( serviceDescriptor.identity() ),
+ ServiceReference<?> serviceRef = (ServiceReference) first( filter( withId( serviceDescriptor.identity().toString() ),
services )
);
if( serviceRef != null )
@@ -362,7 +362,7 @@ public interface ApplicationManagerService
public String getId()
{
- return serviceDescriptor.identity();
+ return serviceDescriptor.identity().toString();
}
public String getVisibility()
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/jmx/src/main/java/org/apache/zest/library/jmx/ConfigurationManagerService.java
----------------------------------------------------------------------
diff --git a/libraries/jmx/src/main/java/org/apache/zest/library/jmx/ConfigurationManagerService.java b/libraries/jmx/src/main/java/org/apache/zest/library/jmx/ConfigurationManagerService.java
index 0a3be5b..3245d6f 100644
--- a/libraries/jmx/src/main/java/org/apache/zest/library/jmx/ConfigurationManagerService.java
+++ b/libraries/jmx/src/main/java/org/apache/zest/library/jmx/ConfigurationManagerService.java
@@ -57,6 +57,8 @@ import org.apache.zest.api.composite.CompositeInstance;
import org.apache.zest.api.configuration.Configuration;
import org.apache.zest.api.entity.EntityComposite;
import org.apache.zest.api.entity.EntityDescriptor;
+import org.apache.zest.api.identity.Identity;
+import org.apache.zest.api.identity.StringIdentity;
import org.apache.zest.api.injection.scope.Service;
import org.apache.zest.api.injection.scope.Structure;
import org.apache.zest.api.mixin.Mixins;
@@ -66,7 +68,6 @@ import org.apache.zest.api.service.ServiceComposite;
import org.apache.zest.api.service.ServiceDescriptor;
import org.apache.zest.api.service.ServiceReference;
import org.apache.zest.api.structure.Application;
-import org.apache.zest.api.structure.Module;
import org.apache.zest.api.structure.ModuleDescriptor;
import org.apache.zest.api.type.EnumType;
import org.apache.zest.api.unitofwork.UnitOfWork;
@@ -155,7 +156,6 @@ public interface ConfigurationManagerService
}
String serviceClass = compositeInstance.types().findFirst().get().getName();
- String name = configurableService.identity();
ServiceDescriptor serviceDescriptor = spi.serviceDescriptorFor( configurableService );
ModuleDescriptor module = spi.moduleOf( configurableService );
Class<Object> configurationClass = serviceDescriptor.configurationType();
@@ -204,18 +204,19 @@ public interface ConfigurationManagerService
List<MBeanOperationInfo> operations = new ArrayList<>();
operations.add( new MBeanOperationInfo( "restart", "Restart service", new MBeanParameterInfo[ 0 ], "java.lang.String", MBeanOperationInfo.ACTION_INFO ) );
- MBeanInfo mbeanInfo = new MBeanInfo( serviceClass, name, attributes.toArray( new MBeanAttributeInfo[ attributes
+ String mbeanName = configurableService.identity().toString();
+ MBeanInfo mbeanInfo = new MBeanInfo( serviceClass, mbeanName, attributes.toArray( new MBeanAttributeInfo[ attributes
.size() ] ), null, operations.toArray( new MBeanOperationInfo[ operations.size() ] ), null );
- Object mbean = new ConfigurableService( configurableService, mbeanInfo, name, properties );
+ Object mbean = new ConfigurableService( configurableService, mbeanInfo, mbeanName, properties );
ObjectName configurableServiceName;
- ObjectName serviceName = ZestMBeans.findServiceName( server, application.name(), name );
+ ObjectName serviceName = ZestMBeans.findServiceName( server, application.name(), mbeanName );
if( serviceName != null )
{
configurableServiceName = new ObjectName( serviceName.toString() + ",name=Configuration" );
}
else
{
- configurableServiceName = new ObjectName( "Configuration:name=" + name );
+ configurableServiceName = new ObjectName( "Configuration:name=" + mbeanName );
}
server.registerMBean( mbean, configurableServiceName );
@@ -238,13 +239,13 @@ public interface ConfigurationManagerService
implements DynamicMBean
{
MBeanInfo info;
- String identity;
+ Identity identity;
Map<String, AccessibleObject> propertyNames;
EditableConfiguration( MBeanInfo info, String identity, Map<String, AccessibleObject> propertyNames )
{
this.info = info;
- this.identity = identity;
+ this.identity = new StringIdentity(identity);
this.propertyNames = propertyNames;
}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/lang-scala/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/build.gradle b/libraries/lang-scala/build.gradle
deleted file mode 100644
index dfb05a4..0000000
--- a/libraries/lang-scala/build.gradle
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
- *
- */
-
-description = "Apache Zest\u2122 Scala Library allows for Mixins to be implemented in Scala."
-
-jar { manifest { name = "Apache Zest\u2122 Library - Scripting - Scala" }}
-
-apply plugin: 'scala'
-
-tasks.withType(ScalaCompile) {
- configure( scalaCompileOptions.forkOptions ) {
- memoryMaximumSize = '1g'
- }
- // ZEST-175
- if( JavaVersion.current() >= JavaVersion.VERSION_1_9 ) {
- enabled = false
- }
-}
-
-dependencies {
- compile project( ':org.apache.zest.core:org.apache.zest.core.bootstrap' )
- compile libraries.scala
-
- testCompile project( ':org.apache.zest.core:org.apache.zest.core.testsupport' )
- testCompile project( ':org.apache.zest.extensions:org.apache.zest.extension.indexing-rdf' )
-
- testRuntime project( ':org.apache.zest.core:org.apache.zest.core.runtime' )
- testRuntime libraries.slf4j_simple
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/lang-scala/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/dev-status.xml b/libraries/lang-scala/dev-status.xml
deleted file mode 100644
index ceee3a0..0000000
--- a/libraries/lang-scala/dev-status.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you 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.
- ~
- ~
- -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
- http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
- <status>
- <!--none,early,beta,stable,mature-->
- <codebase>beta</codebase>
-
- <!-- none, brief, good, complete -->
- <documentation>brief</documentation>
-
- <!-- none, some, good, complete -->
- <unittests>some</unittests>
- </status>
- <licenses>
- <license>ALv2</license>
- </licenses>
-</module>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/lang-scala/src/docs/lang-scala.txt
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/docs/lang-scala.txt b/libraries/lang-scala/src/docs/lang-scala.txt
deleted file mode 100644
index 725d4da..0000000
--- a/libraries/lang-scala/src/docs/lang-scala.txt
+++ /dev/null
@@ -1,117 +0,0 @@
-///////////////////////////////////////////////////////////////
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
-///////////////////////////////////////////////////////////////
-
-[[lang-scala, Scala Library]]
-= Scala Support =
-
-[devstatus]
---------------
-source=libraries/lang-scala/dev-status.xml
---------------
-
-The Scala Support Library allows Fragments and Composites to be written as Scala traits.
-
-include::../../build/docs/buildinfo/artifact.txt[]
-
-The Scala Support Library is a Generic mixin class that implements Composites by delegating to Scala traits.
-
-
-== Composition ==
-
-Example mixin declaration:
-[snippet,scala]
-----
-source=libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldMixin2.scala
-tag=mixin
-----
-
-Example composite declaration:
-[snippet,scala]
-----
-source=libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldComposite.scala
-tag=composite
-----
-
-Example typed concern:
-[snippet,scala]
-----
-source=libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloThereConcern.scala
-tag=typedconcern
-----
-
-Example generic concern with filter:
-[snippet,scala]
-----
-source=libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/ExclamationGenericConcern.scala
-tag=genericconcern
-----
-
-And the assembly code.
-Note that the `ScalaTraitMixin` must be added.
-[snippet,java]
-----
-source=libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldCompositeTest.java
-tag=composite
-----
-
-That pretty much covers the domain model part.
-Usage from Java is transparent, since it looks just like interfaces and classes.
-
-
-== Entity composites ==
-
-The following example separate between command interface (suggestions to change), events (after the fact), and data, so they are in three separate traits below.
-Only commands are called by client code.
-
-[snippet,scala]
-----
-source=libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/TestEntity.scala
-tag=entity
-----
-
-The `self` operator thing solves the `@This` injection requirements, although it doesn't do private injections (i.e. the Entity *has* to extend Events and Data for it to work).
-
-Everything is statically typed.
-
-And the corresponding assembly code:
-
-[snippet,java]
-----
-source=libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldCompositeTest.java
-tag=entity
-----
-
-
-== Services composites ==
-
-The following example is a pretty simple service written as a Scala trait:
-
-[snippet,scala]
-----
-source=libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/TestService.scala
-tag=service
-----
-
-And the corresponding assembly code:
-
-[snippet,java]
-----
-source=libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldCompositeTest.java
-tag=service
-----
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/lang-scala/src/main/java/org/apache/zest/library/scala/ScalaTraitMixin.java
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/main/java/org/apache/zest/library/scala/ScalaTraitMixin.java b/libraries/lang-scala/src/main/java/org/apache/zest/library/scala/ScalaTraitMixin.java
deleted file mode 100644
index c1c31d1..0000000
--- a/libraries/lang-scala/src/main/java/org/apache/zest/library/scala/ScalaTraitMixin.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.zest.library.scala;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.zest.api.ZestAPI;
-import org.apache.zest.api.common.AppliesTo;
-import org.apache.zest.api.common.AppliesToFilter;
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.api.composite.CompositeInstance;
-import org.apache.zest.api.injection.scope.Service;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.injection.scope.This;
-import org.apache.zest.api.service.ServiceReference;
-import org.apache.zest.api.structure.ModuleDescriptor;
-import org.apache.zest.api.util.Classes;
-import org.apache.zest.spi.ZestSPI;
-
-import static org.apache.zest.api.util.Classes.interfacesOf;
-
-/**
- * Generic mixin that handles delegation to Scala trait implementations.
- */
-@AppliesTo( ScalaTraitMixin.TraitFilter.class )
-public class ScalaTraitMixin
- implements InvocationHandler
-{
- private static Map<Class<?>, Map<Method, InvocationHandler>> methods = new HashMap<>();
-
- @Structure
- private ZestSPI spi;
-
- private Class<?> compositeType;
-
- public ScalaTraitMixin( @This Composite composite )
- {
- compositeType = ZestAPI.FUNCTION_DESCRIPTOR_FOR.apply( composite ).primaryType();
- }
-
- @Override
- public Object invoke( Object composite, Method method, Object[] args )
- throws Throwable
- {
- InvocationHandler handler = methods.get( compositeType ).get( method );
- return handler.invoke( composite, method, args );
- }
-
- public static class TraitFilter
- implements AppliesToFilter
- {
- @Override
- public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> fragmentClass )
- {
- if( isScalaTrait( method.getDeclaringClass() ) )
- {
- // Service injection
- if( method.getAnnotation( Service.class ) != null )
- {
- if( method.getReturnType().equals( ServiceReference.class ) )
- {
- InvocationHandler handler = new InvocationHandler()
- {
- @Override
- public Object invoke( Object composite, Method method, Object[] objects )
- throws Throwable
- {
- CompositeInstance compositeInstance = (CompositeInstance) Proxy.getInvocationHandler( composite );
- ModuleDescriptor moduleDescriptor = compositeInstance.module();
- return moduleDescriptor.instance().findService( method.getReturnType() );
- }
- };
- getHandlers( compositeType ).put( method, handler );
- }
- else
- {
- InvocationHandler handler = new InvocationHandler()
- {
- @Override
- public Object invoke( Object composite, Method method, Object[] objects )
- throws Throwable
- {
- CompositeInstance compositeInstance = (CompositeInstance) Proxy.getInvocationHandler( composite );
- ModuleDescriptor moduleDescriptor = compositeInstance.module();
- return moduleDescriptor.instance().findService( method.getReturnType() ).get();
- }
- };
- getHandlers( compositeType ).put( method, handler );
- }
- return true;
- }
-
- final Class<?> declaringClass = method.getDeclaringClass();
- Class traitClass = interfacesOf( compositeType ).map( Classes.RAW_CLASS )
- .filter( declaringClass::isAssignableFrom )
- .reduce( null, ( current, type ) -> {
- try
- {
- type.getClassLoader().loadClass( type.getName() + "$class" );
- if( current == null )
- {
- return type;
- }
- else
- {
- return current.isAssignableFrom( type ) ? type : current;
- }
- }
- catch( ClassNotFoundException e )
- {
- // Ignore - no trait implementation found
- }
- return current;
- }
- );
-
-// Class traitClass = Iterables.last( Iterables.map( new Function<Class, Class>()
-// {
-// Class current;
-//
-// @Override
-// public Class apply( Class aClass )
-// {
-// if( declaringClass.isAssignableFrom( aClass ) )
-// {
-// try
-// {
-// aClass.getClassLoader().loadClass( aClass.getName() + "$class" );
-//
-// if( current == null )
-// {
-// current = aClass;
-// }
-// else
-// {
-// current = current.isAssignableFrom( aClass ) ? aClass : current;
-// }
-// }
-// catch( ClassNotFoundException e )
-// {
-// // Ignore - no trait implementation found
-// }
-// }
-//
-// return current;
-// }
-// }, Iterables.map( Classes.RAW_CLASS, interfacesOf( compositeType ) ) ) );
-
- if( traitClass == null )
- {
- return false;
- }
-
- try
- {
- Class traitMixin = traitClass.getClassLoader().loadClass( traitClass.getName() + "$class" );
- Class<?>[] methodParameterTypes = method.getParameterTypes();
- Class[] parameterTypes = new Class[ 1 + methodParameterTypes.length ];
- parameterTypes[ 0 ] = traitClass;
- System.arraycopy( methodParameterTypes, 0, parameterTypes, 1, methodParameterTypes.length );
- final Method traitMethod = traitMixin.getMethod( method.getName(), parameterTypes );
-
- Map<Method, InvocationHandler> handlers = getHandlers( compositeType );
-
- handlers.put( method, ( composite, method1, args ) -> {
- if( args != null )
- {
- Object[] params = new Object[ args.length + 1 ];
- params[ 0 ] = composite;
- System.arraycopy( args, 0, params, 1, args.length );
-
- return traitMethod.invoke( null, params );
- }
- else
- {
- return traitMethod.invoke( null, composite );
- }
- } );
-
- return true;
- }
- catch( ClassNotFoundException e )
- {
- return false;
- }
- catch( NoSuchMethodException e )
- {
- return false;
- }
- }
- else
- {
- return false;
- }
- }
-
- private boolean isScalaTrait( Class<?> declaringClass )
- {
- for( Annotation annotation : declaringClass.getAnnotations() )
- {
- if( annotation.annotationType().getSimpleName().equals( "ScalaSignature" ) )
- {
- return true;
- }
- }
- return false;
- }
-
- private Map<Method, InvocationHandler> getHandlers( Class<?> compositeType )
- {
- Map<Method, InvocationHandler> handlerMap = methods.get( compositeType );
- if( handlerMap == null )
- {
- handlerMap = new HashMap<>();
- methods.put( compositeType, handlerMap );
- }
- return handlerMap;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/lang-scala/src/main/java/org/apache/zest/library/scala/package.html
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/main/java/org/apache/zest/library/scala/package.html b/libraries/lang-scala/src/main/java/org/apache/zest/library/scala/package.html
deleted file mode 100644
index 8b1988e..0000000
--- a/libraries/lang-scala/src/main/java/org/apache/zest/library/scala/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you 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.
- ~
- ~
- -->
-<html>
- <body>
- <h2>Scala Language Support Library.</h2>
- </body>
-</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/ExclamationGenericConcern.scala
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/ExclamationGenericConcern.scala b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/ExclamationGenericConcern.scala
deleted file mode 100644
index 8ad8b29..0000000
--- a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/ExclamationGenericConcern.scala
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.zest.library.scala
-
-import java.lang.reflect.Method
-import org.apache.zest.api.concern.GenericConcern
-import org.apache.zest.api.common.{AppliesToFilter, AppliesTo}
-
-/**
- * Add an exclamation mark to the returned string
- */
-// START SNIPPET: genericconcern
-@AppliesTo(Array(classOf[ StringFilter ]))
-class ExclamationGenericConcern
- extends GenericConcern
-{
- def invoke(composite: AnyRef, method: Method, args: Array[ AnyRef ] ) = next.invoke(composite, method, args) + "!"
-}
-
-class StringFilter
- extends AppliesToFilter
-{
- def appliesTo(method: Method, mixin: Class[ _ ], compositeType: Class[ _ ], fragmentClass: Class[ _ ] ) = method
- .getReturnType
- .equals(classOf[ String ])
-}
-// END SNIPPET: genericconcern
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloThereConcern.scala
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloThereConcern.scala b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloThereConcern.scala
deleted file mode 100644
index 276c144..0000000
--- a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloThereConcern.scala
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.zest.library.scala
-
-import org.apache.zest.api.concern.ConcernOf
-
-// START SNIPPET: typedconcern
-class HelloThereConcern
- extends ConcernOf[ HelloWorldMixin2 ] with HelloWorldMixin2
-{
- override def sayHello(name: String ) = next.sayHello("there " + name)
-}
-// END SNIPPET: typedconcern
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldComposite.scala
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldComposite.scala b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldComposite.scala
deleted file mode 100644
index bf496a2..0000000
--- a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldComposite.scala
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.zest.library.scala
-
-import org.apache.zest.api.composite.TransientComposite
-import org.apache.zest.api.concern.Concerns
-
-// START SNIPPET: composite
-@Concerns(Array(classOf[ HelloThereConcern ]))
-trait HelloWorldComposite
- extends TransientComposite with HelloWorldMixin with HelloWorldMixin2
-// END SNIPPET: composite
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldComposite2.scala
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldComposite2.scala b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldComposite2.scala
deleted file mode 100644
index bb7ba31..0000000
--- a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldComposite2.scala
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.zest.library.scala
-
-trait HelloWorldComposite2
- extends HelloWorldComposite with HelloWorldMixin3
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldCompositeTest.java
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldCompositeTest.java b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldCompositeTest.java
deleted file mode 100644
index d231fab..0000000
--- a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldCompositeTest.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.zest.library.scala;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.apache.zest.api.constraint.ConstraintViolationException;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.bootstrap.SingletonAssembler;
-import org.apache.zest.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
-import org.apache.zest.index.rdf.assembly.RdfMemoryStoreAssembler;
-import org.apache.zest.spi.query.IndexExporter;
-import org.apache.zest.test.EntityTestAssembler;
-
-import static org.apache.zest.api.query.QueryExpressions.eq;
-import static org.apache.zest.api.query.QueryExpressions.templateFor;
-
-/**
- * TODO
- */
-public class HelloWorldCompositeTest
-{
- @Test
- public void testComposite()
- throws Exception
- {
- SingletonAssembler assembler = new SingletonAssembler()
- {
- @Override
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- // START SNIPPET: composite
- module.transients( HelloWorldComposite.class, HelloWorldComposite2.class ).
- withMixins( ScalaTraitMixin.class ).
- withConcerns( ExclamationGenericConcern.class );
- // END SNIPPET: composite
- }
- };
-
- HelloWorldComposite composite = assembler.module().newTransient( HelloWorldComposite.class );
- Assert.assertEquals( "Do stuff!", composite.doStuff() );
- Assert.assertEquals( "Hello there World!", composite.sayHello( "World" ) );
-
- try
- {
- composite.sayHello( "AReallyReallyLongName" );
- }
- catch( ConstraintViolationException e )
- {
- // Ok!
- }
-
- HelloWorldComposite2 composite2 = assembler.module().newTransient( HelloWorldComposite2.class );
- Assert.assertEquals( "Do custom stuff!", composite2.doStuff() );
- }
-
- @Test
- public void testEntity()
- throws Exception
- {
- SingletonAssembler assembler = new SingletonAssembler()
- {
- @Override
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- // START SNIPPET: entity
- module.entities( TestEntity.class ).withMixins( ScalaTraitMixin.class );
- // END SNIPPET: entity
- // START SNIPPET: service
- module.services( TestService.class ).withMixins( ScalaTraitMixin.class );
- // END SNIPPET: service
-
- new EntityTestAssembler().assemble( module );
- new RdfMemoryStoreAssembler().assemble( module );
- new DefaultUnitOfWorkAssembler().assemble( module );
- }
- };
-
- // Create and update Entity
- UnitOfWork uow = assembler.module().unitOfWorkFactory().newUnitOfWork();
- try
- {
- Commands entity = uow.newEntity( Commands.class );
- entity.updateFoo( "Foo" );
-
- Data data = uow.get( Data.class, entity.toString() );
-
- Assert.assertEquals( "FooFoo", data.foo().get() );
- }
- finally
- {
- uow.complete();
- }
-
- assembler.module().findService( IndexExporter.class ).get().exportReadableToStream( System.out );
-
- // Find it
- uow = assembler.module().unitOfWorkFactory().newUnitOfWork();
- try
- {
- Data data = uow.newQuery( assembler.module()
- .newQueryBuilder( Data.class )
- .where( eq( templateFor( Data.class ).foo(), "FooFoo" ) ) ).find();
- Assert.assertEquals( "FooFoo", data.foo().get() );
- }
- finally
- {
- uow.discard();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldMixin.scala
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldMixin.scala b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldMixin.scala
deleted file mode 100644
index 217e8e8..0000000
--- a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldMixin.scala
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.zest.library.scala
-
-trait HelloWorldMixin
-{
- def doStuff(): String =
- {
- "Do stuff"
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldMixin2.scala
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldMixin2.scala b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldMixin2.scala
deleted file mode 100644
index 76e22ae..0000000
--- a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldMixin2.scala
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.zest.library.scala
-
-import org.apache.zest.library.constraints.annotation.MaxLength
-
-// START SNIPPET: mixin
-trait HelloWorldMixin2
-{
- def sayHello(@MaxLength(10) name: String ): String = "Hello " + name
-}
-// END SNIPPET: mixin
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldMixin3.scala
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldMixin3.scala b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldMixin3.scala
deleted file mode 100644
index 24ee34f..0000000
--- a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldMixin3.scala
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.zest.library.scala
-
-/**
- * TODO
- */
-
-trait HelloWorldMixin3
- extends HelloWorldMixin
-{
- override def doStuff() = "Do custom stuff"
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/TestEntity.scala
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/TestEntity.scala b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/TestEntity.scala
deleted file mode 100644
index e5e2c9e..0000000
--- a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/TestEntity.scala
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.zest.library.scala
-
-import org.apache.zest.api.entity.EntityComposite
-import org.apache.zest.api.injection.scope.Service
-import org.apache.zest.api.common.UseDefaults
-import org.apache.zest.api.property.Property
-
-/**
- * Test entity
- */
- // START SNIPPET: entity
-trait TestEntity
- extends EntityComposite with Commands with Events with Data
-
-trait Commands
-{
- self: Events =>
- def updateFoo(newValue: String )
- {
- // Call "injected" service
- val repeated = testService.repeat(newValue)
-
- // Check here if input is ok
- updatedFoo(repeated)
- }
-
- // Service injection - this is really a method call to the ServiceFinder of the composite
- @Service
- def testService: TestService
-}
-
-// Raw data of entity goes here
-trait Data
-{
- @UseDefaults
- def foo: Property[ String ]
-
- // Define property
- def foo_=(v: String ) { foo.set(v) } // Operator overloading for =
-}
-
-trait Events
-{
- self: Data =>
- def updatedFoo(newValue: String )
- {
- // Register change by modifying state
- foo = newValue
- }
-}
-// END SNIPPET: entity
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/TestService.scala
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/TestService.scala b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/TestService.scala
deleted file mode 100644
index 95c6f1d..0000000
--- a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/TestService.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.zest.library.scala
-
-import org.apache.zest.api.service.ServiceComposite
-
-/**
- * Test service that repeats given string
- */
- // START SNIPPET: service
-trait TestService
- extends ServiceComposite
-{
- def repeat(input: String ): String = input + input
-}
-// END SNIPPET: service
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/logging/src/main/java/org/apache/zest/library/logging/debug/service/DebuggingServiceMixin.java
----------------------------------------------------------------------
diff --git a/libraries/logging/src/main/java/org/apache/zest/library/logging/debug/service/DebuggingServiceMixin.java b/libraries/logging/src/main/java/org/apache/zest/library/logging/debug/service/DebuggingServiceMixin.java
index 5d8fd9c..3c2c1ac 100644
--- a/libraries/logging/src/main/java/org/apache/zest/library/logging/debug/service/DebuggingServiceMixin.java
+++ b/libraries/logging/src/main/java/org/apache/zest/library/logging/debug/service/DebuggingServiceMixin.java
@@ -144,7 +144,7 @@ public class DebuggingServiceMixin
EntityBuilder<ServiceDebugRecordEntity> builder = uow.newEntityBuilder( ServiceDebugRecordEntity.class );
ServiceDebugRecordEntity state = builder.instance();
setStandardStuff( composite, message, state, params );
- state.source().set( ( (ServiceComposite) composite ).identity().get() );
+ state.source().set( ( (ServiceComposite) composite ).identity().get().toString() );
ServiceDebugRecordEntity slr = builder.newInstance();
}
else if( composite instanceof EntityComposite )