You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2012/07/06 12:51:21 UTC
svn commit: r1358111 [3/13] - in
/incubator/isis/trunk/framework/core/commons: ./
src/main/java/org/apache/isis/core/commons/authentication/
src/main/java/org/apache/isis/core/commons/components/
src/main/java/org/apache/isis/core/commons/config/ src/m...
Modified: incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/IsisConfigurationBuilderResourceStreams.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/IsisConfigurationBuilderResourceStreams.java?rev=1358111&r1=1358110&r2=1358111&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/IsisConfigurationBuilderResourceStreams.java (original)
+++ incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/IsisConfigurationBuilderResourceStreams.java Fri Jul 6 10:51:16 2012
@@ -1,328 +1,328 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.commons.config;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.Sets;
-
-import org.apache.log4j.Logger;
-
-import org.apache.isis.core.commons.exceptions.IsisException;
-import org.apache.isis.core.commons.resource.ResourceStreamSource;
-import org.apache.isis.core.commons.resource.ResourceStreamSourceComposite;
-import org.apache.isis.core.commons.resource.ResourceStreamSourceFileSystem;
-
-/**
- * Adapter for {@link IsisConfigurationBuilder}, loading the specified
- * configuration resource (file) from the given {@link ResourceStreamSource}(s).
- *
- * <p>
- * If a property is in multiple configuration resources then the latter
- * resources will overwrite the former.
- */
-public class IsisConfigurationBuilderResourceStreams implements IsisConfigurationBuilder {
-
- private static final Logger LOG = Logger.getLogger(IsisConfigurationBuilderResourceStreams.class);
-
- private final Set<String> configurationResourcesFound = Sets.newLinkedHashSet();
- private final Set<String> configurationResourcesNotFound = Sets.newLinkedHashSet();
-
- static class ConfigurationResourceAndPolicy {
- private final String configurationResource;
- private final NotFoundPolicy notFoundPolicy;
-
- public ConfigurationResourceAndPolicy(final String configurationResource, final NotFoundPolicy notFoundPolicy) {
- this.configurationResource = configurationResource;
- this.notFoundPolicy = notFoundPolicy;
- }
-
- public String getConfigurationResource() {
- return configurationResource;
- }
-
- public NotFoundPolicy getNotFoundPolicy() {
- return notFoundPolicy;
- }
-
- @Override
- public String toString() {
- return String.format("%s{%s}", configurationResource, notFoundPolicy);
- }
- }
-
- private final ResourceStreamSource resourceStreamSource;
-
- private final List<ConfigurationResourceAndPolicy> configurationResources = new ArrayList<ConfigurationResourceAndPolicy>();
- private final Properties additionalProperties = new Properties();
- private boolean includeSystemProperties = false;
-
- /**
- * Most recent snapshot of {@link IsisConfiguration} obtained from
- * {@link #configurationLoader}.
- *
- * <p>
- * Whenever further configuration is merged in, this cache is invalidated.
- */
- private IsisConfiguration cachedConfiguration;
-
- // ////////////////////////////////////////////////////////////
- // Constructor, initialization
- // ////////////////////////////////////////////////////////////
-
- private static ResourceStreamSource createComposite(final ResourceStreamSource... resourceStreamSources) {
- final ResourceStreamSourceComposite composite = new ResourceStreamSourceComposite();
- for (final ResourceStreamSource rss : resourceStreamSources) {
- if (rss == null) {
- continue;
- }
- composite.addResourceStreamSource(rss);
- }
- return composite;
- }
-
- public IsisConfigurationBuilderResourceStreams() {
- this(ResourceStreamSourceFileSystem.create(ConfigurationConstants.DEFAULT_CONFIG_DIRECTORY));
- }
-
- public IsisConfigurationBuilderResourceStreams(final ResourceStreamSource... resourceStreamSources) {
- this(createComposite(resourceStreamSources));
- }
-
- public IsisConfigurationBuilderResourceStreams(final ResourceStreamSource resourceStreamSource) {
- this.resourceStreamSource = resourceStreamSource;
- addDefaultConfigurationResources();
- }
-
- /**
- * May be overridden by subclasses if required.
- */
- protected void addDefaultConfigurationResources() {
- addConfigurationResource(ConfigurationConstants.DEFAULT_CONFIG_FILE, NotFoundPolicy.FAIL_FAST);
- addConfigurationResource(ConfigurationConstants.WEB_CONFIG_FILE, NotFoundPolicy.CONTINUE);
- }
-
- // ////////////////////////////////////////////////////////////
- // ResourceStreamSource
- // ////////////////////////////////////////////////////////////
-
- @Override
- public ResourceStreamSource getResourceStreamSource() {
- return resourceStreamSource;
- }
-
- // ////////////////////////////////////////////////////////////
- // populating or updating
- // ////////////////////////////////////////////////////////////
-
- /**
- * Registers the configuration resource (usually, a file) with the specified
- * name from the first {@link ResourceStreamSource} available.
- *
- * <p>
- * If the configuration resource cannot be found then the provided
- * {@link NotFoundPolicy} determines whether an exception is thrown or not.
- *
- * <p>
- * Must be called before {@link #getConfiguration()}; the resource is
- * actually read on {@link #getConfiguration()}.
- */
- @Override
- public synchronized void addConfigurationResource(final String configurationResource, final NotFoundPolicy notFoundPolicy) {
- configurationResources.add(new ConfigurationResourceAndPolicy(configurationResource, notFoundPolicy));
- invalidateCache();
- }
-
- public synchronized void setIncludeSystemProperties(final boolean includeSystemProperties) {
- this.includeSystemProperties = includeSystemProperties;
- invalidateCache();
- }
-
- /**
- * Adds additional property.
- */
- @Override
- public synchronized void add(final String key, final String value) {
- if (key == null || value == null) {
- return;
- }
- additionalProperties.setProperty(key, value);
- if (LOG.isInfoEnabled()) {
- LOG.info("added " + key + "=" + value);
- }
- invalidateCache();
- }
-
- /**
- * Adds additional properties.
- */
- @Override
- public synchronized void add(final Properties properties) {
- final Enumeration<?> keys = properties.propertyNames();
- while (keys.hasMoreElements()) {
- final String key = (String) keys.nextElement();
- add(key, properties.getProperty(key));
- }
- invalidateCache();
- }
-
- // ////////////////////////////////////////////////////////////
- // getConfiguration
- // ////////////////////////////////////////////////////////////
-
- /**
- * Returns the current {@link IsisConfiguration configuration}.
- */
- @Override
- public synchronized IsisConfiguration getConfiguration() {
- if (cachedConfiguration != null) {
- return cachedConfiguration;
- }
-
- final IsisConfigurationDefault configuration = new IsisConfigurationDefault(getResourceStreamSource());
- loadConfigurationResources(configuration);
- // TODO: this hack should move elsewhere, where the DeploymentType is
- // known.
- addShowExplorationOptionsIfNotSpecified(configuration);
- addSystemPropertiesIfRequested(configuration);
- addAdditionalProperties(configuration);
- return cachedConfiguration = configuration;
- }
-
- private void loadConfigurationResources(final IsisConfigurationDefault configuration) {
- for (final ConfigurationResourceAndPolicy configResourceAndPolicy : configurationResources) {
- loadConfigurationResource(configuration, configResourceAndPolicy);
- }
- }
-
- private void loadConfigurationResource(final IsisConfigurationDefault configuration, final ConfigurationResourceAndPolicy configResourceAndPolicy) {
- final String configurationResource = configResourceAndPolicy.getConfigurationResource();
- final NotFoundPolicy notFoundPolicy = configResourceAndPolicy.getNotFoundPolicy();
- if (LOG.isDebugEnabled()) {
- LOG.debug("loading configuration resource: " + configurationResource + ", notFoundPolicy: " + notFoundPolicy);
- }
- loadConfigurationResource(configuration, configurationResource, notFoundPolicy);
- }
-
- /**
- * Loads the configuration resource (usually, a file) with the specified
- * name from the first {@link ResourceStreamSource} available.
- *
- * <p>
- * If the configuration resource cannot be found then the provided
- * {@link NotFoundPolicy} determines whether an exception is thrown or not.
- */
- protected void loadConfigurationResource(final IsisConfigurationDefault configuration, final String configurationResource, final NotFoundPolicy notFoundPolicy) {
- try {
- final PropertiesReader propertiesReader = loadConfigurationResource(resourceStreamSource, configurationResource);
- addProperties(configuration, propertiesReader.getProperties());
- configurationResourcesFound.add(configurationResource);
- if (LOG.isDebugEnabled()) {
- LOG.debug("'" + configurationResource + "' FOUND");
- }
- return;
- } catch (final IOException ex) {
- // keep going
- }
- if (notFoundPolicy == NotFoundPolicy.FAIL_FAST) {
- throw new IsisException("failed to load '" + configurationResource + "'; tried using: " + resourceStreamSource.getName());
- } else {
- configurationResourcesNotFound.add(configurationResource);
- if (LOG.isDebugEnabled()) {
- LOG.debug("'" + configurationResource + "' not found, but not needed");
- }
- }
- }
-
- private PropertiesReader loadConfigurationResource(final ResourceStreamSource resourceStreamSource, final String configurationResource) throws IOException {
- return new PropertiesReader(resourceStreamSource, configurationResource);
- }
-
- private void addShowExplorationOptionsIfNotSpecified(final IsisConfigurationDefault configuration) {
- if (configuration.getString(ConfigurationConstants.SHOW_EXPLORATION_OPTIONS) == null) {
- configuration.add(ConfigurationConstants.SHOW_EXPLORATION_OPTIONS, "yes");
- }
- }
-
- private void addSystemPropertiesIfRequested(final IsisConfigurationDefault configuration) {
- if (includeSystemProperties) {
- addProperties(configuration, System.getProperties());
- }
- }
-
- private void addAdditionalProperties(final IsisConfigurationDefault configuration) {
- addProperties(configuration, additionalProperties);
- }
-
- protected void addProperties(final IsisConfigurationDefault configuration, final Properties properties) {
- configuration.add(properties);
- }
-
- private void invalidateCache() {
- cachedConfiguration = null;
- }
-
-
-
- // ////////////////////////////////////////////////////////////
- // Logging
- // ////////////////////////////////////////////////////////////
-
- @Override
- public void dumpResourcesToLog() {
- if (LOG.isInfoEnabled()) {
- LOG.info("Configuration resources FOUND:");
- for (String resource : configurationResourcesFound) {
- LOG.info("* " + resource);
- }
- }
- if (LOG.isInfoEnabled()) {
- LOG.info("Configuration resources NOT FOUND (but not needed):");
- for (String resource : configurationResourcesNotFound) {
- LOG.info("* " + resource);
- }
- }
- }
-
-
- // ////////////////////////////////////////////////////////////
- // Injectable
- // ////////////////////////////////////////////////////////////
-
- @Override
- public void injectInto(final Object candidate) {
- if (IsisConfigurationBuilderAware.class.isAssignableFrom(candidate.getClass())) {
- final IsisConfigurationBuilderAware cast = IsisConfigurationBuilderAware.class.cast(candidate);
- cast.setConfigurationBuilder(this);
- }
- }
-
- @Override
- public String toString() {
- return Objects.toStringHelper(this).add("resourceStream", resourceStreamSource).add("configResources", configurationResources).toString();
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.commons.config;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+import com.google.common.base.Objects;
+import com.google.common.collect.Sets;
+
+import org.apache.log4j.Logger;
+
+import org.apache.isis.core.commons.exceptions.IsisException;
+import org.apache.isis.core.commons.resource.ResourceStreamSource;
+import org.apache.isis.core.commons.resource.ResourceStreamSourceComposite;
+import org.apache.isis.core.commons.resource.ResourceStreamSourceFileSystem;
+
+/**
+ * Adapter for {@link IsisConfigurationBuilder}, loading the specified
+ * configuration resource (file) from the given {@link ResourceStreamSource}(s).
+ *
+ * <p>
+ * If a property is in multiple configuration resources then the latter
+ * resources will overwrite the former.
+ */
+public class IsisConfigurationBuilderResourceStreams implements IsisConfigurationBuilder {
+
+ private static final Logger LOG = Logger.getLogger(IsisConfigurationBuilderResourceStreams.class);
+
+ private final Set<String> configurationResourcesFound = Sets.newLinkedHashSet();
+ private final Set<String> configurationResourcesNotFound = Sets.newLinkedHashSet();
+
+ static class ConfigurationResourceAndPolicy {
+ private final String configurationResource;
+ private final NotFoundPolicy notFoundPolicy;
+
+ public ConfigurationResourceAndPolicy(final String configurationResource, final NotFoundPolicy notFoundPolicy) {
+ this.configurationResource = configurationResource;
+ this.notFoundPolicy = notFoundPolicy;
+ }
+
+ public String getConfigurationResource() {
+ return configurationResource;
+ }
+
+ public NotFoundPolicy getNotFoundPolicy() {
+ return notFoundPolicy;
+ }
+
+ @Override
+ public String toString() {
+ return String.format("%s{%s}", configurationResource, notFoundPolicy);
+ }
+ }
+
+ private final ResourceStreamSource resourceStreamSource;
+
+ private final List<ConfigurationResourceAndPolicy> configurationResources = new ArrayList<ConfigurationResourceAndPolicy>();
+ private final Properties additionalProperties = new Properties();
+ private boolean includeSystemProperties = false;
+
+ /**
+ * Most recent snapshot of {@link IsisConfiguration} obtained from
+ * {@link #configurationLoader}.
+ *
+ * <p>
+ * Whenever further configuration is merged in, this cache is invalidated.
+ */
+ private IsisConfiguration cachedConfiguration;
+
+ // ////////////////////////////////////////////////////////////
+ // Constructor, initialization
+ // ////////////////////////////////////////////////////////////
+
+ private static ResourceStreamSource createComposite(final ResourceStreamSource... resourceStreamSources) {
+ final ResourceStreamSourceComposite composite = new ResourceStreamSourceComposite();
+ for (final ResourceStreamSource rss : resourceStreamSources) {
+ if (rss == null) {
+ continue;
+ }
+ composite.addResourceStreamSource(rss);
+ }
+ return composite;
+ }
+
+ public IsisConfigurationBuilderResourceStreams() {
+ this(ResourceStreamSourceFileSystem.create(ConfigurationConstants.DEFAULT_CONFIG_DIRECTORY));
+ }
+
+ public IsisConfigurationBuilderResourceStreams(final ResourceStreamSource... resourceStreamSources) {
+ this(createComposite(resourceStreamSources));
+ }
+
+ public IsisConfigurationBuilderResourceStreams(final ResourceStreamSource resourceStreamSource) {
+ this.resourceStreamSource = resourceStreamSource;
+ addDefaultConfigurationResources();
+ }
+
+ /**
+ * May be overridden by subclasses if required.
+ */
+ protected void addDefaultConfigurationResources() {
+ addConfigurationResource(ConfigurationConstants.DEFAULT_CONFIG_FILE, NotFoundPolicy.FAIL_FAST);
+ addConfigurationResource(ConfigurationConstants.WEB_CONFIG_FILE, NotFoundPolicy.CONTINUE);
+ }
+
+ // ////////////////////////////////////////////////////////////
+ // ResourceStreamSource
+ // ////////////////////////////////////////////////////////////
+
+ @Override
+ public ResourceStreamSource getResourceStreamSource() {
+ return resourceStreamSource;
+ }
+
+ // ////////////////////////////////////////////////////////////
+ // populating or updating
+ // ////////////////////////////////////////////////////////////
+
+ /**
+ * Registers the configuration resource (usually, a file) with the specified
+ * name from the first {@link ResourceStreamSource} available.
+ *
+ * <p>
+ * If the configuration resource cannot be found then the provided
+ * {@link NotFoundPolicy} determines whether an exception is thrown or not.
+ *
+ * <p>
+ * Must be called before {@link #getConfiguration()}; the resource is
+ * actually read on {@link #getConfiguration()}.
+ */
+ @Override
+ public synchronized void addConfigurationResource(final String configurationResource, final NotFoundPolicy notFoundPolicy) {
+ configurationResources.add(new ConfigurationResourceAndPolicy(configurationResource, notFoundPolicy));
+ invalidateCache();
+ }
+
+ public synchronized void setIncludeSystemProperties(final boolean includeSystemProperties) {
+ this.includeSystemProperties = includeSystemProperties;
+ invalidateCache();
+ }
+
+ /**
+ * Adds additional property.
+ */
+ @Override
+ public synchronized void add(final String key, final String value) {
+ if (key == null || value == null) {
+ return;
+ }
+ additionalProperties.setProperty(key, value);
+ if (LOG.isInfoEnabled()) {
+ LOG.info("added " + key + "=" + value);
+ }
+ invalidateCache();
+ }
+
+ /**
+ * Adds additional properties.
+ */
+ @Override
+ public synchronized void add(final Properties properties) {
+ final Enumeration<?> keys = properties.propertyNames();
+ while (keys.hasMoreElements()) {
+ final String key = (String) keys.nextElement();
+ add(key, properties.getProperty(key));
+ }
+ invalidateCache();
+ }
+
+ // ////////////////////////////////////////////////////////////
+ // getConfiguration
+ // ////////////////////////////////////////////////////////////
+
+ /**
+ * Returns the current {@link IsisConfiguration configuration}.
+ */
+ @Override
+ public synchronized IsisConfiguration getConfiguration() {
+ if (cachedConfiguration != null) {
+ return cachedConfiguration;
+ }
+
+ final IsisConfigurationDefault configuration = new IsisConfigurationDefault(getResourceStreamSource());
+ loadConfigurationResources(configuration);
+ // TODO: this hack should move elsewhere, where the DeploymentType is
+ // known.
+ addShowExplorationOptionsIfNotSpecified(configuration);
+ addSystemPropertiesIfRequested(configuration);
+ addAdditionalProperties(configuration);
+ return cachedConfiguration = configuration;
+ }
+
+ private void loadConfigurationResources(final IsisConfigurationDefault configuration) {
+ for (final ConfigurationResourceAndPolicy configResourceAndPolicy : configurationResources) {
+ loadConfigurationResource(configuration, configResourceAndPolicy);
+ }
+ }
+
+ private void loadConfigurationResource(final IsisConfigurationDefault configuration, final ConfigurationResourceAndPolicy configResourceAndPolicy) {
+ final String configurationResource = configResourceAndPolicy.getConfigurationResource();
+ final NotFoundPolicy notFoundPolicy = configResourceAndPolicy.getNotFoundPolicy();
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("loading configuration resource: " + configurationResource + ", notFoundPolicy: " + notFoundPolicy);
+ }
+ loadConfigurationResource(configuration, configurationResource, notFoundPolicy);
+ }
+
+ /**
+ * Loads the configuration resource (usually, a file) with the specified
+ * name from the first {@link ResourceStreamSource} available.
+ *
+ * <p>
+ * If the configuration resource cannot be found then the provided
+ * {@link NotFoundPolicy} determines whether an exception is thrown or not.
+ */
+ protected void loadConfigurationResource(final IsisConfigurationDefault configuration, final String configurationResource, final NotFoundPolicy notFoundPolicy) {
+ try {
+ final PropertiesReader propertiesReader = loadConfigurationResource(resourceStreamSource, configurationResource);
+ addProperties(configuration, propertiesReader.getProperties());
+ configurationResourcesFound.add(configurationResource);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("'" + configurationResource + "' FOUND");
+ }
+ return;
+ } catch (final IOException ex) {
+ // keep going
+ }
+ if (notFoundPolicy == NotFoundPolicy.FAIL_FAST) {
+ throw new IsisException("failed to load '" + configurationResource + "'; tried using: " + resourceStreamSource.getName());
+ } else {
+ configurationResourcesNotFound.add(configurationResource);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("'" + configurationResource + "' not found, but not needed");
+ }
+ }
+ }
+
+ private PropertiesReader loadConfigurationResource(final ResourceStreamSource resourceStreamSource, final String configurationResource) throws IOException {
+ return new PropertiesReader(resourceStreamSource, configurationResource);
+ }
+
+ private void addShowExplorationOptionsIfNotSpecified(final IsisConfigurationDefault configuration) {
+ if (configuration.getString(ConfigurationConstants.SHOW_EXPLORATION_OPTIONS) == null) {
+ configuration.add(ConfigurationConstants.SHOW_EXPLORATION_OPTIONS, "yes");
+ }
+ }
+
+ private void addSystemPropertiesIfRequested(final IsisConfigurationDefault configuration) {
+ if (includeSystemProperties) {
+ addProperties(configuration, System.getProperties());
+ }
+ }
+
+ private void addAdditionalProperties(final IsisConfigurationDefault configuration) {
+ addProperties(configuration, additionalProperties);
+ }
+
+ protected void addProperties(final IsisConfigurationDefault configuration, final Properties properties) {
+ configuration.add(properties);
+ }
+
+ private void invalidateCache() {
+ cachedConfiguration = null;
+ }
+
+
+
+ // ////////////////////////////////////////////////////////////
+ // Logging
+ // ////////////////////////////////////////////////////////////
+
+ @Override
+ public void dumpResourcesToLog() {
+ if (LOG.isInfoEnabled()) {
+ LOG.info("Configuration resources FOUND:");
+ for (String resource : configurationResourcesFound) {
+ LOG.info("* " + resource);
+ }
+ }
+ if (LOG.isInfoEnabled()) {
+ LOG.info("Configuration resources NOT FOUND (but not needed):");
+ for (String resource : configurationResourcesNotFound) {
+ LOG.info("* " + resource);
+ }
+ }
+ }
+
+
+ // ////////////////////////////////////////////////////////////
+ // Injectable
+ // ////////////////////////////////////////////////////////////
+
+ @Override
+ public void injectInto(final Object candidate) {
+ if (IsisConfigurationBuilderAware.class.isAssignableFrom(candidate.getClass())) {
+ final IsisConfigurationBuilderAware cast = IsisConfigurationBuilderAware.class.cast(candidate);
+ cast.setConfigurationBuilder(this);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this).add("resourceStream", resourceStreamSource).add("configResources", configurationResources).toString();
+ }
+
+}
Modified: incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/IsisConfigurationDefault.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/IsisConfigurationDefault.java?rev=1358111&r1=1358110&r2=1358111&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/IsisConfigurationDefault.java (original)
+++ incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/IsisConfigurationDefault.java Fri Jul 6 10:51:16 2012
@@ -1,397 +1,397 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.commons.config;
-
-import java.awt.Color;
-import java.awt.Font;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.StringTokenizer;
-
-import com.google.common.collect.Maps;
-
-import org.apache.log4j.Logger;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.commons.exceptions.IsisException;
-import org.apache.isis.core.commons.resource.ResourceStreamSource;
-
-public class IsisConfigurationDefault implements IsisConfiguration {
-
- private static final Logger LOG = Logger.getLogger(IsisConfigurationDefault.class);
- private final Properties properties = new Properties();
- private final ResourceStreamSource resourceStreamSource;
-
- // ////////////////////////////////////////////////
- // Constructor
- // ////////////////////////////////////////////////
-
- public IsisConfigurationDefault() {
- this(null);
- }
-
- public IsisConfigurationDefault(final ResourceStreamSource resourceStreamSource) {
- this.resourceStreamSource = resourceStreamSource;
- LOG.debug("from :" + nameOf(resourceStreamSource));
- }
-
- private String nameOf(final ResourceStreamSource resourceStreamSource) {
- return resourceStreamSource != null ? resourceStreamSource.getName() : null;
- }
-
- // ////////////////////////////////////////////////
- // ResourceStreamSource
- // ////////////////////////////////////////////////
-
- @Override
- public ResourceStreamSource getResourceStreamSource() {
- return resourceStreamSource;
- }
-
- // ////////////////////////////////////////////////
- // add
- // ////////////////////////////////////////////////
-
- /**
- * Add the properties from an existing Properties object.
- */
- public void add(final Properties properties) {
- for(Object key: properties.keySet()) {
- Object value = properties.get(key);
- add((String)key, (String)value);
- }
- }
-
- /**
- * Adds a key-value pair to this set of properties
- */
- public void add(final String key, final String value) {
- if (key == null) {
- return;
- }
- if (properties.containsKey(key)) {
- LOG.info("replacing " + key + "=" + properties.get(key) + " with " + value);
- }
- properties.put(key, value);
- }
-
- @Override
- public IsisConfiguration createSubset(final String prefix) {
- final IsisConfigurationDefault subset = new IsisConfigurationDefault(resourceStreamSource);
-
- String startsWith = prefix;
- if (!startsWith.endsWith(".")) {
- startsWith = startsWith + '.';
- }
- final int prefixLength = startsWith.length();
-
- for(Object keyObj: properties.keySet()) {
- final String key = (String)keyObj;
- if (key.startsWith(startsWith)) {
- final String modifiedKey = key.substring(prefixLength);
- subset.properties.put(modifiedKey, properties.get(key));
- }
- }
- return subset;
- }
-
- // ////////////////////////////////////////////////
- // getXxx
- // ////////////////////////////////////////////////
-
- /**
- * Gets the boolean value for the specified name where no value or 'on' will
- * result in true being returned; anything gives false. If no boolean
- * property is specified with this name then false is returned.
- *
- * @param name
- * the property name
- */
- @Override
- public boolean getBoolean(final String name) {
- return getBoolean(name, false);
- }
-
- /**
- * Gets the boolean value for the specified name. If no property is
- * specified with this name then the specified default boolean value is
- * returned.
- *
- * @param name
- * the property name
- * @param defaultValue
- * the value to use as a default
- */
- @Override
- public boolean getBoolean(final String name, final boolean defaultValue) {
- String value = getProperty(name);
- if (value == null) {
- return defaultValue;
- }
- value = value.toLowerCase();
- if (value.equals("on") || value.equals("yes") || value.equals("true") || value.equals("")) {
- return true;
- }
- if (value.equals("off") || value.equals("no") || value.equals("false")) {
- return false;
- }
-
- throw new IsisConfigurationException("Illegal flag for " + name + "; must be one of on, off, yes, no, true or false");
- }
-
- /**
- * Gets the color for the specified name. If no color property is specified
- * with this name then null is returned.
- *
- * @param name
- * the property name
- */
- @Override
- public Color getColor(final String name) {
- return getColor(name, null);
- }
-
- /**
- * Gets the color for the specified name. If no color property is specified
- * with this name then the specified default color is returned.
- *
- * @param name
- * the property name
- * @param defaultValue
- * the value to use as a default
- */
- @Override
- public Color getColor(final String name, final Color defaultValue) {
- final String color = getProperty(name);
-
- if (color == null) {
- return defaultValue;
- }
-
- return Color.decode(color);
- }
-
- @Override
- public void debugData(final DebugBuilder str) {
- str.appendln("Resource Stream Source", resourceStreamSource);
- str.appendln();
- final Enumeration<?> names = properties.propertyNames();
- while (names.hasMoreElements()) {
- final String name = (String) names.nextElement();
- str.append(name, 55);
- str.append(" = ");
- str.appendln(properties.getProperty(name));
- }
- }
-
- @Override
- public String debugTitle() {
- return "Properties Configuration";
- }
-
- /**
- * Gets the font for the specified name. If no font property is specified
- * with this name then null is returned.
- *
- * @param name
- * the property name
- */
- @Override
- public Font getFont(final String name) {
- return getFont(name, null);
- }
-
- /**
- * Gets the font for the specified name. If no font property is specified
- * with this name then the specified default font is returned.
- *
- * @param name
- * the property name
- * @param defaultValue
- * the color to use as a default
- */
- @Override
- public Font getFont(final String name, final Font defaultValue) {
- final String font = getProperty(name);
-
- if (font == null) {
- return defaultValue;
- }
-
- return Font.decode(font);
- }
-
- /**
- * Gets the number value for the specified name. If no property is specified
- * with this name then 0 is returned.
- *
- * @param name
- * the property name
- */
- @Override
- public int getInteger(final String name) {
- return getInteger(name, 0);
- }
-
- /**
- * Gets the number value for the specified name. If no property is specified
- * with this name then the specified default number value is returned.
- *
- * @param name
- * the property name
- * @param defaultValue
- * the value to use as a default
- */
- @Override
- public int getInteger(final String name, final int defaultValue) {
- final String value = getProperty(name);
-
- if (value == null) {
- return defaultValue;
- }
-
- return Integer.valueOf(value).intValue();
- }
-
- @Override
- public String[] getList(final String name) {
- final String list = getString(name);
- if (list == null) {
- return new String[0];
- } else {
- final StringTokenizer tokens = new StringTokenizer(list, ConfigurationConstants.LIST_SEPARATOR);
- final String array[] = new String[tokens.countTokens()];
- int i = 0;
- while (tokens.hasMoreTokens()) {
- array[i++] = tokens.nextToken().trim();
- }
- return array;
- }
- }
-
- @Override
- public IsisConfiguration getProperties(final String withPrefix) {
- final int prefixLength = "".length();
-
- final Properties pp = new Properties();
- final Enumeration<?> e = properties.keys();
- while (e.hasMoreElements()) {
- final String key = (String) e.nextElement();
- if (key.startsWith(withPrefix)) {
- final String modifiedKey = key.substring(prefixLength);
- pp.put(modifiedKey, properties.get(key));
- }
- }
- final IsisConfigurationDefault isisConfigurationDefault = new IsisConfigurationDefault(resourceStreamSource);
- isisConfigurationDefault.add(pp);
- return isisConfigurationDefault;
- }
-
- private String getProperty(final String name) {
- return getProperty(name, null);
- }
-
- private String getProperty(final String name, final String defaultValue) {
- final String key = referedToAs(name);
- if (key.indexOf("..") >= 0) {
- throw new IsisException("property names should not have '..' within them: " + name);
- }
- String property = properties.getProperty(key, defaultValue);
- property = property != null ? property.trim() : null;
- LOG.debug("property: '" + key + "' = '" + property + "'");
- return property;
- }
-
- /**
- * Returns the configuration property with the specified name. If there is
- * no matching property then null is returned.
- */
- @Override
- public String getString(final String name) {
- return getProperty(name);
- }
-
- @Override
- public String getString(final String name, final String defaultValue) {
- return getProperty(name, defaultValue);
- }
-
- @Override
- public boolean hasProperty(final String name) {
- final String key = referedToAs(name);
- return properties.containsKey(key);
- }
-
- @Override
- public boolean isEmpty() {
- return properties.isEmpty();
- }
-
- @Override
- public Iterator<String> iterator() {
- return properties.stringPropertyNames().iterator();
- }
-
- /**
- * Returns as a String that the named property is refered to as. For example
- * in a simple properties file the property z might be specified in the file
- * as x.y.z.
- */
- private String referedToAs(final String name) {
- return name;
- }
-
- @Override
- public int size() {
- return properties.size();
- }
-
- @Override
- public String toString() {
- return "ConfigurationParameters [properties=" + properties + "]";
- }
-
- // ////////////////////////////////////////////////////////////////////
- // injectInto
- // ////////////////////////////////////////////////////////////////////
-
- @Override
- public void injectInto(final Object candidate) {
- if (IsisConfigurationAware.class.isAssignableFrom(candidate.getClass())) {
- final IsisConfigurationAware cast = IsisConfigurationAware.class.cast(candidate);
- cast.setConfiguration(this);
- }
- }
-
- @Override
- public Map<String,String> asMap() {
- final Map<String, String> map = Maps.newHashMap();
- for(String propertyName: this) {
- final String propertyValue = this.getProperty(propertyName);
- map.put(propertyName, propertyValue);
- }
- return map;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.commons.config;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+import com.google.common.collect.Maps;
+
+import org.apache.log4j.Logger;
+
+import org.apache.isis.core.commons.debug.DebugBuilder;
+import org.apache.isis.core.commons.exceptions.IsisException;
+import org.apache.isis.core.commons.resource.ResourceStreamSource;
+
+public class IsisConfigurationDefault implements IsisConfiguration {
+
+ private static final Logger LOG = Logger.getLogger(IsisConfigurationDefault.class);
+ private final Properties properties = new Properties();
+ private final ResourceStreamSource resourceStreamSource;
+
+ // ////////////////////////////////////////////////
+ // Constructor
+ // ////////////////////////////////////////////////
+
+ public IsisConfigurationDefault() {
+ this(null);
+ }
+
+ public IsisConfigurationDefault(final ResourceStreamSource resourceStreamSource) {
+ this.resourceStreamSource = resourceStreamSource;
+ LOG.debug("from :" + nameOf(resourceStreamSource));
+ }
+
+ private String nameOf(final ResourceStreamSource resourceStreamSource) {
+ return resourceStreamSource != null ? resourceStreamSource.getName() : null;
+ }
+
+ // ////////////////////////////////////////////////
+ // ResourceStreamSource
+ // ////////////////////////////////////////////////
+
+ @Override
+ public ResourceStreamSource getResourceStreamSource() {
+ return resourceStreamSource;
+ }
+
+ // ////////////////////////////////////////////////
+ // add
+ // ////////////////////////////////////////////////
+
+ /**
+ * Add the properties from an existing Properties object.
+ */
+ public void add(final Properties properties) {
+ for(Object key: properties.keySet()) {
+ Object value = properties.get(key);
+ add((String)key, (String)value);
+ }
+ }
+
+ /**
+ * Adds a key-value pair to this set of properties
+ */
+ public void add(final String key, final String value) {
+ if (key == null) {
+ return;
+ }
+ if (properties.containsKey(key)) {
+ LOG.info("replacing " + key + "=" + properties.get(key) + " with " + value);
+ }
+ properties.put(key, value);
+ }
+
+ @Override
+ public IsisConfiguration createSubset(final String prefix) {
+ final IsisConfigurationDefault subset = new IsisConfigurationDefault(resourceStreamSource);
+
+ String startsWith = prefix;
+ if (!startsWith.endsWith(".")) {
+ startsWith = startsWith + '.';
+ }
+ final int prefixLength = startsWith.length();
+
+ for(Object keyObj: properties.keySet()) {
+ final String key = (String)keyObj;
+ if (key.startsWith(startsWith)) {
+ final String modifiedKey = key.substring(prefixLength);
+ subset.properties.put(modifiedKey, properties.get(key));
+ }
+ }
+ return subset;
+ }
+
+ // ////////////////////////////////////////////////
+ // getXxx
+ // ////////////////////////////////////////////////
+
+ /**
+ * Gets the boolean value for the specified name where no value or 'on' will
+ * result in true being returned; anything gives false. If no boolean
+ * property is specified with this name then false is returned.
+ *
+ * @param name
+ * the property name
+ */
+ @Override
+ public boolean getBoolean(final String name) {
+ return getBoolean(name, false);
+ }
+
+ /**
+ * Gets the boolean value for the specified name. If no property is
+ * specified with this name then the specified default boolean value is
+ * returned.
+ *
+ * @param name
+ * the property name
+ * @param defaultValue
+ * the value to use as a default
+ */
+ @Override
+ public boolean getBoolean(final String name, final boolean defaultValue) {
+ String value = getProperty(name);
+ if (value == null) {
+ return defaultValue;
+ }
+ value = value.toLowerCase();
+ if (value.equals("on") || value.equals("yes") || value.equals("true") || value.equals("")) {
+ return true;
+ }
+ if (value.equals("off") || value.equals("no") || value.equals("false")) {
+ return false;
+ }
+
+ throw new IsisConfigurationException("Illegal flag for " + name + "; must be one of on, off, yes, no, true or false");
+ }
+
+ /**
+ * Gets the color for the specified name. If no color property is specified
+ * with this name then null is returned.
+ *
+ * @param name
+ * the property name
+ */
+ @Override
+ public Color getColor(final String name) {
+ return getColor(name, null);
+ }
+
+ /**
+ * Gets the color for the specified name. If no color property is specified
+ * with this name then the specified default color is returned.
+ *
+ * @param name
+ * the property name
+ * @param defaultValue
+ * the value to use as a default
+ */
+ @Override
+ public Color getColor(final String name, final Color defaultValue) {
+ final String color = getProperty(name);
+
+ if (color == null) {
+ return defaultValue;
+ }
+
+ return Color.decode(color);
+ }
+
+ @Override
+ public void debugData(final DebugBuilder str) {
+ str.appendln("Resource Stream Source", resourceStreamSource);
+ str.appendln();
+ final Enumeration<?> names = properties.propertyNames();
+ while (names.hasMoreElements()) {
+ final String name = (String) names.nextElement();
+ str.append(name, 55);
+ str.append(" = ");
+ str.appendln(properties.getProperty(name));
+ }
+ }
+
+ @Override
+ public String debugTitle() {
+ return "Properties Configuration";
+ }
+
+ /**
+ * Gets the font for the specified name. If no font property is specified
+ * with this name then null is returned.
+ *
+ * @param name
+ * the property name
+ */
+ @Override
+ public Font getFont(final String name) {
+ return getFont(name, null);
+ }
+
+ /**
+ * Gets the font for the specified name. If no font property is specified
+ * with this name then the specified default font is returned.
+ *
+ * @param name
+ * the property name
+ * @param defaultValue
+ * the color to use as a default
+ */
+ @Override
+ public Font getFont(final String name, final Font defaultValue) {
+ final String font = getProperty(name);
+
+ if (font == null) {
+ return defaultValue;
+ }
+
+ return Font.decode(font);
+ }
+
+ /**
+ * Gets the number value for the specified name. If no property is specified
+ * with this name then 0 is returned.
+ *
+ * @param name
+ * the property name
+ */
+ @Override
+ public int getInteger(final String name) {
+ return getInteger(name, 0);
+ }
+
+ /**
+ * Gets the number value for the specified name. If no property is specified
+ * with this name then the specified default number value is returned.
+ *
+ * @param name
+ * the property name
+ * @param defaultValue
+ * the value to use as a default
+ */
+ @Override
+ public int getInteger(final String name, final int defaultValue) {
+ final String value = getProperty(name);
+
+ if (value == null) {
+ return defaultValue;
+ }
+
+ return Integer.valueOf(value).intValue();
+ }
+
+ @Override
+ public String[] getList(final String name) {
+ final String list = getString(name);
+ if (list == null) {
+ return new String[0];
+ } else {
+ final StringTokenizer tokens = new StringTokenizer(list, ConfigurationConstants.LIST_SEPARATOR);
+ final String array[] = new String[tokens.countTokens()];
+ int i = 0;
+ while (tokens.hasMoreTokens()) {
+ array[i++] = tokens.nextToken().trim();
+ }
+ return array;
+ }
+ }
+
+ @Override
+ public IsisConfiguration getProperties(final String withPrefix) {
+ final int prefixLength = "".length();
+
+ final Properties pp = new Properties();
+ final Enumeration<?> e = properties.keys();
+ while (e.hasMoreElements()) {
+ final String key = (String) e.nextElement();
+ if (key.startsWith(withPrefix)) {
+ final String modifiedKey = key.substring(prefixLength);
+ pp.put(modifiedKey, properties.get(key));
+ }
+ }
+ final IsisConfigurationDefault isisConfigurationDefault = new IsisConfigurationDefault(resourceStreamSource);
+ isisConfigurationDefault.add(pp);
+ return isisConfigurationDefault;
+ }
+
+ private String getProperty(final String name) {
+ return getProperty(name, null);
+ }
+
+ private String getProperty(final String name, final String defaultValue) {
+ final String key = referedToAs(name);
+ if (key.indexOf("..") >= 0) {
+ throw new IsisException("property names should not have '..' within them: " + name);
+ }
+ String property = properties.getProperty(key, defaultValue);
+ property = property != null ? property.trim() : null;
+ LOG.debug("property: '" + key + "' = '" + property + "'");
+ return property;
+ }
+
+ /**
+ * Returns the configuration property with the specified name. If there is
+ * no matching property then null is returned.
+ */
+ @Override
+ public String getString(final String name) {
+ return getProperty(name);
+ }
+
+ @Override
+ public String getString(final String name, final String defaultValue) {
+ return getProperty(name, defaultValue);
+ }
+
+ @Override
+ public boolean hasProperty(final String name) {
+ final String key = referedToAs(name);
+ return properties.containsKey(key);
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return properties.isEmpty();
+ }
+
+ @Override
+ public Iterator<String> iterator() {
+ return properties.stringPropertyNames().iterator();
+ }
+
+ /**
+ * Returns as a String that the named property is refered to as. For example
+ * in a simple properties file the property z might be specified in the file
+ * as x.y.z.
+ */
+ private String referedToAs(final String name) {
+ return name;
+ }
+
+ @Override
+ public int size() {
+ return properties.size();
+ }
+
+ @Override
+ public String toString() {
+ return "ConfigurationParameters [properties=" + properties + "]";
+ }
+
+ // ////////////////////////////////////////////////////////////////////
+ // injectInto
+ // ////////////////////////////////////////////////////////////////////
+
+ @Override
+ public void injectInto(final Object candidate) {
+ if (IsisConfigurationAware.class.isAssignableFrom(candidate.getClass())) {
+ final IsisConfigurationAware cast = IsisConfigurationAware.class.cast(candidate);
+ cast.setConfiguration(this);
+ }
+ }
+
+ @Override
+ public Map<String,String> asMap() {
+ final Map<String, String> map = Maps.newHashMap();
+ for(String propertyName: this) {
+ final String propertyValue = this.getProperty(propertyName);
+ map.put(propertyName, propertyValue);
+ }
+ return map;
+ }
+
+}
Modified: incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/IsisConfigurationException.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/IsisConfigurationException.java?rev=1358111&r1=1358110&r2=1358111&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/IsisConfigurationException.java (original)
+++ incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/IsisConfigurationException.java Fri Jul 6 10:51:16 2012
@@ -1,42 +1,42 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.commons.config;
-
-import org.apache.isis.core.commons.exceptions.IsisException;
-
-public class IsisConfigurationException extends IsisException {
- private static final long serialVersionUID = 1L;
-
- public IsisConfigurationException() {
- super();
- }
-
- public IsisConfigurationException(final String s) {
- super(s);
- }
-
- public IsisConfigurationException(final String msg, final Throwable cause) {
- super(msg, cause);
- }
-
- public IsisConfigurationException(final Throwable cause) {
- super(cause);
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.commons.config;
+
+import org.apache.isis.core.commons.exceptions.IsisException;
+
+public class IsisConfigurationException extends IsisException {
+ private static final long serialVersionUID = 1L;
+
+ public IsisConfigurationException() {
+ super();
+ }
+
+ public IsisConfigurationException(final String s) {
+ super(s);
+ }
+
+ public IsisConfigurationException(final String msg, final Throwable cause) {
+ super(msg, cause);
+ }
+
+ public IsisConfigurationException(final Throwable cause) {
+ super(cause);
+ }
+}
Modified: incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/JmxBeanServer.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/JmxBeanServer.java?rev=1358111&r1=1358110&r2=1358111&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/JmxBeanServer.java (original)
+++ incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/JmxBeanServer.java Fri Jul 6 10:51:16 2012
@@ -1,72 +1,72 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.core.commons.config;
-
-import java.lang.management.ManagementFactory;
-
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.MBeanRegistrationException;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.NotCompliantMBeanException;
-import javax.management.ObjectName;
-
-import org.apache.log4j.Logger;
-
-public class JmxBeanServer {
-
- private static final Logger LOG = Logger.getLogger(JmxBeanServer.class);
-
- private static JmxBeanServer instance;
- private final MBeanServer server;
-
- private JmxBeanServer() {
- server = ManagementFactory.getPlatformMBeanServer();
- instance = this;
- }
-
- public static JmxBeanServer getInstance() {
- if (instance == null) {
- LOG.info("JMX bean server created");
- instance = new JmxBeanServer();
- }
- return instance;
- }
-
- public void register(final String name, final Object object) {
- try {
- final ObjectName objectName = new ObjectName("Isis:name=" + name);
- server.registerMBean(object, objectName);
- LOG.info(name + " JMX mbean registered: " + object);
- } catch (final MalformedObjectNameException e) {
- throw new RuntimeException(e);
- } catch (final NullPointerException e) {
- throw new RuntimeException(e);
- } catch (final InstanceAlreadyExistsException e) {
- LOG.info(name + " JMX mbean already registered: " + object);
- } catch (final MBeanRegistrationException e) {
- throw new RuntimeException(e);
- } catch (final NotCompliantMBeanException e) {
- throw new RuntimeException(e);
- }
-
- }
-}
-
-// Copyright (c) Naked Objects Group Ltd.
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.core.commons.config;
+
+import java.lang.management.ManagementFactory;
+
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.MBeanRegistrationException;
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.NotCompliantMBeanException;
+import javax.management.ObjectName;
+
+import org.apache.log4j.Logger;
+
+public class JmxBeanServer {
+
+ private static final Logger LOG = Logger.getLogger(JmxBeanServer.class);
+
+ private static JmxBeanServer instance;
+ private final MBeanServer server;
+
+ private JmxBeanServer() {
+ server = ManagementFactory.getPlatformMBeanServer();
+ instance = this;
+ }
+
+ public static JmxBeanServer getInstance() {
+ if (instance == null) {
+ LOG.info("JMX bean server created");
+ instance = new JmxBeanServer();
+ }
+ return instance;
+ }
+
+ public void register(final String name, final Object object) {
+ try {
+ final ObjectName objectName = new ObjectName("Isis:name=" + name);
+ server.registerMBean(object, objectName);
+ LOG.info(name + " JMX mbean registered: " + object);
+ } catch (final MalformedObjectNameException e) {
+ throw new RuntimeException(e);
+ } catch (final NullPointerException e) {
+ throw new RuntimeException(e);
+ } catch (final InstanceAlreadyExistsException e) {
+ LOG.info(name + " JMX mbean already registered: " + object);
+ } catch (final MBeanRegistrationException e) {
+ throw new RuntimeException(e);
+ } catch (final NotCompliantMBeanException e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+}
+
+// Copyright (c) Naked Objects Group Ltd.
Modified: incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/NotFoundPolicy.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/NotFoundPolicy.java?rev=1358111&r1=1358110&r2=1358111&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/NotFoundPolicy.java (original)
+++ incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/NotFoundPolicy.java Fri Jul 6 10:51:16 2012
@@ -1,24 +1,24 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.commons.config;
-
-public enum NotFoundPolicy {
- CONTINUE, FAIL_FAST
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.commons.config;
+
+public enum NotFoundPolicy {
+ CONTINUE, FAIL_FAST
+}
Modified: incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/PropertiesReader.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/PropertiesReader.java?rev=1358111&r1=1358110&r2=1358111&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/PropertiesReader.java (original)
+++ incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/PropertiesReader.java Fri Jul 6 10:51:16 2012
@@ -1,54 +1,54 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.commons.config;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
-import org.apache.isis.core.commons.lang.IoUtils;
-import org.apache.isis.core.commons.resource.ResourceStreamSource;
-
-/**
- * Loads properties using the specified {@link ResourceStreamSource}.
- */
-class PropertiesReader {
-
- private final Properties properties = new Properties();
-
- public PropertiesReader(final ResourceStreamSource resourceStream, final String configurationResource) throws IOException {
-
- InputStream in = null;
- try {
- in = resourceStream.readResource(configurationResource);
- if (in == null) {
- throw new IOException("Unable to find resource " + configurationResource);
- }
- properties.load(in);
- } finally {
- IoUtils.closeSafely(in);
- }
- }
-
- public Properties getProperties() {
- return properties;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.commons.config;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.apache.isis.core.commons.lang.IoUtils;
+import org.apache.isis.core.commons.resource.ResourceStreamSource;
+
+/**
+ * Loads properties using the specified {@link ResourceStreamSource}.
+ */
+class PropertiesReader {
+
+ private final Properties properties = new Properties();
+
+ public PropertiesReader(final ResourceStreamSource resourceStream, final String configurationResource) throws IOException {
+
+ InputStream in = null;
+ try {
+ in = resourceStream.readResource(configurationResource);
+ if (in == null) {
+ throw new IOException("Unable to find resource " + configurationResource);
+ }
+ properties.load(in);
+ } finally {
+ IoUtils.closeSafely(in);
+ }
+ }
+
+ public Properties getProperties() {
+ return properties;
+ }
+
+}
Modified: incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/package-info.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/package-info.java?rev=1358111&r1=1358110&r2=1358111&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/package-info.java (original)
+++ incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/config/package-info.java Fri Jul 6 10:51:16 2012
@@ -1,40 +1,40 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Defines the {@link org.apache.isis.core.commons.config.IsisConfiguration}
- * which collects an immutable set of configuration options (like a hashmap),
- * along with a number of supporting classes.
- *
- * <p>
- * Chief among these supporting classes is {@link org.apache.isis.core.commons.config.ConfigurationBuilder},
- * which holds a (mutable) collection of properties and is used to build an
- * {@link org.apache.isis.core.commons.config.IsisConfiguration}. The
- * {@link org.apache.isis.core.commons.config.ConfigurationBuilder} and
- * {@link org.apache.isis.core.commons.config.IsisConfiguration} types form
- * an mutable/immutable pair (cf {@link java.lang.StringBuilder} / {@link java.lang.String}).
- *
- * <p>
- * The {@link org.apache.isis.core.commons.config.ConfigurationBuilder} is used
- * by {@link org.apache.isis.core.commons.config.InstallerAbstract}, an
- * implementation of {@link org.apache.isis.core.commons.components.Installer}
- * that allows the configuration to be added to as each component is
- * installed.
- */
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Defines the {@link org.apache.isis.core.commons.config.IsisConfiguration}
+ * which collects an immutable set of configuration options (like a hashmap),
+ * along with a number of supporting classes.
+ *
+ * <p>
+ * Chief among these supporting classes is {@link org.apache.isis.core.commons.config.ConfigurationBuilder},
+ * which holds a (mutable) collection of properties and is used to build an
+ * {@link org.apache.isis.core.commons.config.IsisConfiguration}. The
+ * {@link org.apache.isis.core.commons.config.ConfigurationBuilder} and
+ * {@link org.apache.isis.core.commons.config.IsisConfiguration} types form
+ * an mutable/immutable pair (cf {@link java.lang.StringBuilder} / {@link java.lang.String}).
+ *
+ * <p>
+ * The {@link org.apache.isis.core.commons.config.ConfigurationBuilder} is used
+ * by {@link org.apache.isis.core.commons.config.InstallerAbstract}, an
+ * implementation of {@link org.apache.isis.core.commons.components.Installer}
+ * that allows the configuration to be added to as each component is
+ * installed.
+ */
package org.apache.isis.core.commons.config;
\ No newline at end of file
Modified: incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/debug/DebugBuilder.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/debug/DebugBuilder.java?rev=1358111&r1=1358110&r2=1358111&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/debug/DebugBuilder.java (original)
+++ incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/debug/DebugBuilder.java Fri Jul 6 10:51:16 2012
@@ -1,139 +1,139 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.core.commons.debug;
-
-public interface DebugBuilder {
-
- /**
- * Concatenate the contents of the specified debug builder to the current
- * builder.
- */
- void concat(DebugBuilder debug);
-
- /**
- * Append the specified number within a space (number of spaces) specified
- * by the width. E.g. "15 " where number is 15 and width is 4.
- */
- void append(final int number, final int width);
-
- /**
- * Append the specified object by calling it <code>toString()</code> method.
- */
- void append(final Object object);
-
- /**
- * Append the specified object by calling its <code>toString()</code>
- * method, placing it within specified space.
- */
- void append(final Object object, final int width);
-
- /**
- * Append the specified number, displayed in hexadecimal notation, with the
- * specified label, then start a new line.
- */
- void appendAsHexln(final String label, final long value);
-
- /**
- * Append the message and trace of the specified exception.
- */
- void appendException(final Throwable e);
-
- /**
- * Start a new line.
- *
- * @see #blankLine()
- */
- void appendln();
-
- /**
- * Append the specified text, then start a new line.
- */
- void appendln(final String text);
-
- /**
- * Append the specified text without any formatting.
- */
- void appendPreformatted(final String text);
-
- /**
- * Append the specified value, displayed as true or false, with the
- * specified label, then start a new line.
- */
- void appendln(final String label, final boolean value);
-
- /**
- * Append the specified number with the specified label, then start a new
- * line.
- */
- void appendln(final String label, final double value);
-
- /**
- * Append the specified number, displayed in hexadecimal notation, with the
- * specified label, then start a new line.
- */
- void appendln(final String label, final long value);
-
- /**
- * Append the specified preformatted text with the specified label, then
- * start a new line.
- */
- void appendPreformatted(final String label, final String text);
-
- /**
- * Append the specified object with the specified label, then start a new
- * line.
- */
- void appendln(final String label, final Object object);
-
- /**
- * Append the elements of the specified array with the specified label. Each
- * element is appended on its own line, and a new line is added after the
- * last element.
- */
- void appendln(final String label, final Object[] objects);
-
- /**
- * Append the specified title, then start a new line. A title is shown on
- * two lines with the text on the first line and dashes on the second.
- */
- void appendTitle(final String title);
-
- void startSection(final String title);
-
- void endSection();
-
- /**
- * Append a blank line only if there are existing lines and the previous
- * line is not blank.
- */
- void blankLine();
-
- /**
- * Increase indent used when appending.
- */
- void indent();
-
- /**
- * Decrease indent used when appending.
- */
- void unindent();
-
- void close();
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.core.commons.debug;
+
+public interface DebugBuilder {
+
+ /**
+ * Concatenate the contents of the specified debug builder to the current
+ * builder.
+ */
+ void concat(DebugBuilder debug);
+
+ /**
+ * Append the specified number within a space (number of spaces) specified
+ * by the width. E.g. "15 " where number is 15 and width is 4.
+ */
+ void append(final int number, final int width);
+
+ /**
+ * Append the specified object by calling it <code>toString()</code> method.
+ */
+ void append(final Object object);
+
+ /**
+ * Append the specified object by calling its <code>toString()</code>
+ * method, placing it within specified space.
+ */
+ void append(final Object object, final int width);
+
+ /**
+ * Append the specified number, displayed in hexadecimal notation, with the
+ * specified label, then start a new line.
+ */
+ void appendAsHexln(final String label, final long value);
+
+ /**
+ * Append the message and trace of the specified exception.
+ */
+ void appendException(final Throwable e);
+
+ /**
+ * Start a new line.
+ *
+ * @see #blankLine()
+ */
+ void appendln();
+
+ /**
+ * Append the specified text, then start a new line.
+ */
+ void appendln(final String text);
+
+ /**
+ * Append the specified text without any formatting.
+ */
+ void appendPreformatted(final String text);
+
+ /**
+ * Append the specified value, displayed as true or false, with the
+ * specified label, then start a new line.
+ */
+ void appendln(final String label, final boolean value);
+
+ /**
+ * Append the specified number with the specified label, then start a new
+ * line.
+ */
+ void appendln(final String label, final double value);
+
+ /**
+ * Append the specified number, displayed in hexadecimal notation, with the
+ * specified label, then start a new line.
+ */
+ void appendln(final String label, final long value);
+
+ /**
+ * Append the specified preformatted text with the specified label, then
+ * start a new line.
+ */
+ void appendPreformatted(final String label, final String text);
+
+ /**
+ * Append the specified object with the specified label, then start a new
+ * line.
+ */
+ void appendln(final String label, final Object object);
+
+ /**
+ * Append the elements of the specified array with the specified label. Each
+ * element is appended on its own line, and a new line is added after the
+ * last element.
+ */
+ void appendln(final String label, final Object[] objects);
+
+ /**
+ * Append the specified title, then start a new line. A title is shown on
+ * two lines with the text on the first line and dashes on the second.
+ */
+ void appendTitle(final String title);
+
+ void startSection(final String title);
+
+ void endSection();
+
+ /**
+ * Append a blank line only if there are existing lines and the previous
+ * line is not blank.
+ */
+ void blankLine();
+
+ /**
+ * Increase indent used when appending.
+ */
+ void indent();
+
+ /**
+ * Decrease indent used when appending.
+ */
+ void unindent();
+
+ void close();
+
+}
Modified: incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/debug/DebugHtmlString.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/debug/DebugHtmlString.java?rev=1358111&r1=1358110&r2=1358111&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/debug/DebugHtmlString.java (original)
+++ incubator/isis/trunk/framework/core/commons/src/main/java/org/apache/isis/core/commons/debug/DebugHtmlString.java Fri Jul 6 10:51:16 2012
@@ -1,49 +1,49 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.core.commons.debug;
-
-public class DebugHtmlString extends DebugHtmlStringAbstract {
-
- StringBuffer debug = new StringBuffer();
-
- public DebugHtmlString() {
- super(false);
- }
-
- public DebugHtmlString(final boolean createPage) {
- super(createPage);
- header();
- }
-
- @Override
- public void doClose() {
- footer();
- }
-
- @Override
- protected void appendHtml(final String html) {
- debug.append(html);
- debug.append("\n");
- }
-
- @Override
- public String toString() {
- return debug.toString();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.core.commons.debug;
+
+public class DebugHtmlString extends DebugHtmlStringAbstract {
+
+ StringBuffer debug = new StringBuffer();
+
+ public DebugHtmlString() {
+ super(false);
+ }
+
+ public DebugHtmlString(final boolean createPage) {
+ super(createPage);
+ header();
+ }
+
+ @Override
+ public void doClose() {
+ footer();
+ }
+
+ @Override
+ protected void appendHtml(final String html) {
+ debug.append(html);
+ debug.append("\n");
+ }
+
+ @Override
+ public String toString() {
+ return debug.toString();
+ }
+}