diff --git a/akka-amqp/pom.xml b/akka-amqp/pom.xml index f7067e56b8..aa569958a6 100644 --- a/akka-amqp/pom.xml +++ b/akka-amqp/pom.xml @@ -10,7 +10,7 @@ akka se.scalablesolutions.akka - 0.6 + 0.7-SNAPSHOT diff --git a/akka-cluster/akka-cluster-jgroups/pom.xml b/akka-cluster/akka-cluster-jgroups/pom.xml index 55fecd9fbc..85d25e2330 100644 --- a/akka-cluster/akka-cluster-jgroups/pom.xml +++ b/akka-cluster/akka-cluster-jgroups/pom.xml @@ -10,7 +10,7 @@ akka-cluster-parent se.scalablesolutions.akka - 0.6 + 0.7-SNAPSHOT diff --git a/akka-cluster/akka-cluster-jgroups/src/main/scala/JGroupsClusterActor.scala b/akka-cluster/akka-cluster-jgroups/src/main/scala/JGroupsClusterActor.scala index 8c40421fed..2b6730dd60 100644 --- a/akka-cluster/akka-cluster-jgroups/src/main/scala/JGroupsClusterActor.scala +++ b/akka-cluster/akka-cluster-jgroups/src/main/scala/JGroupsClusterActor.scala @@ -1,43 +1,23 @@ package se.scalablesolutions.akka.remote -import org.jgroups.{JChannel, View, Address, Message, ExtendedMembershipListener, Receiver} - -import se.scalablesolutions.akka.config.ScalaConfig._ -import se.scalablesolutions.akka.remote.Cluster.{Node, RelayedMessage} -import se.scalablesolutions.akka.actor.{ Actor, ActorRegistry} - -import scala.collection.immutable.{Map, HashMap} - -/** - * JGroups Internal Cluster messages. - */ -private[remote] object JGroupsClusterActor { - sealed trait JGroupsClusterMessage - case object PapersPlease extends JGroupsClusterMessage - case class Papers(addresses: List[RemoteAddress]) extends JGroupsClusterMessage - case object Block extends JGroupsClusterMessage - case object Unblock extends JGroupsClusterMessage - case class Zombie(address: Address) extends JGroupsClusterMessage - case class RegisterLocalNode(server: RemoteAddress) extends JGroupsClusterMessage - case class DeregisterLocalNode(server: RemoteAddress) extends JGroupsClusterMessage -} +import org.jgroups.{JChannel, View => JG_VIEW, Address, Message => JG_MSG, ExtendedMembershipListener, Receiver} /** * Clustering support via JGroups. + * @Author Viktor Klang */ -class JGroupsClusterActor extends ClusterActor { - import JGroupsClusterActor._ - import org.scala_tools.javautils.Implicits._ +class JGroupsClusterActor extends BasicClusterActor { + import ClusterActor._ + import org.scala_tools.javautils.Imports._ + type ADDR_T = Address @volatile private var isActive = false - @volatile private var local: Node = Node(Nil) @volatile private var channel: Option[JChannel] = None - @volatile private var remotes: Map[Address, Node] = Map() override def init = { + super.init log debug "Initiating JGroups-based cluster actor" - remotes = new HashMap[Address, Node] val me = this isActive = true @@ -48,108 +28,36 @@ class JGroupsClusterActor extends ClusterActor { def setState(state: Array[Byte]): Unit = () - def receive(msg: Message): Unit = if (isActive) me send msg + def receive(m: JG_MSG): Unit = + if (isActive && m.getSrc != channel.map(_.getAddress).getOrElse(m.getSrc)) me send Message(m.getSrc,m.getRawBuffer) - def viewAccepted(view: View): Unit = if (isActive) me send view + def viewAccepted(view: JG_VIEW): Unit = + if (isActive) me send View(Set[ADDR_T]() ++ view.getMembers.asScala - channel.get.getAddress) - def suspect(a: Address): Unit = if (isActive) me send Zombie(a) + def suspect(a: Address): Unit = + if (isActive) me send Zombie(a) - def block: Unit = if (isActive) me send Block + def block: Unit = + log debug "UNSUPPORTED: JGroupsClusterActor::block" //TODO HotSwap to a buffering body - def unblock: Unit = if (isActive) me send Unblock + def unblock: Unit = + log debug "UNSUPPORTED: JGroupsClusterActor::unblock" //TODO HotSwap back and flush the buffer }) }) channel.map(_.connect(name)) } - def lookup[T](handleRemoteAddress: PartialFunction[RemoteAddress, T]): Option[T] = - remotes.values.toList.flatMap(_.endpoints).find(handleRemoteAddress isDefinedAt _).map(handleRemoteAddress) + protected def toOneNode(dest : Address, msg: Array[Byte]): Unit = + for (c <- channel) c.send(new JG_MSG(dest, null, msg)) - def registerLocalNode(hostname: String, port: Int): Unit = - send(RegisterLocalNode(RemoteAddress(hostname, port))) - - def deregisterLocalNode(hostname: String, port: Int): Unit = - send(DeregisterLocalNode(RemoteAddress(hostname, port))) - - def relayMessage(to: Class[_ <: Actor], msg: AnyRef): Unit = - send(RelayedMessage(to.getName, msg)) - - private def broadcast[T <: AnyRef](recipients: Iterable[Address], msg: T): Unit = { - lazy val m = Cluster.serializer out msg - for (c <- channel; r <- recipients) c.send(new Message(r, null, m)) - } - - private def broadcast[T <: AnyRef](msg: T): Unit = - //Don't broadcast if we are not connected anywhere... - if (!remotes.isEmpty) channel.map(_.send(new Message(null, null, Cluster.serializer out msg))) - - def receive = { - case Zombie(x) => { //Ask the presumed zombie for papers and prematurely treat it as dead - log debug ("Killing Zombie Node: %s", x) - broadcast(x :: Nil, PapersPlease) - remotes = remotes - x - } - - case v: View => { - // Not present in the cluster anymore = presumably zombies - // Nodes we have no prior knowledge existed = unknowns - val members = Set[Address]() ++ v.getMembers.asScala - channel.get.getAddress // Exclude ourselves - val zombies = Set[Address]() ++ remotes.keySet -- members - val unknown = members -- remotes.keySet - - log debug v.printDetails - - // Tell the zombies and unknowns to provide papers and prematurely treat the zombies as dead - broadcast(zombies ++ unknown, PapersPlease) - remotes = remotes -- zombies - } - - case m: Message => { - if (m.getSrc != channel.map(_.getAddress).getOrElse(m.getSrc)) // Handle non-own messages only, and only if we're connected - (Cluster.serializer in (m.getRawBuffer, None)) match { - - case PapersPlease => { - log debug ("Asked for papers by %s", m.getSrc) - broadcast(m.getSrc :: Nil, Papers(local.endpoints)) - - if (remotes.get(m.getSrc).isEmpty) // If we were asked for papers from someone we don't know, ask them! - broadcast(m.getSrc :: Nil, PapersPlease) - } - - case Papers(x) => remotes = remotes + (m.getSrc -> Node(x)) - - case RelayedMessage(c, m) => ActorRegistry.actorsFor(c).map(_ send m) - - case unknown => log debug ("Unknown message: %s", unknown.toString) - } - } - - case rm @ RelayedMessage(_, _) => { - log debug ("Relaying message: %s", rm) - broadcast(rm) - } - - case RegisterLocalNode(s) => { - log debug ("RegisterLocalNode: %s", s) - local = Node(local.endpoints + s) - broadcast(Papers(local.endpoints)) - } - - case DeregisterLocalNode(s) => { - log debug ("DeregisterLocalNode: %s", s) - local = Node(local.endpoints - s) - broadcast(Papers(local.endpoints)) - } - - case Block => log debug "UNSUPPORTED: JGroupsClusterActor::block" //TODO HotSwap to a buffering body - case Unblock => log debug "UNSUPPORTED: JGroupsClusterActor::unblock" //TODO HotSwap back and flush the buffer - } + protected def toAllNodes(msg : Array[Byte]) : Unit = + for (c <- channel) c.send(new JG_MSG(null, null, msg)) override def shutdown = { + super.shutdown log debug ("Shutting down %s", toString) isActive = false channel.foreach(_.shutdown) - remotes = Map() channel = None } } \ No newline at end of file diff --git a/akka-cluster/akka-cluster-shoal/pom.xml b/akka-cluster/akka-cluster-shoal/pom.xml index ade28e8106..b58e77dcf5 100644 --- a/akka-cluster/akka-cluster-shoal/pom.xml +++ b/akka-cluster/akka-cluster-shoal/pom.xml @@ -10,14 +10,24 @@ akka-cluster-parent se.scalablesolutions.akka - 0.6 + 0.7-SNAPSHOT - + + + shoal-jxta + shoal + 1.1-20090818 + + + shoal-jxta + jxta + 1.1-20090818 diff --git a/akka-cluster/akka-cluster-shoal/src/main/scala/ShoalClusterActor.scala b/akka-cluster/akka-cluster-shoal/src/main/scala/ShoalClusterActor.scala new file mode 100644 index 0000000000..c656bd4b81 --- /dev/null +++ b/akka-cluster/akka-cluster-shoal/src/main/scala/ShoalClusterActor.scala @@ -0,0 +1,116 @@ +/** + * Copyright (C) 2009-2010 Scalable Solutions AB + */ +package se.scalablesolutions.akka.remote + +import se.scalablesolutions.akka.Config.config +import java.util.Properties + +import com.sun.enterprise.ee.cms.core.{CallBack, + GMSConstants, + GMSFactory, + GroupManagementService, + MessageSignal, + Signal, + GMSException, + SignalAcquireException, + SignalReleaseException, + JoinNotificationSignal, + FailureSuspectedSignal, + FailureNotificationSignal } +import com.sun.enterprise.ee.cms.impl.client.{FailureNotificationActionFactoryImpl, + FailureSuspectedActionFactoryImpl, + JoinNotificationActionFactoryImpl, + MessageActionFactoryImpl, + PlannedShutdownActionFactoryImpl +} +/** + * Clustering support via Shoal. + */ +class ShoalClusterActor extends BasicClusterActor { + + type ADDR_T = String + + @volatile protected var gms : Option[GroupManagementService] = None + protected lazy val serverName : String = RemoteServer.HOSTNAME + ":" + RemoteServer.PORT + @volatile private var isActive = false + + lazy val topic : String = config.getString("akka.remote.cluster.shoal.topic") getOrElse "akka-messages" + + override def init = { + super.init + gms = Some(createGMS) + isActive = true + } + + override def shutdown = { + super.shutdown + isActive = false + for(g <- gms) g.shutdown(GMSConstants.shutdownType.INSTANCE_SHUTDOWN) + gms = None + } + + /** + * Constructs a Properties instance with properties designated for the underlying + * Shoal cluster transport (JXTA,JGroups) + */ + protected def properties() : Properties = { + config.getConfigMap("akka.remote.cluster.shoal.properties").map( m => { + new Properties(){ + for(key <- m.keys) setProperty(key,m(key)) + } + }).getOrElse(null) + } + + /** + * Creates a GroupManagementService, provides it with the proper properties + * Adds callbacks and boots up the cluster + */ + protected def createGMS : GroupManagementService = { + + val g = GMSFactory.startGMSModule(serverName,name, GroupManagementService.MemberType.CORE, properties()).asInstanceOf[GroupManagementService] + + val callback = createCallback + g.addActionFactory(new JoinNotificationActionFactoryImpl(callback)) + g.addActionFactory(new FailureSuspectedActionFactoryImpl(callback)) + g.addActionFactory(new FailureNotificationActionFactoryImpl(callback)) + g.addActionFactory(new PlannedShutdownActionFactoryImpl(callback)) + g.addActionFactory(new MessageActionFactoryImpl(callback), topic) + g.join + g + } + + /** + * Creates a CallBack instance that deals with the cluster signalling + */ + protected def createCallback : CallBack = { + import org.scala_tools.javautils.Imports._ + val me = this + new CallBack { + def processNotification(signal : Signal) { + try { + signal.acquire() + if(isActive) { + signal match { + case ms : MessageSignal => me send Message(ms.getMemberToken,ms.getMessage) + case jns : JoinNotificationSignal => me send View(Set[ADDR_T]() ++ jns.getCurrentCoreMembers.asScala - serverName) + case fss : FailureSuspectedSignal => me send Zombie(fss.getMemberToken) + case fns : FailureNotificationSignal => me send Zombie(fns.getMemberToken) + case _ => log.debug("Unhandled signal: [%s]",signal) + } + } + signal.release() + } catch { + case e : SignalAcquireException => log.warning(e,"SignalAcquireException") + case e : SignalReleaseException => log.warning(e,"SignalReleaseException") + } + } + } + } + + protected def toOneNode(dest : ADDR_T, msg : Array[Byte]) : Unit = + for(g <- gms) g.getGroupHandle.sendMessage(dest,topic, msg) + + protected def toAllNodes(msg : Array[Byte]) : Unit = + for(g <- gms) g.getGroupHandle.sendMessage(topic, msg) +} \ No newline at end of file diff --git a/akka-cluster/akka-cluster-tribes/pom.xml b/akka-cluster/akka-cluster-tribes/pom.xml index 1eba5570d2..efcea51aa8 100644 --- a/akka-cluster/akka-cluster-tribes/pom.xml +++ b/akka-cluster/akka-cluster-tribes/pom.xml @@ -10,7 +10,7 @@ akka-cluster-parent se.scalablesolutions.akka - 0.6 + 0.7-SNAPSHOT diff --git a/akka-cluster/pom.xml b/akka-cluster/pom.xml index f18c02f1dc..9d7bd42000 100644 --- a/akka-cluster/pom.xml +++ b/akka-cluster/pom.xml @@ -10,13 +10,13 @@ akka se.scalablesolutions.akka - 0.6 + 0.7-SNAPSHOT akka-cluster-jgroups - + + akka-cluster-shoal diff --git a/akka-comet/pom.xml b/akka-comet/pom.xml index 2d31a72c36..88cdc0cf57 100644 --- a/akka-comet/pom.xml +++ b/akka-comet/pom.xml @@ -11,7 +11,7 @@ akka se.scalablesolutions.akka - 0.6 + 0.7-SNAPSHOT @@ -34,7 +34,7 @@ javax.servlet servlet-api 2.5 - + org.atmosphere atmosphere-annotations @@ -48,7 +48,7 @@ org.atmosphere atmosphere-runtime - 0.5.v20100104 + ${atmosphere.version} diff --git a/akka-comet/src/main/scala/AkkaBroadcaster.scala b/akka-comet/src/main/scala/AkkaBroadcaster.scala new file mode 100644 index 0000000000..320ec44c3b --- /dev/null +++ b/akka-comet/src/main/scala/AkkaBroadcaster.scala @@ -0,0 +1,27 @@ +/** + * Copyright (C) 2009-2010 Scalable Solutions AB + */ + +package se.scalablesolutions.akka.comet + +import org.atmosphere.cpr.{AtmosphereResourceEvent, AtmosphereResource} +import se.scalablesolutions.akka.actor.Actor + +class AkkaBroadcaster extends org.atmosphere.jersey.JerseyBroadcaster { + name = classOf[AkkaBroadcaster].getName + + val caster = new Actor { + def receive = { case f : Function0[_] => f() } + + start + } + + override def destroy { + super.destroy + caster.stop + } + + protected override def broadcast(r : AtmosphereResource[_,_], e : AtmosphereResourceEvent[_,_]) = { + caster.send( () => super.broadcast(r,e) ) + } +} \ No newline at end of file diff --git a/akka-comet/src/main/scala/AkkaClusterBroadcastFilter.scala b/akka-comet/src/main/scala/AkkaClusterBroadcastFilter.scala index ca60831389..724c82432e 100644 --- a/akka-comet/src/main/scala/AkkaClusterBroadcastFilter.scala +++ b/akka-comet/src/main/scala/AkkaClusterBroadcastFilter.scala @@ -6,8 +6,8 @@ package se.scalablesolutions.akka.comet import se.scalablesolutions.akka.actor.{Actor} import se.scalablesolutions.akka.remote.{Cluster} -import org.atmosphere.cpr.{ClusterBroadcastFilter,Broadcaster} import scala.reflect.{BeanProperty} +import org.atmosphere.cpr.{BroadcastFilter, ClusterBroadcastFilter, Broadcaster} sealed trait ClusterCometMessageType case class ClusterCometBroadcast(val name : String, val msg : AnyRef) extends ClusterCometMessageType @@ -34,14 +34,14 @@ class AkkaClusterBroadcastFilter extends Actor with ClusterBroadcastFilter[AnyRe * ClusterCometBroadcasts are not broadcasted because they originate from the cluster, * otherwise we'd start a chain reaction. */ - def filter(o : AnyRef) : AnyRef = o match { + def filter(o : AnyRef) = new BroadcastFilter.BroadcastAction(o match { case ClusterCometBroadcast(_,m) => m //Do not re-broadcast, just unbox and pass along case m : AnyRef => { //Relay message to the cluster and pass along Cluster.relayMessage(classOf[AkkaClusterBroadcastFilter],ClusterCometBroadcast(clusterName,m)) m } - } + }) def receive = { //Only handle messages intended for this particular instance diff --git a/akka-comet/src/main/scala/AkkaServlet.scala b/akka-comet/src/main/scala/AkkaServlet.scala index c43d87c560..6e37d56c49 100644 --- a/akka-comet/src/main/scala/AkkaServlet.scala +++ b/akka-comet/src/main/scala/AkkaServlet.scala @@ -14,7 +14,6 @@ import javax.servlet.http.{HttpServletRequest, HttpServletResponse} import org.atmosphere.container.GrizzlyCometSupport import org.atmosphere.cpr.{AtmosphereServlet, AtmosphereServletProcessor, AtmosphereResource, AtmosphereResourceEvent,CometSupport,CometSupportResolver,DefaultCometSupportResolver} import org.atmosphere.handler.{ReflectorServletProcessor, AbstractReflectorAtmosphereHandler} -import org.atmosphere.jersey.JerseyBroadcaster /** * Akka's Comet servlet to be used when deploying actors exposed as Comet (and REST) services in a @@ -51,8 +50,8 @@ class AkkaServlet extends org.atmosphere.cpr.AtmosphereServlet with Logging { */ override def loadConfiguration(sc: ServletConfig) { config = new AtmosphereConfig { supportSession = false } - setDefaultBroadcasterClassName(classOf[JerseyBroadcaster].getName) - atmosphereHandlers.put("/*", new AtmosphereServlet.AtmosphereHandlerWrapper(servlet, new JerseyBroadcaster)) + setDefaultBroadcasterClassName(classOf[AkkaBroadcaster].getName) + atmosphereHandlers.put("/*", new AtmosphereServlet.AtmosphereHandlerWrapper(servlet, new AkkaBroadcaster)) } /** diff --git a/akka-core/pom.xml b/akka-core/pom.xml index 3e36a80cda..d6ca57ebfe 100644 --- a/akka-core/pom.xml +++ b/akka-core/pom.xml @@ -11,7 +11,7 @@ akka se.scalablesolutions.akka - 0.6 + 0.7-SNAPSHOT @@ -44,7 +44,7 @@ org.jboss.netty netty - 3.2.0.ALPHA2 + 3.2.0.ALPHA3 org.scala-tools @@ -91,7 +91,7 @@ sjson.json sjson - 0.3 + 0.4 diff --git a/akka-core/src/main/resources/META-INF/aop.xml b/akka-core/src/main/resources/META-INF/aop.xml old mode 100755 new mode 100644 diff --git a/akka-core/src/main/scala/actor/ActiveObject.scala b/akka-core/src/main/scala/actor/ActiveObject.scala index 86e08c1a87..1858952f40 100644 --- a/akka-core/src/main/scala/actor/ActiveObject.scala +++ b/akka-core/src/main/scala/actor/ActiveObject.scala @@ -4,10 +4,9 @@ package se.scalablesolutions.akka.actor -import java.net.InetSocketAddress - import se.scalablesolutions.akka.remote.protobuf.RemoteProtocol.RemoteRequest import se.scalablesolutions.akka.remote.{RemoteProtocolBuilder, RemoteClient, RemoteRequestIdFactory} +import se.scalablesolutions.akka.dispatch.{MessageDispatcher, FutureResult} import se.scalablesolutions.akka.config.ScalaConfig._ import se.scalablesolutions.akka.serialization.Serializer import se.scalablesolutions.akka.util._ @@ -16,8 +15,8 @@ import org.codehaus.aspectwerkz.joinpoint.{MethodRtti, JoinPoint} import org.codehaus.aspectwerkz.proxy.Proxy import org.codehaus.aspectwerkz.annotation.{Aspect, Around} +import java.net.InetSocketAddress import java.lang.reflect.{InvocationTargetException, Method} -import se.scalablesolutions.akka.dispatch.{Dispatchers, MessageDispatcher, FutureResult} object Annotations { import se.scalablesolutions.akka.annotation._ @@ -234,6 +233,7 @@ private[akka] sealed case class AspectInit( * @author Jonas Bonér */ @Aspect("perInstance") +// TODO: add @shutdown callback to ActiveObject in which we get the Aspect through 'Aspects.aspectOf(MyAspect.class, targetInstance)' and shuts down the Dispatcher actor private[akka] sealed class ActiveObjectAspect { @volatile private var isInitialized = false private var target: Class[_] = _ diff --git a/akka-core/src/main/scala/actor/Actor.scala b/akka-core/src/main/scala/actor/Actor.scala index 7e038a7509..f8eb5e0347 100644 --- a/akka-core/src/main/scala/actor/Actor.scala +++ b/akka-core/src/main/scala/actor/Actor.scala @@ -12,7 +12,7 @@ import se.scalablesolutions.akka.stm.Transaction._ import se.scalablesolutions.akka.stm.TransactionManagement._ import se.scalablesolutions.akka.stm.{StmException, TransactionManagement} import se.scalablesolutions.akka.remote.protobuf.RemoteProtocol.RemoteRequest -import se.scalablesolutions.akka.remote.{RemoteProtocolBuilder,RemoteServer, RemoteClient, RemoteRequestIdFactory} +import se.scalablesolutions.akka.remote.{RemoteProtocolBuilder, RemoteClient, RemoteRequestIdFactory} import se.scalablesolutions.akka.serialization.Serializer import se.scalablesolutions.akka.util.{HashCode, Logging, UUID} @@ -72,18 +72,8 @@ object Actor extends Logging { val HOSTNAME = config.getString("akka.remote.server.hostname", "localhost") val PORT = config.getInt("akka.remote.server.port", 9999) - object Sender extends Actor { + object Sender{ implicit val Self: Option[Actor] = None - - def receive = { - case unknown => - Actor.log.error( - "Actor.Sender can't process messages. Received message [%s]." + - "This error could occur if you either:" + - "\n\t- Explicitly send a message to the Actor.Sender object." + - "\n\t- Invoking the 'reply(..)' method or sending a message to the 'sender' reference " + - "\n\t when you have sent the original request from a instance *not* being an actor.", unknown) - } } /** @@ -145,11 +135,15 @@ object Actor extends Logging { * } * */ - def spawn(body: => Unit): Actor = new Actor() { - start - body - def receive = { - case _ => throw new IllegalArgumentException("Actors created with 'actor(body: => Unit)' do not respond to messages.") + def spawn(body: => Unit): Actor = { + case object Spawn + new Actor() { + start + send(Spawn) + def receive = { + case Spawn => body + case _ => throw new IllegalArgumentException("Actors created with 'actor(body: => Unit)' do not respond to messages.") + } } } @@ -225,7 +219,7 @@ trait Actor extends TransactionManagement { private[akka] var _remoteAddress: Option[InetSocketAddress] = None private[akka] var _linkedActors: Option[HashSet[Actor]] = None private[akka] var _supervisor: Option[Actor] = None - private[akka] var _contactAddress: Option[InetSocketAddress] = None + private[akka] var _replyToAddress: Option[InetSocketAddress] = None private[akka] val _mailbox: Queue[MessageInvocation] = new ConcurrentLinkedQueue[MessageInvocation] // ==================================== @@ -445,6 +439,7 @@ trait Actor extends TransactionManagement { _isShutDown = true shutdown ActorRegistry.unregister(this) + _remoteAddress.foreach(address => RemoteClient.unregister(address.getHostName, address.getPort, uuid)) } } @@ -480,7 +475,7 @@ trait Actor extends TransactionManagement { * */ def !(message: Any)(implicit sender: Option[Actor]) = { -//FIXME 2.8 def !(message: Any)(implicit sender: Option[Actor] = None) = { + //FIXME 2.8 def !(message: Any)(implicit sender: Option[Actor] = None) = { if (_isKilled) throw new ActorKilledException("Actor [" + toString + "] has been killed, can't respond to messages") if (_isRunning) postMessageToMailbox(message, sender) else throw new IllegalStateException("Actor has not been started, you need to invoke 'actor.start' before using it") @@ -492,8 +487,7 @@ trait Actor extends TransactionManagement { def send(message: Any) = { if (_isKilled) throw new ActorKilledException("Actor [" + toString + "] has been killed, can't respond to messages") if (_isRunning) postMessageToMailbox(message, None) - else throw new IllegalStateException( - "Actor has not been started, you need to invoke 'actor.start' before using it") + else throw new IllegalStateException("Actor has not been started, you need to invoke 'actor.start' before using it") } /** @@ -596,7 +590,7 @@ trait Actor extends TransactionManagement { "\n\t\t2. Send a message from an instance that is *not* an actor" + "\n\t\t3. Send a message to an Active Object annotated with the '@oneway' annotation? " + "\n\tIf so, switch to '!!' (or remove '@oneway') which passes on an implicit future" + - "\n\tthat will be bound by the argument passed to 'reply'. Alternatively, you can use setContactAddress to make sure the actor can be contacted over the network.") + "\n\tthat will be bound by the argument passed to 'reply'. Alternatively, you can use setReplyToAddress to make sure the actor can be contacted over the network.") case Some(future) => future.completeWithResult(message) } @@ -634,18 +628,18 @@ trait Actor extends TransactionManagement { def makeRemote(address: InetSocketAddress): Unit = if (_isRunning) throw new IllegalStateException("Can't make a running actor remote. Make sure you call 'makeRemote' before 'start'.") else { - _remoteAddress = Some(address) - if(_contactAddress.isEmpty) - setContactAddress(RemoteServer.HOSTNAME,RemoteServer.PORT) + _remoteAddress = Some(address) + RemoteClient.register(address.getHostName, address.getPort, uuid) + if (_replyToAddress.isEmpty) setReplyToAddress(Actor.HOSTNAME, Actor.PORT) } /** * Set the contact address for this actor. This is used for replying to messages sent asynchronously when no reply channel exists. */ - def setContactAddress(hostname: String, port: Int): Unit = setContactAddress(new InetSocketAddress(hostname, port)) + def setReplyToAddress(hostname: String, port: Int): Unit = setReplyToAddress(new InetSocketAddress(hostname, port)) - def setContactAddress(address: InetSocketAddress): Unit = _contactAddress = Some(address) + def setReplyToAddress(address: InetSocketAddress): Unit = _replyToAddress = Some(address) /** * Invoking 'makeTransactionRequired' means that the actor will **start** a new transaction if non exists. @@ -793,7 +787,7 @@ trait Actor extends TransactionManagement { actor } - private def postMessageToMailbox(message: Any, sender: Option[Actor]): Unit = { + protected[akka] def postMessageToMailbox(message: Any, sender: Option[Actor]): Unit = { if (_remoteAddress.isDefined) { val requestBuilder = RemoteRequest.newBuilder .setId(RemoteRequestIdFactory.nextId) @@ -803,26 +797,24 @@ trait Actor extends TransactionManagement { .setIsActor(true) .setIsOneWay(true) .setIsEscaped(false) + val id = registerSupervisorAsRemoteActor - if (id.isDefined) requestBuilder.setSupervisorUuid(id.get) + if(id.isDefined) + requestBuilder.setSupervisorUuid(id.get) // set the source fields used to reply back to the original sender // (i.e. not the remote proxy actor) - if (sender.isDefined) { - requestBuilder.setSourceTarget(sender.get.getClass.getName) - requestBuilder.setSourceUuid(sender.get.uuid) - log.debug("Setting sending actor as %s, %s", sender.get.getClass.getName, _contactAddress) + if(sender.isDefined) { + val s = sender.get + requestBuilder.setSourceTarget(s.getClass.getName) + requestBuilder.setSourceUuid(s.uuid) - if (sender.get._contactAddress.isDefined) { - val addr = sender.get._contactAddress.get - requestBuilder.setSourceHostname(addr.getHostName()) - requestBuilder.setSourcePort(addr.getPort()) - } else { - // set the contact address to the default values from the - // configuration file - requestBuilder.setSourceHostname(Actor.HOSTNAME) - requestBuilder.setSourcePort(Actor.PORT) - } + val (host,port) = s._replyToAddress.map(a => (a.getHostName,a.getPort)).getOrElse((Actor.HOSTNAME,Actor.PORT)) + + log.debug("Setting sending actor as %s @ %s:%s", s.getClass.getName, host, port) + + requestBuilder.setSourceHostname(host) + requestBuilder.setSourcePort(port) } RemoteProtocolBuilder.setMessage(message, requestBuilder) RemoteClient.clientFor(_remoteAddress.get).send(requestBuilder.build, None) @@ -831,11 +823,13 @@ trait Actor extends TransactionManagement { if (_isEventBased) { _mailbox.add(invocation) if (_isSuspended) invocation.send - } else invocation.send + } + else + invocation.send } } - private def postMessageToMailboxAndCreateFutureResultWithTimeout( + protected[akka] def postMessageToMailboxAndCreateFutureResultWithTimeout( message: Any, timeout: Long, senderFuture: Option[CompletableFutureResult]): CompletableFutureResult = { @@ -926,7 +920,7 @@ trait Actor extends TransactionManagement { if (senderFuture.isEmpty) throw new StmException( "Can't continue transaction in a one-way fire-forget message send" + "\n\tE.g. using Actor '!' method or Active Object 'void' method" + - "\n\tPlease use the Actor '!!', '!?' methods or Active Object method with non-void return type") + "\n\tPlease use the Actor '!!' method or Active Object method with non-void return type") atomic { proceed } diff --git a/akka-core/src/main/scala/actor/ActorRegistry.scala b/akka-core/src/main/scala/actor/ActorRegistry.scala index 9a6dafcc58..63314ae051 100644 --- a/akka-core/src/main/scala/actor/ActorRegistry.scala +++ b/akka-core/src/main/scala/actor/ActorRegistry.scala @@ -6,7 +6,8 @@ package se.scalablesolutions.akka.actor import se.scalablesolutions.akka.util.Logging -import scala.collection.mutable.HashMap +import scala.collection.mutable.{ListBuffer, HashMap} +import scala.reflect.Manifest /** * Registry holding all actor instances, mapped by class and the actor's id field (which can be set by user-code). @@ -17,6 +18,30 @@ object ActorRegistry extends Logging { private val actorsByClassName = new HashMap[String, List[Actor]] private val actorsById = new HashMap[String, List[Actor]] + /** + * Returns all actors in the system. + */ + def actors: List[Actor] = synchronized { + val all = new ListBuffer[Actor] + actorsById.values.foreach(all ++= _) + all.toList + } + + /** + * Invokes a function for all actors. + */ + def foreach(f: (Actor) => Unit) = actors.foreach(f) + + /** + * Finds all actors that are subtypes of the class passed in as the Manifest argument. + */ + def actorsFor[T <: Actor](implicit manifest: Manifest[T]): List[T] = synchronized { + for (actor <- actors; if manifest.erasure.isAssignableFrom(actor.getClass)) yield actor.asInstanceOf[T] + } + + /** + * Finds all actors of the exact type specified by the class passed in as the Class argument. + */ def actorsFor[T <: Actor](clazz: Class[T]): List[T] = synchronized { actorsByClassName.get(clazz.getName) match { case None => Nil @@ -24,6 +49,9 @@ object ActorRegistry extends Logging { } } + /** + * Finds all actors that has a specific id. + */ def actorsFor(id : String): List[Actor] = synchronized { actorsById.get(id) match { case None => Nil diff --git a/akka-core/src/main/scala/actor/BootableActorLoaderService.scala b/akka-core/src/main/scala/actor/BootableActorLoaderService.scala index 85ec2dc8ca..1bacbf6f59 100644 --- a/akka-core/src/main/scala/actor/BootableActorLoaderService.scala +++ b/akka-core/src/main/scala/actor/BootableActorLoaderService.scala @@ -16,10 +16,10 @@ import se.scalablesolutions.akka.Config._ trait BootableActorLoaderService extends Bootable with Logging { val BOOT_CLASSES = config.getList("akka.boot") - var applicationLoader: Option[ClassLoader] = None + lazy val applicationLoader: Option[ClassLoader] = createApplicationClassLoader - protected def runApplicationBootClasses : Option[ClassLoader] = { - val loader = + protected def createApplicationClassLoader : Option[ClassLoader] = { + Some( if (HOME.isDefined) { val CONFIG = HOME.get + "/config" val DEPLOY = HOME.get + "/deploy" @@ -30,24 +30,21 @@ trait BootableActorLoaderService extends Bootable with Logging { } val toDeploy = for (f <- DEPLOY_DIR.listFiles().toArray.toList.asInstanceOf[List[File]]) yield f.toURL log.info("Deploying applications from [%s]: [%s]", DEPLOY, toDeploy.toArray.toList) - new URLClassLoader(toDeploy.toArray, getClass.getClassLoader) + new URLClassLoader(toDeploy.toArray, ClassLoader.getSystemClassLoader) } else if (getClass.getClassLoader.getResourceAsStream("akka.conf") ne null) { getClass.getClassLoader } else throw new IllegalStateException( "AKKA_HOME is not defined and no 'akka.conf' can be found on the classpath, aborting") - for (clazz <- BOOT_CLASSES) { + ) + } + + abstract override def onLoad = { + for (loader <- applicationLoader; clazz <- BOOT_CLASSES) { log.info("Loading boot class [%s]", clazz) loader.loadClass(clazz).newInstance } - Some(loader) - } - - abstract override def onLoad = { - applicationLoader = runApplicationBootClasses - super.onLoad + super.onLoad } - abstract override def onUnload = { - ActorRegistry.shutdownAll - } + abstract override def onUnload = ActorRegistry.shutdownAll } \ No newline at end of file diff --git a/akka-core/src/main/scala/remote/BootableRemoteActorService.scala b/akka-core/src/main/scala/remote/BootableRemoteActorService.scala index b3ca8d4cb7..429fdb61ec 100644 --- a/akka-core/src/main/scala/remote/BootableRemoteActorService.scala +++ b/akka-core/src/main/scala/remote/BootableRemoteActorService.scala @@ -23,22 +23,26 @@ trait BootableRemoteActorService extends Bootable with Logging { def startRemoteService = remoteServerThread.start abstract override def onLoad = { - super.onLoad //Make sure the actors facility is loaded before we load the remote service if(config.getBool("akka.remote.server.service", true)){ + log.info("Starting up Cluster Service") + Cluster.start + super.onLoad //Initialize BootableActorLoaderService before remote service log.info("Initializing Remote Actors Service...") startRemoteService log.info("Remote Actors Service initialized!") } + else + super.onLoad + } abstract override def onUnload = { - super.onUnload - if (remoteServerThread.isAlive) { + super.onUnload + if (remoteServerThread.isAlive) { log.info("Shutting down Remote Actors Service") RemoteNode.shutdown - log.info("Shutting down Cluster Service") - Cluster.shutdown remoteServerThread.join(1000) } + Cluster.shutdown } } \ No newline at end of file diff --git a/akka-core/src/main/scala/remote/Cluster.scala b/akka-core/src/main/scala/remote/Cluster.scala index 61e42d4695..c2e9069a01 100644 --- a/akka-core/src/main/scala/remote/Cluster.scala +++ b/akka-core/src/main/scala/remote/Cluster.scala @@ -26,53 +26,220 @@ trait Cluster { def relayMessage(to: Class[_ <: Actor], msg: AnyRef): Unit def lookup[T](pf: PartialFunction[RemoteAddress, T]): Option[T] + + def foreach(f : (RemoteAddress) => Unit) : Unit } /** - * Base class for cluster actor implementations. + * Base trait for Cluster implementations + * + * @author Viktor Klang */ -abstract class ClusterActor extends Actor with Cluster { +trait ClusterActor extends Actor with Cluster { val name = config.getString("akka.remote.cluster.name") getOrElse "default" } /** - * A singleton representing the Cluster. + * Companion object to ClusterActor that defines some common messages + * + * @author Viktor Klang + */ +private[remote] object ClusterActor { + sealed trait ClusterMessage + + private[remote] case class RelayedMessage(actorClassFQN: String, msg: AnyRef) extends ClusterMessage + + private[remote] case class Node(endpoints: List[RemoteAddress]) +} + +/** + * Base class for cluster actor implementations. + * Provides most of the behavior out of the box + * only needs to be gives hooks into the underlaying cluster impl. + */ +abstract class BasicClusterActor extends ClusterActor { + import ClusterActor._ + + case class Message(sender : ADDR_T,msg : Array[Byte]) + case object PapersPlease extends ClusterMessage + case class Papers(addresses: List[RemoteAddress]) extends ClusterMessage + case object Block extends ClusterMessage + case object Unblock extends ClusterMessage + case class View(othersPresent : Set[ADDR_T]) extends ClusterMessage + case class Zombie(address: ADDR_T) extends ClusterMessage + case class RegisterLocalNode(server: RemoteAddress) extends ClusterMessage + case class DeregisterLocalNode(server: RemoteAddress) extends ClusterMessage + + type ADDR_T + + + @volatile private var local: Node = Node(Nil) + @volatile private var remotes: Map[ADDR_T, Node] = Map() + + override def init = { + remotes = new HashMap[ADDR_T, Node] + } + + override def shutdown = { + remotes = Map() + } + + def receive = { + case v @ View(members) => { + // Not present in the cluster anymore = presumably zombies + // Nodes we have no prior knowledge existed = unknowns + val zombies = Set[ADDR_T]() ++ remotes.keySet -- members + val unknown = members -- remotes.keySet + + log debug ("Updating view") + log debug ("Other memebers: [%s]",members) + log debug ("Zombies: [%s]",zombies) + log debug ("Unknowns: [%s]",unknown) + + // Tell the zombies and unknowns to provide papers and prematurely treat the zombies as dead + broadcast(zombies ++ unknown, PapersPlease) + remotes = remotes -- zombies + } + + case Zombie(x) => { //Ask the presumed zombie for papers and prematurely treat it as dead + log debug ("Killing Zombie Node: %s", x) + broadcast(x :: Nil, PapersPlease) + remotes = remotes - x + } + + case rm @ RelayedMessage(_, _) => { + log debug ("Relaying message: %s", rm) + broadcast(rm) + } + + case m @ Message(src,msg) => { + (Cluster.serializer in (msg, None)) match { + + case PapersPlease => { + log debug ("Asked for papers by %s", src) + broadcast(src :: Nil, Papers(local.endpoints)) + + if (remotes.get(src).isEmpty) // If we were asked for papers from someone we don't know, ask them! + broadcast(src :: Nil, PapersPlease) + } + + case Papers(x) => remotes = remotes + (src -> Node(x)) + + case RelayedMessage(c, m) => ActorRegistry.actorsFor(c).foreach(_ send m) + + case unknown => log debug ("Unknown message: %s", unknown.toString) + } + } + + case RegisterLocalNode(s) => { + log debug ("RegisterLocalNode: %s", s) + local = Node(local.endpoints + s) + broadcast(Papers(local.endpoints)) + } + + case DeregisterLocalNode(s) => { + log debug ("DeregisterLocalNode: %s", s) + local = Node(local.endpoints - s) + broadcast(Papers(local.endpoints)) + } + } + + /** + * Implement this in a subclass to add node-to-node messaging + */ + protected def toOneNode(dest : ADDR_T, msg : Array[Byte]) : Unit + + /** + * Implement this in a subclass to add node-to-many-nodes messaging + */ + protected def toAllNodes(msg : Array[Byte]) : Unit + + /** + * Sends the specified message to the given recipients using the serializer + * that's been set in the akka-conf + */ + protected def broadcast[T <: AnyRef](recipients: Iterable[ADDR_T], msg: T): Unit = { + lazy val m = Cluster.serializer out msg + for (r <- recipients) toOneNode(r,m) + } + + /** + * Sends the specified message toall other nodes using the serializer + * that's been set in the akka-conf + */ + protected def broadcast[T <: AnyRef](msg: T): Unit = + if (!remotes.isEmpty) toAllNodes(Cluster.serializer out msg) + + /** + * Applies the given PartialFunction to all known RemoteAddresses + */ + def lookup[T](handleRemoteAddress: PartialFunction[RemoteAddress, T]): Option[T] = + remotes.values.toList.flatMap(_.endpoints).find(handleRemoteAddress isDefinedAt _).map(handleRemoteAddress) + + /** + * Applies the given function to all remote addresses known + */ + def foreach(f : (RemoteAddress) => Unit) : Unit = remotes.values.toList.flatMap(_.endpoints).foreach(f) + + /** + * Registers a local endpoint + */ + def registerLocalNode(hostname: String, port: Int): Unit = + send(RegisterLocalNode(RemoteAddress(hostname, port))) + + /** + * Deregisters a local endpoint + */ + def deregisterLocalNode(hostname: String, port: Int): Unit = + send(DeregisterLocalNode(RemoteAddress(hostname, port))) + + /** + * Broadcasts the specified message to all Actors of type Class on all known Nodes + */ + def relayMessage(to: Class[_ <: Actor], msg: AnyRef): Unit = + send(RelayedMessage(to.getName, msg)) +} + +/** + * A singleton representing the Cluster. *

* Loads a specified ClusterActor and delegates to that instance. */ object Cluster extends Cluster with Logging { - private[remote] sealed trait ClusterMessage - private[remote] case class Node(endpoints: List[RemoteAddress]) extends ClusterMessage - private[remote] case class RelayedMessage(actorClassFQN: String, msg: AnyRef) extends ClusterMessage - - private[remote] val clusterActor: Option[ClusterActor] = { - val name = config.getString("akka.remote.cluster.actor","not defined") - try { - val a = Class.forName(name).newInstance.asInstanceOf[ClusterActor] - a.start - Some(a) - } - catch { - case e => log.error(e,"Couldn't load Cluster provider: [%s]",name) - None - } - } - - private[remote] val supervisor: Option[Supervisor] = if (clusterActor.isDefined) { - val sup = SupervisorFactory( - SupervisorConfig( - RestartStrategy(OneForOne, 5, 1000, List(classOf[Exception])), - Supervise(clusterActor.get, LifeCycle(Permanent)) :: Nil) - ).newInstance - sup.start - Some(sup) - } else None + @volatile private[remote] var clusterActor: Option[ClusterActor] = None + @volatile private[remote] var supervisor: Option[Supervisor] = None private[remote] lazy val serializer: Serializer = { val className = config.getString("akka.remote.cluster.serializer", Serializer.Java.getClass.getName) Class.forName(className).newInstance.asInstanceOf[Serializer] } + private[remote] def createClusterActor : Option[ClusterActor] = { + val name = config.getString("akka.remote.cluster.actor") + + try { + name map { fqn => + val a = Class.forName(fqn).newInstance.asInstanceOf[ClusterActor] + a.start + a + } + } + catch { + case e => log.error(e,"Couldn't load Cluster provider: [%s]",name.getOrElse("Not specified")); None + } + } + + private[remote] def createSupervisor(actor : ClusterActor) : Option[Supervisor] = { + val sup = SupervisorFactory( + SupervisorConfig( + RestartStrategy(OneForOne, 5, 1000, List(classOf[Exception])), + Supervise(actor, LifeCycle(Permanent)) :: Nil) + ).newInstance + sup.start + Some(sup) + } + + def name = clusterActor.map(_.name).getOrElse("No cluster") def lookup[T](pf: PartialFunction[RemoteAddress, T]): Option[T] = clusterActor.flatMap(_.lookup(pf)) @@ -82,6 +249,22 @@ object Cluster extends Cluster with Logging { def deregisterLocalNode(hostname: String, port: Int): Unit = clusterActor.foreach(_.deregisterLocalNode(hostname, port)) def relayMessage(to: Class[_ <: Actor], msg: AnyRef): Unit = clusterActor.foreach(_.relayMessage(to, msg)) + + def foreach(f : (RemoteAddress) => Unit) : Unit = clusterActor.foreach(_.foreach(f)) - def shutdown = supervisor.foreach(_.stop) + def start : Unit = synchronized { + if(supervisor.isEmpty) { + for(actor <- createClusterActor; + sup <- createSupervisor(actor)) { + clusterActor = Some(actor) + supervisor = Some(sup) + } + } + } + + def shutdown : Unit = synchronized { + supervisor.foreach(_.stop) + supervisor = None + clusterActor = None + } } diff --git a/akka-core/src/main/scala/remote/RemoteClient.scala b/akka-core/src/main/scala/remote/RemoteClient.scala index e2f1e6d032..f97f014f06 100644 --- a/akka-core/src/main/scala/remote/RemoteClient.scala +++ b/akka-core/src/main/scala/remote/RemoteClient.scala @@ -4,8 +4,6 @@ package se.scalablesolutions.akka.remote -import scala.collection.mutable.HashMap - import se.scalablesolutions.akka.remote.protobuf.RemoteProtocol.{RemoteRequest, RemoteReply} import se.scalablesolutions.akka.actor.{Exit, Actor} import se.scalablesolutions.akka.dispatch.{DefaultCompletableFutureResult, CompletableFutureResult} @@ -13,6 +11,7 @@ import se.scalablesolutions.akka.util.{UUID, Logging} import se.scalablesolutions.akka.Config.config import org.jboss.netty.channel._ +import group.DefaultChannelGroup import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory import org.jboss.netty.bootstrap.ClientBootstrap import org.jboss.netty.handler.codec.frame.{LengthFieldBasedFrameDecoder, LengthFieldPrepender} @@ -25,12 +24,15 @@ import java.net.{SocketAddress, InetSocketAddress} import java.util.concurrent.{TimeUnit, Executors, ConcurrentMap, ConcurrentHashMap} import java.util.concurrent.atomic.AtomicLong +import scala.collection.mutable.{HashSet, HashMap} + /** * @author Jonas Bonér */ object RemoteRequestIdFactory { private val nodeId = UUID.newUuid private val id = new AtomicLong + def nextId: Long = id.getAndIncrement + nodeId } @@ -41,27 +43,121 @@ object RemoteClient extends Logging { val READ_TIMEOUT = config.getInt("akka.remote.client.read-timeout", 10000) val RECONNECT_DELAY = config.getInt("akka.remote.client.reconnect-delay", 5000) - private val clients = new HashMap[String, RemoteClient] + private val remoteClients = new HashMap[String, RemoteClient] + private val remoteActors = new HashMap[RemoteServer.Address, HashSet[String]] + + // FIXME: simplify overloaded methods when we have Scala 2.8 + + def actorFor(className: String, hostname: String, port: Int): Actor = + actorFor(className, className, 5000L, hostname, port) + + def actorFor(actorId: String, className: String, hostname: String, port: Int): Actor = + actorFor(actorId, className, 5000L, hostname, port) + + def actorFor(className: String, timeout: Long, hostname: String, port: Int): Actor = + actorFor(className, className, timeout, hostname, port) + + def actorFor(actorId: String, className: String, timeout: Long, hostname: String, port: Int): Actor = { + new Actor { + start + val remoteClient = RemoteClient.clientFor(hostname, port) + + override def postMessageToMailbox(message: Any, sender: Option[Actor]): Unit = { + val requestBuilder = RemoteRequest.newBuilder + .setId(RemoteRequestIdFactory.nextId) + .setTarget(className) + .setTimeout(timeout) + .setUuid(actorId) + .setIsActor(true) + .setIsOneWay(true) + .setIsEscaped(false) + if (sender.isDefined) { + val s = sender.get + requestBuilder.setSourceTarget(s.getClass.getName) + requestBuilder.setSourceUuid(s.uuid) + val (host, port) = s._replyToAddress.map(a => (a.getHostName, a.getPort)).getOrElse((Actor.HOSTNAME, Actor.PORT)) + requestBuilder.setSourceHostname(host) + requestBuilder.setSourcePort(port) + } + RemoteProtocolBuilder.setMessage(message, requestBuilder) + remoteClient.send(requestBuilder.build, None) + } + + override def postMessageToMailboxAndCreateFutureResultWithTimeout( + message: Any, + timeout: Long, + senderFuture: Option[CompletableFutureResult]): CompletableFutureResult = { + val requestBuilder = RemoteRequest.newBuilder + .setId(RemoteRequestIdFactory.nextId) + .setTarget(className) + .setTimeout(timeout) + .setUuid(actorId) + .setIsActor(true) + .setIsOneWay(false) + .setIsEscaped(false) + RemoteProtocolBuilder.setMessage(message, requestBuilder) + val future = remoteClient.send(requestBuilder.build, senderFuture) + if (future.isDefined) future.get + else throw new IllegalStateException("Expected a future from remote call to actor " + toString) + } + + def receive = {case _ => {}} + } + } + + def clientFor(hostname: String, port: Int): RemoteClient = clientFor(new InetSocketAddress(hostname, port)) def clientFor(address: InetSocketAddress): RemoteClient = synchronized { val hostname = address.getHostName val port = address.getPort val hash = hostname + ':' + port - if (clients.contains(hash)) clients(hash) + if (remoteClients.contains(hash)) remoteClients(hash) else { val client = new RemoteClient(hostname, port) client.connect - clients += hash -> client + remoteClients += hash -> client client } } + def shutdownClientFor(address: InetSocketAddress) = synchronized { + val hostname = address.getHostName + val port = address.getPort + val hash = hostname + ':' + port + if (remoteClients.contains(hash)) { + val client = remoteClients(hash) + client.shutdown + remoteClients - hash + } + } + /** * Clean-up all open connections. */ - def shutdownAll() = synchronized { - clients.foreach({case (addr, client) => client.shutdown}) - clients.clear + def shutdownAll = synchronized { + remoteClients.foreach({case (addr, client) => client.shutdown}) + remoteClients.clear + } + + private[akka] def register(hostname: String, port: Int, uuid: String) = synchronized { + actorsFor(RemoteServer.Address(hostname, port)) + uuid + } + + // TODO: add RemoteClient.unregister for ActiveObject, but first need a @shutdown callback + private[akka] def unregister(hostname: String, port: Int, uuid: String) = synchronized { + val set = actorsFor(RemoteServer.Address(hostname, port)) + set - uuid + if (set.isEmpty) shutdownClientFor(new InetSocketAddress(hostname, port)) + } + + private[akka] def actorsFor(remoteServerAddress: RemoteServer.Address): HashSet[String] = { + val set = remoteActors.get(remoteServerAddress) + if (set.isDefined && (set.get ne null)) set.get + else { + val remoteActorSet = new HashSet[String] + remoteActors.put(remoteServerAddress, remoteActorSet) + remoteActorSet + } } } @@ -69,9 +165,9 @@ object RemoteClient extends Logging { * @author Jonas Bonér */ class RemoteClient(hostname: String, port: Int) extends Logging { - val name = "RemoteClient@" + hostname - - @volatile private var isRunning = false + val name = "RemoteClient@" + hostname + "::" + port + + @volatile private[remote] var isRunning = false private val futures = new ConcurrentHashMap[Long, CompletableFutureResult] private val supervisors = new ConcurrentHashMap[String, Actor] @@ -80,6 +176,7 @@ class RemoteClient(hostname: String, port: Int) extends Logging { Executors.newCachedThreadPool) private val bootstrap = new ClientBootstrap(channelFactory) + private val openChannels = new DefaultChannelGroup(classOf[RemoteClient].getName); private val timer = new HashedWheelTimer private val remoteAddress = new InetSocketAddress(hostname, port) @@ -93,20 +190,22 @@ class RemoteClient(hostname: String, port: Int) extends Logging { if (!isRunning) { connection = bootstrap.connect(remoteAddress) log.info("Starting remote client connection to [%s:%s]", hostname, port) - // Wait until the connection attempt succeeds or fails. - connection.awaitUninterruptibly - if (!connection.isSuccess) log.error(connection.getCause, "Remote connection to [%s:%s] has failed", hostname, port) + val channel = connection.awaitUninterruptibly.getChannel + openChannels.add(channel) + if (!connection.isSuccess) log.error(connection.getCause, "Remote client connection to [%s:%s] has failed", hostname, port) isRunning = true } } def shutdown = synchronized { - if (!isRunning) { - connection.getChannel.getCloseFuture.awaitUninterruptibly - channelFactory.releaseExternalResources + if (isRunning) { + isRunning = false + openChannels.close.awaitUninterruptibly + bootstrap.releaseExternalResources + timer.stop + log.info("%s has been shut down", name) } - timer.stop } def send(request: RemoteRequest, senderFuture: Option[CompletableFutureResult]): Option[CompletableFutureResult] = if (isRunning) { @@ -116,11 +215,11 @@ class RemoteClient(hostname: String, port: Int) extends Logging { } else { futures.synchronized { val futureResult = if (senderFuture.isDefined) senderFuture.get - else new DefaultCompletableFutureResult(request.getTimeout) + else new DefaultCompletableFutureResult(request.getTimeout) futures.put(request.getId, futureResult) connection.getChannel.write(request) Some(futureResult) - } + } } } else throw new IllegalStateException("Remote client is not running, make sure you have invoked 'RemoteClient.connect' before using it.") @@ -131,14 +230,14 @@ class RemoteClient(hostname: String, port: Int) extends Logging { def deregisterSupervisorForActor(actor: Actor) = if (!actor._supervisor.isDefined) throw new IllegalStateException("Can't unregister supervisor for " + actor + " since it is not under supervision") else supervisors.remove(actor._supervisor.get.uuid) - + def deregisterSupervisorWithUuid(uuid: String) = supervisors.remove(uuid) } /** * @author Jonas Bonér */ -class RemoteClientPipelineFactory(name: String, +class RemoteClientPipelineFactory(name: String, futures: ConcurrentMap[Long, CompletableFutureResult], supervisors: ConcurrentMap[String, Actor], bootstrap: ClientBootstrap, @@ -146,21 +245,21 @@ class RemoteClientPipelineFactory(name: String, timer: HashedWheelTimer, client: RemoteClient) extends ChannelPipelineFactory { def getPipeline: ChannelPipeline = { - val timeout = new ReadTimeoutHandler(timer, RemoteClient.READ_TIMEOUT) - val lenDec = new LengthFieldBasedFrameDecoder(1048576, 0, 4, 0, 4) - val lenPrep = new LengthFieldPrepender(4) - val protobufDec = new ProtobufDecoder(RemoteReply.getDefaultInstance) - val protobufEnc = new ProtobufEncoder + val timeout = new ReadTimeoutHandler(timer, RemoteClient.READ_TIMEOUT) + val lenDec = new LengthFieldBasedFrameDecoder(1048576, 0, 4, 0, 4) + val lenPrep = new LengthFieldPrepender(4) + val protobufDec = new ProtobufDecoder(RemoteReply.getDefaultInstance) + val protobufEnc = new ProtobufEncoder val zipCodec = RemoteServer.COMPRESSION_SCHEME match { - case "zlib" => Some(Codec(new ZlibEncoder(RemoteServer.ZLIB_COMPRESSION_LEVEL), new ZlibDecoder)) + case "zlib" => Some(Codec(new ZlibEncoder(RemoteServer.ZLIB_COMPRESSION_LEVEL), new ZlibDecoder)) //case "lzf" => Some(Codec(new LzfEncoder, new LzfDecoder)) case _ => None } val remoteClient = new RemoteClientHandler(name, futures, supervisors, bootstrap, remoteAddress, timer, client) - val stages: Array[ChannelHandler] = - zipCodec.map(codec => Array(timeout, codec.decoder, lenDec, protobufDec, codec.encoder, lenPrep, protobufEnc, remoteClient)) - .getOrElse(Array(timeout, lenDec, protobufDec, lenPrep, protobufEnc, remoteClient)) + val stages: Array[ChannelHandler] = + zipCodec.map(codec => Array(timeout, codec.decoder, lenDec, protobufDec, codec.encoder, lenPrep, protobufEnc, remoteClient)) + .getOrElse(Array(timeout, lenDec, protobufDec, lenPrep, protobufEnc, remoteClient)) new StaticChannelPipeline(stages: _*) } } @@ -168,7 +267,7 @@ class RemoteClientPipelineFactory(name: String, /** * @author Jonas Bonér */ -@ChannelPipelineCoverage { val value = "all" } +@ChannelPipelineCoverage {val value = "all"} class RemoteClientHandler(val name: String, val futures: ConcurrentMap[Long, CompletableFutureResult], val supervisors: ConcurrentMap[String, Actor], @@ -176,7 +275,7 @@ class RemoteClientHandler(val name: String, val remoteAddress: SocketAddress, val timer: HashedWheelTimer, val client: RemoteClient) - extends SimpleChannelUpstreamHandler with Logging { + extends SimpleChannelUpstreamHandler with Logging { import Actor.Sender.Self override def handleUpstream(ctx: ChannelHandlerContext, event: ChannelEvent) = { @@ -214,9 +313,9 @@ class RemoteClientHandler(val name: String, log.error("Unexpected exception in remote client handler: %s", e) throw e } - } + } - override def channelClosed(ctx: ChannelHandlerContext, event: ChannelStateEvent) = { + override def channelClosed(ctx: ChannelHandlerContext, event: ChannelStateEvent) = if (client.isRunning) { timer.newTimeout(new TimerTask() { def run(timeout: Timeout) = { log.debug("Remote client reconnecting to [%s]", remoteAddress) @@ -245,7 +344,7 @@ class RemoteClientHandler(val name: String, val exceptionType = Class.forName(exception.substring(0, exception.indexOf('$'))) val exceptionMessage = exception.substring(exception.indexOf('$') + 1, exception.length) exceptionType - .getConstructor(Array[Class[_]](classOf[String]): _*) - .newInstance(exceptionMessage).asInstanceOf[Throwable] + .getConstructor(Array[Class[_]](classOf[String]): _*) + .newInstance(exceptionMessage).asInstanceOf[Throwable] } } diff --git a/akka-core/src/main/scala/remote/RemoteServer.scala b/akka-core/src/main/scala/remote/RemoteServer.scala index 580cbc48cd..5288bd7bd4 100644 --- a/akka-core/src/main/scala/remote/RemoteServer.scala +++ b/akka-core/src/main/scala/remote/RemoteServer.scala @@ -33,6 +33,11 @@ import org.jboss.netty.handler.codec.compression.{ZlibEncoder, ZlibDecoder} *

  * RemoteNode.start(hostname, port)
  * 
+ * + * You can specify the class loader to use to load the remote actors. + *
+ * RemoteNode.start(hostname, port, classLoader)
+ * 
* * If you need to create more than one, then you can use the RemoteServer: * @@ -112,8 +117,6 @@ object RemoteServer { private[remote] def unregister(hostname: String, port: Int) = remoteServers.remove(Address(hostname, port)) - - private[remote] def canShutDownCluster: Boolean = remoteServers.isEmpty } /** @@ -179,14 +182,30 @@ class RemoteServer extends Logging { } } - def shutdown = { + def shutdown = if (isRunning) { RemoteServer.unregister(hostname, port) openChannels.disconnect - openChannels.unbind - openChannels.close.awaitUninterruptibly(1000) + openChannels.close.awaitUninterruptibly bootstrap.releaseExternalResources Cluster.deregisterLocalNode(hostname, port) - if (RemoteServer.canShutDownCluster) Cluster.shutdown + } + + // TODO: register active object in RemoteServer as well + + /** + * Register Remote Actor by the Actor's 'id' field. + */ + def register(actor: Actor) = if (isRunning) { + log.info("Registering server side remote actor [%s] with id [%s]", actor.getClass.getName, actor.id) + RemoteServer.actorsFor(RemoteServer.Address(hostname, port)).actors.put(actor.id, actor) + } + + /** + * Register Remote Actor by a specific 'id' passed as argument. + */ + def register(id: String, actor: Actor) = if (isRunning) { + log.info("Registering server side remote actor [%s] with id [%s]", actor.getClass.getName, id) + RemoteServer.actorsFor(RemoteServer.Address(hostname, port)).actors.put(id, actor) } } @@ -255,8 +274,7 @@ class RemoteServerHandler( override def messageReceived(ctx: ChannelHandlerContext, event: MessageEvent) = { val message = event.getMessage - if (message eq null) throw new IllegalStateException( - "Message in remote MessageEvent is null: " + event) + if (message eq null) throw new IllegalStateException("Message in remote MessageEvent is null: " + event) if (message.isInstanceOf[RemoteRequest]) { handleRemoteRequest(message.asInstanceOf[RemoteRequest], event.getChannel) } diff --git a/akka-core/src/main/scala/serialization/Serializer.scala b/akka-core/src/main/scala/serialization/Serializer.scala index 3d1c05f423..3eb9315126 100644 --- a/akka-core/src/main/scala/serialization/Serializer.scala +++ b/akka-core/src/main/scala/serialization/Serializer.scala @@ -152,7 +152,14 @@ object Serializer { // FIXME set ClassLoader on SJSONSerializer.SJSON def in(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = SJSONSerializer.SJSON.in(bytes) - def in(json: String): AnyRef = SJSONSerializer.SJSON.in(json) + import scala.reflect.Manifest + def in[T](json: String)(implicit m: Manifest[T]): AnyRef = { + SJSONSerializer.SJSON.in(json)(m) + } + + def in[T](bytes: Array[Byte])(implicit m: Manifest[T]): AnyRef = { + SJSONSerializer.SJSON.in(bytes)(m) + } } /** diff --git a/akka-core/src/main/scala/stm/HashTrie.scala b/akka-core/src/main/scala/stm/HashTrie.scala index c41ad85006..02b7ad2145 100644 --- a/akka-core/src/main/scala/stm/HashTrie.scala +++ b/akka-core/src/main/scala/stm/HashTrie.scala @@ -323,12 +323,12 @@ private[collection] class FullNode[K, +V](shift: Int)(table: Array[Node[K, V]]) val node = (table(i)(shift + 5, key, hash) = value) if (node == table(i)) this else { - val newTable = new Array[Node[K, A]](32) - Array.copy(table, 0, newTable, 0, 32) - - newTable(i) = node - - new FullNode(shift)(newTable) + val newTable = new Array[Node[K, A]](32) + Array.copy(table, 0, newTable, 0, 32) + + newTable(i) = node + + new FullNode(shift)(newTable) } } diff --git a/akka-core/src/main/scala/stm/ResultOrFailure.scala b/akka-core/src/main/scala/stm/ResultOrFailure.scala index 99d88c0c5a..51ce6ddf68 100644 --- a/akka-core/src/main/scala/stm/ResultOrFailure.scala +++ b/akka-core/src/main/scala/stm/ResultOrFailure.scala @@ -32,10 +32,10 @@ import stm.Transaction * * scala> res0() * java.lang.RuntimeException: Lets see what happens here... - * at ResultOrFailure.apply(RefExcept.scala:11) - * at .(:6) - * at .() - * at Re... + * at ResultOrFailure.apply(RefExcept.scala:11) + * at .(:6) + * at .() + * at Re... * * * @author Jonas Bonér diff --git a/akka-core/src/main/scala/stm/TransactionalState.scala b/akka-core/src/main/scala/stm/TransactionalState.scala index b2e69c7d63..6003a89f89 100644 --- a/akka-core/src/main/scala/stm/TransactionalState.scala +++ b/akka-core/src/main/scala/stm/TransactionalState.scala @@ -5,6 +5,7 @@ package se.scalablesolutions.akka.state import se.scalablesolutions.akka.stm.Transaction.atomic +import se.scalablesolutions.akka.stm.NoTransactionInScopeException import se.scalablesolutions.akka.collection._ import se.scalablesolutions.akka.util.UUID @@ -72,45 +73,87 @@ object TransactionalRef { * @author Jonas Bonér */ class TransactionalRef[T] extends Transactional { - implicit val txInitName = "TransactionalRef:Init" import org.multiverse.api.ThreadLocalTransaction._ + + implicit val txInitName = "TransactionalRef:Init" val uuid = UUID.newUuid.toString private[this] val ref: Ref[T] = atomic { new Ref } - def swap(elem: T) = ref.set(elem) - + def swap(elem: T) = { + ensureIsInTransaction + ref.set(elem) + } + def get: Option[T] = { + ensureIsInTransaction if (ref.isNull) None else Some(ref.get) } - def getOrWait: T = ref.getOrAwait + def getOrWait: T = { + ensureIsInTransaction + ref.getOrAwait + } def getOrElse(default: => T): T = { + ensureIsInTransaction if (ref.isNull) default else ref.get } - def isDefined: Boolean = !ref.isNull + def isDefined: Boolean = { + ensureIsInTransaction + !ref.isNull + } - def isEmpty: Boolean = ref.isNull + def isEmpty: Boolean = { + ensureIsInTransaction + ref.isNull + } - def map[B](f: T => B): Option[B] = if (isEmpty) None else Some(f(ref.get)) + def map[B](f: T => B): Option[B] = { + ensureIsInTransaction + if (isEmpty) None else Some(f(ref.get)) + } - def flatMap[B](f: T => Option[B]): Option[B] = if (isEmpty) None else f(ref.get) + def flatMap[B](f: T => Option[B]): Option[B] = { + ensureIsInTransaction + if (isEmpty) None else f(ref.get) + } - def filter(p: T => Boolean): Option[T] = if (isEmpty || p(ref.get)) Some(ref.get) else None + def filter(p: T => Boolean): Option[T] = { + ensureIsInTransaction + if (isEmpty || p(ref.get)) Some(ref.get) else None + } - def foreach(f: T => Unit) { if (!isEmpty) f(ref.get) } + def foreach(f: T => Unit) { + ensureIsInTransaction + if (!isEmpty) f(ref.get) + } - def elements: Iterator[T] = if (isEmpty) Iterator.empty else Iterator.fromValues(ref.get) + def elements: Iterator[T] = { + ensureIsInTransaction + if (isEmpty) Iterator.empty else Iterator.fromValues(ref.get) + } - def toList: List[T] = if (isEmpty) List() else List(ref.get) + def toList: List[T] = { + ensureIsInTransaction + if (isEmpty) List() else List(ref.get) + } - def toRight[X](left: => X) = if (isEmpty) Left(left) else Right(ref.get) + def toRight[X](left: => X) = { + ensureIsInTransaction + if (isEmpty) Left(left) else Right(ref.get) + } - def toLeft[X](right: => X) = if (isEmpty) Right(right) else Left(ref.get) + def toLeft[X](right: => X) = { + ensureIsInTransaction + if (isEmpty) Right(right) else Left(ref.get) + } + + private def ensureIsInTransaction = + if (getThreadLocalTransaction eq null) throw new NoTransactionInScopeException } object TransactionalMap { diff --git a/akka-core/src/test/scala/AllTest.scala b/akka-core/src/test/scala/AllTest.scala index 37604e2e7a..fdf3351298 100644 --- a/akka-core/src/test/scala/AllTest.scala +++ b/akka-core/src/test/scala/AllTest.scala @@ -4,7 +4,7 @@ import junit.framework.Test import junit.framework.TestCase import junit.framework.TestSuite -import se.scalablesolutions.akka.actor.{RemoteActorTest, InMemoryActorTest, ThreadBasedActorTest, SupervisorTest, RemoteSupervisorTest, SchedulerTest} +import se.scalablesolutions.akka.actor.{ClientInitiatedRemoteActorTest, InMemoryActorTest, ThreadBasedActorTest, SupervisorTest, RemoteSupervisorTest, SchedulerTest} object AllTest extends TestCase { def suite(): Test = { @@ -16,7 +16,7 @@ object AllTest extends TestCase { suite.addTestSuite(classOf[ThreadBasedActorTest]) suite.addTestSuite(classOf[ReactorBasedSingleThreadEventDrivenDispatcherTest]) suite.addTestSuite(classOf[ReactorBasedThreadPoolEventDrivenDispatcherTest]) - suite.addTestSuite(classOf[RemoteActorTest]) + suite.addTestSuite(classOf[ClientInitiatedRemoteActorTest]) suite.addTestSuite(classOf[InMemoryActorTest]) suite.addTestSuite(classOf[SchedulerTest]) //suite.addTestSuite(classOf[TransactionClasherTest]) diff --git a/akka-core/src/test/scala/RemoteActorTest.scala b/akka-core/src/test/scala/ClientInitiatedRemoteActorTest.scala similarity index 81% rename from akka-core/src/test/scala/RemoteActorTest.scala rename to akka-core/src/test/scala/ClientInitiatedRemoteActorTest.scala index 6bb5d8e689..81fb4780da 100644 --- a/akka-core/src/test/scala/RemoteActorTest.scala +++ b/akka-core/src/test/scala/ClientInitiatedRemoteActorTest.scala @@ -46,7 +46,7 @@ class RemoteActorSpecActorAsyncSender extends Actor { } } -class RemoteActorTest extends JUnitSuite { +class ClientInitiatedRemoteActorTest extends JUnitSuite { import Actor.Sender.Self akka.Config.config @@ -108,7 +108,7 @@ class RemoteActorTest extends JUnitSuite { actor.start val sender = new RemoteActorSpecActorAsyncSender - sender.setContactAddress(HOSTNAME, PORT1) + sender.setReplyToAddress(HOSTNAME, PORT1) sender.start sender.send(actor) Thread.sleep(1000) @@ -116,26 +116,6 @@ class RemoteActorTest extends JUnitSuite { actor.stop } - /* - This test does not throw an exception since the - _contactAddress is always defined via the - global configuration if not set explicitly. - - @Test - def shouldSendRemoteReplyException = { - implicit val timeout = 500000000L - val actor = new RemoteActorSpecActorBidirectional - actor.makeRemote(HOSTNAME, PORT1) - actor.start - - val sender = new RemoteActorSpecActorAsyncSender - sender.start - sender.send(actor) - Thread.sleep(500) - assert("exception" === Global.remoteReply) - actor.stop - } - */ @Test def shouldSendReceiveException = { implicit val timeout = 500000000L diff --git a/akka-core/src/test/scala/RemoteClientShutdownTest.scala b/akka-core/src/test/scala/RemoteClientShutdownTest.scala new file mode 100644 index 0000000000..f6fbea1bb9 --- /dev/null +++ b/akka-core/src/test/scala/RemoteClientShutdownTest.scala @@ -0,0 +1,30 @@ +package se.scalablesolutions.akka.actor + +import se.scalablesolutions.akka.remote.RemoteNode +import se.scalablesolutions.akka.actor._ +import Actor.Sender.Self + +import org.scalatest.junit.JUnitSuite +import org.junit.Test + +class RemoteClientShutdownTest extends JUnitSuite { + @Test def shouldShutdownRemoteClient = { + RemoteNode.start("localhost", 9999) + + var remote = new TravelingActor + remote.start + remote ! "sending a remote message" + remote.stop + + Thread.sleep(1000) + RemoteNode.shutdown + println("======= REMOTE CLIENT SHUT DOWN FINE =======") + assert(true) + } +} + +class TravelingActor extends RemoteActor("localhost", 9999) { + def receive = { + case _ => log.info("message received") + } +} diff --git a/akka-core/src/test/scala/SerializerTest.scala b/akka-core/src/test/scala/SerializerTest.scala new file mode 100644 index 0000000000..e11e83a2f5 --- /dev/null +++ b/akka-core/src/test/scala/SerializerTest.scala @@ -0,0 +1,40 @@ +package se.scalablesolutions.akka.serialization + +import junit.framework.TestCase + +import org.scalatest.junit.JUnitSuite +import org.junit.{Test, Before, After} + +import scala.reflect.BeanInfo +@BeanInfo +case class Foo(foo: String) { + def this() = this(null) +} + +@BeanInfo +case class MyMessage(val id: String, val value: Tuple2[String, Int]) { + private def this() = this(null, null) +} + + +class SerializerTest extends JUnitSuite { + @Test + def shouldSerializeString = { + val f = Foo("debasish") + val json = Serializer.ScalaJSON.out(f) + assert(new String(json) == """{"foo":"debasish"}""") + val fo = Serializer.ScalaJSON.in[Foo](new String(json)).asInstanceOf[Foo] + assert(fo == f) + } + + @Test + def shouldSerializeTuple2 = { + val message = MyMessage("id", ("hello", 34)) + val json = Serializer.ScalaJSON.out(message) + assert(new String(json) == """{"id":"id","value":{"hello":34}}""") + val f = Serializer.ScalaJSON.in[MyMessage](new String(json)).asInstanceOf[MyMessage] + assert(f == message) + val g = Serializer.ScalaJSON.in[MyMessage](json).asInstanceOf[MyMessage] + assert(f == message) + } +} diff --git a/akka-core/src/test/scala/ServerInitiatedRemoteActorSample.scala b/akka-core/src/test/scala/ServerInitiatedRemoteActorSample.scala new file mode 100644 index 0000000000..f53f706f3b --- /dev/null +++ b/akka-core/src/test/scala/ServerInitiatedRemoteActorSample.scala @@ -0,0 +1,34 @@ +package sample + +import se.scalablesolutions.akka.actor.Actor +import se.scalablesolutions.akka.remote.{RemoteClient, RemoteNode} +import se.scalablesolutions.akka.util.Logging + +class HelloWorldActor extends Actor { + start + def receive = { + case "Hello" => reply("World") + } +} + +object ServerInitiatedRemoteActorServer { + + def run = { + RemoteNode.start("localhost", 9999) + RemoteNode.register("hello-service", new HelloWorldActor) + } + + def main(args: Array[String]) = run +} + +object ServerInitiatedRemoteActorClient extends Logging { + + def run = { + val actor = RemoteClient.actorFor("hello-service", "localhost", 9999) + val result = actor !! "Hello" + log.info("Result from Remote Actor: %s", result) + } + + def main(args: Array[String]) = run +} + diff --git a/akka-core/src/test/scala/ServerInitiatedRemoteActorTest.scala b/akka-core/src/test/scala/ServerInitiatedRemoteActorTest.scala new file mode 100644 index 0000000000..2f1ef161c8 --- /dev/null +++ b/akka-core/src/test/scala/ServerInitiatedRemoteActorTest.scala @@ -0,0 +1,145 @@ +package se.scalablesolutions.akka.actor + +import java.util.concurrent.TimeUnit + +import org.scalatest.junit.JUnitSuite +import org.junit.{Test, Before, After} + +import se.scalablesolutions.akka.remote.{RemoteServer, RemoteClient} +import se.scalablesolutions.akka.dispatch.Dispatchers + +object ServerInitiatedRemoteActorTest { + val HOSTNAME = "localhost" + val PORT = 9990 + var server: RemoteServer = null + + object Global { + var oneWay = "nada" + var remoteReply = "nada" + } + + class RemoteActorSpecActorUnidirectional extends Actor { + dispatcher = Dispatchers.newThreadBasedDispatcher(this) + start + + def receive = { + case "OneWay" => + println("================== ONEWAY") + Global.oneWay = "received" + } + } + + class RemoteActorSpecActorBidirectional extends Actor { + start + def receive = { + case "Hello" => + reply("World") + case "Failure" => + throw new RuntimeException("expected") + } + } + + case class Send(actor: Actor) + + class RemoteActorSpecActorAsyncSender extends Actor { + start + def receive = { + case Send(actor: Actor) => + actor ! "Hello" + case "World" => + Global.remoteReply = "replied" + } + + def send(actor: Actor) { + this ! Send(actor) + } + } +} + +class ServerInitiatedRemoteActorTest extends JUnitSuite { + import ServerInitiatedRemoteActorTest._ + + import Actor.Sender.Self + akka.Config.config + + private val unit = TimeUnit.MILLISECONDS + + @Before + def init() { + server = new RemoteServer() + + server.start(HOSTNAME, PORT) + + server.register(new RemoteActorSpecActorUnidirectional) + server.register(new RemoteActorSpecActorBidirectional) + server.register(new RemoteActorSpecActorAsyncSender) + + Thread.sleep(1000) + } + + // make sure the servers shutdown cleanly after the test has finished + @After + def finished() { + server.shutdown + RemoteClient.shutdownAll + Thread.sleep(1000) + } + + @Test + def shouldSendOneWay = { + val actor = RemoteClient.actorFor( + "se.scalablesolutions.akka.actor.ServerInitiatedRemoteActorTest$RemoteActorSpecActorUnidirectional", + 5000L, + HOSTNAME, PORT) + val result = actor ! "OneWay" + Thread.sleep(1000) + assert("received" === Global.oneWay) + actor.stop + } + + @Test + def shouldSendReplyAsync = { + val actor = RemoteClient.actorFor( + "se.scalablesolutions.akka.actor.ServerInitiatedRemoteActorTest$RemoteActorSpecActorBidirectional", + 5000L, + HOSTNAME, PORT) + val result = actor !! "Hello" + assert("World" === result.get.asInstanceOf[String]) + actor.stop + } + + @Test + def shouldSendRemoteReply = { + implicit val timeout = 500000000L + val actor = RemoteClient.actorFor( + "se.scalablesolutions.akka.actor.ServerInitiatedRemoteActorTest$RemoteActorSpecActorBidirectional", + timeout, + HOSTNAME, PORT) + + val sender = new RemoteActorSpecActorAsyncSender + sender.setReplyToAddress(HOSTNAME, PORT) + sender.start + sender.send(actor) + Thread.sleep(1000) + assert("replied" === Global.remoteReply) + actor.stop + } + + @Test + def shouldSendReceiveException = { + implicit val timeout = 500000000L + val actor = RemoteClient.actorFor( + "se.scalablesolutions.akka.actor.ServerInitiatedRemoteActorTest$RemoteActorSpecActorBidirectional", + timeout, + HOSTNAME, PORT) + try { + actor !! "Failure" + fail("Should have thrown an exception") + } catch { + case e => + assert("expected" === e.getMessage()) + } + actor.stop + } +} + \ No newline at end of file diff --git a/akka-fun-test-java/pom.xml b/akka-fun-test-java/pom.xml index 24868c06e4..beb19f25c5 100644 --- a/akka-fun-test-java/pom.xml +++ b/akka-fun-test-java/pom.xml @@ -11,7 +11,7 @@ akka se.scalablesolutions.akka - 0.6 + 0.7-SNAPSHOT diff --git a/akka-fun-test-java/src/test/java/se/scalablesolutions/akka/api/PersistentNestedStateTest.java b/akka-fun-test-java/src/test/java/se/scalablesolutions/akka/api/PersistentNestedStateTest.java index 70aa10b9b1..7fd3a65dfb 100644 --- a/akka-fun-test-java/src/test/java/se/scalablesolutions/akka/api/PersistentNestedStateTest.java +++ b/akka-fun-test-java/src/test/java/se/scalablesolutions/akka/api/PersistentNestedStateTest.java @@ -8,7 +8,7 @@ import se.scalablesolutions.akka.config.*; import se.scalablesolutions.akka.config.ActiveObjectConfigurator; import static se.scalablesolutions.akka.config.JavaConfig.*; import se.scalablesolutions.akka.actor.*; - import se.scalablesolutions.akka.Kernel; + import se.scalablesolutions.akka.Kernel; import junit.framework.TestCase; diff --git a/akka-fun-test-java/testng.xml b/akka-fun-test-java/testng.xml old mode 100755 new mode 100644 diff --git a/akka-kernel/pom.xml b/akka-kernel/pom.xml old mode 100755 new mode 100644 index 5aab4575c5..4b1d114d45 --- a/akka-kernel/pom.xml +++ b/akka-kernel/pom.xml @@ -11,7 +11,7 @@ akka se.scalablesolutions.akka - 0.6 + 0.7-SNAPSHOT @@ -56,6 +56,11 @@ ${project.groupId} ${project.version}
+ diff --git a/akka-comet/src/main/scala/BootableCometActorService.scala b/akka-kernel/src/main/scala/BootableCometActorService.scala similarity index 92% rename from akka-comet/src/main/scala/BootableCometActorService.scala rename to akka-kernel/src/main/scala/BootableCometActorService.scala index 2ded71ed3c..b014fcb9ad 100644 --- a/akka-comet/src/main/scala/BootableCometActorService.scala +++ b/akka-kernel/src/main/scala/BootableCometActorService.scala @@ -2,13 +2,14 @@ * Copyright (C) 2009-2010 Scalable Solutions AB */ -package se.scalablesolutions.akka.comet +package se.scalablesolutions.akka import com.sun.grizzly.http.SelectorThread import com.sun.grizzly.http.servlet.ServletAdapter import com.sun.grizzly.standalone.StaticStreamAlgorithm import javax.ws.rs.core.UriBuilder +import se.scalablesolutions.akka.comet.AkkaServlet import se.scalablesolutions.akka.actor.BootableActorLoaderService import se.scalablesolutions.akka.util.{Bootable,Logging} @@ -54,17 +55,17 @@ trait BootableCometActorService extends Bootable with Logging { t.setAdapter(adapter) t.setEnableAsyncExecution(true) t.setAsyncHandler(ah) - t.listen - t } + t.listen + t } log.info("REST service started successfully. Listening to port [%s]", REST_PORT) } } abstract override def onUnload = { - super.onUnload - - if (jerseySelectorThread.isDefined) { + super.onUnload + + if (jerseySelectorThread.isDefined) { log.info("Shutting down REST service (Jersey)") jerseySelectorThread.get.stopEndpoint } diff --git a/akka-kernel/src/main/scala/Kernel.scala b/akka-kernel/src/main/scala/Kernel.scala index 455a5a9cbc..f63a50a0a7 100644 --- a/akka-kernel/src/main/scala/Kernel.scala +++ b/akka-kernel/src/main/scala/Kernel.scala @@ -4,10 +4,9 @@ package se.scalablesolutions.akka -import se.scalablesolutions.akka.comet.BootableCometActorService import se.scalablesolutions.akka.remote.BootableRemoteActorService import se.scalablesolutions.akka.actor.BootableActorLoaderService -import se.scalablesolutions.akka.util.Logging +import se.scalablesolutions.akka.util.{Logging,Bootable} import javax.servlet.{ServletContextListener, ServletContextEvent} @@ -24,29 +23,30 @@ object Kernel extends Logging { @volatile private var hasBooted = false private val startTime = System.currentTimeMillis + + /** + * Holds a reference to the services that has been booted + */ + @volatile private var bundles : Option[Bootable] = None /** - * Bundles is what modules are to be loaded with the Kernel, this uses Jonas' AOP style mixin pattern. + * Boots up the Kernel with default bootables */ - object Bundles extends BootableActorLoaderService with BootableRemoteActorService with BootableCometActorService - - /** - * Boots up the Kernel. - */ - def boot: Unit = boot(true) + def boot : Unit = boot(true, new BootableActorLoaderService with BootableRemoteActorService with BootableCometActorService) /** * Boots up the Kernel. * If you pass in false as parameter then the Akka banner is not printed out. */ - def boot(withBanner: Boolean): Unit = synchronized { + def boot(withBanner: Boolean, b : Bootable): Unit = synchronized { if (!hasBooted) { if (withBanner) printBanner log.info("Starting Akka...") - Bundles.onLoad + b.onLoad Thread.currentThread.setContextClassLoader(getClass.getClassLoader) log.info("Akka started successfully") hasBooted = true + bundles = Some(b) } } @@ -56,12 +56,17 @@ object Kernel extends Logging { def shutdown = synchronized { if (hasBooted) { log.info("Shutting down Akka...") - Bundles.onUnload + bundles.foreach(_.onUnload) + bundles = None log.info("Akka succesfully shut down") } } - def startRemoteService = Bundles.startRemoteService + //For testing purposes only + def startRemoteService : Unit = bundles.foreach( _ match { + case x : BootableRemoteActorService => x.startRemoteService + case _ => + }) private def printBanner = { log.info( @@ -85,5 +90,5 @@ object Kernel extends Logging { class Kernel extends ServletContextListener { def contextDestroyed(e : ServletContextEvent) : Unit = Kernel.shutdown - def contextInitialized(e : ServletContextEvent) : Unit = Kernel.boot + def contextInitialized(e : ServletContextEvent) : Unit = Kernel.boot(true,new BootableActorLoaderService with BootableRemoteActorService) } \ No newline at end of file diff --git a/akka-patterns/pom.xml b/akka-patterns/pom.xml new file mode 100644 index 0000000000..6d3f8e0b41 --- /dev/null +++ b/akka-patterns/pom.xml @@ -0,0 +1,39 @@ + + 4.0.0 + + akka-patterns + Akka Patterns Module + + jar + + + akka + se.scalablesolutions.akka + 0.7-SNAPSHOT + + + + + + akka-core + ${project.groupId} + ${project.version} + + + + + org.scalatest + scalatest + 1.0 + test + + + junit + junit + 4.5 + test + + + diff --git a/akka-patterns/src/main/scala/Agent.scala b/akka-patterns/src/main/scala/Agent.scala new file mode 100644 index 0000000000..4dd8640c32 --- /dev/null +++ b/akka-patterns/src/main/scala/Agent.scala @@ -0,0 +1,146 @@ +// ScalaAgent +// +// Copyright © 2008-9 The original author or authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package se.scalablesolutions.akka.actor + +import se.scalablesolutions.akka.state.TransactionalState +import se.scalablesolutions.akka.stm.Transaction.atomic + +import java.util.concurrent.atomic.AtomicReference +import java.util.concurrent.{CountDownLatch} + +/** +* The Agent class was strongly inspired by the agent principle in Clojure. Essentially, an agent wraps a shared mutable state +* and hides it behind a message-passing interface. Agents accept messages and process them on behalf of the wrapped state. +* Typically agents accept functions / commands as messages and ensure the submitted commands are executed against the internal +* agent's state in a thread-safe manner (sequentially). +* The submitted functions / commands take the internal state as a parameter and their output becomes the new internal state value. +* The code that is submitted to an agent doesn't need to pay attention to threading or synchronization, the agent will +* provide such guarantees by itself. +* See the examples of use for more details. +* +* @author Vaclav Pech +* Date: Oct 18, 2009 +* +* AKKA retrofit by +* @author Viktor Klang +* Date: Jan 24 2010 +*/ +sealed class Agent[T] private (initialValue: T) extends Actor { + import Agent._ + + private val value = TransactionalState.newRef[T] + + updateData(initialValue) + + /** + * Periodically handles incoming messages + */ + def receive = { + case FunctionHolder(fun: (T => T)) => atomic { updateData(fun(value.getOrWait)) } + + case ValueHolder(x: T) => updateData(x) + + case ProcedureHolder(fun: (T => Unit)) => atomic { fun(copyStrategy(value.getOrWait)) } + } + + /** + * Specifies how a copy of the value is made, defaults to using identity + */ + protected def copyStrategy(t : T) : T = t + + + /** + * Updates the internal state with the value provided as a by-name parameter + */ + private final def updateData(newData: => T) : Unit = atomic { value.swap(newData) } + + /** + * Submits a request to read the internal state. + * A copy of the internal state will be returned, depending on the underlying effective copyStrategy. + * Internally leverages the asynchronous getValue() method and then waits for its result on a CountDownLatch. + */ + final def get : T = { + val ref = new AtomicReference[T] + val latch = new CountDownLatch(1) + get((x: T) => {ref.set(x); latch.countDown}) + latch.await + ref.get + } + + /** + * Asynchronously submits a request to read the internal state. The supplied function will be executed on the returned internal state value. + * A copy of the internal state will be used, depending on the underlying effective copyStrategy. + */ + final def get(message: (T => Unit)) : Unit = this ! ProcedureHolder(message) + + /** + * Submits a request to read the internal state. + * A copy of the internal state will be returned, depending on the underlying effective copyStrategy. + * Internally leverages the asynchronous getValue() method and then waits for its result on a CountDownLatch. + */ + final def apply() : T = get + + /** + * Asynchronously submits a request to read the internal state. The supplied function will be executed on the returned internal state value. + * A copy of the internal state will be used, depending on the underlying effective copyStrategy. + */ +// final def apply(message: (T => Unit)) : Unit = get(message) + + /** + * Submits the provided function for execution against the internal agent's state + */ + final def apply(message: (T => T)) : Unit = this ! FunctionHolder(message) + + /** + * Submits a new value to be set as the new agent's internal state + */ + final def apply(message: T) : Unit = this ! ValueHolder(message) + + /** + * Submits the provided function for execution against the internal agent's state + */ + final def update(message: (T => T)) : Unit = this ! FunctionHolder(message) + + /** + * Submits a new value to be set as the new agent's internal state + */ + final def update(message: T) : Unit = this ! ValueHolder(message) +} + +/** +* Provides factory methods to create Agents. +*/ +object Agent { + /** + * The internal messages for passing around requests + */ + private case class ProcedureHolder[T](val fun: ((T) => Unit)) + private case class FunctionHolder[T](val fun: ((T) => T)) + private case class ValueHolder[T](val value: T) + + /** + * Creates a new Agent of type T with the initial value of value + */ + def apply[T](value:T) : Agent[T] = new Agent(value) + + /** + * Creates a new Agent of type T with the initial value of value and with the specified copy function + */ + def apply[T](value:T, newCopyStrategy: (T) => T) = new Agent(value) { + override def copyStrategy(t : T) = newCopyStrategy(t) + } +} diff --git a/akka-patterns/src/main/scala/Patterns.scala b/akka-patterns/src/main/scala/Patterns.scala new file mode 100644 index 0000000000..cc2825145a --- /dev/null +++ b/akka-patterns/src/main/scala/Patterns.scala @@ -0,0 +1,101 @@ +package se.scalablesolutions.akka.actor.patterns + +import se.scalablesolutions.akka.actor.Actor + +object Patterns { + type PF[A,B] = PartialFunction[A,B] + + /** + * Creates a new PartialFunction whose isDefinedAt is a combination + * of the two parameters, and whose apply is first to call filter.apply and then filtered.apply + */ + def filter[A,B](filter : PF[A,Unit],filtered : PF[A,B]) : PF[A,B] = { + case a : A if filtered.isDefinedAt(a) && filter.isDefinedAt(a) => + filter(a) + filtered(a) + } + + /** + * Interceptor is a filter(x,y) where x.isDefinedAt is considered to be always true + */ + def intercept[A,B](interceptor : (A) => Unit, interceptee : PF[A,B]) : PF[A,B] = filter( + { case a if a.isInstanceOf[A] => interceptor(a) }, + interceptee + ) + + //FIXME 2.8, use default params with CyclicIterator + def loadBalancerActor(actors : => InfiniteIterator[Actor]) : Actor = new Actor with LoadBalancer { + val seq = actors + } + + //FIXME 2.8, use default params with CyclicIterator + /*def loadBalancerActor(actors : () => List[Actor]) : Actor = loadBalancerActor( + new CyclicIterator(actors()) + ) */ + + def dispatcherActor(routing : PF[Any,Actor], msgTransformer : (Any) => Any) : Actor = new Actor with Dispatcher { + override def transform(msg : Any) = msgTransformer(msg) + def routes = routing + } + + def dispatcherActor(routing : PF[Any,Actor]) : Actor = new Actor with Dispatcher { + def routes = routing + } + + def loggerActor(actorToLog : Actor, logger : (Any) => Unit) : Actor = dispatcherActor ( + { case _ => actorToLog }, + logger + ) +} + +trait Dispatcher { self : Actor => + + protected def transform(msg : Any) : Any = msg + protected def routes : PartialFunction[Any,Actor] + + protected def dispatch : PartialFunction[Any,Unit] = { + case a if routes.isDefinedAt(a) => { + if(self.sender.isDefined) + routes(a) forward transform(a) + else + routes(a) send transform(a) + } + } + + def receive = dispatch +} + +trait LoadBalancer extends Dispatcher { self : Actor => + protected def seq : InfiniteIterator[Actor] + + protected def routes = { case x if seq.hasNext => seq.next } +} + +trait InfiniteIterator[T] extends Iterator[T] + +class CyclicIterator[T](items : List[T]) extends InfiniteIterator[T] { + @volatile private[this] var current : List[T] = items + def hasNext = items != Nil + def next = { + val nc = if(current == Nil) items else current + current = nc.tail + nc.head + } +} + +//Agent +/* +val a = agent(startValue) +a.set(_ + 5) +a.get +a.foreach println(_) +*/ +object Agent { + sealed trait AgentMessage + case class FunMessage[T](f : (T) => T) extends AgentMessage + case class ProcMessage[T](f : (T) => Unit) extends AgentMessage + case class ValMessage[T](t : T) extends AgentMessage +} +sealed private[akka] class Agent[T] { + +} \ No newline at end of file diff --git a/akka-patterns/src/test/scala/ActorPatternsTest.scala b/akka-patterns/src/test/scala/ActorPatternsTest.scala new file mode 100644 index 0000000000..11f2664640 --- /dev/null +++ b/akka-patterns/src/test/scala/ActorPatternsTest.scala @@ -0,0 +1,87 @@ +package se.scalablesolutions.akka.actor + + +import config.ScalaConfig._ + +import org.scalatest.Suite +import patterns.Patterns +import se.scalablesolutions.akka.util.Logging +import org.junit.runner.RunWith +import org.scalatest.junit.JUnitRunner +import org.scalatest.matchers.MustMatchers +import org.junit.{Before, After, Test} +import scala.collection.mutable.HashSet + +@RunWith(classOf[JUnitRunner]) +class ActorPatternsTest extends junit.framework.TestCase with Suite with MustMatchers with ActorTestUtil with Logging { + import Actor._ + import Patterns._ + @Test def testDispatcher = verify(new TestActor { + def test = { + val (testMsg1,testMsg2,testMsg3,testMsg4) = ("test1","test2","test3","test4") + + var targetOk = 0 + val t1 = actor() receive { + case `testMsg1` => targetOk += 2 + case `testMsg2` => targetOk += 4 + } + + val t2 = actor() receive { + case `testMsg3` => targetOk += 8 + } + + val d = dispatcherActor { + case `testMsg1`|`testMsg2` => t1 + case `testMsg3` => t2 + } + + handle(d,t1,t2){ + d ! testMsg1 + d ! testMsg2 + d ! testMsg3 + Thread.sleep(1000) + targetOk must be(14) + } + } + }) + + @Test def testLogger = verify(new TestActor { + def test = { + val msgs = new HashSet[Any] + val t1 = actor() receive { + case _ => + } + val l = loggerActor(t1,(x) => msgs += x) + handle(t1,l) { + val t1 : Any = "foo" + val t2 : Any = "bar" + l ! t1 + l ! t2 + Thread.sleep(1000) + msgs must ( have size (2) and contain (t1) and contain (t2) ) + } + } + }) +} + +trait ActorTestUtil { + + def handle[T](actors : Actor*)(test : => T) : T = { + for(a <- actors) a.start + try { + test + } + finally { + for(a <- actors) a.stop + } + } + + def verify(actor : TestActor) : Unit = handle(actor) { + actor.test + } +} + +abstract class TestActor extends Actor with ActorTestUtil { + def test : Unit + def receive = { case _ => } +} \ No newline at end of file diff --git a/akka-patterns/src/test/scala/AgentTest.scala b/akka-patterns/src/test/scala/AgentTest.scala new file mode 100644 index 0000000000..17ccce8e0a --- /dev/null +++ b/akka-patterns/src/test/scala/AgentTest.scala @@ -0,0 +1,24 @@ +package se.scalablesolutions.akka.actor + +import org.scalatest.Suite +import se.scalablesolutions.akka.util.Logging +import org.junit.runner.RunWith +import org.scalatest.junit.JUnitRunner +import org.scalatest.matchers.MustMatchers +import org.junit.{Test} + +@RunWith(classOf[JUnitRunner]) +class AgentTest extends junit.framework.TestCase with Suite with MustMatchers with ActorTestUtil with Logging { + @Test def testAgent = verify(new TestActor { + def test = { + val t = Agent(5) + handle(t){ + t.update( _ + 1 ) + t.update( _ * 2 ) + + val r = t() + r must be (12) + } + } + }) +} \ No newline at end of file diff --git a/akka-persistence/akka-persistence-cassandra/pom.xml b/akka-persistence/akka-persistence-cassandra/pom.xml index 9abb616796..4bca9ffbac 100644 --- a/akka-persistence/akka-persistence-cassandra/pom.xml +++ b/akka-persistence/akka-persistence-cassandra/pom.xml @@ -10,7 +10,7 @@ akka-persistence-parent se.scalablesolutions.akka - 0.6 + 0.7-SNAPSHOT @@ -24,7 +24,7 @@ org.apache.cassandra cassandra - 0.4.1 + 0.5.0 log4j diff --git a/akka-persistence/akka-persistence-common/pom.xml b/akka-persistence/akka-persistence-common/pom.xml index e260d3c5a9..623fbea571 100644 --- a/akka-persistence/akka-persistence-common/pom.xml +++ b/akka-persistence/akka-persistence-common/pom.xml @@ -10,7 +10,7 @@ akka-persistence-parent se.scalablesolutions.akka - 0.6 + 0.7-SNAPSHOT diff --git a/akka-persistence/akka-persistence-mongo/pom.xml b/akka-persistence/akka-persistence-mongo/pom.xml index f8543cdd67..616deb7492 100644 --- a/akka-persistence/akka-persistence-mongo/pom.xml +++ b/akka-persistence/akka-persistence-mongo/pom.xml @@ -10,7 +10,7 @@ akka-persistence-parent se.scalablesolutions.akka - 0.6 + 0.7-SNAPSHOT diff --git a/akka-persistence/akka-persistence-redis/pom.xml b/akka-persistence/akka-persistence-redis/pom.xml index 71b5db8920..c6088e573b 100644 --- a/akka-persistence/akka-persistence-redis/pom.xml +++ b/akka-persistence/akka-persistence-redis/pom.xml @@ -10,7 +10,7 @@ akka-persistence-parent se.scalablesolutions.akka - 0.6 + 0.7-SNAPSHOT diff --git a/akka-persistence/akka-persistence-redis/src/test/scala/RedisPersistentActorSpec.scala b/akka-persistence/akka-persistence-redis/src/test/scala/RedisPersistentActorSpec.scala index b577f0ba72..86d4384b70 100644 --- a/akka-persistence/akka-persistence-redis/src/test/scala/RedisPersistentActorSpec.scala +++ b/akka-persistence/akka-persistence-redis/src/test/scala/RedisPersistentActorSpec.scala @@ -27,8 +27,8 @@ case class Credit(accountNo: String, amount: BigInt) case object LogSize class AccountActor extends Transactor { - private val accountState = RedisStorage.newMap - private val txnLog = RedisStorage.newVector + private lazy val accountState = RedisStorage.newMap + private lazy val txnLog = RedisStorage.newVector def receive = { // check balance diff --git a/akka-persistence/akka-persistence-redis/src/test/scala/RedisPersistentQSpec.scala b/akka-persistence/akka-persistence-redis/src/test/scala/RedisPersistentQSpec.scala index 2adc980aad..ad67dbfdbe 100644 --- a/akka-persistence/akka-persistence-redis/src/test/scala/RedisPersistentQSpec.scala +++ b/akka-persistence/akka-persistence-redis/src/test/scala/RedisPersistentQSpec.scala @@ -20,7 +20,7 @@ case class MNDQ(accountNos: List[String], noOfDQs: Int, failer: Actor) case class SZ class QueueActor extends Transactor { - private val accounts = RedisStorage.newQueue + private lazy val accounts = RedisStorage.newQueue def receive = { // enqueue diff --git a/akka-persistence/pom.xml b/akka-persistence/pom.xml index 20f15f8aff..cad4757353 100644 --- a/akka-persistence/pom.xml +++ b/akka-persistence/pom.xml @@ -10,7 +10,7 @@ akka se.scalablesolutions.akka - 0.6 + 0.7-SNAPSHOT diff --git a/akka-rest/pom.xml b/akka-rest/pom.xml index 4fc7f8c7cd..4e875cb310 100644 --- a/akka-rest/pom.xml +++ b/akka-rest/pom.xml @@ -11,7 +11,7 @@ akka se.scalablesolutions.akka - 0.6 + 0.7-SNAPSHOT @@ -27,11 +27,11 @@ javax.servlet servlet-api 2.5 - + com.sun.jersey jersey-core - 1.1.5-ea-20100104 + ${jersey.version} com.sun.jersey diff --git a/akka-samples/akka-sample-chat/Buildfile b/akka-samples/akka-sample-chat/Buildfile new file mode 100644 index 0000000000..fecc093964 --- /dev/null +++ b/akka-samples/akka-sample-chat/Buildfile @@ -0,0 +1,48 @@ +require 'buildr/scala' + +VERSION_NUMBER = "0.6" +GROUP = "se.scalablesolutions.akka" + +repositories.remote << "http://www.ibiblio.org/maven2/" +repositories.remote << "http://www.lag.net/repo" +repositories.remote << "http://multiverse.googlecode.com/svn/maven-repository/releases" + +AKKA = group('akka-core', 'akka-comet', 'akka-util','akka-kernel', 'akka-rest', 'akka-util-java', + 'akka-security','akka-persistence-common', 'akka-persistence-redis', + 'akka-amqp', + :under=> 'se.scalablesolutions.akka', + :version => '0.6') +ASPECTJ = "org.codehaus.aspectwerkz:aspectwerkz-nodeps-jdk5:jar:2.1" +SBINARY = "sbinary:sbinary:jar:0.3" +COMMONS_IO = "commons-io:commons-io:jar:1.4" +CONFIGGY = "net.lag:configgy:jar:1.4.7" +JACKSON = group('jackson-core-asl', 'jackson-mapper-asl', + :under=> 'org.codehaus.jackson', + :version => '1.2.1') +MULTIVERSE = "org.multiverse:multiverse-alpha:jar:jar-with-dependencies:0.3" +NETTY = "org.jboss.netty:netty:jar:3.2.0.ALPHA2" +PROTOBUF = "com.google.protobuf:protobuf-java:jar:2.2.0" +REDIS = "com.redis:redisclient:jar:1.0.1" +SJSON = "sjson.json:sjson:jar:0.3" + +Project.local_task "run" + +desc "Akka Chat Sample Module" +define "akka-sample-chat" do + project.version = VERSION_NUMBER + project.group = GROUP + + compile.with AKKA, CONFIGGY + + p artifact(MULTIVERSE).to_s + + package(:jar) + + task "run" do + Java.java "scala.tools.nsc.MainGenericRunner", + :classpath => [ compile.dependencies, compile.target, + ASPECTJ, COMMONS_IO, JACKSON, NETTY, MULTIVERSE, PROTOBUF, REDIS, + SBINARY, SJSON], + :java_args => ["-server"] + end +end \ No newline at end of file diff --git a/akka-samples/akka-sample-chat/README b/akka-samples/akka-sample-chat/README index 47ee2601f2..d2049cd7c0 100644 --- a/akka-samples/akka-sample-chat/README +++ b/akka-samples/akka-sample-chat/README @@ -12,14 +12,14 @@ Then to run the sample: 1. Set ‘AKKA_HOME’ environment variable to the root of the Akka distribution. 2. Open up a shell and step into the Akka distribution root folder. -3. Build Akka by invoking ‘mvn install -Dmaven.test.skip=true’. This will also bulid the sample application and deploy it to the ‘$AKKA_HOME/deploy’ directory. +3. Build Akka by invoking ‘mvn install -Dmaven.test.skip=true’. This will also build the sample application and deploy it to the ‘$AKKA_HOME/deploy’ directory. 4. Run the microkernel export AKKA_HOME=... cd $AKKA_HOME java -jar ./dist/akka-0.6.jar 5. Now start up a new shell and go down into the ‘./akka-samples/akka-sample-chat’ directory. 6. Invoke ‘mvn scala:console -o’. This will give you a Scala REPL (interpreter) with the chat application and all its dependency JARs on the classpath. -7. Simply paste in the whole code block with the ‘Runner’ object above and invoke ‘Runner.run’. This run a simulated client session that will connect to the running server in the microkernel. +7. Simply paste in the whole code block with the ‘Runner’ object above and invoke ‘Runner.run’. This runs a simulated client session that will connect to the running server in the microkernel. 8. Invoke ‘Runner.run’ again and again… Now you could test client reconnect by killing the running microkernel and start it up again. See the client reconnect take place in the REPL shell. diff --git a/akka-samples/akka-sample-chat/pom.xml b/akka-samples/akka-sample-chat/pom.xml index 9648a1f867..20ee421978 100644 --- a/akka-samples/akka-sample-chat/pom.xml +++ b/akka-samples/akka-sample-chat/pom.xml @@ -10,7 +10,7 @@ akka-samples-parent se.scalablesolutions.akka - 0.6 + 0.7-SNAPSHOT diff --git a/akka-samples/akka-sample-lift/config/akka.conf b/akka-samples/akka-sample-lift/config/akka.conf index 5664f81ec1..4a02b208bb 100644 --- a/akka-samples/akka-sample-lift/config/akka.conf +++ b/akka-samples/akka-sample-lift/config/akka.conf @@ -15,7 +15,7 @@ - version = "0.6" + version = "0.7-SNAPSHOT" timeout = 5000 # default timeout for future based invocations diff --git a/akka-samples/akka-sample-lift/pom.xml b/akka-samples/akka-sample-lift/pom.xml index bc9d1f8eaa..a07c288e31 100644 --- a/akka-samples/akka-sample-lift/pom.xml +++ b/akka-samples/akka-sample-lift/pom.xml @@ -10,7 +10,7 @@ akka-samples-parent se.scalablesolutions.akka - 0.6 + 0.7-SNAPSHOT diff --git a/akka-samples/akka-sample-lift/src/main/webapp/WEB-INF/web.xml b/akka-samples/akka-sample-lift/src/main/webapp/WEB-INF/web.xml old mode 100755 new mode 100644 diff --git a/akka-samples/akka-sample-rest-java/pom.xml b/akka-samples/akka-sample-rest-java/pom.xml index 23ec858ff8..6539a0234b 100644 --- a/akka-samples/akka-sample-rest-java/pom.xml +++ b/akka-samples/akka-sample-rest-java/pom.xml @@ -10,7 +10,7 @@ akka-samples-parent se.scalablesolutions.akka - 0.6 + 0.7-SNAPSHOT diff --git a/akka-samples/akka-sample-rest-scala/pom.xml b/akka-samples/akka-sample-rest-scala/pom.xml index b9268b76eb..e62a329f8c 100644 --- a/akka-samples/akka-sample-rest-scala/pom.xml +++ b/akka-samples/akka-sample-rest-scala/pom.xml @@ -10,7 +10,7 @@ akka-samples-parent se.scalablesolutions.akka - 0.6 + 0.7-SNAPSHOT diff --git a/akka-samples/akka-sample-rest-scala/src/main/scala/SimpleService.scala b/akka-samples/akka-sample-rest-scala/src/main/scala/SimpleService.scala index f62e84e998..2d83607f2d 100644 --- a/akka-samples/akka-sample-rest-scala/src/main/scala/SimpleService.scala +++ b/akka-samples/akka-sample-rest-scala/src/main/scala/SimpleService.scala @@ -132,13 +132,7 @@ class Chat extends Actor { @Suspend @GET @Produces(Array("text/html")) - def suspend = { - val s = new StringBuilder - s append "" - s toString - } + def suspend = () def receive = { case Chat(who, what, msg) => { @@ -174,7 +168,7 @@ class JsonpFilter extends BroadcastFilter[String] with Logging { message = m.substring(m.indexOf("__") + 2) } - ("\n") } } diff --git a/akka-samples/akka-sample-security/pom.xml b/akka-samples/akka-sample-security/pom.xml index 4a2f44b3ae..86f331fd65 100644 --- a/akka-samples/akka-sample-security/pom.xml +++ b/akka-samples/akka-sample-security/pom.xml @@ -10,7 +10,7 @@ akka-samples-parent se.scalablesolutions.akka - 0.6 + 0.7-SNAPSHOT diff --git a/akka-samples/akka-sample-security/src/main/resources/akka.conf b/akka-samples/akka-sample-security/src/main/resources/akka.conf index c1d9569e6e..60f68a64ec 100644 --- a/akka-samples/akka-sample-security/src/main/resources/akka.conf +++ b/akka-samples/akka-sample-security/src/main/resources/akka.conf @@ -6,7 +6,7 @@ # Modify as needed. - version = "0.6" + version = "0.7-SNAPSHOT" boot = ["se.scalablesolutions.akka.security.samples.Boot"] # FQN to the class doing initial active object/actor # supervisor bootstrap, should be defined in default constructor diff --git a/akka-samples/pom.xml b/akka-samples/pom.xml index 5b008bafde..ad94fc8aab 100644 --- a/akka-samples/pom.xml +++ b/akka-samples/pom.xml @@ -10,7 +10,7 @@ akka se.scalablesolutions.akka - 0.6 + 0.7-SNAPSHOT diff --git a/akka-security/pom.xml b/akka-security/pom.xml index 4b3dd43195..8d7c66a5f7 100644 --- a/akka-security/pom.xml +++ b/akka-security/pom.xml @@ -10,7 +10,7 @@ akka se.scalablesolutions.akka - 0.6 + 0.7-SNAPSHOT diff --git a/akka-util-java/pom.xml b/akka-util-java/pom.xml old mode 100755 new mode 100644 index a09aed8ed2..e0a729491b --- a/akka-util-java/pom.xml +++ b/akka-util-java/pom.xml @@ -10,7 +10,7 @@ akka se.scalablesolutions.akka - 0.6 + 0.7-SNAPSHOT diff --git a/akka-util/pom.xml b/akka-util/pom.xml index e4e4622ad9..9b22090ee9 100644 --- a/akka-util/pom.xml +++ b/akka-util/pom.xml @@ -10,7 +10,7 @@ akka se.scalablesolutions.akka - 0.6 + 0.7-SNAPSHOT diff --git a/akka-util/src/main/scala/Config.scala b/akka-util/src/main/scala/Config.scala index f7a204f650..f25b08ee46 100644 --- a/akka-util/src/main/scala/Config.scala +++ b/akka-util/src/main/scala/Config.scala @@ -12,7 +12,7 @@ import net.lag.configgy.{Configgy, ParseException} * @author Jonas Bonér */ object Config extends Logging { - val VERSION = "0.6" + val VERSION = "0.7-SNAPSHOT" // Set Multiverse options for max speed System.setProperty("org.multiverse.MuliverseConstants.sanityChecks", "false") diff --git a/akka.iml b/akka.iml index c418d66936..2f07a75716 100644 --- a/akka.iml +++ b/akka.iml @@ -1,5 +1,10 @@ + + + + + diff --git a/config/akka-reference.conf b/config/akka-reference.conf index 2120d2b93c..749b599e0b 100644 --- a/config/akka-reference.conf +++ b/config/akka-reference.conf @@ -15,7 +15,7 @@ - version = "0.6" + version = "0.7-SNAPSHOT" # FQN to the class doing initial active object/actor # supervisor bootstrap, should be defined in default constructor @@ -48,7 +48,7 @@ name = "default" # The name of the cluster - actor = "se.scalablesolutions.akka.remote.JGroupsClusterActor" # FQN of an implementation of ClusterActor + #actor = "se.scalablesolutions.akka.remote.JGroupsClusterActor" # FQN of an implementation of ClusterActor serializer = "se.scalablesolutions.akka.serialization.Serializer$Java" # FQN of the serializer class @@ -69,7 +69,6 @@ hostname = "127.0.0.1" # IP address or hostname of one of the Cassandra cluster's seeds port = 9160 - storage-format = "scala-json" # Options: java, scala-json, java-json, protobuf consistency-level = "QUORUM" # Options: ZERO, ONE, QUORUM, ALL diff --git a/config/storage-conf.xml b/config/storage-conf.xml index 5894740d89..8ffdce0a5f 100644 --- a/config/storage-conf.xml +++ b/config/storage-conf.xml @@ -15,27 +15,43 @@ ~ KIND, either express or implied. See the License for the ~ specific language governing permissions and limitations ~ under the License. - --> +--> - + akka - + false - There is an implicit keyspace named 'system' for Cassandra internals. + @@ -87,183 +103,235 @@ one logical cluster from joining any other cluster. --> - org.apache.cassandra.dht.RandomPartitioner - + ~ This can also be useful with RandomPartitioner to force equal spacing + ~ of tokens around the hash space, especially for clusters with a small + ~ number of nodes. + --> - - org.apache.cassandra.locator.EndPointSnitch - org.apache.cassandra.locator.RackUnawareStrategy - + 1 - cassandra/commitlog - cassandra/data + cassandra/data cassandra/callouts - cassandra/bootstrap cassandra/staging - - 127.0.0.1 + 127.0.0.1 - + 5000 - + 128 - + localhost 7000 7001 - localhost 9160 + + false - + 64 + + 32 8 - + 64 64 0.1 + + 60 - + 8 32 - - false - - 1000 + + periodic + + 10000 + + - 864000 + + + 256 + diff --git a/deploy/root/images/body-background.png b/deploy/root/images/body-background.png deleted file mode 100644 index ece11eb20a..0000000000 Binary files a/deploy/root/images/body-background.png and /dev/null differ diff --git a/deploy/root/images/header-background.png b/deploy/root/images/header-background.png deleted file mode 100644 index 93e4a49c37..0000000000 Binary files a/deploy/root/images/header-background.png and /dev/null differ diff --git a/deploy/root/images/main-background.png b/deploy/root/images/main-background.png deleted file mode 100644 index e94cb2d7ca..0000000000 Binary files a/deploy/root/images/main-background.png and /dev/null differ diff --git a/deploy/root/index.html b/deploy/root/index.html deleted file mode 100644 index 01314dfe3d..0000000000 --- a/deploy/root/index.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - Atmosphere Scala REST Chat - - - - - - - - -
-
- -
-
-
-
-
Please input your name:
-
- -
- -
- -
-
-
-
- - - diff --git a/deploy/root/javascripts/application.js b/deploy/root/javascripts/application.js deleted file mode 100644 index f8361babea..0000000000 --- a/deploy/root/javascripts/application.js +++ /dev/null @@ -1,90 +0,0 @@ -var count = 0; -var app = { - url: '/chat', - initialize: function() { - $('login-name').focus(); - app.listen(); - }, - listen: function() { - $('comet-frame').src = app.url + '?' + count; - count ++; - }, - login: function() { - var name = $F('login-name'); - if(! name.length > 0) { - $('system-message').style.color = 'red'; - $('login-name').focus(); - return; - } - $('system-message').style.color = '#2d2b3d'; - $('system-message').innerHTML = name + ':'; - - $('login-button').disabled = true; - $('login-form').style.display = 'none'; - $('message-form').style.display = ''; - - var query = - 'action=login' + - '&name=' + encodeURI($F('login-name')); - new Ajax.Request(app.url, { - postBody: query, - onSuccess: function() { - $('message').focus(); - } - }); - }, - post: function() { - var message = $F('message'); - if(!message > 0) { - return; - } - $('message').disabled = true; - $('post-button').disabled = true; - - var query = - 'action=post' + - '&name=' + encodeURI($F('login-name')) + - '&message=' + encodeURI(message); - new Ajax.Request(app.url, { - postBody: query, - onComplete: function() { - $('message').disabled = false; - $('post-button').disabled = false; - $('message').focus(); - $('message').value = ''; - } - }); - }, - update: function(data) { - var p = document.createElement('p'); - p.innerHTML = data.name + ':
' + data.message; - - $('display').appendChild(p); - - new Fx.Scroll('display').down(); - } -}; -var rules = { - '#login-name': function(elem) { - Event.observe(elem, 'keydown', function(e) { - if(e.keyCode == 13) { - $('login-button').focus(); - } - }); - }, - '#login-button': function(elem) { - elem.onclick = app.login; - }, - '#message': function(elem) { - Event.observe(elem, 'keydown', function(e) { - if(e.shiftKey && e.keyCode == 13) { - $('post-button').focus(); - } - }); - }, - '#post-button': function(elem) { - elem.onclick = app.post; - } -}; -Behaviour.addLoadEvent(app.initialize); -Behaviour.register(rules); diff --git a/deploy/root/javascripts/behaviour.js b/deploy/root/javascripts/behaviour.js deleted file mode 100644 index fdde861bba..0000000000 --- a/deploy/root/javascripts/behaviour.js +++ /dev/null @@ -1,254 +0,0 @@ -/* - Behaviour v1.1 by Ben Nolan, June 2005. Based largely on the work - of Simon Willison (see comments by Simon below). - - Description: - - Uses css selectors to apply javascript behaviours to enable - unobtrusive javascript in html documents. - - Usage: - - var myrules = { - 'b.someclass' : function(element){ - element.onclick = function(){ - alert(this.innerHTML); - } - }, - '#someid u' : function(element){ - element.onmouseover = function(){ - this.innerHTML = "BLAH!"; - } - } - }; - - Behaviour.register(myrules); - - // Call Behaviour.apply() to re-apply the rules (if you - // update the dom, etc). - - License: - - This file is entirely BSD licensed. - - More information: - - http://ripcord.co.nz/behaviour/ - -*/ - -var Behaviour = { - list : new Array, - - register : function(sheet){ - Behaviour.list.push(sheet); - }, - - start : function(){ - Behaviour.addLoadEvent(function(){ - Behaviour.apply(); - }); - }, - - apply : function(){ - for (h=0;sheet=Behaviour.list[h];h++){ - for (selector in sheet){ - list = document.getElementsBySelector(selector); - - if (!list){ - continue; - } - - for (i=0;element=list[i];i++){ - sheet[selector](element); - } - } - } - }, - - addLoadEvent : function(func){ - var oldonload = window.onload; - - if (typeof window.onload != 'function') { - window.onload = func; - } else { - window.onload = function() { - oldonload(); - func(); - } - } - } -} - -Behaviour.start(); - -/* - The following code is Copyright (C) Simon Willison 2004. - - document.getElementsBySelector(selector) - - returns an array of element objects from the current document - matching the CSS selector. Selectors can contain element names, - class names and ids and can be nested. For example: - - elements = document.getElementsBySelect('div#main p a.external') - - Will return an array of all 'a' elements with 'external' in their - class attribute that are contained inside 'p' elements that are - contained inside the 'div' element which has id="main" - - New in version 0.4: Support for CSS2 and CSS3 attribute selectors: - See http://www.w3.org/TR/css3-selectors/#attribute-selectors - - Version 0.4 - Simon Willison, March 25th 2003 - -- Works in Phoenix 0.5, Mozilla 1.3, Opera 7, Internet Explorer 6, Internet Explorer 5 on Windows - -- Opera 7 fails -*/ - -function getAllChildren(e) { - // Returns all children of element. Workaround required for IE5/Windows. Ugh. - return e.all ? e.all : e.getElementsByTagName('*'); -} - -document.getElementsBySelector = function(selector) { - // Attempt to fail gracefully in lesser browsers - if (!document.getElementsByTagName) { - return new Array(); - } - // Split selector in to tokens - var tokens = selector.split(' '); - var currentContext = new Array(document); - for (var i = 0; i < tokens.length; i++) { - token = tokens[i].replace(/^\s+/,'').replace(/\s+$/,'');; - if (token.indexOf('#') > -1) { - // Token is an ID selector - var bits = token.split('#'); - var tagName = bits[0]; - var id = bits[1]; - var element = document.getElementById(id); - if (tagName && element.nodeName.toLowerCase() != tagName) { - // tag with that ID not found, return false - return new Array(); - } - // Set currentContext to contain just this element - currentContext = new Array(element); - continue; // Skip to next token - } - if (token.indexOf('.') > -1) { - // Token contains a class selector - var bits = token.split('.'); - var tagName = bits[0]; - var className = bits[1]; - if (!tagName) { - tagName = '*'; - } - // Get elements matching tag, filter them for class selector - var found = new Array; - var foundCount = 0; - for (var h = 0; h < currentContext.length; h++) { - var elements; - if (tagName == '*') { - elements = getAllChildren(currentContext[h]); - } else { - elements = currentContext[h].getElementsByTagName(tagName); - } - for (var j = 0; j < elements.length; j++) { - found[foundCount++] = elements[j]; - } - } - currentContext = new Array; - var currentContextIndex = 0; - for (var k = 0; k < found.length; k++) { - if (found[k].className && found[k].className.match(new RegExp('\\b'+className+'\\b'))) { - currentContext[currentContextIndex++] = found[k]; - } - } - continue; // Skip to next token - } - // Code to deal with attribute selectors - if (token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)) { - var tagName = RegExp.$1; - var attrName = RegExp.$2; - var attrOperator = RegExp.$3; - var attrValue = RegExp.$4; - if (!tagName) { - tagName = '*'; - } - // Grab all of the tagName elements within current context - var found = new Array; - var foundCount = 0; - for (var h = 0; h < currentContext.length; h++) { - var elements; - if (tagName == '*') { - elements = getAllChildren(currentContext[h]); - } else { - elements = currentContext[h].getElementsByTagName(tagName); - } - for (var j = 0; j < elements.length; j++) { - found[foundCount++] = elements[j]; - } - } - currentContext = new Array; - var currentContextIndex = 0; - var checkFunction; // This function will be used to filter the elements - switch (attrOperator) { - case '=': // Equality - checkFunction = function(e) { return (e.getAttribute(attrName) == attrValue); }; - break; - case '~': // Match one of space seperated words - checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('\\b'+attrValue+'\\b'))); }; - break; - case '|': // Match start with value followed by optional hyphen - checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('^'+attrValue+'-?'))); }; - break; - case '^': // Match starts with value - checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) == 0); }; - break; - case '$': // Match ends with value - fails with "Warning" in Opera 7 - checkFunction = function(e) { return (e.getAttribute(attrName).lastIndexOf(attrValue) == e.getAttribute(attrName).length - attrValue.length); }; - break; - case '*': // Match ends with value - checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) > -1); }; - break; - default : - // Just test for existence of attribute - checkFunction = function(e) { return e.getAttribute(attrName); }; - } - currentContext = new Array; - var currentContextIndex = 0; - for (var k = 0; k < found.length; k++) { - if (checkFunction(found[k])) { - currentContext[currentContextIndex++] = found[k]; - } - } - // alert('Attribute Selector: '+tagName+' '+attrName+' '+attrOperator+' '+attrValue); - continue; // Skip to next token - } - - if (!currentContext[0]){ - return; - } - - // If we get here, token is JUST an element (not a class or ID selector) - tagName = token; - var found = new Array; - var foundCount = 0; - for (var h = 0; h < currentContext.length; h++) { - var elements = currentContext[h].getElementsByTagName(tagName); - for (var j = 0; j < elements.length; j++) { - found[foundCount++] = elements[j]; - } - } - currentContext = found; - } - return currentContext; -} - -/* That revolting regular expression explained -/^(\w+)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/ - \---/ \---/\-------------/ \-------/ - | | | | - | | | The value - | | ~,|,^,$,* or = - | Attribute - Tag -*/ diff --git a/deploy/root/javascripts/moo.fx.js b/deploy/root/javascripts/moo.fx.js deleted file mode 100644 index 95c01f819a..0000000000 --- a/deploy/root/javascripts/moo.fx.js +++ /dev/null @@ -1,136 +0,0 @@ -//(c) 2006 Valerio Proietti (http://mad4milk.net). MIT-style license. -//moo.fx.js - depends on prototype.js OR prototype.lite.js -//version 2.0 - -var Fx = fx = {}; - -Fx.Base = function(){}; -Fx.Base.prototype = { - - setOptions: function(options){ - this.options = Object.extend({ - onStart: function(){}, - onComplete: function(){}, - transition: Fx.Transitions.sineInOut, - duration: 500, - unit: 'px', - wait: true, - fps: 50 - }, options || {}); - }, - - step: function(){ - var time = new Date().getTime(); - if (time < this.time + this.options.duration){ - this.cTime = time - this.time; - this.setNow(); - } else { - setTimeout(this.options.onComplete.bind(this, this.element), 10); - this.clearTimer(); - this.now = this.to; - } - this.increase(); - }, - - setNow: function(){ - this.now = this.compute(this.from, this.to); - }, - - compute: function(from, to){ - var change = to - from; - return this.options.transition(this.cTime, from, change, this.options.duration); - }, - - clearTimer: function(){ - clearInterval(this.timer); - this.timer = null; - return this; - }, - - _start: function(from, to){ - if (!this.options.wait) this.clearTimer(); - if (this.timer) return; - setTimeout(this.options.onStart.bind(this, this.element), 10); - this.from = from; - this.to = to; - this.time = new Date().getTime(); - this.timer = setInterval(this.step.bind(this), Math.round(1000/this.options.fps)); - return this; - }, - - custom: function(from, to){ - return this._start(from, to); - }, - - set: function(to){ - this.now = to; - this.increase(); - return this; - }, - - hide: function(){ - return this.set(0); - }, - - setStyle: function(e, p, v){ - if (p == 'opacity'){ - if (v == 0 && e.style.visibility != "hidden") e.style.visibility = "hidden"; - else if (e.style.visibility != "visible") e.style.visibility = "visible"; - if (window.ActiveXObject) e.style.filter = "alpha(opacity=" + v*100 + ")"; - e.style.opacity = v; - } else e.style[p] = v+this.options.unit; - } - -}; - -Fx.Style = Class.create(); -Fx.Style.prototype = Object.extend(new Fx.Base(), { - - initialize: function(el, property, options){ - this.element = $(el); - this.setOptions(options); - this.property = property.camelize(); - }, - - increase: function(){ - this.setStyle(this.element, this.property, this.now); - } - -}); - -Fx.Styles = Class.create(); -Fx.Styles.prototype = Object.extend(new Fx.Base(), { - - initialize: function(el, options){ - this.element = $(el); - this.setOptions(options); - this.now = {}; - }, - - setNow: function(){ - for (p in this.from) this.now[p] = this.compute(this.from[p], this.to[p]); - }, - - custom: function(obj){ - if (this.timer && this.options.wait) return; - var from = {}; - var to = {}; - for (p in obj){ - from[p] = obj[p][0]; - to[p] = obj[p][1]; - } - return this._start(from, to); - }, - - increase: function(){ - for (var p in this.now) this.setStyle(this.element, p, this.now[p]); - } - -}); - -//Transitions (c) 2003 Robert Penner (http://www.robertpenner.com/easing/), BSD License. - -Fx.Transitions = { - linear: function(t, b, c, d) { return c*t/d + b; }, - sineInOut: function(t, b, c, d) { return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; } -}; \ No newline at end of file diff --git a/deploy/root/javascripts/moo.fx.pack.js b/deploy/root/javascripts/moo.fx.pack.js deleted file mode 100644 index a06656fb44..0000000000 --- a/deploy/root/javascripts/moo.fx.pack.js +++ /dev/null @@ -1,83 +0,0 @@ -//by Valerio Proietti (http://mad4milk.net). MIT-style license. -//moo.fx.pack.js - depends on prototype.js or prototype.lite.js + moo.fx.js -//version 2.0 - -Fx.Scroll = Class.create(); -Fx.Scroll.prototype = Object.extend(new Fx.Base(), { - - initialize: function(el, options) { - this.element = $(el); - this.setOptions(options); - this.element.style.overflow = 'hidden'; - }, - - down: function(){ - return this.custom(this.element.scrollTop, this.element.scrollHeight-this.element.offsetHeight); - }, - - up: function(){ - return this.custom(this.element.scrollTop, 0); - }, - - increase: function(){ - this.element.scrollTop = this.now; - } - -}); - -//fx.Color, originally by Tom Jensen (http://neuemusic.com) MIT-style LICENSE. - -Fx.Color = Class.create(); -Fx.Color.prototype = Object.extend(new Fx.Base(), { - - initialize: function(el, property, options){ - this.element = $(el); - this.setOptions(options); - this.property = property.camelize(); - this.now = []; - }, - - custom: function(from, to){ - return this._start(from.hexToRgb(true), to.hexToRgb(true)); - }, - - setNow: function(){ - [0,1,2].each(function(i){ - this.now[i] = Math.round(this.compute(this.from[i], this.to[i])); - }.bind(this)); - }, - - increase: function(){ - this.element.style[this.property] = "rgb("+this.now[0]+","+this.now[1]+","+this.now[2]+")"; - } - -}); - -Object.extend(String.prototype, { - - rgbToHex: function(array){ - var rgb = this.match(new RegExp('([\\d]{1,3})', 'g')); - if (rgb[3] == 0) return 'transparent'; - var hex = []; - for (var i = 0; i < 3; i++){ - var bit = (rgb[i]-0).toString(16); - hex.push(bit.length == 1 ? '0'+bit : bit); - } - var hexText = '#'+hex.join(''); - if (array) return hex; - else return hexText; - }, - - hexToRgb: function(array){ - var hex = this.match(new RegExp('^[#]{0,1}([\\w]{1,2})([\\w]{1,2})([\\w]{1,2})$')); - var rgb = []; - for (var i = 1; i < hex.length; i++){ - if (hex[i].length == 1) hex[i] += hex[i]; - rgb.push(parseInt(hex[i], 16)); - } - var rgbText = 'rgb('+rgb.join(',')+')'; - if (array) return rgb; - else return rgbText; - } - -}); \ No newline at end of file diff --git a/deploy/root/javascripts/prototype.js b/deploy/root/javascripts/prototype.js deleted file mode 100644 index a18d2bd479..0000000000 --- a/deploy/root/javascripts/prototype.js +++ /dev/null @@ -1,1781 +0,0 @@ -/* Prototype JavaScript framework, version 1.4.0 - * (c) 2005 Sam Stephenson - * - * Prototype is freely distributable under the terms of an MIT-style license. - * For details, see the Prototype web site: http://prototype.conio.net/ - * -/*--------------------------------------------------------------------------*/ - -var Prototype = { - Version: '1.4.0', - ScriptFragment: '(?:)((\n|\r|.)*?)(?:<\/script>)', - - emptyFunction: function() {}, - K: function(x) {return x} -} - -var Class = { - create: function() { - return function() { - this.initialize.apply(this, arguments); - } - } -} - -var Abstract = new Object(); - -Object.extend = function(destination, source) { - for (property in source) { - destination[property] = source[property]; - } - return destination; -} - -Object.inspect = function(object) { - try { - if (object == undefined) return 'undefined'; - if (object eq null) return 'null'; - return object.inspect ? object.inspect() : object.toString(); - } catch (e) { - if (e instanceof RangeError) return '...'; - throw e; - } -} - -Function.prototype.bind = function() { - var __method = this, args = $A(arguments), object = args.shift(); - return function() { - return __method.apply(object, args.concat($A(arguments))); - } -} - -Function.prototype.bindAsEventListener = function(object) { - var __method = this; - return function(event) { - return __method.call(object, event || window.event); - } -} - -Object.extend(Number.prototype, { - toColorPart: function() { - var digits = this.toString(16); - if (this < 16) return '0' + digits; - return digits; - }, - - succ: function() { - return this + 1; - }, - - times: function(iterator) { - $R(0, this, true).each(iterator); - return this; - } -}); - -var Try = { - these: function() { - var returnValue; - - for (var i = 0; i < arguments.length; i++) { - var lambda = arguments[i]; - try { - returnValue = lambda(); - break; - } catch (e) {} - } - - return returnValue; - } -} - -/*--------------------------------------------------------------------------*/ - -var PeriodicalExecuter = Class.create(); -PeriodicalExecuter.prototype = { - initialize: function(callback, frequency) { - this.callback = callback; - this.frequency = frequency; - this.currentlyExecuting = false; - - this.registerCallback(); - }, - - registerCallback: function() { - setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); - }, - - onTimerEvent: function() { - if (!this.currentlyExecuting) { - try { - this.currentlyExecuting = true; - this.callback(); - } finally { - this.currentlyExecuting = false; - } - } - } -} - -/*--------------------------------------------------------------------------*/ - -function $() { - var elements = new Array(); - - for (var i = 0; i < arguments.length; i++) { - var element = arguments[i]; - if (typeof element == 'string') - element = document.getElementById(element); - - if (arguments.length == 1) - return element; - - elements.push(element); - } - - return elements; -} -Object.extend(String.prototype, { - stripTags: function() { - return this.replace(/<\/?[^>]+>/gi, ''); - }, - - stripScripts: function() { - return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), ''); - }, - - extractScripts: function() { - var matchAll = new RegExp(Prototype.ScriptFragment, 'img'); - var matchOne = new RegExp(Prototype.ScriptFragment, 'im'); - return (this.match(matchAll) || []).map(function(scriptTag) { - return (scriptTag.match(matchOne) || ['', ''])[1]; - }); - }, - - evalScripts: function() { - return this.extractScripts().map(eval); - }, - - escapeHTML: function() { - var div = document.createElement('div'); - var text = document.createTextNode(this); - div.appendChild(text); - return div.innerHTML; - }, - - unescapeHTML: function() { - var div = document.createElement('div'); - div.innerHTML = this.stripTags(); - return div.childNodes[0] ? div.childNodes[0].nodeValue : ''; - }, - - toQueryParams: function() { - var pairs = this.match(/^\??(.*)$/)[1].split('&'); - return pairs.inject({}, function(params, pairString) { - var pair = pairString.split('='); - params[pair[0]] = pair[1]; - return params; - }); - }, - - toArray: function() { - return this.split(''); - }, - - camelize: function() { - var oStringList = this.split('-'); - if (oStringList.length == 1) return oStringList[0]; - - var camelizedString = this.indexOf('-') == 0 - ? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1) - : oStringList[0]; - - for (var i = 1, len = oStringList.length; i < len; i++) { - var s = oStringList[i]; - camelizedString += s.charAt(0).toUpperCase() + s.substring(1); - } - - return camelizedString; - }, - - inspect: function() { - return "'" + this.replace('\\', '\\\\').replace("'", '\\\'') + "'"; - } -}); - -String.prototype.parseQuery = String.prototype.toQueryParams; - -var $break = new Object(); -var $continue = new Object(); - -var Enumerable = { - each: function(iterator) { - var index = 0; - try { - this._each(function(value) { - try { - iterator(value, index++); - } catch (e) { - if (e != $continue) throw e; - } - }); - } catch (e) { - if (e != $break) throw e; - } - }, - - all: function(iterator) { - var result = true; - this.each(function(value, index) { - result = result && !!(iterator || Prototype.K)(value, index); - if (!result) throw $break; - }); - return result; - }, - - any: function(iterator) { - var result = true; - this.each(function(value, index) { - if (result = !!(iterator || Prototype.K)(value, index)) - throw $break; - }); - return result; - }, - - collect: function(iterator) { - var results = []; - this.each(function(value, index) { - results.push(iterator(value, index)); - }); - return results; - }, - - detect: function (iterator) { - var result; - this.each(function(value, index) { - if (iterator(value, index)) { - result = value; - throw $break; - } - }); - return result; - }, - - findAll: function(iterator) { - var results = []; - this.each(function(value, index) { - if (iterator(value, index)) - results.push(value); - }); - return results; - }, - - grep: function(pattern, iterator) { - var results = []; - this.each(function(value, index) { - var stringValue = value.toString(); - if (stringValue.match(pattern)) - results.push((iterator || Prototype.K)(value, index)); - }) - return results; - }, - - include: function(object) { - var found = false; - this.each(function(value) { - if (value == object) { - found = true; - throw $break; - } - }); - return found; - }, - - inject: function(memo, iterator) { - this.each(function(value, index) { - memo = iterator(memo, value, index); - }); - return memo; - }, - - invoke: function(method) { - var args = $A(arguments).slice(1); - return this.collect(function(value) { - return value[method].apply(value, args); - }); - }, - - max: function(iterator) { - var result; - this.each(function(value, index) { - value = (iterator || Prototype.K)(value, index); - if (value >= (result || value)) - result = value; - }); - return result; - }, - - min: function(iterator) { - var result; - this.each(function(value, index) { - value = (iterator || Prototype.K)(value, index); - if (value <= (result || value)) - result = value; - }); - return result; - }, - - partition: function(iterator) { - var trues = [], falses = []; - this.each(function(value, index) { - ((iterator || Prototype.K)(value, index) ? - trues : falses).push(value); - }); - return [trues, falses]; - }, - - pluck: function(property) { - var results = []; - this.each(function(value, index) { - results.push(value[property]); - }); - return results; - }, - - reject: function(iterator) { - var results = []; - this.each(function(value, index) { - if (!iterator(value, index)) - results.push(value); - }); - return results; - }, - - sortBy: function(iterator) { - return this.collect(function(value, index) { - return {value: value, criteria: iterator(value, index)}; - }).sort(function(left, right) { - var a = left.criteria, b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - }).pluck('value'); - }, - - toArray: function() { - return this.collect(Prototype.K); - }, - - zip: function() { - var iterator = Prototype.K, args = $A(arguments); - if (typeof args.last() == 'function') - iterator = args.pop(); - - var collections = [this].concat(args).map($A); - return this.map(function(value, index) { - iterator(value = collections.pluck(index)); - return value; - }); - }, - - inspect: function() { - return '#'; - } -} - -Object.extend(Enumerable, { - map: Enumerable.collect, - find: Enumerable.detect, - select: Enumerable.findAll, - member: Enumerable.include, - entries: Enumerable.toArray -}); -var $A = Array.from = function(iterable) { - if (!iterable) return []; - if (iterable.toArray) { - return iterable.toArray(); - } else { - var results = []; - for (var i = 0; i < iterable.length; i++) - results.push(iterable[i]); - return results; - } -} - -Object.extend(Array.prototype, Enumerable); - -Array.prototype._reverse = Array.prototype.reverse; - -Object.extend(Array.prototype, { - _each: function(iterator) { - for (var i = 0; i < this.length; i++) - iterator(this[i]); - }, - - clear: function() { - this.length = 0; - return this; - }, - - first: function() { - return this[0]; - }, - - last: function() { - return this[this.length - 1]; - }, - - compact: function() { - return this.select(function(value) { - return value != undefined || value != null; - }); - }, - - flatten: function() { - return this.inject([], function(array, value) { - return array.concat(value.constructor == Array ? - value.flatten() : [value]); - }); - }, - - without: function() { - var values = $A(arguments); - return this.select(function(value) { - return !values.include(value); - }); - }, - - indexOf: function(object) { - for (var i = 0; i < this.length; i++) - if (this[i] == object) return i; - return -1; - }, - - reverse: function(inline) { - return (inline !== false ? this : this.toArray())._reverse(); - }, - - shift: function() { - var result = this[0]; - for (var i = 0; i < this.length - 1; i++) - this[i] = this[i + 1]; - this.length--; - return result; - }, - - inspect: function() { - return '[' + this.map(Object.inspect).join(', ') + ']'; - } -}); -var Hash = { - _each: function(iterator) { - for (key in this) { - var value = this[key]; - if (typeof value == 'function') continue; - - var pair = [key, value]; - pair.key = key; - pair.value = value; - iterator(pair); - } - }, - - keys: function() { - return this.pluck('key'); - }, - - values: function() { - return this.pluck('value'); - }, - - merge: function(hash) { - return $H(hash).inject($H(this), function(mergedHash, pair) { - mergedHash[pair.key] = pair.value; - return mergedHash; - }); - }, - - toQueryString: function() { - return this.map(function(pair) { - return pair.map(encodeURIComponent).join('='); - }).join('&'); - }, - - inspect: function() { - return '#'; - } -} - -function $H(object) { - var hash = Object.extend({}, object || {}); - Object.extend(hash, Enumerable); - Object.extend(hash, Hash); - return hash; -} -ObjectRange = Class.create(); -Object.extend(ObjectRange.prototype, Enumerable); -Object.extend(ObjectRange.prototype, { - initialize: function(start, end, exclusive) { - this.start = start; - this.end = end; - this.exclusive = exclusive; - }, - - _each: function(iterator) { - var value = this.start; - do { - iterator(value); - value = value.succ(); - } while (this.include(value)); - }, - - include: function(value) { - if (value < this.start) - return false; - if (this.exclusive) - return value < this.end; - return value <= this.end; - } -}); - -var $R = function(start, end, exclusive) { - return new ObjectRange(start, end, exclusive); -} - -var Ajax = { - getTransport: function() { - return Try.these( - function() {return new ActiveXObject('Msxml2.XMLHTTP')}, - function() {return new ActiveXObject('Microsoft.XMLHTTP')}, - function() {return new XMLHttpRequest()} - ) || false; - }, - - activeRequestCount: 0 -} - -Ajax.Responders = { - responders: [], - - _each: function(iterator) { - this.responders._each(iterator); - }, - - register: function(responderToAdd) { - if (!this.include(responderToAdd)) - this.responders.push(responderToAdd); - }, - - unregister: function(responderToRemove) { - this.responders = this.responders.without(responderToRemove); - }, - - dispatch: function(callback, request, transport, json) { - this.each(function(responder) { - if (responder[callback] && typeof responder[callback] == 'function') { - try { - responder[callback].apply(responder, [request, transport, json]); - } catch (e) {} - } - }); - } -}; - -Object.extend(Ajax.Responders, Enumerable); - -Ajax.Responders.register({ - onCreate: function() { - Ajax.activeRequestCount++; - }, - - onComplete: function() { - Ajax.activeRequestCount--; - } -}); - -Ajax.Base = function() {}; -Ajax.Base.prototype = { - setOptions: function(options) { - this.options = { - method: 'post', - asynchronous: true, - parameters: '' - } - Object.extend(this.options, options || {}); - }, - - responseIsSuccess: function() { - return this.transport.status == undefined - || this.transport.status == 0 - || (this.transport.status >= 200 && this.transport.status < 300); - }, - - responseIsFailure: function() { - return !this.responseIsSuccess(); - } -} - -Ajax.Request = Class.create(); -Ajax.Request.Events = - ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; - -Ajax.Request.prototype = Object.extend(new Ajax.Base(), { - initialize: function(url, options) { - this.transport = Ajax.getTransport(); - this.setOptions(options); - this.request(url); - }, - - request: function(url) { - var parameters = this.options.parameters || ''; - if (parameters.length > 0) parameters += '&_='; - - try { - this.url = url; - if (this.options.method == 'get' && parameters.length > 0) - this.url += (this.url.match(/\?/) ? '&' : '?') + parameters; - - Ajax.Responders.dispatch('onCreate', this, this.transport); - - this.transport.open(this.options.method, this.url, - this.options.asynchronous); - - if (this.options.asynchronous) { - this.transport.onreadystatechange = this.onStateChange.bind(this); - setTimeout((function() {this.respondToReadyState(1)}).bind(this), 10); - } - - this.setRequestHeaders(); - - var body = this.options.postBody ? this.options.postBody : parameters; - this.transport.send(this.options.method == 'post' ? body : null); - - } catch (e) { - this.dispatchException(e); - } - }, - - setRequestHeaders: function() { - var requestHeaders = - ['X-Requested-With', 'XMLHttpRequest', - 'X-Prototype-Version', Prototype.Version]; - - if (this.options.method == 'post') { - requestHeaders.push('Content-type', - 'application/x-www-form-urlencoded'); - - /* Force "Connection: close" for Mozilla browsers to work around - * a bug where XMLHttpReqeuest sends an incorrect Content-length - * header. See Mozilla Bugzilla #246651. - */ - if (this.transport.overrideMimeType) - requestHeaders.push('Connection', 'close'); - } - - if (this.options.requestHeaders) - requestHeaders.push.apply(requestHeaders, this.options.requestHeaders); - - for (var i = 0; i < requestHeaders.length; i += 2) - this.transport.setRequestHeader(requestHeaders[i], requestHeaders[i+1]); - }, - - onStateChange: function() { - var readyState = this.transport.readyState; - if (readyState != 1) - this.respondToReadyState(this.transport.readyState); - }, - - header: function(name) { - try { - return this.transport.getResponseHeader(name); - } catch (e) {} - }, - - evalJSON: function() { - try { - return eval(this.header('X-JSON')); - } catch (e) {} - }, - - evalResponse: function() { - try { - return eval(this.transport.responseText); - } catch (e) { - this.dispatchException(e); - } - }, - - respondToReadyState: function(readyState) { - var event = Ajax.Request.Events[readyState]; - var transport = this.transport, json = this.evalJSON(); - - if (event == 'Complete') { - try { - (this.options['on' + this.transport.status] - || this.options['on' + (this.responseIsSuccess() ? 'Success' : 'Failure')] - || Prototype.emptyFunction)(transport, json); - } catch (e) { - this.dispatchException(e); - } - - if ((this.header('Content-type') || '').match(/^text\/javascript/i)) - this.evalResponse(); - } - - try { - (this.options['on' + event] || Prototype.emptyFunction)(transport, json); - Ajax.Responders.dispatch('on' + event, this, transport, json); - } catch (e) { - this.dispatchException(e); - } - - /* Avoid memory leak in MSIE: clean up the oncomplete event handler */ - if (event == 'Complete') - this.transport.onreadystatechange = Prototype.emptyFunction; - }, - - dispatchException: function(exception) { - (this.options.onException || Prototype.emptyFunction)(this, exception); - Ajax.Responders.dispatch('onException', this, exception); - } -}); - -Ajax.Updater = Class.create(); - -Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), { - initialize: function(container, url, options) { - this.containers = { - success: container.success ? $(container.success) : $(container), - failure: container.failure ? $(container.failure) : - (container.success ? null : $(container)) - } - - this.transport = Ajax.getTransport(); - this.setOptions(options); - - var onComplete = this.options.onComplete || Prototype.emptyFunction; - this.options.onComplete = (function(transport, object) { - this.updateContent(); - onComplete(transport, object); - }).bind(this); - - this.request(url); - }, - - updateContent: function() { - var receiver = this.responseIsSuccess() ? - this.containers.success : this.containers.failure; - var response = this.transport.responseText; - - if (!this.options.evalScripts) - response = response.stripScripts(); - - if (receiver) { - if (this.options.insertion) { - new this.options.insertion(receiver, response); - } else { - Element.update(receiver, response); - } - } - - if (this.responseIsSuccess()) { - if (this.onComplete) - setTimeout(this.onComplete.bind(this), 10); - } - } -}); - -Ajax.PeriodicalUpdater = Class.create(); -Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), { - initialize: function(container, url, options) { - this.setOptions(options); - this.onComplete = this.options.onComplete; - - this.frequency = (this.options.frequency || 2); - this.decay = (this.options.decay || 1); - - this.updater = {}; - this.container = container; - this.url = url; - - this.start(); - }, - - start: function() { - this.options.onComplete = this.updateComplete.bind(this); - this.onTimerEvent(); - }, - - stop: function() { - this.updater.onComplete = undefined; - clearTimeout(this.timer); - (this.onComplete || Prototype.emptyFunction).apply(this, arguments); - }, - - updateComplete: function(request) { - if (this.options.decay) { - this.decay = (request.responseText == this.lastText ? - this.decay * this.options.decay : 1); - - this.lastText = request.responseText; - } - this.timer = setTimeout(this.onTimerEvent.bind(this), - this.decay * this.frequency * 1000); - }, - - onTimerEvent: function() { - this.updater = new Ajax.Updater(this.container, this.url, this.options); - } -}); -document.getElementsByClassName = function(className, parentElement) { - var children = ($(parentElement) || document.body).getElementsByTagName('*'); - return $A(children).inject([], function(elements, child) { - if (child.className.match(new RegExp("(^|\\s)" + className + "(\\s|$)"))) - elements.push(child); - return elements; - }); -} - -/*--------------------------------------------------------------------------*/ - -if (!window.Element) { - var Element = new Object(); -} - -Object.extend(Element, { - visible: function(element) { - return $(element).style.display != 'none'; - }, - - toggle: function() { - for (var i = 0; i < arguments.length; i++) { - var element = $(arguments[i]); - Element[Element.visible(element) ? 'hide' : 'show'](element); - } - }, - - hide: function() { - for (var i = 0; i < arguments.length; i++) { - var element = $(arguments[i]); - element.style.display = 'none'; - } - }, - - show: function() { - for (var i = 0; i < arguments.length; i++) { - var element = $(arguments[i]); - element.style.display = ''; - } - }, - - remove: function(element) { - element = $(element); - element.parentNode.removeChild(element); - }, - - update: function(element, html) { - $(element).innerHTML = html.stripScripts(); - setTimeout(function() {html.evalScripts()}, 10); - }, - - getHeight: function(element) { - element = $(element); - return element.offsetHeight; - }, - - classNames: function(element) { - return new Element.ClassNames(element); - }, - - hasClassName: function(element, className) { - if (!(element = $(element))) return; - return Element.classNames(element).include(className); - }, - - addClassName: function(element, className) { - if (!(element = $(element))) return; - return Element.classNames(element).add(className); - }, - - removeClassName: function(element, className) { - if (!(element = $(element))) return; - return Element.classNames(element).remove(className); - }, - - // removes whitespace-only text node children - cleanWhitespace: function(element) { - element = $(element); - for (var i = 0; i < element.childNodes.length; i++) { - var node = element.childNodes[i]; - if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) - Element.remove(node); - } - }, - - empty: function(element) { - return $(element).innerHTML.match(/^\s*$/); - }, - - scrollTo: function(element) { - element = $(element); - var x = element.x ? element.x : element.offsetLeft, - y = element.y ? element.y : element.offsetTop; - window.scrollTo(x, y); - }, - - getStyle: function(element, style) { - element = $(element); - var value = element.style[style.camelize()]; - if (!value) { - if (document.defaultView && document.defaultView.getComputedStyle) { - var css = document.defaultView.getComputedStyle(element, null); - value = css ? css.getPropertyValue(style) : null; - } else if (element.currentStyle) { - value = element.currentStyle[style.camelize()]; - } - } - - if (window.opera && ['left', 'top', 'right', 'bottom'].include(style)) - if (Element.getStyle(element, 'position') == 'static') value = 'auto'; - - return value == 'auto' ? null : value; - }, - - setStyle: function(element, style) { - element = $(element); - for (name in style) - element.style[name.camelize()] = style[name]; - }, - - getDimensions: function(element) { - element = $(element); - if (Element.getStyle(element, 'display') != 'none') - return {width: element.offsetWidth, height: element.offsetHeight}; - - // All *Width and *Height properties give 0 on elements with display none, - // so enable the element temporarily - var els = element.style; - var originalVisibility = els.visibility; - var originalPosition = els.position; - els.visibility = 'hidden'; - els.position = 'absolute'; - els.display = ''; - var originalWidth = element.clientWidth; - var originalHeight = element.clientHeight; - els.display = 'none'; - els.position = originalPosition; - els.visibility = originalVisibility; - return {width: originalWidth, height: originalHeight}; - }, - - makePositioned: function(element) { - element = $(element); - var pos = Element.getStyle(element, 'position'); - if (pos == 'static' || !pos) { - element._madePositioned = true; - element.style.position = 'relative'; - // Opera returns the offset relative to the positioning context, when an - // element is position relative but top and left have not been defined - if (window.opera) { - element.style.top = 0; - element.style.left = 0; - } - } - }, - - undoPositioned: function(element) { - element = $(element); - if (element._madePositioned) { - element._madePositioned = undefined; - element.style.position = - element.style.top = - element.style.left = - element.style.bottom = - element.style.right = ''; - } - }, - - makeClipping: function(element) { - element = $(element); - if (element._overflow) return; - element._overflow = element.style.overflow; - if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden') - element.style.overflow = 'hidden'; - }, - - undoClipping: function(element) { - element = $(element); - if (element._overflow) return; - element.style.overflow = element._overflow; - element._overflow = undefined; - } -}); - -var Toggle = new Object(); -Toggle.display = Element.toggle; - -/*--------------------------------------------------------------------------*/ - -Abstract.Insertion = function(adjacency) { - this.adjacency = adjacency; -} - -Abstract.Insertion.prototype = { - initialize: function(element, content) { - this.element = $(element); - this.content = content.stripScripts(); - - if (this.adjacency && this.element.insertAdjacentHTML) { - try { - this.element.insertAdjacentHTML(this.adjacency, this.content); - } catch (e) { - if (this.element.tagName.toLowerCase() == 'tbody') { - this.insertContent(this.contentFromAnonymousTable()); - } else { - throw e; - } - } - } else { - this.range = this.element.ownerDocument.createRange(); - if (this.initializeRange) this.initializeRange(); - this.insertContent([this.range.createContextualFragment(this.content)]); - } - - setTimeout(function() {content.evalScripts()}, 10); - }, - - contentFromAnonymousTable: function() { - var div = document.createElement('div'); - div.innerHTML = '' + this.content + '
'; - return $A(div.childNodes[0].childNodes[0].childNodes); - } -} - -var Insertion = new Object(); - -Insertion.Before = Class.create(); -Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), { - initializeRange: function() { - this.range.setStartBefore(this.element); - }, - - insertContent: function(fragments) { - fragments.each((function(fragment) { - this.element.parentNode.insertBefore(fragment, this.element); - }).bind(this)); - } -}); - -Insertion.Top = Class.create(); -Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), { - initializeRange: function() { - this.range.selectNodeContents(this.element); - this.range.collapse(true); - }, - - insertContent: function(fragments) { - fragments.reverse(false).each((function(fragment) { - this.element.insertBefore(fragment, this.element.firstChild); - }).bind(this)); - } -}); - -Insertion.Bottom = Class.create(); -Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), { - initializeRange: function() { - this.range.selectNodeContents(this.element); - this.range.collapse(this.element); - }, - - insertContent: function(fragments) { - fragments.each((function(fragment) { - this.element.appendChild(fragment); - }).bind(this)); - } -}); - -Insertion.After = Class.create(); -Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), { - initializeRange: function() { - this.range.setStartAfter(this.element); - }, - - insertContent: function(fragments) { - fragments.each((function(fragment) { - this.element.parentNode.insertBefore(fragment, - this.element.nextSibling); - }).bind(this)); - } -}); - -/*--------------------------------------------------------------------------*/ - -Element.ClassNames = Class.create(); -Element.ClassNames.prototype = { - initialize: function(element) { - this.element = $(element); - }, - - _each: function(iterator) { - this.element.className.split(/\s+/).select(function(name) { - return name.length > 0; - })._each(iterator); - }, - - set: function(className) { - this.element.className = className; - }, - - add: function(classNameToAdd) { - if (this.include(classNameToAdd)) return; - this.set(this.toArray().concat(classNameToAdd).join(' ')); - }, - - remove: function(classNameToRemove) { - if (!this.include(classNameToRemove)) return; - this.set(this.select(function(className) { - return className != classNameToRemove; - }).join(' ')); - }, - - toString: function() { - return this.toArray().join(' '); - } -} - -Object.extend(Element.ClassNames.prototype, Enumerable); -var Field = { - clear: function() { - for (var i = 0; i < arguments.length; i++) - $(arguments[i]).value = ''; - }, - - focus: function(element) { - $(element).focus(); - }, - - present: function() { - for (var i = 0; i < arguments.length; i++) - if ($(arguments[i]).value == '') return false; - return true; - }, - - select: function(element) { - $(element).select(); - }, - - activate: function(element) { - element = $(element); - element.focus(); - if (element.select) - element.select(); - } -} - -/*--------------------------------------------------------------------------*/ - -var Form = { - serialize: function(form) { - var elements = Form.getElements($(form)); - var queryComponents = new Array(); - - for (var i = 0; i < elements.length; i++) { - var queryComponent = Form.Element.serialize(elements[i]); - if (queryComponent) - queryComponents.push(queryComponent); - } - - return queryComponents.join('&'); - }, - - getElements: function(form) { - form = $(form); - var elements = new Array(); - - for (tagName in Form.Element.Serializers) { - var tagElements = form.getElementsByTagName(tagName); - for (var j = 0; j < tagElements.length; j++) - elements.push(tagElements[j]); - } - return elements; - }, - - getInputs: function(form, typeName, name) { - form = $(form); - var inputs = form.getElementsByTagName('input'); - - if (!typeName && !name) - return inputs; - - var matchingInputs = new Array(); - for (var i = 0; i < inputs.length; i++) { - var input = inputs[i]; - if ((typeName && input.type != typeName) || - (name && input.name != name)) - continue; - matchingInputs.push(input); - } - - return matchingInputs; - }, - - disable: function(form) { - var elements = Form.getElements(form); - for (var i = 0; i < elements.length; i++) { - var element = elements[i]; - element.blur(); - element.disabled = 'true'; - } - }, - - enable: function(form) { - var elements = Form.getElements(form); - for (var i = 0; i < elements.length; i++) { - var element = elements[i]; - element.disabled = ''; - } - }, - - findFirstElement: function(form) { - return Form.getElements(form).find(function(element) { - return element.type != 'hidden' && !element.disabled && - ['input', 'select', 'textarea'].include(element.tagName.toLowerCase()); - }); - }, - - focusFirstElement: function(form) { - Field.activate(Form.findFirstElement(form)); - }, - - reset: function(form) { - $(form).reset(); - } -} - -Form.Element = { - serialize: function(element) { - element = $(element); - var method = element.tagName.toLowerCase(); - var parameter = Form.Element.Serializers[method](element); - - if (parameter) { - var key = encodeURIComponent(parameter[0]); - if (key.length == 0) return; - - if (parameter[1].constructor != Array) - parameter[1] = [parameter[1]]; - - return parameter[1].map(function(value) { - return key + '=' + encodeURIComponent(value); - }).join('&'); - } - }, - - getValue: function(element) { - element = $(element); - var method = element.tagName.toLowerCase(); - var parameter = Form.Element.Serializers[method](element); - - if (parameter) - return parameter[1]; - } -} - -Form.Element.Serializers = { - input: function(element) { - switch (element.type.toLowerCase()) { - case 'submit': - case 'hidden': - case 'password': - case 'text': - return Form.Element.Serializers.textarea(element); - case 'checkbox': - case 'radio': - return Form.Element.Serializers.inputSelector(element); - } - return false; - }, - - inputSelector: function(element) { - if (element.checked) - return [element.name, element.value]; - }, - - textarea: function(element) { - return [element.name, element.value]; - }, - - select: function(element) { - return Form.Element.Serializers[element.type == 'select-one' ? - 'selectOne' : 'selectMany'](element); - }, - - selectOne: function(element) { - var value = '', opt, index = element.selectedIndex; - if (index >= 0) { - opt = element.options[index]; - value = opt.value; - if (!value && !('value' in opt)) - value = opt.text; - } - return [element.name, value]; - }, - - selectMany: function(element) { - var value = new Array(); - for (var i = 0; i < element.length; i++) { - var opt = element.options[i]; - if (opt.selected) { - var optValue = opt.value; - if (!optValue && !('value' in opt)) - optValue = opt.text; - value.push(optValue); - } - } - return [element.name, value]; - } -} - -/*--------------------------------------------------------------------------*/ - -var $F = Form.Element.getValue; - -/*--------------------------------------------------------------------------*/ - -Abstract.TimedObserver = function() {} -Abstract.TimedObserver.prototype = { - initialize: function(element, frequency, callback) { - this.frequency = frequency; - this.element = $(element); - this.callback = callback; - - this.lastValue = this.getValue(); - this.registerCallback(); - }, - - registerCallback: function() { - setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); - }, - - onTimerEvent: function() { - var value = this.getValue(); - if (this.lastValue != value) { - this.callback(this.element, value); - this.lastValue = value; - } - } -} - -Form.Element.Observer = Class.create(); -Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), { - getValue: function() { - return Form.Element.getValue(this.element); - } -}); - -Form.Observer = Class.create(); -Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), { - getValue: function() { - return Form.serialize(this.element); - } -}); - -/*--------------------------------------------------------------------------*/ - -Abstract.EventObserver = function() {} -Abstract.EventObserver.prototype = { - initialize: function(element, callback) { - this.element = $(element); - this.callback = callback; - - this.lastValue = this.getValue(); - if (this.element.tagName.toLowerCase() == 'form') - this.registerFormCallbacks(); - else - this.registerCallback(this.element); - }, - - onElementEvent: function() { - var value = this.getValue(); - if (this.lastValue != value) { - this.callback(this.element, value); - this.lastValue = value; - } - }, - - registerFormCallbacks: function() { - var elements = Form.getElements(this.element); - for (var i = 0; i < elements.length; i++) - this.registerCallback(elements[i]); - }, - - registerCallback: function(element) { - if (element.type) { - switch (element.type.toLowerCase()) { - case 'checkbox': - case 'radio': - Event.observe(element, 'click', this.onElementEvent.bind(this)); - break; - case 'password': - case 'text': - case 'textarea': - case 'select-one': - case 'select-multiple': - Event.observe(element, 'change', this.onElementEvent.bind(this)); - break; - } - } - } -} - -Form.Element.EventObserver = Class.create(); -Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), { - getValue: function() { - return Form.Element.getValue(this.element); - } -}); - -Form.EventObserver = Class.create(); -Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), { - getValue: function() { - return Form.serialize(this.element); - } -}); -if (!window.Event) { - var Event = new Object(); -} - -Object.extend(Event, { - KEY_BACKSPACE: 8, - KEY_TAB: 9, - KEY_RETURN: 13, - KEY_ESC: 27, - KEY_LEFT: 37, - KEY_UP: 38, - KEY_RIGHT: 39, - KEY_DOWN: 40, - KEY_DELETE: 46, - - element: function(event) { - return event.target || event.srcElement; - }, - - isLeftClick: function(event) { - return (((event.which) && (event.which == 1)) || - ((event.button) && (event.button == 1))); - }, - - pointerX: function(event) { - return event.pageX || (event.clientX + - (document.documentElement.scrollLeft || document.body.scrollLeft)); - }, - - pointerY: function(event) { - return event.pageY || (event.clientY + - (document.documentElement.scrollTop || document.body.scrollTop)); - }, - - stop: function(event) { - if (event.preventDefault) { - event.preventDefault(); - event.stopPropagation(); - } else { - event.returnValue = false; - event.cancelBubble = true; - } - }, - - // find the first node with the given tagName, starting from the - // node the event was triggered on; traverses the DOM upwards - findElement: function(event, tagName) { - var element = Event.element(event); - while (element.parentNode && (!element.tagName || - (element.tagName.toUpperCase() != tagName.toUpperCase()))) - element = element.parentNode; - return element; - }, - - observers: false, - - _observeAndCache: function(element, name, observer, useCapture) { - if (!this.observers) this.observers = []; - if (element.addEventListener) { - this.observers.push([element, name, observer, useCapture]); - element.addEventListener(name, observer, useCapture); - } else if (element.attachEvent) { - this.observers.push([element, name, observer, useCapture]); - element.attachEvent('on' + name, observer); - } - }, - - unloadCache: function() { - if (!Event.observers) return; - for (var i = 0; i < Event.observers.length; i++) { - Event.stopObserving.apply(this, Event.observers[i]); - Event.observers[i][0] = null; - } - Event.observers = false; - }, - - observe: function(element, name, observer, useCapture) { - var element = $(element); - useCapture = useCapture || false; - - if (name == 'keypress' && - (navigator.appVersion.match(/Konqueror|Safari|KHTML/) - || element.attachEvent)) - name = 'keydown'; - - this._observeAndCache(element, name, observer, useCapture); - }, - - stopObserving: function(element, name, observer, useCapture) { - var element = $(element); - useCapture = useCapture || false; - - if (name == 'keypress' && - (navigator.appVersion.match(/Konqueror|Safari|KHTML/) - || element.detachEvent)) - name = 'keydown'; - - if (element.removeEventListener) { - element.removeEventListener(name, observer, useCapture); - } else if (element.detachEvent) { - element.detachEvent('on' + name, observer); - } - } -}); - -/* prevent memory leaks in IE */ -Event.observe(window, 'unload', Event.unloadCache, false); -var Position = { - // set to true if needed, warning: firefox performance problems - // NOT neeeded for page scrolling, only if draggable contained in - // scrollable elements - includeScrollOffsets: false, - - // must be called before calling withinIncludingScrolloffset, every time the - // page is scrolled - prepare: function() { - this.deltaX = window.pageXOffset - || document.documentElement.scrollLeft - || document.body.scrollLeft - || 0; - this.deltaY = window.pageYOffset - || document.documentElement.scrollTop - || document.body.scrollTop - || 0; - }, - - realOffset: function(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.scrollTop || 0; - valueL += element.scrollLeft || 0; - element = element.parentNode; - } while (element); - return [valueL, valueT]; - }, - - cumulativeOffset: function(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - element = element.offsetParent; - } while (element); - return [valueL, valueT]; - }, - - positionedOffset: function(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - element = element.offsetParent; - if (element) { - p = Element.getStyle(element, 'position'); - if (p == 'relative' || p == 'absolute') break; - } - } while (element); - return [valueL, valueT]; - }, - - offsetParent: function(element) { - if (element.offsetParent) return element.offsetParent; - if (element == document.body) return element; - - while ((element = element.parentNode) && element != document.body) - if (Element.getStyle(element, 'position') != 'static') - return element; - - return document.body; - }, - - // caches x/y coordinate pair to use with overlap - within: function(element, x, y) { - if (this.includeScrollOffsets) - return this.withinIncludingScrolloffsets(element, x, y); - this.xcomp = x; - this.ycomp = y; - this.offset = this.cumulativeOffset(element); - - return (y >= this.offset[1] && - y < this.offset[1] + element.offsetHeight && - x >= this.offset[0] && - x < this.offset[0] + element.offsetWidth); - }, - - withinIncludingScrolloffsets: function(element, x, y) { - var offsetcache = this.realOffset(element); - - this.xcomp = x + offsetcache[0] - this.deltaX; - this.ycomp = y + offsetcache[1] - this.deltaY; - this.offset = this.cumulativeOffset(element); - - return (this.ycomp >= this.offset[1] && - this.ycomp < this.offset[1] + element.offsetHeight && - this.xcomp >= this.offset[0] && - this.xcomp < this.offset[0] + element.offsetWidth); - }, - - // within must be called directly before - overlap: function(mode, element) { - if (!mode) return 0; - if (mode == 'vertical') - return ((this.offset[1] + element.offsetHeight) - this.ycomp) / - element.offsetHeight; - if (mode == 'horizontal') - return ((this.offset[0] + element.offsetWidth) - this.xcomp) / - element.offsetWidth; - }, - - clone: function(source, target) { - source = $(source); - target = $(target); - target.style.position = 'absolute'; - var offsets = this.cumulativeOffset(source); - target.style.top = offsets[1] + 'px'; - target.style.left = offsets[0] + 'px'; - target.style.width = source.offsetWidth + 'px'; - target.style.height = source.offsetHeight + 'px'; - }, - - page: function(forElement) { - var valueT = 0, valueL = 0; - - var element = forElement; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - - // Safari fix - if (element.offsetParent==document.body) - if (Element.getStyle(element,'position')=='absolute') break; - - } while (element = element.offsetParent); - - element = forElement; - do { - valueT -= element.scrollTop || 0; - valueL -= element.scrollLeft || 0; - } while (element = element.parentNode); - - return [valueL, valueT]; - }, - - clone: function(source, target) { - var options = Object.extend({ - setLeft: true, - setTop: true, - setWidth: true, - setHeight: true, - offsetTop: 0, - offsetLeft: 0 - }, arguments[2] || {}) - - // find page position of source - source = $(source); - var p = Position.page(source); - - // find coordinate system to use - target = $(target); - var delta = [0, 0]; - var parent = null; - // delta [0,0] will do fine with position: fixed elements, - // position:absolute needs offsetParent deltas - if (Element.getStyle(target,'position') == 'absolute') { - parent = Position.offsetParent(target); - delta = Position.page(parent); - } - - // correct by body offsets (fixes Safari) - if (parent == document.body) { - delta[0] -= document.body.offsetLeft; - delta[1] -= document.body.offsetTop; - } - - // set position - if(options.setLeft) target.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px'; - if(options.setTop) target.style.top = (p[1] - delta[1] + options.offsetTop) + 'px'; - if(options.setWidth) target.style.width = source.offsetWidth + 'px'; - if(options.setHeight) target.style.height = source.offsetHeight + 'px'; - }, - - absolutize: function(element) { - element = $(element); - if (element.style.position == 'absolute') return; - Position.prepare(); - - var offsets = Position.positionedOffset(element); - var top = offsets[1]; - var left = offsets[0]; - var width = element.clientWidth; - var height = element.clientHeight; - - element._originalLeft = left - parseFloat(element.style.left || 0); - element._originalTop = top - parseFloat(element.style.top || 0); - element._originalWidth = element.style.width; - element._originalHeight = element.style.height; - - element.style.position = 'absolute'; - element.style.top = top + 'px';; - element.style.left = left + 'px';; - element.style.width = width + 'px';; - element.style.height = height + 'px';; - }, - - relativize: function(element) { - element = $(element); - if (element.style.position == 'relative') return; - Position.prepare(); - - element.style.position = 'relative'; - var top = parseFloat(element.style.top || 0) - (element._originalTop || 0); - var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0); - - element.style.top = top + 'px'; - element.style.left = left + 'px'; - element.style.height = element._originalHeight; - element.style.width = element._originalWidth; - } -} - -// Safari returns margins on body which is incorrect if the child is absolutely -// positioned. For performance reasons, redefine Position.cumulativeOffset for -// KHTML/WebKit only. -if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) { - Position.cumulativeOffset = function(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - if (element.offsetParent == document.body) - if (Element.getStyle(element, 'position') == 'absolute') break; - - element = element.offsetParent; - } while (element); - - return [valueL, valueT]; - } -} \ No newline at end of file diff --git a/deploy/root/jquery-1.3.2.min.js b/deploy/root/jquery-1.3.2.min.js new file mode 100644 index 0000000000..b1ae21d8b2 --- /dev/null +++ b/deploy/root/jquery-1.3.2.min.js @@ -0,0 +1,19 @@ +/* + * jQuery JavaScript Library v1.3.2 + * http://jquery.com/ + * + * Copyright (c) 2009 John Resig + * Dual licensed under the MIT and GPL licenses. + * http://docs.jquery.com/License + * + * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) + * Revision: 6246 + */ +(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("",""]||!O.indexOf("",""]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!O.indexOf("",""]||(!O.indexOf("",""]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div
","
"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); +/* + * Sizzle CSS Selector Engine - v0.9.3 + * Copyright 2009, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); \ No newline at end of file diff --git a/deploy/root/stylesheets/default.css b/deploy/root/stylesheets/default.css deleted file mode 100644 index 716fc7ab59..0000000000 --- a/deploy/root/stylesheets/default.css +++ /dev/null @@ -1,54 +0,0 @@ -body { - background-image: url(../images/body-background.png); - background-repeat: repeat-x; - background-color: #5c8098; -} -html, body, h1, h2 { - margin: 0px; - padding: 0px; -} -body, textarea, input { - font-size: 12px; - font-family: Verdana, Helvetica, Arial, sans-serif; - color: #2d2b3d; -} -#container { - text-align:center; -} -#container-inner { - margin-left: auto; - margin-right: auto; - text-align: justify; - width: 820px; -} -#header { - width: 820px; - height: 100px; - background-image: url(../images/header-background.png); - background-repeat: no-repeat; -} -#header h1 { - display: none; -} -#main { - height: 610px; - background-image: url(../images/main-background.png); - background-repeat: no-repeat; - text-align: left; - width: 740px; - padding: 30px 40px 20px 40px; -} -#display { - border: 1px solid #5c8098; - width: 740px; - height: 400px; - margin-bottom: 10px; - overflow-y: scroll; -} -#login-name { - width: 200px; -} -#message { - width: 740px; - height: 50px; -} diff --git a/embedded-repo/org/apache/cassandra/cassandra/0.5.0/cassandra-0.5.0.jar b/embedded-repo/org/apache/cassandra/cassandra/0.5.0/cassandra-0.5.0.jar new file mode 100644 index 0000000000..05bfccec95 Binary files /dev/null and b/embedded-repo/org/apache/cassandra/cassandra/0.5.0/cassandra-0.5.0.jar differ diff --git a/embedded-repo/shoal-jxta/jxta/1.1-20090818/LICENSE.txt b/embedded-repo/shoal-jxta/jxta/1.1-20090818/LICENSE.txt new file mode 100644 index 0000000000..4aea53745d --- /dev/null +++ b/embedded-repo/shoal-jxta/jxta/1.1-20090818/LICENSE.txt @@ -0,0 +1,263 @@ +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + +1. Definitions. + + 1.1. Contributor. means each individual or entity that creates or contributes to the creation of Modifications. + + 1.2. Contributor Version. means the combination of the Original Software, prior Modifications used by a Contributor (if any), and the Modifications made by that particular Contributor. + + 1.3. Covered Software. means (a) the Original Software, or (b) Modifications, or (c) the combination of files containing Original Software with files containing Modifications, in each case including portions thereof. + + 1.4. Executable. means the Covered Software in any form other than Source Code. + + 1.5. Initial Developer. means the individual or entity that first makes Original Software available under this License. + + 1.6. Larger Work. means a work which combines Covered Software or portions thereof with code not governed by the terms of this License. + + 1.7. License. means this document. + + 1.8. Licensable. means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein. + + 1.9. Modifications. means the Source Code and Executable form of any of the following: + + A. Any file that results from an addition to, deletion from or modification of the contents of a file containing Original Software or previous Modifications; + + B. Any new file that contains any part of the Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made available under the terms of this License. + + 1.10. Original Software. means the Source Code and Executable form of computer software code that is originally released under this License. + + 1.11. Patent Claims. means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor. + + 1.12. Source Code. means (a) the common form of computer software code in which modifications are made and (b) associated documentation included in or with such code. + + 1.13. You. (or .Your.) means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, .You. includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, .control. means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. + +2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, the Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer, to use, reproduce, modify, display, perform, sublicense and distribute the Original Software (or portions thereof), with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using or selling of Original Software, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Software (or portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) are effective on the date Initial Developer first distributes or otherwise makes the Original Software available to a third party under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is granted: (1) for code that You delete from the Original Software, or (2) for infringements caused by: (i) the modification of the Original Software, or (ii) the combination of the Original Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than patent or trademark) Licensable by Contributor to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof), either on an unmodified basis, with other Modifications, as Covered Software and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: (1) Modifications made by that Contributor (or portions thereof); and (2) the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective on the date Contributor first distributes or otherwise makes the Modifications available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent license is granted: (1) for any code that Contributor has deleted from the Contributor Version; (2) for infringements caused by: (i) third party modifications of Contributor Version, or (ii) the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or (3) under Patent Claims infringed by Covered Software in the absence of Modifications made by that Contributor. + +3. Distribution Obligations. + + 3.1. Availability of Source Code. + Any Covered Software that You distribute or otherwise make available in Executable form must also be made available in Source Code form and that Source Code form must be distributed only under the terms of this License. You must include a copy of this License with every copy of the Source Code form of the Covered Software You distribute or otherwise make available. You must inform recipients of any such Covered Software in Executable form as to how they can obtain such Covered Software in Source Code form in a reasonable manner on or through a medium customarily used for software exchange. + + 3.2. Modifications. + The Modifications that You create or to which You contribute are governed by the terms of this License. You represent that You believe Your Modifications are Your original creation(s) and/or You have sufficient rights to grant the rights conveyed by this License. + + 3.3. Required Notices. + You must include a notice in each of Your Modifications that identifies You as the Contributor of the Modification. You may not remove or alter any copyright, patent or trademark notices contained within the Covered Software, or any notices of licensing or any descriptive text giving attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + You may not offer or impose any terms on any Covered Software in Source Code form that alters or restricts the applicable version of this License or the recipients. rights hereunder. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, you may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear that any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer. + + 3.5. Distribution of Executable Versions. + You may distribute the Executable form of the Covered Software under the terms of this License or under the terms of a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable form does not attempt to limit or alter the recipient.s rights in the Source Code form from the rights set forth in this License. If You distribute the Covered Software in Executable form under a different license, You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer. + + 3.6. Larger Works. + You may create a Larger Work by combining Covered Software with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Software. + +4. Versions of the License. + + 4.1. New Versions. + Sun Microsystems, Inc. is the initial license steward and may publish revised and/or new versions of this License from time to time. Each version will be given a distinguishing version number. Except as provided in Section 4.3, no one other than the license steward has the right to modify this License. + + 4.2. Effect of New Versions. + You may always continue to use, distribute or otherwise make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. If the Initial Developer includes a notice in the Original Software prohibiting it from being distributed or otherwise made available under any subsequent version of the License, You must distribute and make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. Otherwise, You may also choose to use, distribute or otherwise make the Covered Software available under the terms of any subsequent version of the License published by the license steward. + + 4.3. Modified Versions. + When You are an Initial Developer and You want to create a new license for Your Original Software, You may create and use a modified version of this License if You: (a) rename the license and remove any references to the name of the license steward (except to note that the license differs from this License); and (b) otherwise make it clear that the license contains terms which differ from this License. + +5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN .AS IS. BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +6. TERMINATION. + + 6.1. This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding declaratory judgment actions) against Initial Developer or a Contributor (the Initial Developer or Contributor against whom You assert such claim is referred to as .Participant.) alleging that the Participant Software (meaning the Contributor Version where the Participant is a Contributor or the Original Software where the Participant is the Initial Developer) directly or indirectly infringes any patent, then any and all rights granted directly or indirectly to You by such Participant, the Initial Developer (if the Initial Developer is not the Participant) and all Contributors under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively and automatically at the expiration of such 60 day notice period, unless if within such 60 day period You withdraw Your claim with respect to the Participant Software against such Participant either unilaterally or pursuant to a written agreement with Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 above, all end user licenses that have been validly granted by You or any distributor hereunder prior to termination (excluding licenses granted to You by any distributor) shall survive termination. + +7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY.S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +8. U.S. GOVERNMENT END USERS. + + The Covered Software is a .commercial item,. as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of .commercial computer software. (as that term is defined at 48 C.F.R. º 252.227-7014(a)(1)) and .commercial computer software documentation. as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Software with only those rights set forth herein. This U.S. Government Rights clause is in lieu of, and supersedes, any other FAR, DFAR, or other clause or provision that addresses Government rights in computer software under this License. + +9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by the law of the jurisdiction specified in a notice contained within the Original Software (except to the extent applicable law, if any, provides otherwise), excluding such jurisdiction.s conflict-of-law provisions. Any litigation relating to this License shall be subject to the jurisdiction of the courts located in the jurisdiction and venue specified in a notice contained within the Original Software, with the losing party responsible for costs, including, without limitation, court costs and reasonable attorneys. fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License. You agree that You alone are responsible for compliance with the United States export administration regulations (and the export control laws and regulation of any other countries) when You use, distribute or otherwise make available any Covered Software. + +10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability. + + NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) + + The code released under the CDDL shall be governed by the laws of the State of California (excluding conflict-of-law provisions). Any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California and the state courts of the State of California, with venue lying in Santa Clara County, California. + + +The GNU General Public License (GPL) Version 2, June 1991 + + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. + +To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and modification follow. + + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. + +You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. + + c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. + +3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. + +If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. + +5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. + +7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. + + One line to give the program's name and a brief idea of what it does. + + Copyright (C) + + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. + + signature of Ty Coon, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. + + +"CLASSPATH" EXCEPTION TO THE GPL VERSION 2 + +Certain source files distributed by Sun Microsystems, Inc. are subject to the following clarification and special exception to the GPL Version 2, but only where Sun has expressly included in the particular source file's header the words + +"Sun designates this particular file as subject to the "Classpath" exception as provided by Sun in the License file that accompanied this code." + +Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License Version 2 cover the whole combination. + +As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module.? An independent module is a module which is not derived from or based on this library.? If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so.? If you do not wish to do so, delete this exception statement from your version. diff --git a/embedded-repo/shoal-jxta/jxta/1.1-20090818/jxta-1.1-20090818.jar b/embedded-repo/shoal-jxta/jxta/1.1-20090818/jxta-1.1-20090818.jar new file mode 100644 index 0000000000..6b539cce4a Binary files /dev/null and b/embedded-repo/shoal-jxta/jxta/1.1-20090818/jxta-1.1-20090818.jar differ diff --git a/embedded-repo/shoal-jxta/jxta/1.1-20090818/jxta-1.1-20090818.pom b/embedded-repo/shoal-jxta/jxta/1.1-20090818/jxta-1.1-20090818.pom new file mode 100755 index 0000000000..c0f3c68341 --- /dev/null +++ b/embedded-repo/shoal-jxta/jxta/1.1-20090818/jxta-1.1-20090818.pom @@ -0,0 +1,8 @@ + + + 4.0.0 + shoal-jxta + jxta + 1.1-20090818 + jar + \ No newline at end of file diff --git a/embedded-repo/shoal-jxta/shoal/1.1-20090818/LICENSE.txt b/embedded-repo/shoal-jxta/shoal/1.1-20090818/LICENSE.txt new file mode 100644 index 0000000000..4aea53745d --- /dev/null +++ b/embedded-repo/shoal-jxta/shoal/1.1-20090818/LICENSE.txt @@ -0,0 +1,263 @@ +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + +1. Definitions. + + 1.1. Contributor. means each individual or entity that creates or contributes to the creation of Modifications. + + 1.2. Contributor Version. means the combination of the Original Software, prior Modifications used by a Contributor (if any), and the Modifications made by that particular Contributor. + + 1.3. Covered Software. means (a) the Original Software, or (b) Modifications, or (c) the combination of files containing Original Software with files containing Modifications, in each case including portions thereof. + + 1.4. Executable. means the Covered Software in any form other than Source Code. + + 1.5. Initial Developer. means the individual or entity that first makes Original Software available under this License. + + 1.6. Larger Work. means a work which combines Covered Software or portions thereof with code not governed by the terms of this License. + + 1.7. License. means this document. + + 1.8. Licensable. means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein. + + 1.9. Modifications. means the Source Code and Executable form of any of the following: + + A. Any file that results from an addition to, deletion from or modification of the contents of a file containing Original Software or previous Modifications; + + B. Any new file that contains any part of the Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made available under the terms of this License. + + 1.10. Original Software. means the Source Code and Executable form of computer software code that is originally released under this License. + + 1.11. Patent Claims. means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor. + + 1.12. Source Code. means (a) the common form of computer software code in which modifications are made and (b) associated documentation included in or with such code. + + 1.13. You. (or .Your.) means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, .You. includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, .control. means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. + +2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, the Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer, to use, reproduce, modify, display, perform, sublicense and distribute the Original Software (or portions thereof), with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using or selling of Original Software, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Software (or portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) are effective on the date Initial Developer first distributes or otherwise makes the Original Software available to a third party under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is granted: (1) for code that You delete from the Original Software, or (2) for infringements caused by: (i) the modification of the Original Software, or (ii) the combination of the Original Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than patent or trademark) Licensable by Contributor to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof), either on an unmodified basis, with other Modifications, as Covered Software and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: (1) Modifications made by that Contributor (or portions thereof); and (2) the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective on the date Contributor first distributes or otherwise makes the Modifications available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent license is granted: (1) for any code that Contributor has deleted from the Contributor Version; (2) for infringements caused by: (i) third party modifications of Contributor Version, or (ii) the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or (3) under Patent Claims infringed by Covered Software in the absence of Modifications made by that Contributor. + +3. Distribution Obligations. + + 3.1. Availability of Source Code. + Any Covered Software that You distribute or otherwise make available in Executable form must also be made available in Source Code form and that Source Code form must be distributed only under the terms of this License. You must include a copy of this License with every copy of the Source Code form of the Covered Software You distribute or otherwise make available. You must inform recipients of any such Covered Software in Executable form as to how they can obtain such Covered Software in Source Code form in a reasonable manner on or through a medium customarily used for software exchange. + + 3.2. Modifications. + The Modifications that You create or to which You contribute are governed by the terms of this License. You represent that You believe Your Modifications are Your original creation(s) and/or You have sufficient rights to grant the rights conveyed by this License. + + 3.3. Required Notices. + You must include a notice in each of Your Modifications that identifies You as the Contributor of the Modification. You may not remove or alter any copyright, patent or trademark notices contained within the Covered Software, or any notices of licensing or any descriptive text giving attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + You may not offer or impose any terms on any Covered Software in Source Code form that alters or restricts the applicable version of this License or the recipients. rights hereunder. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, you may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear that any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer. + + 3.5. Distribution of Executable Versions. + You may distribute the Executable form of the Covered Software under the terms of this License or under the terms of a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable form does not attempt to limit or alter the recipient.s rights in the Source Code form from the rights set forth in this License. If You distribute the Covered Software in Executable form under a different license, You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer. + + 3.6. Larger Works. + You may create a Larger Work by combining Covered Software with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Software. + +4. Versions of the License. + + 4.1. New Versions. + Sun Microsystems, Inc. is the initial license steward and may publish revised and/or new versions of this License from time to time. Each version will be given a distinguishing version number. Except as provided in Section 4.3, no one other than the license steward has the right to modify this License. + + 4.2. Effect of New Versions. + You may always continue to use, distribute or otherwise make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. If the Initial Developer includes a notice in the Original Software prohibiting it from being distributed or otherwise made available under any subsequent version of the License, You must distribute and make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. Otherwise, You may also choose to use, distribute or otherwise make the Covered Software available under the terms of any subsequent version of the License published by the license steward. + + 4.3. Modified Versions. + When You are an Initial Developer and You want to create a new license for Your Original Software, You may create and use a modified version of this License if You: (a) rename the license and remove any references to the name of the license steward (except to note that the license differs from this License); and (b) otherwise make it clear that the license contains terms which differ from this License. + +5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN .AS IS. BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +6. TERMINATION. + + 6.1. This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding declaratory judgment actions) against Initial Developer or a Contributor (the Initial Developer or Contributor against whom You assert such claim is referred to as .Participant.) alleging that the Participant Software (meaning the Contributor Version where the Participant is a Contributor or the Original Software where the Participant is the Initial Developer) directly or indirectly infringes any patent, then any and all rights granted directly or indirectly to You by such Participant, the Initial Developer (if the Initial Developer is not the Participant) and all Contributors under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively and automatically at the expiration of such 60 day notice period, unless if within such 60 day period You withdraw Your claim with respect to the Participant Software against such Participant either unilaterally or pursuant to a written agreement with Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 above, all end user licenses that have been validly granted by You or any distributor hereunder prior to termination (excluding licenses granted to You by any distributor) shall survive termination. + +7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY.S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +8. U.S. GOVERNMENT END USERS. + + The Covered Software is a .commercial item,. as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of .commercial computer software. (as that term is defined at 48 C.F.R. º 252.227-7014(a)(1)) and .commercial computer software documentation. as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Software with only those rights set forth herein. This U.S. Government Rights clause is in lieu of, and supersedes, any other FAR, DFAR, or other clause or provision that addresses Government rights in computer software under this License. + +9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by the law of the jurisdiction specified in a notice contained within the Original Software (except to the extent applicable law, if any, provides otherwise), excluding such jurisdiction.s conflict-of-law provisions. Any litigation relating to this License shall be subject to the jurisdiction of the courts located in the jurisdiction and venue specified in a notice contained within the Original Software, with the losing party responsible for costs, including, without limitation, court costs and reasonable attorneys. fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License. You agree that You alone are responsible for compliance with the United States export administration regulations (and the export control laws and regulation of any other countries) when You use, distribute or otherwise make available any Covered Software. + +10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability. + + NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) + + The code released under the CDDL shall be governed by the laws of the State of California (excluding conflict-of-law provisions). Any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California and the state courts of the State of California, with venue lying in Santa Clara County, California. + + +The GNU General Public License (GPL) Version 2, June 1991 + + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. + +To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and modification follow. + + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. + +You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. + + c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. + +3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. + +If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. + +5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. + +7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. + + One line to give the program's name and a brief idea of what it does. + + Copyright (C) + + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. + + signature of Ty Coon, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. + + +"CLASSPATH" EXCEPTION TO THE GPL VERSION 2 + +Certain source files distributed by Sun Microsystems, Inc. are subject to the following clarification and special exception to the GPL Version 2, but only where Sun has expressly included in the particular source file's header the words + +"Sun designates this particular file as subject to the "Classpath" exception as provided by Sun in the License file that accompanied this code." + +Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License Version 2 cover the whole combination. + +As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module.? An independent module is a module which is not derived from or based on this library.? If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so.? If you do not wish to do so, delete this exception statement from your version. diff --git a/embedded-repo/shoal-jxta/shoal/1.1-20090818/shoal-1.1-20090818.jar b/embedded-repo/shoal-jxta/shoal/1.1-20090818/shoal-1.1-20090818.jar new file mode 100644 index 0000000000..3e13c87681 Binary files /dev/null and b/embedded-repo/shoal-jxta/shoal/1.1-20090818/shoal-1.1-20090818.jar differ diff --git a/embedded-repo/shoal-jxta/shoal/1.1-20090818/shoal-1.1-20090818.pom b/embedded-repo/shoal-jxta/shoal/1.1-20090818/shoal-1.1-20090818.pom new file mode 100755 index 0000000000..3174de1e4a --- /dev/null +++ b/embedded-repo/shoal-jxta/shoal/1.1-20090818/shoal-1.1-20090818.pom @@ -0,0 +1,8 @@ + + + 4.0.0 + shoal-jxta + shoal + 1.1-20090818 + jar + \ No newline at end of file diff --git a/embedded-repo/sjson/json/sjson/0.2/sjson-0.2.jar b/embedded-repo/sjson/json/sjson/0.2/sjson-0.2.jar deleted file mode 100644 index 264e565c64..0000000000 Binary files a/embedded-repo/sjson/json/sjson/0.2/sjson-0.2.jar and /dev/null differ diff --git a/embedded-repo/sjson/json/sjson/0.3/sjson-0.3.jar b/embedded-repo/sjson/json/sjson/0.3/sjson-0.3.jar deleted file mode 100644 index 5f3c358883..0000000000 Binary files a/embedded-repo/sjson/json/sjson/0.3/sjson-0.3.jar and /dev/null differ diff --git a/embedded-repo/sjson/json/sjson/0.4/sjson-0.4.jar b/embedded-repo/sjson/json/sjson/0.4/sjson-0.4.jar new file mode 100644 index 0000000000..dcab322c81 Binary files /dev/null and b/embedded-repo/sjson/json/sjson/0.4/sjson-0.4.jar differ diff --git a/embedded-repo/sjson/json/sjson/0.4/sjson-0.4.pom b/embedded-repo/sjson/json/sjson/0.4/sjson-0.4.pom new file mode 100755 index 0000000000..784adff55e --- /dev/null +++ b/embedded-repo/sjson/json/sjson/0.4/sjson-0.4.pom @@ -0,0 +1,8 @@ + + + 4.0.0 + sjson.json + sjson + 0.4 + jar + diff --git a/pom.xml b/pom.xml old mode 100755 new mode 100644 index 1fb9775741..4382083837 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ Akka Project akka se.scalablesolutions.akka - 0.6 + 0.7-SNAPSHOT 2009 http://akkasource.org pom @@ -42,8 +42,8 @@ ${maven.compiler.source} ${project.build.sourceEncoding} ${project.build.sourceEncoding} - 0.5.v20100104 - 1.1.5-ea-20100104 + 0.5.2 + 1.1.5 1.9.18-i 1.0-for-scala-2.8.0-SNAPSHOT 2.8.0.Beta1-RC8 @@ -59,6 +59,7 @@ akka-comet akka-amqp akka-security + akka-patterns akka-kernel akka-fun-test-java akka-samples @@ -94,9 +95,7 @@ +1 viktor.klang [REMOVE] AT gmail DOT com - Hacker - Plumber - Comic relief + Apostle @@ -261,6 +260,46 @@ src/main/scala src/test/scala + + org.apache.maven.plugins + maven-enforcer-plugin + 1.0-beta-1 + + + enforce-akka-home + + enforce + + + + + env.AKKA_HOME + "You must have set AKKA_HOME!" + + + + ${env.AKKA_HOME}/embedded-repo + + + + true + + + + enforce-java + + enforce + + + + + 1.6.0 + + + + + + org.apache.maven.plugins maven-surefire-plugin @@ -359,26 +398,6 @@ org.apache.maven.plugins maven-antrun-plugin - - org.apache.maven.plugins - maven-enforcer-plugin - 1.0-beta-1 - - - enforce-java - - enforce - - - - - 1.6.0 - - - - - -