Drools guided rule editor and Eclipse Project - eclipse

I have created a java project in eclipse which automatically picks up
all the .drl files from an external directory and executes all the
rules in that directory .So this enables the execution of dynamic
addition of new rules at anytime.
Now, instead of creating a new drool file and add it into that
directory, i want to use the guided rule editor to help non technical
users to add new rules into that directory.
I have started on with drools-workbench, but still i have no idea how
to integrate this eclipse project with the guided rule editor feature
available in drools-wb.
Is there any way in which i can export this project into the drools
workbench. If that is possible, then how can i deploy this directory
which contains all the .drl files into drools-wb and how these .drl
files can be used in the guided rule editor.

If your existing project is a maven project then you can import that project into drools-workbench, but there should be some required files(project.import,..etc) need to available specific to drools-workbench those should be available into project. We cant download any specific rule file from drools-workbench, workbench will create jar file which contains all the assets(rules and BPMN files), you can add this jar into classpath and create kieSession from there through which you can execute rules.

Related

How to import ATG CRS module in eclipse and customize

I am new to ATG and i installed ATG CRS 11.2 using CIM and it is installed properly and i am able to access the site but i want to import the CRS module in eclipse and customize the existing code for my learning purpose.
I tried the ways given on net, install atg plugin and trying to import but it is not importing.
Please explain the steps to do same.
Thanks
The Oracle A-Team have an article Building Oracle ATG Commerce With Maven. They have created a sample github project which uses CRS 11.2 as the basis for the project. You should be able to import this as a Maven project within Eclipse.
Create a new Java Project in Eclipse
Using windows browser, go to the location where your Java Project is created.
Open the Java Project folder, you will find .classpath and .project files there.
Now, go to your ATG_ROOT folder, and find the folder CommerceReferenceStore/Store
Copy-paste your .project and .classpath files here.
Edit the .project file and replace the project name by CommerceReferenceStore.Store.
CRS also has some other (nested) modules. Do the same for the nested modules you want to import in eclipse.
Re-open eclipse, Go to File -> Import -> Other -> Existing Projects into your workspace.
Browse to your ATG_ROOT directory and select the Store folder
Check on "Search for Nested Projects"
It will populate a list of all the projects, which you can now import.
For customizing CRS, it is not recommended to modify the existing CRS
code. You can create a new module, and layer it on top of CRS to
customize it. For more details on creating a new module above CRS, and
doing an assemble-deploy via CIM, you can follow this article provided
below. It has 3 small parts which can get your task done!
Here is the article:
http://learnoracleatg.blogspot.in/2016/12/create-and-deploy-new-atg-module-on-local-from-scratch-part-1.html

How to initialize project when it is imported

I have an eclipse plugin and a custom project type. When the project is created through the wizard i can do as much setup code as i want. While using the plugin an .xml file is created containing plugin specific information about some resources inside the project.
Now when the project is checked into a versioning system the xml file is included. When someone checks out the project into eclipse again i would have to read the .xml file and apply the information to the resources again.
Is there a place where i can put code that is executed when a project of my custom project nature is beeing imported from somewhere else ?
You could use an IResourceChangeListener to listen for resource changes.
Your listener should get an IResourceDelta for the project with the 'kind' flag set to IResourceDelta.ADDED.

Install4J, db configuration and Maven filters

I currently want to try Install4J to package up / install my Swing application. I would like to know if it has a screen during installation where a user can input DB parameters (url, port, user, pass). If so, I would like to know how this will work in the context of a maven build. My Swing project is being handled by Maven and includes profiles to populate a db-config file using filters. When a Maven build is completed, the jar file already has the db-config populated with the appropriate parameters from the filter in it's classpath. All of this is packaged into an executable JAR file (with all dependencies included-- Spring, Hibernate, etc).
Now can Install4J use this big executable JAR file as is, "open" it up and insert/override the db-config file during installation with user-inputted values? Or will Install4J need for me to use the basic jar file, add all jar dependencies (Spring, Hibernate, etc) separately, add the db-config outside of the jar, etc?
1) Building a form that asks for your DB parameters is straight-forward, see here.
2) To modify a JAR file during the installation you can add the following sequence of actions:
"Extract a ZIP file" action
"Modify text files with regular expressions" or "Replace installer variables in text files" action if you put in the template values in the form ${installer:myDbParam}
"Create a ZIP file" action
However, I would consider leaving such a configuration file outside the JAR file, it makes things easier.

