You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2011/10/11 17:08:08 UTC
svn commit: r1181829 - in
/incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena:
perf/ slib/
Author: andy
Date: Tue Oct 11 15:08:07 2011
New Revision: 1181829
URL: http://svn.apache.org/viewvc?rev=1181829&view=rev
Log:
Add Apache license boilerplate to scala files.
Added:
incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/slib/
incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/slib/ALib.scala
incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/slib/SLog.scala
Removed:
incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/Enum.scala
Modified:
incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/ActionBuilderManifest.scala
incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/Actions.scala
incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfMain.scala
incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfUnit.scala
incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfUnitLib.scala
Modified: incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/ActionBuilderManifest.scala
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/ActionBuilderManifest.scala?rev=1181829&r1=1181828&r2=1181829&view=diff
==============================================================================
--- incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/ActionBuilderManifest.scala (original)
+++ incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/ActionBuilderManifest.scala Tue Oct 11 15:08:07 2011
@@ -1,3 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.jena.perf
import com.hp.hpl.jena.util.FileManager
import com.hp.hpl.jena.query._
@@ -108,4 +126,4 @@ class ActionBuilderManifest(filename: St
val rs = qexec.execSelect()
rs.toList
}
-}
\ No newline at end of file
+}
Modified: incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/Actions.scala
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/Actions.scala?rev=1181829&r1=1181828&r2=1181829&view=diff
==============================================================================
--- incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/Actions.scala (original)
+++ incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/Actions.scala Tue Oct 11 15:08:07 2011
@@ -1,3 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.jena.perf
import com.hp.hpl.jena.query.Dataset
import com.hp.hpl.jena.query.DatasetFactory
Modified: incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfMain.scala
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfMain.scala?rev=1181829&r1=1181828&r2=1181829&view=diff
==============================================================================
--- incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfMain.scala (original)
+++ incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfMain.scala Tue Oct 11 15:08:07 2011
@@ -1,3 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.jena.perf
import java.util.Date
import com.hp.hpl.jena.query._
@@ -78,5 +96,3 @@ object PerfMain {
private val dateFmt:DateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z")
def now():String = dateFmt.format(new Date())
}
-
-
Modified: incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfUnit.scala
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfUnit.scala?rev=1181829&r1=1181828&r2=1181829&view=diff
==============================================================================
--- incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfUnit.scala (original)
+++ incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfUnit.scala Tue Oct 11 15:08:07 2011
@@ -1,3 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.jena.perf
import java.util.Date
import java.util.concurrent.atomic.AtomicInteger
@@ -89,4 +107,3 @@ trait ResultMonitor {
// if ( out2 == NoOutcome ) NoOutcome
// Success
// }
-
Modified: incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfUnitLib.scala
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfUnitLib.scala?rev=1181829&r1=1181828&r2=1181829&view=diff
==============================================================================
--- incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfUnitLib.scala (original)
+++ incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfUnitLib.scala Tue Oct 11 15:08:07 2011
@@ -1,3 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.jena.perf
import java.util.Date
import scala.collection.mutable.ArrayBuffer
Added: incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/slib/ALib.scala
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/slib/ALib.scala?rev=1181829&view=auto
==============================================================================
--- incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/slib/ALib.scala (added)
+++ incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/slib/ALib.scala Tue Oct 11 15:08:07 2011
@@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.atlas
+
+object ALib {
+
+ /* From http://www.scala-lang.org/node/49
+ * Works by putting a delayed arg inside an object (SuspImpl) as a mutable Option.
+ * When the value needed, via () or force,
+ */
+ /** Delay the evaluation of an expression until it is needed. */
+ def delay[A](value: => A): Susp[A] = new SuspImpl[A](value)
+
+ /** Get the value of a delayed expression. */
+ implicit def force[A](s: Susp[A]): A = s()
+
+ /**
+ * Data type of suspended computations. (The name comes from ML.)
+ */
+ abstract class Susp[+A] extends Function0[A]
+
+ /**
+ * Implementation of suspended computations, separated from the
+ * abstract class so that the type parameter can be invariant.
+ */
+ private class SuspImpl[A](lazyValue: => A) extends Susp[A] {
+ private var maybeValue: Option[A] = None
+
+ override def apply() = maybeValue match {
+ case None =>
+ val value = lazyValue
+ maybeValue = Some(value)
+ value
+ case Some(value) =>
+ value
+ }
+
+ override def toString() = maybeValue match {
+ case None => "Susp(?)"
+ case Some(value) => "Susp(" + value + ")"
+ }
+ }
+}
Added: incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/slib/SLog.scala
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/slib/SLog.scala?rev=1181829&view=auto
==============================================================================
--- incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/slib/SLog.scala (added)
+++ incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/slib/SLog.scala Tue Oct 11 15:08:07 2011
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.atlas
+
+/** Simple wrapper for logging - delays argument evaluation until needed */
+trait SLog
+{
+ org.openjena.atlas.logging.Log.setLog4j
+
+ val log = org.slf4j.LoggerFactory.getLogger(this.getClass) ;
+
+ // Choice:
+ // 1/ Use delayed args (msg: => AnyRef) -- ugly if it pushed .format into app code
+ // 2/ Varargs
+ // Both!
+
+ private def str(msg:String, args:Any*):String = {
+ if ( args.size == 0 ) return msg
+ msg.format(args:_*)
+ }
+
+ def INFO(msg: => String, args:Any*):Unit =
+ {
+ if ( log.isInfoEnabled )
+ log.info(str(msg, args:_*))
+ }
+
+ def DEBUG(msg: => String, args:Any*) : Unit =
+ {
+ if ( log.isDebugEnabled() )
+ log.debug(str(msg, args:_*))
+ }
+}