Repository: oozie Updated Branches: refs/heads/master 83527ebe6 -> d5f88032a
OOZIE-2107 Schema config properties should be consistent with ActionExecutor config properties (rkanter) Project: http://git-wip-us.apache.org/repos/asf/oozie/repo Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/d5f88032 Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/d5f88032 Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/d5f88032 Branch: refs/heads/master Commit: d5f88032a98d0baea6dcb5652486494cf3cbb858 Parents: 83527eb Author: Robert Kanter <[email protected]> Authored: Thu Jan 22 14:03:24 2015 -0800 Committer: Robert Kanter <[email protected]> Committed: Thu Jan 22 14:03:24 2015 -0800 ---------------------------------------------------------------------- .../org/apache/oozie/service/SchemaService.java | 57 ++++++++------ core/src/main/resources/oozie-default.xml | 78 ++++++++++++++++---- release-log.txt | 1 + 3 files changed, 96 insertions(+), 40 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/oozie/blob/d5f88032/core/src/main/java/org/apache/oozie/service/SchemaService.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/service/SchemaService.java b/core/src/main/java/org/apache/oozie/service/SchemaService.java index 3210585..3181495 100644 --- a/core/src/main/java/org/apache/oozie/service/SchemaService.java +++ b/core/src/main/java/org/apache/oozie/service/SchemaService.java @@ -20,7 +20,9 @@ package org.apache.oozie.service; import java.io.IOException; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Set; import javax.xml.XMLConstants; import javax.xml.transform.stream.StreamSource; @@ -40,12 +42,20 @@ public class SchemaService implements Service { public static final String CONF_PREFIX = Service.CONF_PREFIX + "SchemaService."; + public static final String WF_CONF_SCHEMAS = CONF_PREFIX + "wf.schemas"; + public static final String WF_CONF_EXT_SCHEMAS = CONF_PREFIX + "wf.ext.schemas"; + public static final String COORD_CONF_SCHEMAS = CONF_PREFIX + "coord.schemas"; + public static final String COORD_CONF_EXT_SCHEMAS = CONF_PREFIX + "coord.ext.schemas"; + public static final String BUNDLE_CONF_SCHEMAS = CONF_PREFIX + "bundle.schemas"; + public static final String BUNDLE_CONF_EXT_SCHEMAS = CONF_PREFIX + "bundle.ext.schemas"; + public static final String SLA_CONF_SCHEMAS = CONF_PREFIX + "sla.schemas"; + public static final String SLA_CONF_EXT_SCHEMAS = CONF_PREFIX + "sla.ext.schemas"; @Deprecated @@ -63,34 +73,30 @@ public class SchemaService implements Service { private Schema slaSchema; - private static final String OOZIE_WORKFLOW_XSD[] = { - "oozie-workflow-0.1.xsd", - "oozie-workflow-0.2.xsd", - "oozie-workflow-0.2.5.xsd", - "oozie-workflow-0.3.xsd", - "oozie-workflow-0.4.xsd", - "oozie-workflow-0.4.5.xsd", - "oozie-workflow-0.5.xsd"}; - private static final String OOZIE_COORDINATOR_XSD[] = { "oozie-coordinator-0.1.xsd", "oozie-coordinator-0.2.xsd", - "oozie-coordinator-0.3.xsd", "oozie-coordinator-0.4.xsd"}; - private static final String OOZIE_BUNDLE_XSD[] = { "oozie-bundle-0.1.xsd", "oozie-bundle-0.2.xsd" }; - private static final String OOZIE_SLA_SEMANTIC_XSD[] = { "gms-oozie-sla-0.1.xsd", "oozie-sla-0.2.xsd" }; - - private Schema loadSchema(Configuration conf, String[] baseSchemas, String extSchema) throws SAXException, - IOException { - List<StreamSource> sources = new ArrayList<StreamSource>(); - for (String baseSchema : baseSchemas) { - sources.add(new StreamSource(IOUtils.getResourceAsStream(baseSchema, -1))); + private Schema loadSchema(String baseSchemas, String extSchema) throws SAXException, IOException { + Set<String> schemaNames = new HashSet<String>(); + String[] schemas = ConfigurationService.getStrings(baseSchemas); + if (schemas != null) { + for (String schema : schemas) { + schema = schema.trim(); + if (!schema.isEmpty()) { + schemaNames.add(schema); + } + } } - String[] schemas = ConfigurationService.getStrings(conf, extSchema); + schemas = ConfigurationService.getStrings(extSchema); if (schemas != null) { for (String schema : schemas) { schema = schema.trim(); if (!schema.isEmpty()) { - sources.add(new StreamSource(IOUtils.getResourceAsStream(schema, -1))); + schemaNames.add(schema); } } } + List<StreamSource> sources = new ArrayList<StreamSource>(); + for (String schemaName : schemaNames) { + sources.add(new StreamSource(IOUtils.getResourceAsStream(schemaName, -1))); + } SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); return factory.newSchema(sources.toArray(new StreamSource[sources.size()])); } @@ -101,12 +107,13 @@ public class SchemaService implements Service { * @param services services instance. * @throws ServiceException thrown if the service could not be initialized. */ + @Override public void init(Services services) throws ServiceException { try { - wfSchema = loadSchema(services.getConf(), OOZIE_WORKFLOW_XSD, WF_CONF_EXT_SCHEMAS); - coordSchema = loadSchema(services.getConf(), OOZIE_COORDINATOR_XSD, COORD_CONF_EXT_SCHEMAS); - bundleSchema = loadSchema(services.getConf(), OOZIE_BUNDLE_XSD, BUNDLE_CONF_EXT_SCHEMAS); - slaSchema = loadSchema(services.getConf(), OOZIE_SLA_SEMANTIC_XSD, SLA_CONF_EXT_SCHEMAS); + wfSchema = loadSchema(WF_CONF_SCHEMAS, WF_CONF_EXT_SCHEMAS); + coordSchema = loadSchema(COORD_CONF_SCHEMAS, COORD_CONF_EXT_SCHEMAS); + bundleSchema = loadSchema(BUNDLE_CONF_SCHEMAS, BUNDLE_CONF_EXT_SCHEMAS); + slaSchema = loadSchema(SLA_CONF_SCHEMAS, SLA_CONF_EXT_SCHEMAS); } catch (SAXException ex) { throw new ServiceException(ErrorCode.E0130, ex.getMessage(), ex); @@ -121,6 +128,7 @@ public class SchemaService implements Service { * * @return {@link SchemaService}. */ + @Override public Class<? extends Service> getInterface() { return SchemaService.class; } @@ -128,6 +136,7 @@ public class SchemaService implements Service { /** * Destroy the service. */ + @Override public void destroy() { wfSchema = null; bundleSchema = null; http://git-wip-us.apache.org/repos/asf/oozie/blob/d5f88032/core/src/main/resources/oozie-default.xml ---------------------------------------------------------------------- diff --git a/core/src/main/resources/oozie-default.xml b/core/src/main/resources/oozie-default.xml index 1cb937e..db8aa24 100644 --- a/core/src/main/resources/oozie-default.xml +++ b/core/src/main/resources/oozie-default.xml @@ -1418,42 +1418,88 @@ <!-- SchemaService --> <property> - <name>oozie.service.SchemaService.wf.ext.schemas</name> + <name>oozie.service.SchemaService.wf.schemas</name> <value> - shell-action-0.1.xsd,shell-action-0.2.xsd,shell-action-0.3.xsd,email-action-0.1.xsd,email-action-0.2.xsd, - hive-action-0.2.xsd,hive-action-0.3.xsd,hive-action-0.4.xsd,hive-action-0.5.xsd,sqoop-action-0.2.xsd, - sqoop-action-0.3.xsd,sqoop-action-0.4.xsd,ssh-action-0.1.xsd,ssh-action-0.2.xsd,distcp-action-0.1.xsd, - distcp-action-0.2.xsd,oozie-sla-0.1.xsd,oozie-sla-0.2.xsd,hive2-action-0.1.xsd,spark-action-0.1.xsd + oozie-workflow-0.1.xsd,oozie-workflow-0.2.xsd,oozie-workflow-0.2.5.xsd,oozie-workflow-0.3.xsd,oozie-workflow-0.4.xsd, + oozie-workflow-0.4.5.xsd,oozie-workflow-0.5.xsd, + shell-action-0.1.xsd,shell-action-0.2.xsd,shell-action-0.3.xsd, + email-action-0.1.xsd,email-action-0.2.xsd, + hive-action-0.2.xsd,hive-action-0.3.xsd,hive-action-0.4.xsd,hive-action-0.5.xsd, + sqoop-action-0.2.xsd,sqoop-action-0.3.xsd,sqoop-action-0.4.xsd, + ssh-action-0.1.xsd,ssh-action-0.2.xsd, + distcp-action-0.1.xsd,distcp-action-0.2.xsd, + oozie-sla-0.1.xsd,oozie-sla-0.2.xsd, + hive2-action-0.1.xsd, + spark-action-0.1.xsd </value> <description> - Schemas for additional actions types. + List of schemas for workflows (separated by commas). + </description> + </property> - IMPORTANT: if there are no schemas leave a 1 space string, the service trims the value, - if empty Configuration assumes it is NULL. + <property> + <name>oozie.service.SchemaService.wf.ext.schemas</name> + <value> </value> + <description> + List of additional schemas for workflows (separated by commas). + </description> + </property> + + <property> + <name>oozie.service.SchemaService.coord.schemas</name> + <value> + oozie-coordinator-0.1.xsd,oozie-coordinator-0.2.xsd,oozie-coordinator-0.3.xsd,oozie-coordinator-0.4.xsd, + oozie-sla-0.1.xsd,oozie-sla-0.2.xsd + </value> + <description> + List of schemas for coordinators (separated by commas). </description> </property> <property> <name>oozie.service.SchemaService.coord.ext.schemas</name> - <value>oozie-sla-0.1.xsd,oozie-sla-0.2.xsd</value> + <value> </value> <description> - Schemas for additional actions types. + List of additional schemas for coordinators (separated by commas). + </description> + </property> - IMPORTANT: if there are no schemas leave a 1 space string, the service trims the value, - if empty Configuration assumes it is NULL. + <property> + <name>oozie.service.SchemaService.bundle.schemas</name> + <value> + oozie-bundle-0.1.xsd,oozie-bundle-0.2.xsd + </value> + <description> + List of schemas for bundles (separated by commas). </description> </property> <property> - <name>oozie.service.SchemaService.sla.ext.schemas</name> + <name>oozie.service.SchemaService.bundle.ext.schemas</name> <value> </value> <description> - Schemas for semantic validation for GMS SLA. + List of additional schemas for bundles (separated by commas). + </description> + </property> - IMPORTANT: if there are no schemas leave a 1 space string, the service trims the value, - if empty Configuration assumes it is NULL. + <property> + <name>oozie.service.SchemaService.sla.schemas</name> + <value> + gms-oozie-sla-0.1.xsd,oozie-sla-0.2.xsd + </value> + <description> + List of schemas for semantic validation for GMS SLA (separated by commas). </description> </property> + + <property> + <name>oozie.service.SchemaService.sla.ext.schemas</name> + <value> </value> + <description> + List of additional schemas for semantic validation for GMS SLA (separated by commas). + </description> + </property> + <!-- CallbackService --> <property> http://git-wip-us.apache.org/repos/asf/oozie/blob/d5f88032/release-log.txt ---------------------------------------------------------------------- diff --git a/release-log.txt b/release-log.txt index ee82853..6dda7b1 100644 --- a/release-log.txt +++ b/release-log.txt @@ -1,5 +1,6 @@ -- Oozie 4.2.0 release (trunk - unreleased) +OOZIE-2107 Schema config properties should be consistent with ActionExecutor config properties (rkanter) OOZIE-1730 Change hadoop-2 profile to use 2.4.0 (jaydeepvishwakarma via rkanter) OOZIE-2088 Exponential retries for transient failures (pavan kumar via shwethags) OOZIE-2111 Kerberized Oozie doesn't allow connections from users with a lot of groups (rkanter)
