Namespace Overview | 24 |
---|
#arguments.qPackages.namespace# | 29 |
34 | #replacenocase(comparison_result.s1,chr(10)," ","all")# 35 | |
36 |
37 | #replacenocase(comparison_result.s2,chr(10)," ","all")# 38 | |
39 |
apply()
method
11 | * @debug Add debugging or not
12 | * @loadAppContext By default, we load the Application context into the running thread. If you don't need it, then don't load it.
13 | */
14 | function init(
15 | required f,
16 | boolean debug = false,
17 | boolean loadAppContext = true
18 | ){
19 | super.init(
20 | arguments.f,
21 | arguments.debug,
22 | arguments.loadAppContext
23 | );
24 | return this;
25 | }
26 |
27 | /**
28 | * Represents a function that accepts one argument and produces a result.
29 | */
30 | function apply( t ){
31 | loadContext();
32 | try {
33 | lock name="#getConcurrentEngineLockName()#" type="exclusive" timeout="60" {
34 | if( isNull( arguments.t ) ){
35 | return variables.target();
36 | }
37 | return variables.target( arguments.t );
38 | }
39 | } finally {
40 | unLoadContext();
41 | }
42 | }
43 |
44 | function andThen( after ){
45 | }
46 |
47 | function compose( before ){
48 | }
49 |
50 | function identity(){
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/cfml/system/wirebox/system/async/proxies/FutureFunction.cfc:
--------------------------------------------------------------------------------
1 | /**
2 | * Functional Interface that maps to java.util.function.Function
3 | * but will return the native future which is expected in the result
4 | * of the called target
5 | */
6 | component extends="Function" {
7 |
8 | /**
9 | * Represents a function that accepts one argument and produces a result.
10 | * I have to use it like this because `super` does not work on ACF in a proxy
11 | */
12 | function apply( t ){
13 | loadContext();
14 | try {
15 | lock name="#getConcurrentEngineLockName()#" type="exclusive" timeout="60" {
16 | var oFuture = variables.target( arguments.t );
17 | if ( isNull( oFuture ) || !structKeyExists( oFuture, "getNative" ) ) {
18 | throw(
19 | type = "IllegalFutureException",
20 | message = "The return of the function is NOT a ColdBox Future"
21 | );
22 | }
23 | return oFuture.getNative();
24 | }
25 | } finally {
26 | unLoadContext();
27 | }
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/src/cfml/system/wirebox/system/async/proxies/Runnable.cfc:
--------------------------------------------------------------------------------
1 | /**
2 | * Functional Interface that maps to java.lang.Runnable
3 | * See https://docs.oracle.com/javase/8/docs/api/java/lang/Runnable.html
4 | */
5 | component extends="BaseProxy" {
6 |
7 | /**
8 | * Constructor
9 | *
10 | * @target The lambda or closure that will be the task
11 | * @method An optional method in case the supplier is a CFC instead of a closure
12 | * @debug Add debugging or not
13 | * @loadAppContext By default, we load the Application context into the running thread. If you don't need it, then don't load it.
14 | */
15 | function init(
16 | required target,
17 | method = "run",
18 | boolean debug = false,
19 | boolean loadAppContext = true
20 | ){
21 | super.init(
22 | arguments.target,
23 | arguments.debug,
24 | arguments.loadAppContext
25 | );
26 | variables.method = arguments.method;
27 | return this;
28 | }
29 |
30 | function run(){
31 | loadContext();
32 | try {
33 | lock name="#getConcurrentEngineLockName()#" type="exclusive" timeout="60" {
34 | if ( isClosure( variables.target ) || isCustomFunction( variables.target ) ) {
35 | variables.target();
36 | } else {
37 | invoke( variables.target, variables.method );
38 | }
39 | }
40 | } finally {
41 | unLoadContext();
42 | }
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/cfml/system/wirebox/system/async/proxies/Supplier.cfc:
--------------------------------------------------------------------------------
1 | component extends="BaseProxy" {
2 |
3 | /**
4 | * Constructor
5 | *
6 | * @supplier The lambda or closure that will supply the elements
7 | * @method An optional method in case the supplier is a CFC instead of a closure
8 | * @debug Add debugging or not
9 | * @loadAppContext By default, we load the Application context into the running thread. If you don't need it, then don't load it.
10 | */
11 | function init(
12 | required supplier,
13 | method = "run",
14 | boolean debug = false,
15 | boolean loadAppContext = true
16 | ){
17 | super.init(
18 | arguments.supplier,
19 | arguments.debug,
20 | arguments.loadAppContext
21 | );
22 | variables.method = arguments.method;
23 | return this;
24 | }
25 |
26 | /**
27 | * Functional interface for supplier to get a result
28 | * See https://docs.oracle.com/javase/8/docs/api/java/util/function/Supplier.html
29 | */
30 | function get(){
31 | loadContext();
32 | try {
33 | lock name="#getConcurrentEngineLockName()#" type="exclusive" timeout="60" {
34 | if ( isClosure( variables.target ) || isCustomFunction( variables.target ) ) {
35 | return variables.target();
36 | } else {
37 | return invoke( variables.target, variables.method );
38 | }
39 | }
40 | } finally {
41 | unLoadContext();
42 | }
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/cfml/system/wirebox/system/async/tasks/ScheduledFuture.cfc:
--------------------------------------------------------------------------------
1 | /**
2 | * This is a ColdBox Scheduled Future object modeled and backed by Java's ScheduledFuture & Future interface but with Dynamic Goodness!
3 | *
4 | * @see https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ScheduledFuture.html
5 | */
6 | component accessors="true" extends="FutureTask" {
7 |
8 | /**
9 | * Build the ColdBox ScheduledFuture with the Java native class
10 | *
11 | * @native The native ScheduledFuture class we are wrapping
12 | */
13 | ScheduledFuture function init( native ){
14 | if ( isNull( arguments.native ) ) {
15 | arguments.native = createObject(
16 | "java",
17 | "java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask"
18 | );
19 | }
20 | variables.native = arguments.native;
21 | return this;
22 | }
23 |
24 | /**
25 | * Returns true if the scheduled task is periodic or not
26 | */
27 | boolean function isPeriodic(){
28 | return variables.native.isPeriodic();
29 | }
30 |
31 | /**
32 | * Get the delay of the scheduled task in the given time unit
33 | *
34 | * @timeUnit The time unit to use, available units are: days, hours, microseconds, milliseconds, minutes, nanoseconds, and seconds. The default is milliseconds
35 | */
36 | numeric function getDelay( timeUnit = "milliseconds" ){
37 | return variables.native.getDelay( this.$timeUnit.get( arguments.timeUnit ) );
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/src/cfml/system/wirebox/system/async/time/TimeUnit.cfc:
--------------------------------------------------------------------------------
1 | /**
2 | * Static class to map ColdFusion strings units to Java units
3 | * A TimeUnit does not maintain time information,
4 | * but only helps organize and use time representations that may be maintained separately across various contexts
5 | */
6 | component singleton {
7 |
8 | // The static java class
9 | variables.jTimeUnit = createObject( "java", "java.util.concurrent.TimeUnit" );
10 |
11 | /**
12 | * Get the appropriate Java timeunit class according to string conventions
13 | *
14 | * @timeUnit The time unit to use, available units are: days, hours, microseconds, milliseconds, minutes, nanoseconds, and seconds. The default is milliseconds
15 | *
16 | * @return The Java time unit class
17 | */
18 | function get( required timeUnit = "milliseconds" ){
19 | switch ( arguments.timeUnit ) {
20 | case "days": {
21 | return variables.jTimeUnit.DAYS;
22 | }
23 | case "hours": {
24 | return variables.jTimeUnit.HOURS;
25 | }
26 | case "microseconds": {
27 | return variables.jTimeUnit.MICROSECONDS;
28 | }
29 | case "milliseconds": {
30 | return variables.jTimeUnit.MILLISECONDS;
31 | }
32 | case "minutes": {
33 | return variables.jTimeUnit.MINUTES;
34 | }
35 | case "nanoseconds": {
36 | return variables.jTimeUnit.NANOSECONDS;
37 | }
38 | case "seconds": {
39 | return variables.jTimeUnit.SECONDS;
40 | }
41 | }
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/cfml/system/wirebox/system/cache/config/LogBox.cfc:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | * Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
3 | * www.ortussolutions.com
4 | ********************************************************************************
5 | The logging configuration object for CacheBox Standalone version.
6 | You can make changes here to determine how CacheBox logs information. For more
7 | information about logBox visit: http://wiki.coldbox.org/wiki/LogBox.cfm
8 | **/
9 | component{
10 |
11 | /**
12 | * Configure logBox
13 | */
14 | function configure(){
15 | variables.logBox = {
16 | // Define Appenders
17 | appenders = {
18 | console = {
19 | class="ConsoleAppender"
20 | }
21 | },
22 | // Root Logger
23 | root = { levelmax="INFO", appenders="*" }
24 | };
25 | }
26 |
27 | }
--------------------------------------------------------------------------------
/src/cfml/system/wirebox/system/cache/license.txt:
--------------------------------------------------------------------------------
1 | ********************************************************************************
2 | Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
3 | www.ortussolutions.com
4 | ********************************************************************************
5 | ColdBox is open source. However, if you use this product please know that it is bound to the following Licence.
6 | If you use ColdBox, please make mention of it in your code or web site or add a Powered By Coldbox icon.
7 |
8 | Apache License, Version 2.0
9 |
10 | Copyright [2007] [Luis Majano and Ortus Solutions,Corp]
11 |
12 | Licensed under the Apache License, Version 2.0 (the "License");
13 | you may not use this file except in compliance with the License.
14 | You may obtain a copy of the License at
15 |
16 | http://www.apache.org/licenses/LICENSE-2.0
17 |
18 | Unless required by applicable law or agreed to in writing, software
19 | distributed under the License is distributed on an "AS IS" BASIS,
20 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 | See the License for the specific language governing permissions and
22 | limitations under the License.
--------------------------------------------------------------------------------
/src/cfml/system/wirebox/system/cache/policies/FIFO.cfc:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
3 | * www.ortussolutions.com
4 | * ----
5 | * This is a FIFO eviction Policy meaning that the first object placed on cache
6 | * will be the first one to come out.
7 | *
8 | * More information can be found here:
9 | * http://en.wikipedia.org/wiki/FIFO
10 | */
11 | component extends="wirebox.system.cache.policies.AbstractEvictionPolicy"{
12 |
13 | /**
14 | * Constructor
15 | *
16 | * @cacheProvider The associated cache provider of type: wirebox.system.cache.providers.ICacheProvider" doc_generic="wirebox.system.cache.providers.ICacheProvider
17 | */
18 | FIFO function init ( required any cacheProvider ){
19 | super.init( arguments.cacheProvider );
20 |
21 | return this;
22 | }
23 |
24 | /**
25 | * Execute the policy
26 | */
27 | void function execute (){
28 | // Get searchable index
29 | try{
30 | var index = getAssociatedCache()
31 | .getObjectStore()
32 | .getIndexer()
33 | .getSortedKeys( "created", "numeric", "asc" );
34 | // process evictions
35 | processEvictions( index );
36 | } catch( Any e ) {
37 | getLogger().error( "Error sorting via store indexer #e.message# #e.detail# #e.stackTrace#." );
38 | }
39 | }
40 |
41 | }
--------------------------------------------------------------------------------
/src/cfml/system/wirebox/system/cache/policies/IEvictionPolicy.cfc:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
3 | * www.ortussolutions.com
4 | * ----
5 | *
6 | * CacheBox Eviction policy interface
7 | */
8 | interface{
9 |
10 | /**
11 | * Execute the eviction policy on the associated cache
12 | */
13 | void function execute();
14 |
15 | /**
16 | * Get the Associated Cache Provider of type: wirebox.system.cache.providers.ICacheProvider
17 | *
18 | * @return wirebox.system.cache.providers.ICacheProvider
19 | */
20 | any function getAssociatedCache();
21 |
22 | }
--------------------------------------------------------------------------------
/src/cfml/system/wirebox/system/cache/policies/LFU.cfc:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
3 | * www.coldbox.org | www.luismajano.com | www.ortussolutions.com
4 | * ----
5 | * @author original: Luis Majano, cfscript: Ben Koshy
6 | * LFU Eviction Policy Command
7 | * Removes entities from the cache that are used the least.
8 | * More information can be found here:
9 | * http://en.wikipedia.org/wiki/Least_Frequently_Used
10 | */
11 | component extends = "wirebox.system.cache.policies.AbstractEvictionPolicy"{
12 |
13 | /**
14 | * Constructor
15 | * @cacheProvider The associated cache provider of type: wirebox.system.cache.providers.ICacheProvider" doc_generic="wirebox.system.cache.providers.ICacheProvider
16 | */
17 | LFU function init( required any cacheProvider ){
18 | super.init( arguments.cacheProvider );
19 |
20 | return this;
21 | }
22 |
23 | /**
24 | * Execute the policy
25 | */
26 | void function execute(){
27 | // Get searchable index
28 | try {
29 | var index = getAssociatedCache()
30 | .getObjectStore()
31 | .getIndexer()
32 | .getSortedKeys( "hits", "numeric", "asc" );
33 | // process evictions
34 | processEvictions( index );
35 | }
36 | catch( any e ){
37 | getLogger().error( "Error sorting via store indexer #e.message# #e.detail# #e.stackTrace#." );
38 | }
39 | }
40 |
41 | }
--------------------------------------------------------------------------------
/src/cfml/system/wirebox/system/cache/policies/LIFO.cfc:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
3 | * www.ortussolutions.com
4 | * ----
5 | * @author original: Luis Majano, cfscript: Francesco Pepe
6 | *
7 | * This is a LIFO eviction Policy meaning that the first object placed on cache
8 | * will be the last one to come out. This is usually a structure that represents
9 | * a stack.
10 | *
11 | * More information can be found here:
12 | * http://en.wikipedia.org/wiki/FIFO
13 | */
14 | component extends="wirebox.system.cache.policies.AbstractEvictionPolicy"{
15 |
16 | /**
17 | * This is the constructor
18 | * @cacheProvider The associated cache provider of type: wirebox.system.cache.providers.ICacheProvider" doc_generic="wirebox.system.cache.providers.ICacheProvider
19 | */
20 | LIFO function init( required any cacheProvider ){
21 | super.init( arguments.cacheProvider );
22 |
23 | return this;
24 | }
25 |
26 | /**
27 | * Execute the policy
28 | */
29 | void function execute(){
30 | // Get searchable index
31 | try{
32 | var index = getAssociatedCache()
33 | .getObjectStore()
34 | .getIndexer()
35 | .getSortedKeys( "Created", "numeric", "desc" );
36 | // process evictions
37 | processEvictions( index );
38 | } catch( Any e ) {
39 | getLogger().error( "Error sorting via store indexer #e.message# #e.detail# #e.stackTrace#." );
40 | }
41 | }
42 |
43 | }
--------------------------------------------------------------------------------
/src/cfml/system/wirebox/system/cache/policies/LRU.cfc:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
3 | * www.ortussolutions.com
4 | * ----
5 | *
6 | * This is the LRU or least recently used algorithm for cachebox.
7 | * It basically discards the least recently used items first according to the last accessed date.
8 | * This is also the default algorithm for CacheBox.
9 | *
10 | * For more information visit: http://en.wikipedia.org/wiki/Least_Recently_Used
11 | */
12 | component extends="wirebox.system.cache.policies.AbstractEvictionPolicy"{
13 |
14 | /**
15 | * This is the constructor
16 | * @cacheProvider The associated cache provider of type: wirebox.system.cache.providers.ICacheProvider" doc_generic="wirebox.system.cache.providers.ICacheProvider
17 | */
18 | LRU function init( required any cacheProvider ){
19 | super.init( arguments.cacheProvider );
20 |
21 | return this;
22 | }
23 |
24 | /**
25 | * Execute the policy
26 | */
27 | void function execute(){
28 | // Get searchable index
29 | try{
30 | var index = getAssociatedCache()
31 | .getObjectStore()
32 | .getIndexer()
33 | .getSortedKeys( "LastAccessed", "numeric", "asc" );
34 | // process evictions
35 | processEvictions( index );
36 | } catch( Any e ) {
37 | getLogger().error( "Error sorting via store indexer #e.message# #e.detail# #e.stackTrace#." );
38 | }
39 | }
40 |
41 | }
--------------------------------------------------------------------------------
/src/cfml/system/wirebox/system/cache/report/skins/default/images/bg-glass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ortus-Solutions/commandbox/358574dbb887b8fa24840920d5854221e26f9633/src/cfml/system/wirebox/system/cache/report/skins/default/images/bg-glass.png
--------------------------------------------------------------------------------
/src/cfml/system/wirebox/system/cache/report/skins/default/images/bg-glass2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ortus-Solutions/commandbox/358574dbb887b8fa24840920d5854221e26f9633/src/cfml/system/wirebox/system/cache/report/skins/default/images/bg-glass2.png
--------------------------------------------------------------------------------
/src/cfml/system/wirebox/system/cache/store/sql/JDBCStore-MySQL.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE `cacheBox` (
2 | `id` varchar(100) NOT NULL,
3 | `objectKey` varchar(255) NOT NULL,
4 | `objectValue` longtext NOT NULL,
5 | `hits` int(11) NOT NULL DEFAULT '1',
6 | `timeout` int(11) NOT NULL,
7 | `lastAccessTimeout` int(11) NOT NULL,
8 | `created` datetime NOT NULL,
9 | `lastAccessed` datetime NOT NULL,
10 | `isExpired` tinyint(4) NOT NULL DEFAULT '0',
11 | `isSimple` tinyint(4) NOT NULL DEFAULT '1',
12 | PRIMARY KEY (`id`),
13 | KEY `hits` (`hits`),
14 | KEY `created` (`created`),
15 | KEY `lastAccessed` (`lastAccessed`),
16 | KEY `timeout` (`timeout`),
17 | KEY `isExpired` (`isExpired`)
18 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--------------------------------------------------------------------------------
/src/cfml/system/wirebox/system/cache/store/sql/JDBCStore-Postgres.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE cachebox (
2 | id VARCHAR(100) NOT NULL,
3 | objectKey VARCHAR(255) NOT NULL,
4 | objectValue text NOT NULL,
5 | hits integer NOT NULL DEFAULT '1',
6 | timeout integer NOT NULL,
7 | lastAccessTimeout integer NOT NULL,
8 | created timestamp NOT NULL,
9 | lastAccessed timestamp NOT NULL,
10 | isExpired boolean NOT NULL DEFAULT true,
11 | isSimple boolean NOT NULL DEFAULT false,
12 | PRIMARY KEY (id)
13 | )
14 | CREATE INDEX created
15 | ON cachebox
16 | USING btree
17 | (created);
18 | CREATE INDEX hits
19 | ON cachebox
20 | USING btree
21 | (hits);
22 | CREATE INDEX "isExpired"
23 | ON cachebox
24 | USING btree
25 | (isexpired);
26 | CREATE INDEX "lastAccessed"
27 | ON cachebox
28 | USING btree
29 | (lastaccessed);
30 | CREATE INDEX timeout
31 | ON cachebox
32 | USING btree
33 | (timeout);
--------------------------------------------------------------------------------
/src/cfml/system/wirebox/system/cache/util/IStats.cfc:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
3 | * www.ortussolutions.com
4 | * ---
5 | * @author Luis Majano
6 | *
7 | * The main interface for a CacheBox cache provider statistics object
8 | */
9 | interface {
10 |
11 | /**
12 | * Get the cache's performance ratio
13 | */
14 | numeric function getCachePerformanceRatio();
15 |
16 | /**
17 | * Get the associated cache's live object count
18 | */
19 | numeric function getObjectCount();
20 |
21 | /**
22 | * Clear the stats
23 | *
24 | * @return IStats
25 | */
26 | function clearStatistics();
27 |
28 | /**
29 | * Get the total cache's garbage collections
30 | */
31 | numeric function getGarbageCollections();
32 |
33 | /**
34 | * Get the total cache's eviction count
35 | */
36 | numeric function getEvictionCount();
37 |
38 | /**
39 | * Get the total cache's hits
40 | */
41 | numeric function getHits();
42 |
43 | /**
44 | * Get the total cache's misses
45 | */
46 | numeric function getMisses();
47 |
48 | /**
49 | * Get the date/time of the last reap the cache did
50 | *
51 | * @return date/time or empty
52 | */
53 | function getLastReapDatetime();
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/src/cfml/system/wirebox/system/core/conversion/CFDocument.cfm:
--------------------------------------------------------------------------------
1 |