01: package org.drools.brms.client.common;
02:
03: /*
04: * Copyright 2005 JBoss Inc
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: /**
20: * Keeps track of the different rule formats we support.
21: * Each format type corresponds to the dublin core "format" attribute.
22: *
23: * This is used both by the UI, to determine what are valid formats, and also on the server.
24: * If you are adding new types they need to be registered here.
25: *
26: * If an asset type is unknown, then it will be opened with the default editor.
27: *
28: *
29: * @author Michael Neale
30: *
31: */
32: public class AssetFormats {
33:
34: /** For functions */
35: public static final String FUNCTION = "function";
36:
37: /** For "model" assets */
38: public static final String MODEL = "jar";
39:
40: /** For DSL language grammars */
41: public static final String DSL = "dsl";
42:
43: /** Vanilla DRL "file" */
44: public static final String DRL = "drl";
45:
46: /** Use the rule modeller */
47: public static final String BUSINESS_RULE = "brl";
48:
49: /** use a DSL, free text editor */
50: public static final String DSL_TEMPLATE_RULE = "dslr";
51:
52: /** Use a decision table.*/
53: public static final String DECISION_SPREADSHEET_XLS = "xls";
54:
55: /** Use a ruleflow.*/
56: public static final String RULE_FLOW_RF = "rf";
57:
58: /** Use a data enum.*/
59: public static final String ENUMERATION = "enumeration";
60:
61: /**
62: * The following group the assets together for lists, helpers etc...
63: */
64: public static final String[] BUSINESS_RULE_FORMATS = new String[] {
65: AssetFormats.BUSINESS_RULE, AssetFormats.DSL_TEMPLATE_RULE,
66: AssetFormats.DECISION_SPREADSHEET_XLS };
67: public static final String[] TECHNICAL_RULE_FORMATS = new String[] {
68: AssetFormats.DRL, AssetFormats.RULE_FLOW_RF,
69: AssetFormats.ENUMERATION };
70:
71: /**
72: * These define assets that are really package level "things"
73: */
74: private static final String[] PACKAGE_DEPENCENCIES = new String[] {
75: AssetFormats.FUNCTION, AssetFormats.DSL,
76: AssetFormats.MODEL, AssetFormats.ENUMERATION };
77:
78: /**
79: * Will return true if the given asset format is a package dependency (eg a function, DSL, model etc).
80: * Package dependencies are needed before the package is validated, and any rule assets are processed.
81: */
82: public static boolean isPackageDependency(String format) {
83: for (int i = 0; i < PACKAGE_DEPENCENCIES.length; i++) {
84: if (PACKAGE_DEPENCENCIES[i].equals(format)) {
85: return true;
86: }
87: }
88: return false;
89: }
90:
91: }
|