Skip to content

Commit

Permalink
updated generic bean config
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane Bryzak committed Oct 26, 2010
1 parent 8edd3e6 commit 43176f4
Show file tree
Hide file tree
Showing 13 changed files with 390 additions and 193 deletions.
34 changes: 3 additions & 31 deletions api/src/main/java/org/jboss/seam/drools/config/Drools.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import org.jboss.weld.extensions.bean.generic.GenericConfiguration;
import org.jboss.weld.extensions.bean.generic.GenericType;

/**
* Drools configuration file.
Expand All @@ -40,36 +40,8 @@
*/
@Retention(RUNTIME)
@Target( { METHOD, FIELD, PARAMETER, TYPE })
@GenericConfiguration
@GenericType(DroolsConfig.class)
public @interface Drools
{
public String name() default "";
public String kbuilderConfigFile() default "";
public String kbaseConfigFile() default "";
public String ksessionConfigFile() default "";
public String kagentConfigFile() default "";
public String serializationSigningConfigFile() default "";

public boolean startChangeNotifierService() default false;
public boolean startChangeScannerService() default false;
public int scannerInterval() default -1;
public String agentName() default "";

public String loggerName() default "";
public String loggerType() default "";
public String loggerPath() default "";
public int loggerInterval() default 0;

public boolean disableSeamDelegate() default false;

public DroolsProperty[] kbuilderProperties() default {};

public DroolsProperty[] kbaseProperties() default {};

public DroolsProperty[] ksessionProperties() default {};

public DroolsProperty[] kagentPropertiest() default {};

public DroolsProperty[] serializationSigningProperties() default {};

public String name() default "";
}
246 changes: 246 additions & 0 deletions api/src/main/java/org/jboss/seam/drools/config/DroolsConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
package org.jboss.seam.drools.config;

