Skip to content
Browse files

removed duplicate classes

  • Loading branch information...
1 parent 26f537b commit 8c587e550b28ed3b01eb655349dbc3e4fc063648 Burt Beckwith committed Jan 8, 2013
View
37 test/integration/grails_akka/actor/BaseActor.groovy
@@ -1,37 +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 grails_akka.actor
-
-import akka.actor.UntypedActor
-import akka.event.*
-
-
-/**
- * Abstract base actor class, to use (when desired) as base class for all other messages here.
- */
-public abstract class BaseActor extends UntypedActor
-{
- LoggingAdapter log = Logging.getLogger(getContext().system(), this);
-
- @Override
- public void onReceive(Object message) throws Exception
- {
- // do nothing here ... but override in subclasses
- // String messageClassName = message?.getClass()?.getName();
- }
-
-}
View
88 test/integration/grails_akka/actor/GreetingActor.groovy
@@ -1,88 +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 grails_akka.actor
-
-import akka.actor.UntypedActor
-import akka.event.*
-
-import grails_akka.actor.*
-import grails_akka.command.*
-import grails_akka.message.*
-
-
-/**
- * Greeting actor, as a sample.
- * <br/>
- * This code is derived from Akka Samples.
- */
-public class GreetingActor extends UntypedActor
-{
- LoggingAdapter log = Logging.getLogger(getContext().system(), this)
-
- @Override
- public void onReceive(Object message) throws Exception
- {
- String messageClassName = message?.getClass()?.getName();
-
- if (message == null)
- {
- log.warning("$messageClassName: null message")
- unhandled(message)
- }
- else if (message instanceof Greeting)
- {
- log.info("$messageClassName: Hello \"" + ((Greeting) message)?.who + "\"")
- }
- // else if (message instanceof BaseMessage) // but it's abstract ...
- // {
- // log.info("$messageClassName: Hello BaseMessage instance")
- // }
- else if (message instanceof Stop)
- {
- log.info(messageClassName + ": " + "Stop this actor now ...")
- // Stops this actor and all its supervised children
- getContext().stop(getSelf())
- }
- else if (message instanceof Shutdown)
- {
- log.info(messageClassName + ": " + "Shutdown this akka system now ...")
- // Shutdown the entire akka system
- getContext.getSystem().shutdown()
- }
- else if (message instanceof Wait)
- {
- long sleep = ((Wait) message).msec
- log.info(messageClassName + ": " + "Waiting for " + sleep + " milliseconds now ...")
- // Sleep this actor for the given time
- long startSleep = System.currentTimeMillis()
- // sleep this actor
- // note that this is not the right way, but should be ok in this small test ...
- // because Thread.sleep breaks actors management as it will monopolize all threads of the used executor
- Thread.sleep(sleep)
- // TODO: probably it's needed something like this
- // getContext.getSystem().getScheduler().scheduleOnce(sleep, sender, "Done")
- long stopSleep = System.currentTimeMillis()
- log.info("Wait: " + "End Waiting, after " + (stopSleep - startSleep) + " milliseconds.")
- }
- else
- {
- log.warning("Unknown message type $messageClassName, contents: \"" + message?.toString() + "\"")
- unhandled(message)
- }
- }
-
-}
View
62 test/integration/grails_akka/command/ActorCommand.groovy
@@ -1,62 +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 grails_akka.command
-
-import akka.actor.*
-
-import groovy.transform.*
-
-
-/**
- * Command that send the given message to the given actor.
- */
-@EqualsAndHashCode
-// @Immutable
-@ToString
-public class ActorCommand implements Command
-{
- // read only properties, with public getter generated by Groovy, but not setter
- final ActorRef actor;
- final Serializable message;
-
- /**
- * Constructor
- *
- * @param actor
- * The Actor Reference, must be not null.
- *
- * @param message
- * The Serializable message to send, must be not null.
- */
- public ActorCommand(ActorRef actor, Serializable message)
- {
- if (actor == null)
- throw new IllegalArgumentException("actor must be not null.");
- if (message == null)
- throw new IllegalArgumentException("message must be not null.");
-
- this.actor = actor;
- this.message = message;
- }
-
- @Override
- public void execute()
- {
- actor.tell(message);
- }
-
-}
View
25 test/integration/grails_akka/command/Command.groovy
@@ -1,25 +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 grails_akka.command
-
-/**
- * The Command pattern.
- */
-public interface Command
-{
- public void execute();
-}
View
43 test/integration/grails_akka/command/GenericCommand.groovy
@@ -1,43 +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 grails_akka.command
-
-/**
- * GenericCommand, with command details in the given map.
- * <br/>
- * Subclass and override the execute method for similar concrete implementation of command.
- */
-public class GenericCommand implements Command
-{
- // read only property, with public getter generated by Groovy, but not setter
- final Map arguments;
-
- public GenericCommand(Map arguments)
- {
- if (arguments == null)
- throw new IllegalArgumentException("arguments Map must be not null.");
-
- this.arguments = arguments;
- }
-
- @Override
- public void execute()
- {
- // do nothing here ... but override in subclasses
- }
-
-}
View
25 test/integration/grails_akka/command/GenericCommandArguments.groovy
@@ -1,25 +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 grails_akka.command
-
-/**
- * Enum with standard keys to use as keys (but as Strings) in the GenericCommand arguments map.
- */
-public enum GenericCommandArguments
-{
- NAME
-}
View
33 test/integration/grails_akka/message/BaseMessage.groovy
@@ -1,33 +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 grails_akka.message
-
-/**
- * Abstract base message class, to use (when desired) as base class for all other messages here.
- * <br/>
- * Used a kind of message to send to actors.
- * <br/>
- * This code is derived from Akka Samples.
- */
-public abstract class BaseMessage implements Serializable
-{
-
- public BaseMessage()
- {
- }
-
-}
View
39 test/integration/grails_akka/message/GenericMessage.groovy
@@ -1,39 +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 grails_akka.message
-
-import groovy.transform.*
-
-
-/**
- * GenericMessage.
- * <br/>
- * Used a kind of message to send to actors.
- */
-@EqualsAndHashCode
-@ToString
-public class GenericMessage<T> extends BaseMessage implements Serializable
-{
- // read only property, with public getter generated by Groovy, but not setter
- final T message;
-
- public GenericMessage(T message)
- {
- this.message = message;
- }
-
-}
View
35 test/integration/grails_akka/message/Greeting.groovy
@@ -1,35 +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 grails_akka.message
-
-/**
- * Greeting message, as a sample.
- * <br/>
- * Used a kind of message to send to actors.
- * <br/>
- * This code is derived from Akka Samples.
- */
-public class Greeting implements Serializable
-{
- public final String who;
-
- public Greeting(String who)
- {
- this.who = who;
- }
-
-}
View
45 test/integration/grails_akka/message/ImmutableMessage.groovy
@@ -1,45 +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 grails_akka.message
-
-/**
- * ImmutableMessage, as a sample.
- * <br/>
- * Used a kind of message to send to actors.
- * <br/>
- * This code is derived from Akka Samples.
- */
-public class ImmutableMessage
-{
- private final int sequenceNumber;
- private final List<String> values;
-
- public ImmutableMessage(int sequenceNumber, List<String> values)
- {
- this.sequenceNumber = sequenceNumber;
- this.values = Collections.unmodifiableList(new ArrayList<String>(values));
- }
-
- public int getSequenceNumber() {
- return sequenceNumber;
- }
-
- public List<String> getValues() {
- return values;
- }
-
-}
View
33 test/integration/grails_akka/message/Shutdown.groovy
@@ -1,33 +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 grails_akka.message
-
-import groovy.transform.*
-
-
-/**
- * Shutdown message, as a sample.
- * <br/>
- * Used a kind of message to send to actors.
- */
-// @EqualsAndHashCode
-@Immutable
-// @ToString
-public class Shutdown extends BaseMessage implements Serializable
-{
-
-}
View
33 test/integration/grails_akka/message/Stop.groovy
@@ -1,33 +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 grails_akka.message
-
-import groovy.transform.*
-
-
-/**
- * Stop message, as a sample.
- * <br/>
- * Used a kind of message to send to actors.
- */
-// @EqualsAndHashCode
-@Immutable
-// @ToString
-public class Stop extends BaseMessage implements Serializable
-{
-
-}
View
43 test/integration/grails_akka/message/Wait.groovy
@@ -1,43 +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 grails_akka.message
-
-import groovy.transform.*
-
-
-/**
- * Waiting message, as a sample.
- * <br/>
- * Used a kind of message to send to actors.
- */
-@EqualsAndHashCode
-// @Immutable
-@ToString
-public class Wait implements Serializable
-{
- final long msec;
-
- public Wait(long msec)
- {
- // this.msec = (msec < 0) ? 0l : msec;
- if (msec < 0)
- throw new IllegalArgumentException("Waiting time must be 0 or positive.");
-
- this.msec = msec;
- }
-
-}

0 comments on commit 8c587e5

Please sign in to comment.
Something went wrong with that request. Please try again.