community-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carlo cancellieri <ccancelli...@hotmail.com>
Subject [GSoC] My proposal Checker.jar
Date Tue, 23 Mar 2010 00:01:23 GMT
Proposal Title: checker
Student Name: carlo cancellieri
Student E-mail: ccancellieri@hotmail.com

Organization/Project: independent
Assigned Mentor:none

Proposal Abstract:
A tool/framework to easily implement store and re-utilize multiple
checks/transformation/operation.
It's coming from the needs to do a variable combination of checks on a
series of multiple 'object' at run-time. Implementing a framework
plug-in for example, we need to check a couple of thinks, such as:
file configuration, paths, dependence, the existent of resources and
often to apply some transformation to the incoming objects...
If the framework/plug-in/software we are going to develop can
automatize this operation we could easily get an expandible
development ambient.
Now days is possible to implement all this operation using a static
way, implementing needed checks into the base software and (if needed)
re-implement all these checks  into the expansions (plug-in or
add-on).
And what about the need to change/add some of this
check/transformation/operation at run-time?
The Checker framework will use java class reflection, generics, XML,
(JavaCachingSystem), runtime loading and an easily expandible set of
check/transformation to build hierarchy of operation easy
to-store/to-be created and re utilized (at run time if you want).

Detailed Description:
It's essentially based on a (or a series of) XSD schemas. which are
used to validate an easily (using an editor with validator) expandible
hierarchy of xml 'checks' and 'join'.
The hierarchy, loaded from the cache or from a xml file (thanks to the
extensible Extractors abstract class and the power of a set of static
method of the ObjLoader), could be applied to an object using a small
set of public static resolvers methods of the Checker.class. All the
work is done by the easily expansible set of Check<C> and Join<J,C>.
These are fundamentally:
1 - An Interface called Check<C> which defines a method -> C
exec(Object o). This method have to be implemented to make as
'generic' as possible check or transformation of the passed object 'o'
to the generic result of type 'C'. That's all. (for demonstration
application we've developed boolean function NOT,IsFile,IsString and a
transformation ToAbsolute that absolutize the passed path).
2 - An extensible abstract class Join<J,C> which is able to merge
objects of the same type (J innerJoin(J,J)) or of type C to a
resulting type J (J join(J , C)).
To define a join we have to implement these two methods. For
demonstration application we've developed boolean function
AND,OR,NOR,NAND and an Empty join wich simply returns the passed
object (useful for a single check).
The actually implemented Extractor class (wich extends Extractors)
defines methods to read a recursive tree of checks. Here is a complete
XML file which comprises two simple checks named TEST_A and TEST_B.
<?xml version="1.0" encoding="UTF-8"?>
<cc:RootCheckList xmlns:cc="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd ">
  <cc:CheckElement cc:Name="TEST_A">
    <cc:CheckList>
      <cc:CacheableToCheck cc:Class="java.lang.Integer" cc:CacheID="c">
      	<cc:ObjTypeArg cc:Class="java.lang.String">
      		<cc:Argument>1000</cc:Argument></cc:ObjTypeArg>
      </cc:CacheableToCheck>
      <cc:InnerCheckList>
      	<cc:Join cc:Class="checker.join.Boolean.OR"></cc:Join>
      	<cc:CheckList>
      		<cc:CachedToCheck cc:CacheID="c" />
      		<cc:InnerCheckList>
      			<cc:Join cc:Class="checker.join.Empty"></cc:Join>
      			<cc:CheckList>
      				<cc:CachedToCheck cc:CacheID="c" ></cc:CachedToCheck>
      				<cc:Checks>
      					<cc:Join cc:Class="checker.join.Empty"></cc:Join>
      					<cc:Check cc:Class="checker.checks.Boolean.IsString"></cc:Check>
      				</cc:Checks>
      			</cc:CheckList>
      		</cc:InnerCheckList>
      	</cc:CheckList>
      	<cc:CheckList>
      		<cc:CachedToCheck cc:CacheID="c" ></cc:CachedToCheck>
      		<cc:Checks>
      			<cc:Join cc:Class="checker.join.Empty"></cc:Join>
      			<cc:Check cc:Class="checker.checks.Boolean.IsInteger"></cc:Check>
      		</cc:Checks>
      	</cc:CheckList>
      </cc:InnerCheckList>
    </cc:CheckList>
  </cc:CheckElement>
  <cc:CheckElement cc:Name="TEST_B">
  	<cc:CheckList>
  		<cc:ToCheck cc:Class="java.lang.String">
  			<cc:ObjTypeArg cc:Class="java.lang.String">
  				<cc:Argument>/home/bianco/work/wget-log</cc:Argument></cc:ObjTypeArg></cc:ToCheck>
  		<cc:Checks>
  			<cc:Join cc:Class="checker.join.Boolean.AND"></cc:Join>
  			<cc:Check cc:Class="checker.checks.Boolean.IsString"></cc:Check>
  			<cc:Check cc:Class="checker.checks.Boolean.IsFile"></cc:Check>
  		</cc:Checks>
  	</cc:CheckList>
  </cc:CheckElement>
