Ticket #1 (closed defect: fixed)

Opened 4 years ago

Last modified 17 months ago

Add mechanism to allow users to create their own xsl files to add plugins to reactor.

Reported by: dhughes Owned by: dhughes
Priority: normal Milestone:
Component: Reactor - Reactor Factory Version: 1.0
Severity: blocker Keywords: plugin xsl
Cc:

Description (last modified by dhughes) (diff)

Several people have requested the ability to be able to write or customize their own xsl files to generate objects that meet their specific needs.

Of particular note is João Fernandes has been working to integrate reactor with Flex. To accoplish this goal he has to create objects that interface ColdFusion to Flex. (I don't know the details.) Right now this has to be accomplished by hand. However, he could use this feature to add his own generators to Reactor.

Here's how I think this would work. In the reactor.xml config file there would be an optional config attribute call "plugins". This would point to a directory which would contain xsl style sheets.

For example:

<config>
	<project value="Scratch" />
	<dsn value="scratch" />
	<type value="mssql" />
	<mapping value="/reactorData" />
	<mode value="development" />
	<plugins value="/plugins" />
	<!-- These config values are not required -->
	<!-- <username value="" />
	<password value="" /> -->
</config>

In the /plugins directory the user would place three xsl stylesheets. These xsl stylesheets would follow the same patterns as the ones that come with reactor. In otherwords, there would be one xsl style sheet for base, custom and project.

  • Project = the stylesheet that will generate the base object in the reactor project folder.
  • Base = the customizable object in the user's data directory
  • Custom = the dbms-specific customizable version of the object in the user's data directory

The plugin files would all be named in this pattern: pluginName.objectType.xsl.

For example, if you were to create a plugin called foo your three xsl stylesheets would be namd:

  • foo.project.xsl
  • foo.base.xsl
  • foo.custom.xsl

To create an instance of a foo object using reactor you would use a new method on the reactorFactory called createPlugin(). This method would have the following signature:

Any = createPlugin(objectAlias, pluginName)

ObjectAlias would be the alias of an object in the database, just as with all the other create methods.
PluginName would be the name of the plugin. IE: "foo".

Change History

Changed 4 years ago by dhughes

  • description modified (diff)

Changed 4 years ago by dhughes

  • component changed from Documentation to Reactor - Core Framework

Changed 4 years ago by dhughes

  • component changed from Reactor - Core Framework to Reactor - Reactor Factory

Changed 4 years ago by fwscott@…

Perhaps I dont understand what this is trying to accomplish but here goes anyway

having to call a seperate method to make the plugin run kinda goes against (what I consider) a "plugin" because then your code needs to know the plugin exists.

How about something like having your plugins config attribute.

Then the XSL finding code uses any XSL files in the plugin directory if available.

something like(not tested or anything)...

//replacement for getCurrentTemplatePath()) & "../xsl/#lcase(arguments.type)#.custom.xsl" in ObjectTranslator.generateObject
// findXSL(objectXML.object.XmlAttributes.alias,arguments.type,"custom")

function findXSL(objectAlias,objType,baseType) {
  var pluginConfig = getConfig().getPlugins();
  var testlocation = '';
  if(pluginConfig != '') {
    // first test for specific xsl in the plugins directory
    // ie "foo.dao.project.xsl"
    testlocation = pluginConfig & objectAlias & "." & objectType & "." & baseType & ".xsl";
    if(fileExists(testlocation)) 
      return testlocation;

    // now check for application specific xsl in the plugins directory
    // ie "dao.project.xsl"
    testlocation = pluginConfig & "." & objectType & "." & baseType & ".xsl";
    if(fileExists(testlocation))
      return testlocation;
  }

  // if it got to here, all the above failed so revert to the default XSL files
  return getCurrentTemplatePath() & "../xsl/#lcase(arguments.objType)#.#arguments.baseType#.xsl";
}

Changed 4 years ago by dhughes

  • milestone changed from Release Candidate 1 (RC1) to Beta Candidate 2 (BC2)

Changed 17 months ago by anonymous

  • milestone Beta Candidate 2 (BC2) deleted

Milestone Beta Candidate 2 (BC2) deleted

Note: See TracTickets for help on using tickets.