/**
* Drools configuration parameters
*
* @author Shane Bryzak
*/
public class DroolsConfig
{
private String kbuilderConfigFile;
private String kbaseConfigFile;
private String ksessionConfigFile;
private String kagentConfigFile;
private String serializationSigningConfigFile;

private boolean startChangeNotifierService;
private boolean startChangeScannerService;
private int scannerInterval = -1;
private String agentName;

private String loggerName;
private String loggerType;
private String loggerPath;
private int loggerInterval = 0;

private boolean disableSeamDelegate;

private DroolsProperty[] kbuilderProperties = {};

private DroolsProperty[] kbaseProperties = {};

private DroolsProperty[] ksessionProperties = {};

private DroolsProperty[] kagentProperties = {};

private DroolsProperty[] serializationSigningProperties = {};

public String getKBuilderConfigFile()
{
return kbuilderConfigFile;
}

public String getKBaseConfigFile()
{
return kbaseConfigFile;
}

public String getKSessionConfigFile()
{
return ksessionConfigFile;
}

public String getKAgentConfigFile()
{
return kagentConfigFile;
}

public String getSerializationSigningConfigFile()
{
return serializationSigningConfigFile;
}

public boolean getStartChangeNotifierService()
{
return startChangeNotifierService;
}

public boolean getStartChangeScannerService()
{
return startChangeScannerService;
}

public int getScannerInterval()
{
return scannerInterval;
}

public String getAgentName()
{
return agentName;
}

public String getLoggerName()
{
return loggerName;
}

public String getLoggerType()
{
return loggerType;
}

public String getLoggerPath()
{
return loggerPath;
}

public int getLoggerInterval()
{
return loggerInterval;
}

public boolean getDisableSeamDelegate()
{
return disableSeamDelegate;
}

public DroolsProperty[] getKBuilderProperties()
{
return kbuilderProperties;
}

public DroolsProperty[] getKBaseProperties()
{
return kbaseProperties;
}

public DroolsProperty[] getKSessionProperties()
{
return ksessionProperties;
}

public DroolsProperty[] getKAgentProperties()
{
return kagentProperties;
}

public DroolsProperty[] getSerializationSigningProperties()
{
return serializationSigningProperties;
}

public DroolsConfig setKBuilderConfigFile(String fileName)
{
this.kbuilderConfigFile = fileName;
return this;
}

public DroolsConfig setKBaseConfigFile(String fileName)
{
this.kbaseConfigFile = fileName;
return this;
}

public DroolsConfig setKSessionConfigFile(String fileName)
{
this.ksessionConfigFile = fileName;
return this;
}

public DroolsConfig setKAgentConfigFile(String fileName)
{
this.kagentConfigFile = fileName;
return this;
}

public DroolsConfig setSerializationSigningConfigFile(String fileName)
{
this.serializationSigningConfigFile = fileName;
return this;
}

public DroolsConfig setStartChangeNotifierService(boolean value)
{
this.startChangeNotifierService = value;
return this;
}

public DroolsConfig setStartChangeScannerService(boolean value)
{
this.startChangeScannerService = value;
return this;
}

public DroolsConfig setScannerInterval(int interval)
{
this.scannerInterval = interval;
return this;
}

public DroolsConfig setAgentName(String agentName)
{
this.agentName = agentName;
return this;
}

public DroolsConfig setLoggerName(String loggerName)
{
this.loggerName = loggerName;
return this;
}

public DroolsConfig setLoggerType(String loggerType)
{
this.loggerType = loggerType;
return this;
}

public DroolsConfig setLoggerPath(String loggerPath)
{
this.loggerPath = loggerPath;
return this;
}

public DroolsConfig setLoggerInterval(int loggerInterval)
{
this.loggerInterval = loggerInterval;
return this;
}

public DroolsConfig setDisableSeamDelegate(boolean value)
{
this.disableSeamDelegate = value;
return this;
}

public DroolsConfig setKBuilderProperties(DroolsProperty[] properties)
{
this.kbuilderProperties = properties;
return this;
}

public DroolsConfig setKBaseProperties(DroolsProperty[] properties)
{
this.kbaseProperties = properties;
return this;
}

public DroolsConfig setKSessionProperties(DroolsProperty[] properties)
{
this.ksessionProperties = properties;
return this;
}

public DroolsConfig setKAgentProperties(DroolsProperty[] properties)
{
this.kagentProperties = properties;
return this;
}

public DroolsConfig setSerializationSigningProperties(DroolsProperty[] properties)
{
this.serializationSigningProperties = properties;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import java.util.Iterator;
import java.util.List;

import org.jboss.weld.extensions.bean.generic.Generic;
import org.jboss.weld.extensions.bean.generic.GenericConfiguration;

@Generic(Drools.class)
@GenericConfiguration(Drools.class)
public class RuleResources
{
private List<RuleResource> ruleResources = new ArrayList<RuleResource>();
Expand Down
15 changes: 6 additions & 9 deletions impl/src/main/java/org/jboss/seam/drools/EntryPointProducer.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import org.jboss.seam.drools.qualifiers.EntryPoint;
import org.jboss.seam.drools.qualifiers.Scanned;
import org.jboss.weld.extensions.bean.generic.Generic;
import org.jboss.weld.extensions.bean.generic.GenericProduct;
import org.jboss.weld.extensions.bean.generic.GenericConfiguration;
import org.jboss.weld.extensions.core.Veto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -46,19 +46,16 @@
*/
@Veto
@SessionScoped
//@Generic(Drools.class)
@GenericConfiguration(Drools.class)
public class EntryPointProducer implements Serializable
{
private static final long serialVersionUID = -8162220518047452589L;

private static final Logger log = LoggerFactory.getLogger(EntryPointProducer.class);

@Inject
//@GenericProduct
StatefulKnowledgeSession statefullKsession;
@Inject @Generic StatefulKnowledgeSession statefullKsession;

@Inject
@Scanned
//@GenericProduct
StatefulKnowledgeSession statefulKnowledgeSession;
@Inject @Scanned @Generic StatefulKnowledgeSession statefulKnowledgeSession;

@Produces
@Default
Expand Down
Loading

0 comments on commit 43176f4

Please sign in to comment.