</cc:RootCheckList>

And here is the full debuging log (application is based on the
common-logging bridge (actually in JUnit test case we uses Log4J to
log):
STARTING...
 INFO [main] (XmlReader.java:48) - 	"conf/XMLFile5.xml" correctly
verified and parsed.
 INFO [main] (Extractor.java:82) - STARTING... Resolving Element list
DEBUG [main] (Extractor.java:355) - 	Argument_0: 1000
DEBUG [main] (Extractor.java:426) - Loading: ComplexObject:java.lang.String
DEBUG [main] (ObjLoader.java:184) - Loading a new object of class:
java.lang.String
DEBUG [main] (ObjLoader.java:199) - Argument: 1000 Type: class
java.lang.String or class java.lang.String
DEBUG [main] (ObjLoader.java:206) - Found: public
java.lang.String(java.lang.String)
DEBUG [main] (Extractor.java:378) - 	Argument_0: 1000
DEBUG [main] (Extractor.java:418) - Loading:
CacheableObj:java.lang.Integer	cacheID:c
DEBUG [main] (ObjLoader.java:184) - Loading a new object of class:
java.lang.Integer
DEBUG [main] (ObjLoader.java:199) - Argument: 1000 Type: class
java.lang.String or class java.lang.String
DEBUG [main] (ObjLoader.java:206) - Found: public
java.lang.Integer(java.lang.String) throws
java.lang.NumberFormatException
DEBUG [main] (ObjLoader.java:184) - Loading a new object of class:
checker.impl.Extractor
DEBUG [main] (ObjLoader.java:199) - Argument: conf/XMLSchema.xsd Type:
class java.lang.String or class java.lang.String
DEBUG [main] (ObjLoader.java:199) - Argument:
http://www.w3.org/2001/XMLSchema Type: class java.lang.String or class
java.lang.String
DEBUG [main] (ObjLoader.java:199) - Argument: checker.xsd Type: class
java.lang.String or class java.lang.String
DEBUG [main] (ObjLoader.java:206) - Found: public
checker.impl.Extractor(java.lang.String,java.lang.String,java.lang.String)
throws java.io.IOException
DEBUG [main] (Extractor.java:265) - New InnerCheckList:
checker.xsd.InnerCheckList@43684706
DEBUG [main] (Extractor.java:426) - Loading:
ComplexObject:checker.join.Boolean.OR
DEBUG [main] (Extractor.java:410) - Loading: CachedObj:c
DEBUG [main] (ObjLoader.java:184) - Loading a new object of class:
checker.impl.Extractor
DEBUG [main] (ObjLoader.java:199) - Argument: conf/XMLSchema.xsd Type:
class java.lang.String or class java.lang.String
DEBUG [main] (ObjLoader.java:199) - Argument:
http://www.w3.org/2001/XMLSchema Type: class java.lang.String or class
java.lang.String
DEBUG [main] (ObjLoader.java:199) - Argument: checker.xsd Type: class
java.lang.String or class java.lang.String
DEBUG [main] (ObjLoader.java:206) - Found: public
checker.impl.Extractor(java.lang.String,java.lang.String,java.lang.String)
throws java.io.IOException
DEBUG [main] (Extractor.java:265) - New InnerCheckList:
checker.xsd.InnerCheckList@5d2412e7
DEBUG [main] (Extractor.java:426) - Loading: ComplexObject:checker.join.Empty
DEBUG [main] (Extractor.java:410) - Loading: CachedObj:c
DEBUG [main] (ObjLoader.java:184) - Loading a new object of class:
checker.impl.Extractor
DEBUG [main] (ObjLoader.java:199) - Argument: conf/XMLSchema.xsd Type:
class java.lang.String or class java.lang.String
DEBUG [main] (ObjLoader.java:199) - Argument:
http://www.w3.org/2001/XMLSchema Type: class java.lang.String or class
java.lang.String
DEBUG [main] (ObjLoader.java:199) - Argument: checker.xsd Type: class
java.lang.String or class java.lang.String
DEBUG [main] (ObjLoader.java:206) - Found: public
checker.impl.Extractor(java.lang.String,java.lang.String,java.lang.String)
throws java.io.IOException
DEBUG [main] (Extractor.java:426) - Loading: ComplexObject:checker.join.Empty
DEBUG [main] (Extractor.java:228) - New CheckList: checker.xsd.Checks@7052c6b4
DEBUG [main] (Extractor.java:229) - Loading JOIN: class checker.join.Empty
DEBUG [main] (Extractor.java:426) - Loading:
ComplexObject:checker.checks.Boolean.IsString
DEBUG [main] (Extractor.java:410) - Loading: CachedObj:c
DEBUG [main] (ObjLoader.java:184) - Loading a new object of class:
checker.impl.Extractor
DEBUG [main] (ObjLoader.java:199) - Argument: conf/XMLSchema.xsd Type:
class java.lang.String or class java.lang.String
DEBUG [main] (ObjLoader.java:199) - Argument:
http://www.w3.org/2001/XMLSchema Type: class java.lang.String or class
java.lang.String
DEBUG [main] (ObjLoader.java:199) - Argument: checker.xsd Type: class
java.lang.String or class java.lang.String
DEBUG [main] (ObjLoader.java:206) - Found: public
checker.impl.Extractor(java.lang.String,java.lang.String,java.lang.String)
throws java.io.IOException
DEBUG [main] (Extractor.java:426) - Loading: ComplexObject:checker.join.Empty
DEBUG [main] (Extractor.java:228) - New CheckList: checker.xsd.Checks@3336a1a1
DEBUG [main] (Extractor.java:229) - Loading JOIN: class checker.join.Empty
DEBUG [main] (Extractor.java:426) - Loading:
ComplexObject:checker.checks.Boolean.IsInteger
DEBUG [main] (IsString.java:17) - Executing check on object "1000"
DEBUG [main] (Join.java:69) - JOIN: exit result is false
DEBUG [main] (Checker.java:58) - Inner CheckList size: 1
DEBUG [main] (Checker.java:60) - Calculated partial result: i_0 false
DEBUG [main] (Join.java:26) - JOIN: exit result is false
DEBUG [main] (Checker.java:62) - Calculated InnerCheckList result: false
DEBUG [main] (Join.java:26) - JOIN: exit result is false
DEBUG [main] (IsInteger.java:17) - Executing check on object "1000"
DEBUG [main] (Join.java:69) - JOIN: exit result is true
DEBUG [main] (Checker.java:58) - Inner CheckList size: 2
DEBUG [main] (Checker.java:60) - Calculated partial result: i_0 false
DEBUG [main] (Checker.java:60) - Calculated partial result: i_1 true
DEBUG [main] (OR.java:28) - Executing JOIN: false OR true
DEBUG [main] (Join.java:26) - JOIN: exit result is true
DEBUG [main] (Checker.java:62) - Calculated InnerCheckList result: true
DEBUG [main] (OR.java:28) - Executing JOIN: false OR true
DEBUG [main] (Join.java:26) - JOIN: exit result is true
DEBUG [main] (Extractor.java:355) - 	Argument_0: /home/bianco/work/wget-log
DEBUG [main] (Extractor.java:426) - Loading: ComplexObject:java.lang.String
DEBUG [main] (ObjLoader.java:184) - Loading a new object of class:
java.lang.String
DEBUG [main] (ObjLoader.java:199) - Argument:
/home/bianco/work/wget-log Type: class java.lang.String or class
java.lang.String
DEBUG [main] (ObjLoader.java:206) - Found: public
java.lang.String(java.lang.String)
DEBUG [main] (Extractor.java:378) - 	Argument_0: /home/bianco/work/wget-log
DEBUG [main] (Extractor.java:426) - Loading: ComplexObject:java.lang.String
DEBUG [main] (ObjLoader.java:184) - Loading a new object of class:
java.lang.String
DEBUG [main] (ObjLoader.java:199) - Argument:
/home/bianco/work/wget-log Type: class java.lang.String or class
java.lang.String
DEBUG [main] (ObjLoader.java:206) - Found: public
java.lang.String(java.lang.String)
DEBUG [main] (ObjLoader.java:184) - Loading a new object of class:
checker.impl.Extractor
DEBUG [main] (ObjLoader.java:199) - Argument: conf/XMLSchema.xsd Type:
class java.lang.String or class java.lang.String
DEBUG [main] (ObjLoader.java:199) - Argument:
http://www.w3.org/2001/XMLSchema Type: class java.lang.String or class
java.lang.String
DEBUG [main] (ObjLoader.java:199) - Argument: checker.xsd Type: class
java.lang.String or class java.lang.String
DEBUG [main] (ObjLoader.java:206) - Found: public
checker.impl.Extractor(java.lang.String,java.lang.String,java.lang.String)
throws java.io.IOException
DEBUG [main] (Extractor.java:426) - Loading:
ComplexObject:checker.join.Boolean.AND
DEBUG [main] (Extractor.java:228) - New CheckList: checker.xsd.Checks@4edc41c5
DEBUG [main] (Extractor.java:229) - Loading JOIN: class checker.join.Boolean.AND
DEBUG [main] (Extractor.java:426) - Loading:
ComplexObject:checker.checks.Boolean.IsString
DEBUG [main] (Extractor.java:426) - Loading:
ComplexObject:checker.checks.Boolean.IsFile
DEBUG [main] (IsString.java:17) - Executing check on object
"/home/bianco/work/wget-log"
DEBUG [main] (IsFile.java:19) - Executing check on object
"/home/bianco/work/wget-log"
DEBUG [main] (Join.java:69) - JOIN: exit result is true
 INFO [main] (Extractor.java:90) - DONE... Resolved
KEY: TEST_A GET: true
KEY: TEST_B GET: true
DONE
Using (actually) JAXB2 Checker is able to easy marshal (store) or
un-marshal (load) small (or rationally big) sets of checks which may
be combined to get a single result or a Map of fully checked and
transformed results.
It's obviously easy to change combination of  checks/transformation
simply managing xml code and reloading the CheckList into the Cache or
program (using a daemon for example).

Additional Information:
This is still under heavy development and there are still a couple of
things to do but the structure is very modular and expansible.
Hope you enjoy!

for information ask to:
-- 
carlo cancellieri
------------------------------------------------------->
| ccancellieriNOSPAM@hotmail.com  >
------------------------------------------------------->

Mime
View raw message