Eclipse buildpath automatically taking all JARs of a linked directory

This issue is a variation on the one described here: Eclipse buildpath automatically taking all JARs of a internal directory
But instead of any local folder, I'd rather have a linked folder from another project be picked up automatically in the buildpath.
Basically, I have a main project in my workspace that holds directories lib, ext-lib that contain multiple jar files each. These jar files may be upgraded/removed or new ones added every few days.
I also have many other projects in the workspace that relay on the exact same (up-to-date) jars from my main project.
My goal is that as I modify the jars in these two folders in my main project, to have them as linked folders in all other projects and have those linked projects dynamically picked up as part of the buildpath of all those projects.
Any suggestion on how to do that in eclipse would be highly appreciated.
Unfortunately, the "dynamic directory" plugins people mention can not work with "linked" folders :(
Sincerely,
Guy
I would suggest creating a USER LIBRARY in eclipse and then using that in all of your eclipse projects.
Try going into preferences Java -> Build Path -> User Libraries and creating a new user library with all your jars. Then use this everywhere you need these jars.
See this page for more details.
Also, this page explains creating a user library in a bit more detail. There is also a use-case there which seems a bit more aligned to what you had in mind:
6.2.1. Linked Library Project
A useful hybrid strategy is to configure a user library that is also available as a linked folder in your Eclipse workspace. Follow these steps:
1.
Create a simple project in your workspace. Unlike Java projects, a simple project has no Java build path configuration in its properties. Use the command File > New > Project > Simple Project.
2.
Uncheck the option to use a default project location within the workspace folder and enter the path for your \eclipse-contrib\libraries folder (see Figure 6-8).

Custom project structure in eclipse

I often use a eclipse plugins to quckliy generate project directory structure, for example Spring plugin helps to create WebContent folder to hold WEB-INF contents. But sometimes I create a projects with specific directory structure, always the same. Something like this:
[project_name]
-folder1
-folderA
-folderX
-folderB
-folder2
-dirC
-folder3
I know, that I can write my own ant/maven script to generate specific folders, but I don't want to manualy invoke scripts each time after project creating. I want to create a project template which I would use in the future.
What is the best way to create a this feature?
Should I create something like plugin? If yes, how would I do it?
If you don't want to use a plugin or a script to generate the project structure, you're pretty limited.
Since you can create a project from existing source, you could create the folder structure on your filesystem, and whenever you are creating another project, tell Eclipse to "Create Project from existing source" and point it to your template folder.
If you want to write a plugin, you'll want to contribute a org.eclipse.jdt.ui.actions.OpenProjectWizard that creates the folder structure as part of the project generation. A good tutorial can be found at: http://cvalcarcel.wordpress.com/2009/07/08/writing-an-eclipse-plug-in-part-1-what-im-going-to-do/%20
Maven has a concept of project templates called archetypes which is very similar to what you need. It defines the project structure, files, etc and can be customized upon creation.
If you install the Eclipse m2e maven plugin then you can create a new project from template with a few click
File / new Project / Maven project / Select archetype
You can use this feature even if you dont want to use maven later. You can auto generate ant scripts or anything like that. You can convert an exisint project into an archetype or create a new one from scratch, desciption is here
http://maven.apache.org/archetype/maven-archetype-plugin/
http://maven.apache.org/guides/mini/guide-creating-archetypes.html