text:
package configuration_test

import (
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"fmt"
	"github.com/fgrosse/servo/configuration"
)

var _ = Describe("FileLoader", func() {
	var config *configuration.FileLoader

	BeforeEach(func() {
		config = configuration.NewYAMLFileLoader("../_test_fixtures/config.yml")
	})

	Describe("Load", func() {
		It("return any errors that occur when opening the file", func() {
			config.Path = "/this/path/does/not/exist"
			_, err := config.Load()
			Expect(err).To(HaveOccurred())
		})

		It("return any errors that occur when unmarshalling the file", func() {
			config.Unmarshaller = func(data []byte, target interface{}) error {
				return fmt.Errorf("OH NO!")
			}

			_, err := config.Load()
			Expect(err).To(MatchError("error while parsing configuration file: OH NO!"))
		})

		It("should load the configuration using the provided file path and unmarshaller function", func() {
			data, err := config.Load()
			Expect(err).NotTo(HaveOccurred())
			Expect(data).To(HaveKeyWithValue("foo", "value1"))
			Expect(data).To(HaveKeyWithValue("bar", "value2"))
		})
	})
})


text:
import React from 'react';
import { Page, PageContent, Heading, Paragraph, Grid, Card } from 'grommet';

export const Background = () => (
  // Uncomment <Grommet> lines when using outside of storybook
  // <Grommet theme={...}>
  <Page background="light-3" kind="narrow">
    <PageContent>
      <Heading>Narrow Page</Heading>
      <Paragraph>
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer commodo
        gravida tincidunt. Nunc fringilla blandit tortor, id accumsan nisi
        dictum quis. Aenean porttitor at mi id semper. Donec mattis bibendum
        leo, interdum ullamcorper lectus ultrices vel. Fusce nec enim faucibus
        nunc porta egestas. Fusce dapibus lobortis tincidunt.
      </Paragraph>
      <Grid rows="small" columns={{ count: 'fit', size: 'small' }} gap="small">
        <Card background="white" pad="large">
          Card
        </Card>
        <Card background="white" pad="large">
          Card
        </Card>
      </Grid>
      <Paragraph>
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer commodo
        gravida tincidunt. Nunc fringilla blandit tortor, id accumsan nisi
        dictum quis. Aenean porttitor at mi id semper. Donec mattis bibendum
        leo, interdum ullamcorper lectus ultrices vel. Fusce nec enim faucibus
        nunc porta egestas. Fusce dapibus lobortis tincidunt.
      </Paragraph>
    </PageContent>
  </Page>
  // </Grommet>
);

export default {
  title: 'Layout/Page/Background',
};

redpajama_set_name: RedPajamaGithub


text:
[View Javadoc](../../../../../apidocs/org/apache/struts/config/ActionConfig.html.md)

    1
    21  package org.apache.struts.config;
    22
    23  import org.apache.commons.beanutils.BeanUtils;
    24  import org.apache.commons.logging.Log;
    25  import org.apache.commons.logging.LogFactory;
    26  import org.apache.struts.util.RequestUtils;
    27
    28  import java.lang.reflect.InvocationTargetException;
    29
    30  import java.util.ArrayList;
    31  import java.util.HashMap;
    32
    33  /**
    34   *
A JavaBean representing the configuration information of an
    35   * <action> element from a Struts module configuration
    36   * file.

    37   *
    38   * @version $Rev: 480593 $ $Date: 2006-11-29 09:17:52 -0600 (Wed, 29 Nov 2006) $
    39   * @since Struts 1.1
    40   */
    41  public class ActionConfig extends BaseConfig {
    42      private static final Log log = LogFactory.getLog(ActionConfig.class);
    43
    44      // ----------------------------------------------------- Instance Variables
    45
    46      /**
    47       *
 The set of exception handling configurations for this action, if
    48       * any, keyed by the type property.

    49       */
    50      protected HashMap exceptions = new HashMap();
    51
    52      /**
    53       *
 The set of local forward configurations for this action, if any,
    54       * keyed by the name property.

    55       */
    56      protected HashMap forwards = new HashMap();
    57
    58      // ------------------------------------------------------------- Properties
    59
    60      /**
    61       *
 The module configuration with which we are associated.

    62       */
    63      protected ModuleConfig moduleConfig = null;
    64
    65      /**
    66       *
 The request-scope or session-scope attribute name under which our
    67       * form bean is accessed, if it is different from the form bean's
    68       * specified name.

    69       */
    70      protected String attribute = null;
    71
    72      /**
    73       *
The internal identification of this action mapping. Identifications are
    74       * not inheritable and must be unique within a module.

    75       *
    76       * @since Struts 1.3.6
    77       */
    78      protected String actionId = null;
    79
    80      /**
    81       *
The path of the ActionConfig that this object should inherit
    82       * properties from.

    83       */
    84      protected String inherit = null;
    85
    86      /**
    87       * Indicates whether the "cancellable " property has been set or not.
    88       */
    89      private boolean cancellableSet = false;
    90
    91      /**
    92       *
Can this Action be cancelled? [false]

 By default, when an
    93       * Action is cancelled, validation is bypassed and the Action should not
    94       * execute the business operation. If a request tries to cancel an Action
    95       * when cancellable is not set, a "InvalidCancelException" is thrown.
    96       *

    97       */
    98      protected boolean cancellable = false;
    99
    100     /**
    101      *
 Have the inheritance values for this class been applied?

    102      */
    103     protected boolean extensionProcessed = false;
    104
    105     /**
    106      *
 Context-relative path of the web application resource that will
    107      * process this request via RequestDispatcher.forward(), instead of
    108      * instantiating and calling the Action class specified by
    109      * "type". Exactly one of forward, include, or
    110      * type must be specified.

    111      */
    112     protected String forward = null;
    113
    114     /**
    115      *
 Context-relative path of the web application resource that will
    116      * process this request via RequestDispatcher.include(), instead of
    117      * instantiating and calling the Action class specified by
    118      * "type". Exactly one of forward, include, or
    119      * type must be specified.

    120      */
    121     protected String include = null;
    122
    123     /**
    124      *
 Context-relative path of the input form to which control should be
    125      * returned if a validation error is encountered.  Required if "name" is
    126      * specified and the input bean returns validation errors.

    127      */
    128     protected String input = null;
    129
    130     /**
    131      *
 Fully qualified Java class name of the MultipartRequestHandler
    132      * implementation class used to process multi-part request data for this
    133      * Action.

    134      */
    135     protected String multipartClass = null;
    136
    137     /**
    138      *
 Name of the form bean, if any, associated with this Action.

    139      */
    140     protected String name = null;
    141
    142     /**
    143      *
 General purpose configuration parameter that can be used to pass
    144      * extra information to the Action instance selected by this Action.
    145      * Struts does not itself use this value in any way.

    146      */
    147     protected String parameter = null;
    148
    149     /**
    150      *
 Context-relative path of the submitted request, starting with a
    151      * slash ("/") character, and omitting any filename extension if extension
    152      * mapping is being used.

    153      */
    154     protected String path = null;
    155
    156     /**
    157      *
 Prefix used to match request parameter names to form bean property
    158      * names, if any.

    159      */
    160     protected String prefix = null;
    161
    162     /**
    163      *
 Comma-delimited list of security role names allowed to request this
    164      * Action.

    165      */
    166     protected String roles = null;
    167
    168     /**
    169      *
 The set of security role names used to authorize access to this
    170      * Action, as an array for faster access.

    171      */
    172     protected String[] roleNames = new String[0];
    173
    174     /**
    175      *
 Identifier of the scope ("request" or "session") within which our
    176      * form bean is accessed, if any.

    177      */
    178     protected String scope = "session";
    179
    180     /**
    181      *
 Suffix used to match request parameter names to form bean property
    182      * names, if any.

    183      */
    184     protected String suffix = null;
    185
    186     /**
    187      *
 Fully qualified Java class name of the Action class to
    188      * be used to process requests for this mapping if the
    189      * forward and include properties are not set.
    190      * Exactly one of forward, include, or
    191      * type must be specified.
    192      */
    193     protected String type = null;
    194
    195     /**
    196      *
 Indicates Action be configured as the default one for this module,
    197      * when true.
    198      */
    199     protected boolean unknown = false;
    200
    201     /**
    202      * Indicates whether the "validate" property has been set or not.
    203      */
    204     private boolean validateSet = false;
    205
    206     /**
    207      *
 Should the validate() method of the form bean
    208      * associated with this action be called?
    209      */
    210     protected boolean validate = true;
    211
    212     /**
    213      *
 The name of a commons-chain command which should be
    214      * executed as part of the processing of this action.
    215      *
    216      * @since Struts 1.3.0
    217      */
    218     protected String command = null;
    219
    220     /**
    221      *
 The name of a commons-chain catalog in which
    222      * command should be sought.  If a command is
    223      * defined and this property is undefined, the "default" catalog will be
    224      * used. This is likely to be infrequently used after a future release of
    225      * commons-chain supports a one-string expression of a
    226      * catalog/chain combination.
    227      *
    228      * @since Struts 1.3.0
    229      */
    230     protected String catalog = null;
    231
    232     /**
    233      *
The internal name of this action mapping. If an action has a name, it may be used
    234      * as a shortcut in a URI. For example, an action with an identification of "editPerson"
    235      * may be internally forwarded as "editPerson?id=1" which will then resolve to the
    236      * real URI path at execution time.

    237      *
    238      * @return the actionId
    239      * @since Struts 1.3.6
    240      */
    241     public String getActionId() {
    242         return this.actionId;
    243     }
    244
    245     /**
    246      *
The internal name of this action mapping. The name is not inheritable,
    247      * may not contain a forward slash, and must be unique within a module.

    248      *
    249      * @param actionId the action identifier
    250      * @since Struts 1.3.6
    251      * @throws IllegalStateException if the configuration is frozen
    252      * @throws IllegalArgumentException if the identifier contains a forward slash
    253      */
    254     public void setActionId(String actionId) {
    255         if (configured) {
    256             throw new IllegalStateException("Configuration is frozen");
    257         }
    258
    259         if ((actionId != null) && (actionId.indexOf("/") > -1)) {
    260             throw new IllegalArgumentException("actionId '" + actionId + "' may not contain a forward slash");
    261         }
    262
    263         this.actionId = actionId;
    264     }
    265
    266     /**
    267      *
 The module configuration with which we are associated.
    268      */
    269     public ModuleConfig getModuleConfig() {
    270         return (this.moduleConfig);
    271     }
    272
    273     /**
    274      *
 The module configuration with which we are associated.
    275      */
    276     public void setModuleConfig(ModuleConfig moduleConfig) {
    277         if (configured) {
    278             throw new IllegalStateException("Configuration is frozen");
    279         }
    280
    281         this.moduleConfig = moduleConfig;
    282     }
    283
    284     /**
    285      *
 Returns the request-scope or session-scope attribute name under
    286      * which our form bean is accessed, if it is different from the form
    287      * bean's specified name.
    288      *
    289      * @return attribute name under which our form bean is accessed.
    290      */
    291     public String getAttribute() {
    292         if (this.attribute == null) {
    293             return (this.name);
    294         } else {
    295             return (this.attribute);
    296         }
    297     }
    298
    299     /**
    300      *
 Set the request-scope or session-scope attribute name under which
    301      * our form bean is accessed, if it is different from the form bean's
    302      * specified name.
    303      *
    304      * @param attribute the request-scope or session-scope attribute name
    305      *                  under which our form bean is access.
    306      */
    307     public void setAttribute(String attribute) {
    308         if (configured) {
    309             throw new IllegalStateException("Configuration is frozen");
    310         }
    311
    312         this.attribute = attribute;
    313     }
    314
    315     /**
    316      *
Accessor for cancellable property

    317      *
    318      * @return True if Action can be cancelled
    319      */
    320     public boolean getCancellable() {
    321         return (this.cancellable);
    322     }
    323
    324     /**
    325      *
Mutator for for cancellable property

    326      *
    327      * @param cancellable
    328      */
    329     public void setCancellable(boolean cancellable) {
    330         if (configured) {
    331             throw new IllegalStateException("Configuration is frozen");
    332         }
    333
    334         this.cancellable = cancellable;
    335         this.cancellableSet = true;
    336     }
    337
    338     /**
    339      *
Returns the path of the ActionConfig that this object should inherit
    340      * properties from.

    341      *
    342      * @return the path of the ActionConfig that this object should inherit
    343      *         properties from.
    344      */
    345     public String getExtends() {
    346         return (this.inherit);
    347     }
    348
    349     /**
    350      *
Set the path of the ActionConfig that this object should inherit
    351      * properties from.

    352      *
    353      * @param inherit the path of the ActionConfig that this object should
    354      *                inherit properties from.
    355      */
    356     public void setExtends(String inherit) {
    357         if (configured) {
    358             throw new IllegalStateException("Configuration is frozen");
    359         }
    360
    361         this.inherit = inherit;
    362     }
    363
    364     public boolean isExtensionProcessed() {
    365         return extensionProcessed;
    366     }
    367
    368     /**
    369      *
 Returns context-relative path of the web application resource that
    370      * will process this request.
    371      *
    372      * @return context-relative path of the web application resource that will
    373      *         process this request.
    374      */
    375     public String getForward() {
    376         return (this.forward);
    377     }
    378
    379     /**
    380      *
 Set the context-relative path of the web application resource that
    381      * will process this request. Exactly one of forward,
    382      * include, or type must be specified.
    383      *
    384      * @param forward context-relative path of the web application resource
    385      *                that will process this request.
    386      */
    387     public void setForward(String forward) {
    388         if (configured) {
    389             throw new IllegalStateException("Configuration is frozen");
    390         }
    391
    392         this.forward = forward;
    393     }
    394
    395     /**
    396      *
 Context-relative path of the web application resource that will
    397      * process this request.
    398      *
    399      * @return Context-relative path of the web application resource that will
    400      *         process this request.
    401      */
    402     public String getInclude() {
    403         return (this.include);
    404     }
    405
    406     /**
    407      *
 Set context-relative path of the web application resource that will
    408      * process this request. Exactly one of forward,
    409      * include, or type must be specified.
    410      *
    411      * @param include context-relative path of the web application resource
    412      *                that will process this request.
    413      */
    414     public void setInclude(String include) {
    415         if (configured) {
    416             throw new IllegalStateException("Configuration is frozen");
    417         }
    418
    419         this.include = include;
    420     }
    421
    422     /**
    423      *
 Get the context-relative path of the input form to which control
    424      * should be returned if a validation error is encountered.
    425      *
    426      * @return context-relative path of the input form to which control should
    427      *         be returned if a validation error is encountered.
    428      */
    429     public String getInput() {
    430         return (this.input);
    431     }
    432
    433     /**
    434      *
 Set the context-relative path of the input form to which control
    435      * should be returned if a validation error is encountered.  Required if
    436      * "name" is specified and the input bean returns validation errors.
    437      *
    438      * @param input context-relative path of the input form to which control
    439      *              should be returned if a validation error is encountered.
    440      */
    441     public void setInput(String input) {
    442         if (configured) {
    443             throw new IllegalStateException("Configuration is frozen");
    444         }
    445
    446         this.input = input;
    447     }
    448
    449     /**
    450      *
 Return the fully qualified Java class name of the
    451      * MultipartRequestHandler implementation class used to
    452      * process multi-part request data for this Action.
    453      */
    454     public String getMultipartClass() {
    455         return (this.multipartClass);
    456     }
    457
    458     /**
    459      *
 Set the fully qualified Java class name of the
    460      * MultipartRequestHandler implementation class used to
    461      * process multi-part request data for this Action.
    462      *
    463      * @param multipartClass fully qualified class name of the
    464      *                       MultipartRequestHandler
    465      *                       implementation class.
    466      */
    467     public void setMultipartClass(String multipartClass) {
    468         if (configured) {
    469             throw new IllegalStateException("Configuration is frozen");
    470         }
    471
    472         this.multipartClass = multipartClass;
    473     }
    474
    475     /**
    476      *
 Return name of the form bean, if any, associated with this Action.
    477      */
    478     public String getName() {
    479         return (this.name);
    480     }
    481
    482     /**
    483      * @param name name of the form bean associated with this Action.
    484      */
    485     public void setName(String name) {
    486         if (configured) {
    487             throw new IllegalStateException("Configuration is frozen");
    488         }
    489
    490         this.name = name;
    491     }
    492
    493     /**
    494      *
 Return general purpose configuration parameter that can be used to
    495      * pass extra information to the Action instance selected by this Action.
    496      * Struts does not itself use this value in any way.
    497      */
    498     public String getParameter() {
    499         return (this.parameter);
    500     }
    501
    502     /**
    503      *
 General purpose configuration parameter that can be used to pass
    504      * extra information to the Action instance selected by this Action.
    505      * Struts does not itself use this value in any way.
    506      *
    507      * @param parameter General purpose configuration parameter.
    508      */
    509     public void setParameter(String parameter) {
    510         if (configured) {
    511             throw new IllegalStateException("Configuration is frozen");
    512         }
    513
    514         this.parameter = parameter;
    515     }
    516
    517     /**
    518      *
 Return context-relative path of the submitted request, starting
    519      * with a slash ("/") character, and omitting any filename extension if
    520      * extension mapping is being used.
    521      */
    522     public String getPath() {
    523         return (this.path);
    524     }
    525
    526     /**
    527      *
 Set context-relative path of the submitted request, starting with a
    528      * slash ("/") character, and omitting any filename extension if extension
    529      * mapping is being used.
    530      *
    531      * @param path context-relative path of the submitted request.
    532      */
    533     public void setPath(String path) {
    534         if (configured) {
    535             throw new IllegalStateException("Configuration is frozen");
    536         }
    537
    538         this.path = path;
    539     }
    540
    541     /**
    542      *
 Retruns prefix used to match request parameter names to form bean
    543      * property names, if any.
    544      */
    545     public String getPrefix() {
    546         return (this.prefix);
    547     }
    548
    549     /**
    550      * @param prefix Prefix used to match request parameter names to form bean
    551      *               property names, if any.
    552      */
    553     public void setPrefix(String prefix) {
    554         if (configured) {
    555             throw new IllegalStateException("Configuration is frozen");
    556         }
    557
    558         this.prefix = prefix;
    559     }
    560
    561     public String getRoles() {
    562         return (this.roles);
    563     }
    564
    565     public void setRoles(String roles) {
    566         if (configured) {
    567             throw new IllegalStateException("Configuration is frozen");
    568         }
    569
    570         this.roles = roles;
    571
    572         if (roles == null) {
    573             roleNames = new String[0];
    574
    575             return;
    576         }
    577
    578         ArrayList list = new ArrayList();
    579
    580         while (true) {
    581             int comma = roles.indexOf(',');
    582
    583             if (comma < 0) {
    584                 break;
    585             }
    586
    587             list.add(roles.substring(0, comma).trim());
    588             roles = roles.substring(comma + 1);
    589         }
    590
    591         roles = roles.trim();
    592
    593         if (roles.length() > 0) {
    594             list.add(roles);
    595         }
    596
    597         roleNames = (String[]) list.toArray(new String[list.size()]);
    598     }
    599
    600     /**
    601      *
 Get array of security role names used to authorize access to this
    602      * Action.
    603      */
    604     public String[] getRoleNames() {
    605         return (this.roleNames);
    606     }
    607
    608     /**
    609      *
 Get the scope ("request" or "session") within which our form bean
    610      * is accessed, if any.
    611      */
    612     public String getScope() {
    613         return (this.scope);
    614     }
    615
    616     /**
    617      * @param scope scope ("request" or "session") within which our form bean
    618      *              is accessed, if any.
    619      */
    620     public void setScope(String scope) {
    621         if (configured) {
    622             throw new IllegalStateException("Configuration is frozen");
    623         }
    624
    625         this.scope = scope;
    626     }
    627
    628     /**
    629      *
 Return suffix used to match request parameter names to form bean
    630      * property names, if any.

    631      */
    632     public String getSuffix() {
    633         return (this.suffix);
    634     }
    635
    636     /**
    637      * @param suffix Suffix used to match request parameter names to form bean
    638      *               property names, if any.
    639      */
    640     public void setSuffix(String suffix) {
    641         if (configured) {
    642             throw new IllegalStateException("Configuration is frozen");
    643         }
    644
    645         this.suffix = suffix;
    646     }
    647
    648     public String getType() {
    649         return (this.type);
    650     }
    651
    652     public void setType(String type) {
    653         if (configured) {
    654             throw new IllegalStateException("Configuration is frozen");
    655         }
    656
    657         this.type = type;
    658     }
    659
    660     /**
    661      *
 Determine whether Action is configured as the default one for this
    662      * module.

    663      */
    664     public boolean getUnknown() {
    665         return (this.unknown);
    666     }
    667
    668     /**
    669      * @param unknown Indicates Action is configured as the default one for
    670      *                this module, when true.
    671      */
    672     public void setUnknown(boolean unknown) {
    673         if (configured) {
    674             throw new IllegalStateException("Configuration is frozen");
    675         }
    676
    677         this.unknown = unknown;
    678     }
    679
    680     public boolean getValidate() {
    681         return (this.validate);
    682     }
    683
    684     public void setValidate(boolean validate) {
    685         if (configured) {
    686             throw new IllegalStateException("Configuration is frozen");
    687         }
    688
    689         this.validate = validate;
    690         this.validateSet = true;
    691     }
    692
    693     /**
    694      *
 Get the name of a commons-chain command which should
    695      * be executed as part of the processing of this action.

    696      *
    697      * @return name of a commons-chain command which should be
    698      *         executed as part of the processing of this action.
    699      * @since Struts 1.3.0
    700      */
    701     public String getCommand() {
    702         return (this.command);
    703     }
    704
    705     /**
    706      *
 Get the name of a commons-chain catalog in which a
    707      * specified command should be sought.  This is likely to be infrequently
    708      * used after a future release of commons-chain supports a
    709      * one-string expression of a catalog/chain combination.

    710      *
    711      * @return name of a commons-chain catalog in which a
    712      *         specified command should be sought.
    713      * @since Struts 1.3.0
    714      */
    715     public String getCatalog() {
    716         return (this.catalog);
    717     }
    718
    719     /**
    720      *
 Set the name of a commons-chain command which should
    721      * be executed as part of the processing of this action.

    722      *
    723      * @param command name of a commons-chain command which
    724      *                should be executed as part of the processing of this
    725      *                action.
    726      * @since Struts 1.3.0
    727      */
    728     public void setCommand(String command) {
    729         if (configured) {
    730             throw new IllegalStateException("Configuration is frozen");
    731         }
    732
    733         this.command = command;
    734     }
    735
    736     /**
    737      *
 Set the name of a commons-chain catalog in which a
    738      * specified command should be sought. This is likely to be infrequently
    739      * used after a future release of commons-chain supports a
    740      * one-string expression of a catalog/chain combination.

    741      *
    742      * @param catalog name of a commons-chain catalog in which a
    743      *                specified command should be sought.
    744      * @since Struts 1.3.0
    745      */
    746     public void setCatalog(String catalog) {
    747         if (configured) {
    748             throw new IllegalStateException("Configuration is frozen");
    749         }
    750
    751         this.catalog = catalog;
    752     }
    753
    754     // ------------------------------------------------------ Protected Methods
    755
    756     /**
    757      *
Traces the hierarchy of this object to check if any of the ancestors
    758      * is extending this instance.

    759      *
    760      * @param moduleConfig The configuration for the module being configured.
    761      * @return true if circular inheritance was detected.
    762      */
    763     protected boolean checkCircularInheritance(ModuleConfig moduleConfig) {
    764         String ancestorPath = getExtends();
    765
    766         while (ancestorPath != null) {
    767             // check if we have the same path as an ancestor
    768             if (getPath().equals(ancestorPath)) {
    769                 return true;
    770             }
    771
    772             // get our ancestor's ancestor
    773             ActionConfig ancestor = moduleConfig.findActionConfig(ancestorPath);
    774
    775             if (ancestor != null) {
    776                 ancestorPath = ancestor.getExtends();
    777             } else {
    778                 ancestorPath = null;
    779             }
    780         }
    781
    782         return false;
    783     }
    784
    785     /**
    786      *
Compare the exception handlers of this action with that of the given
    787      * and copy those that are not present.

    788      *
    789      * @param baseConfig The action config to copy handlers from.
    790      * @see #inheritFrom(ActionConfig)
    791      */
    792     protected void inheritExceptionHandlers(ActionConfig baseConfig)
    793         throws ClassNotFoundException, IllegalAccessException,
    794             InstantiationException, InvocationTargetException {
    795         if (configured) {
    796             throw new IllegalStateException("Configuration is frozen");
    797         }
    798
    799         // Inherit exception handler configs
    800         ExceptionConfig[] baseHandlers = baseConfig.findExceptionConfigs();
    801
    802         for (int i = 0; i < baseHandlers.length; i++) {
    803             ExceptionConfig baseHandler = baseHandlers[i];
    804
    805             // Do we have this handler?
    806             ExceptionConfig copy =
    807                 this.findExceptionConfig(baseHandler.getType());
    808
    809             if (copy == null) {
    810                 // We don't have this, so let's copy it
    811                 copy =
    812                     (ExceptionConfig) RequestUtils.applicationInstance(baseHandler.getClass()
    813                                                                                .getName());
    814
    815                 BeanUtils.copyProperties(copy, baseHandler);
    816                 this.addExceptionConfig(copy);
    817                 copy.setProperties(baseHandler.copyProperties());
    818             } else {
    819                 // process any extension that this config might have
    820                 copy.processExtends(getModuleConfig(), this);
    821             }
    822         }
    823     }
    824
    825     /**
    826      *
Compare the forwards of this action with that of the given and copy
    827      * those that are not present.

    828      *
    829      * @param baseConfig The action config to copy forwards from.
    830      * @see #inheritFrom(ActionConfig)
    831      */
    832     protected void inheritForwards(ActionConfig baseConfig)
    833         throws ClassNotFoundException, IllegalAccessException,
    834             InstantiationException, InvocationTargetException {
    835         if (configured) {
    836             throw new IllegalStateException("Configuration is frozen");
    837         }
    838
    839         // Inherit forward configs
    840         ForwardConfig[] baseForwards = baseConfig.findForwardConfigs();
    841
    842         for (int i = 0; i < baseForwards.length; i++) {
    843             ForwardConfig baseForward = baseForwards[i];
    844
    845             // Do we have this forward?
    846             ForwardConfig copy = this.findForwardConfig(baseForward.getName());
    847
    848             if (copy == null) {
    849                 // We don't have this, so let's copy it
    850                 copy =
    851                     (ForwardConfig) RequestUtils.applicationInstance(baseForward.getClass()
    852                                                                                .getName());
    853                 BeanUtils.copyProperties(copy, baseForward);
    854
    855                 this.addForwardConfig(copy);
    856                 copy.setProperties(baseForward.copyProperties());
    857             } else {
    858                 // process any extension for this forward
    859                 copy.processExtends(getModuleConfig(), this);
    860             }
    861         }
    862     }
    863
    864     // --------------------------------------------------------- Public Methods
    865
    866     /**
    867      *
 Add a new ExceptionConfig instance to the set
    868      * associated with this action.

    869      *
    870      * @param config The new configuration instance to be added
    871      * @throws IllegalStateException if this module configuration has been
    872      *                               frozen
    873      */
    874     public void addExceptionConfig(ExceptionConfig config) {
    875         if (configured) {
    876             throw new IllegalStateException("Configuration is frozen");
    877         }
    878
    879         exceptions.put(config.getType(), config);
    880     }
    881
    882     /**
    883      *
 Add a new ForwardConfig instance to the set of global
    884      * forwards associated with this action.

    885      *
    886      * @param config The new configuration instance to be added
    887      * @throws IllegalStateException if this module configuration has been
    888      *                               frozen
    889      */
    890     public void addForwardConfig(ForwardConfig config) {
    891         if (configured) {
    892             throw new IllegalStateException("Configuration is frozen");
    893         }
    894
    895         forwards.put(config.getName(), config);
    896     }
    897
    898     /**
    899      *
 Return the exception configuration for the specified type, if any;
    900      * otherwise return null.

    901      *
    902      * @param type Exception class name to find a configuration for
    903      */
    904     public ExceptionConfig findExceptionConfig(String type) {
    905         return ((ExceptionConfig) exceptions.get(type));
    906     }
    907
    908     /**
    909      *
 Return the exception configurations for this action.  If there are
    910      * none, a zero-length array is returned.

    911      */
    912     public ExceptionConfig[] findExceptionConfigs() {
    913         ExceptionConfig[] results = new ExceptionConfig[exceptions.size()];
    914
    915         return ((ExceptionConfig[]) exceptions.values().toArray(results));
    916     }
    917
    918     /**
    919      *
Find and return the ExceptionConfig instance defining
    920      * how Exceptions of the specified type should be handled.
    921      * This is performed by checking local and then global configurations for
    922      * the specified exception's class, and then looking up the superclass
    923      * chain (again checking local and then global configurations). If no
    924      * handler configuration can be found, return null.

    925      *
    926      *
Introduced in ActionMapping in Struts 1.1, but pushed
    927      * up to ActionConfig in Struts 1.2.0.

    928      *
    929      * @param type Exception class for which to find a handler
    930      * @since Struts 1.2.0
    931      */
    932     public ExceptionConfig findException(Class type) {
    933         // Check through the entire superclass hierarchy as needed
    934         ExceptionConfig config;
    935
    936         while (true) {
    937             // Check for a locally defined handler
    938             String name = type.getName();
    939
    940             log.debug("findException: look locally for " + name);
    941             config = findExceptionConfig(name);
    942
    943             if (config != null) {
    944                 return (config);
    945             }
    946
    947             // Check for a globally defined handler
    948             log.debug("findException: look globally for " + name);
    949             config = getModuleConfig().findExceptionConfig(name);
    950
    951             if (config != null) {
    952                 return (config);
    953             }
    954
    955             // Loop again for our superclass (if any)
    956             type = type.getSuperclass();
    957
    958             if (type == null) {
    959                 break;
    960             }
    961         }
    962
    963         return (null); // No handler has been configured
    964     }
    965
    966     /**
    967      *
 Return the forward configuration for the specified key, if any;
    968      * otherwise return null.

    969      *
    970      * @param name Name of the forward configuration to return
    971      */
    972     public ForwardConfig findForwardConfig(String name) {
    973         return ((ForwardConfig) forwards.get(name));
    974     }
    975
    976     /**
    977      *
 Return all forward configurations for this module.  If there are
    978      * none, a zero-length array is returned.

    979      */
    980     public ForwardConfig[] findForwardConfigs() {
    981         ForwardConfig[] results = new ForwardConfig[forwards.size()];
    982
    983         return ((ForwardConfig[]) forwards.values().toArray(results));
    984     }
    985
    986     /**
    987      *
 Freeze the configuration of this action.

    988      */
    989     public void freeze() {
    990         super.freeze();
    991
    992         ExceptionConfig[] econfigs = findExceptionConfigs();
    993
    994         for (int i = 0; i < econfigs.length; i++) {
    995             econfigs[i].freeze();
    996         }
    997
    998         ForwardConfig[] fconfigs = findForwardConfigs();
    999
    1000         for (int i = 0; i < fconfigs.length; i++) {
    1001             fconfigs[i].freeze();
    1002         }
    1003     }
    1004
    1005     /**
    1006      *
Inherit values that have not been overridden from the provided
    1007      * config object.  Subclasses overriding this method should verify that
    1008      * the given parameter is of a class that contains a property it is trying
    1009      * to inherit:

    1010      *
    1011      *

    1012      * if (config instanceof MyCustomConfig) {
    1013      *     MyCustomConfig myConfig =
    1014      *         (MyCustomConfig) config;
    1015      *
    1016      *     if (getMyCustomProp() == null) {
    1017      *         setMyCustomProp(myConfig.getMyCustomProp());
    1018      *     }
    1019      * }
    1020      *

    1021      *
    1022      *
If the given config is extending another object, those
    1023      * extensions should be resolved before it's used as a parameter to this
    1024      * method.

    1025      *
    1026      * @param config The object that this instance will be inheriting its
    1027      *               values from.
    1028      * @see #processExtends(ModuleConfig)
    1029      */
    1030     public void inheritFrom(ActionConfig config)
    1031         throws ClassNotFoundException, IllegalAccessException,
    1032             InstantiationException, InvocationTargetException {
    1033         if (configured) {
    1034             throw new IllegalStateException("Configuration is frozen");
    1035         }
    1036
    1037         // Inherit values that have not been overridden
    1038         if (getAttribute() == null) {
    1039             setAttribute(config.getAttribute());
    1040         }
    1041
    1042         if (!cancellableSet) {
    1043             setCancellable(config.getCancellable());
    1044         }
    1045
    1046         if (getCatalog() == null) {
    1047             setCatalog(config.getCatalog());
    1048         }
    1049
    1050         if (getCommand() == null) {
    1051             setCommand(config.getCommand());
    1052         }
    1053
    1054         if (getForward() == null) {
    1055             setForward(config.getForward());
    1056         }
    1057
    1058         if (getInclude() == null) {
    1059             setInclude(config.getInclude());
    1060         }
    1061
    1062         if (getInput() == null) {
    1063             setInput(config.getInput());
    1064         }
    1065
    1066         if (getMultipartClass() == null) {
    1067             setMultipartClass(config.getMultipartClass());
    1068         }
    1069
    1070         if (getName() == null) {
    1071             setName(config.getName());
    1072         }
    1073
    1074         if (getParameter() == null) {
    1075             setParameter(config.getParameter());
    1076         }
    1077
    1078         if (getPath() == null) {
    1079             setPath(config.getPath());
    1080         }
    1081
    1082         if (getPrefix() == null) {
    1083             setPrefix(config.getPrefix());
    1084         }
    1085
    1086         if (getRoles() == null) {
    1087             setRoles(config.getRoles());
    1088         }
    1089
    1090         if (getScope().equals("session")) {
    1091             setScope(config.getScope());
    1092         }
    1093
    1094         if (getSuffix() == null) {
    1095             setSuffix(config.getSuffix());
    1096         }
    1097
    1098         if (getType() == null) {
    1099             setType(config.getType());
    1100         }
    1101
    1102         if (!getUnknown()) {
    1103             setUnknown(config.getUnknown());
    1104         }
    1105
    1106         if (!validateSet) {
    1107             setValidate(config.getValidate());
    1108         }
    1109
    1110         inheritExceptionHandlers(config);
    1111         inheritForwards(config);
    1112         inheritProperties(config);
    1113     }
    1114
    1115     /**
    1116      *
Inherit configuration information from the ActionConfig that this
    1117      * instance is extending.  This method verifies that any action config
    1118      * object that it inherits from has also had its processExtends() method
    1119      * called.

    1120      *
    1121      * @param moduleConfig The {@link ModuleConfig} that this bean is from.
    1122      * @see #inheritFrom(ActionConfig)
    1123      */
    1124     public void processExtends(ModuleConfig moduleConfig)
    1125         throws ClassNotFoundException, IllegalAccessException,
    1126             InstantiationException, InvocationTargetException {
    1127         if (configured) {
    1128             throw new IllegalStateException("Configuration is frozen");
    1129         }
    1130
    1131         String ancestorPath = getExtends();
    1132
    1133         if ((!extensionProcessed) && (ancestorPath != null)) {
    1134             ActionConfig baseConfig =
    1135                 moduleConfig.findActionConfig(ancestorPath);
    1136
    1137             if (baseConfig == null) {
    1138                 throw new NullPointerException("Unable to find "
    1139                     + "action for '" + ancestorPath + "' to extend.");
    1140             }
    1141
    1142             // Check against circular inheritance and make sure the base
    1143             //  config's own extends has been processed already
    1144             if (checkCircularInheritance(moduleConfig)) {
    1145                 throw new IllegalArgumentException(
    1146                     "Circular inheritance detected for action " + getPath());
    1147             }
    1148
    1149             // Make sure the ancestor's own extension has been processed.
    1150             if (!baseConfig.isExtensionProcessed()) {
    1151                 baseConfig.processExtends(moduleConfig);
    1152             }
    1153
    1154             // Copy values from the base config
    1155             inheritFrom(baseConfig);
    1156         }
    1157
    1158         extensionProcessed = true;
    1159     }
    1160
    1161     /**
    1162      *
 Remove the specified exception configuration instance.

    1163      *
    1164      * @param config ExceptionConfig instance to be removed
    1165      * @throws IllegalStateException if this module configuration has been
    1166      *                               frozen
    1167      */
    1168     public void removeExceptionConfig(ExceptionConfig config) {
    1169         if (configured) {
    1170             throw new IllegalStateException("Configuration is frozen");
    1171         }
    1172
    1173         exceptions.remove(config.getType());
    1174     }
    1175
    1176     /**
    1177      *
 Remove the specified forward configuration instance.

    1178      *
    1179      * @param config ForwardConfig instance to be removed
    1180      * @throws IllegalStateException if this module configuration has been
    1181      *                               frozen
    1182      */
    1183     public void removeForwardConfig(ForwardConfig config) {
    1184         if (configured) {
    1185             throw new IllegalStateException("Configuration is frozen");
    1186         }
    1187
    1188         forwards.remove(config.getName());
    1189     }
    1190
    1191     /**
    1192      *
 Return a String representation of this object.

    1193      */
    1194     public String toString() {
    1195         StringBuffer sb = new StringBuffer("ActionConfig[");
    1196
    1197         sb.append("cancellable=");
    1198         sb.append(cancellable);
    1199
    1200         sb.append(",path=");
    1201         sb.append(path);
    1202
    1203         sb.append(",validate=");
    1204         sb.append(validate);
    1205
    1206         if (actionId != null) {
    1207             sb.append(",actionId=");
    1208             sb.append(actionId);
    1209         }
    1210
    1211         if (attribute != null) {
    1212             sb.append(",attribute=");
    1213             sb.append(attribute);
    1214         }
    1215
    1216         if (catalog != null) {
    1217             sb.append(",catalog=");
    1218             sb.append(catalog);
    1219         }
    1220
    1221         if (command != null) {
    1222             sb.append(",command=");
    1223             sb.append(command);
    1224         }
    1225
    1226         if (inherit != null) {
    1227             sb.append(",extends=");
    1228             sb.append(inherit);
    1229         }
    1230
    1231         if (forward != null) {
    1232             sb.append(",forward=");
    1233             sb.append(forward);
    1234         }
    1235
    1236         if (include != null) {
    1237             sb.append(",include=");
    1238             sb.append(include);
    1239         }
    1240
    1241         if (input != null) {
    1242             sb.append(",input=");
    1243             sb.append(input);
    1244         }
    1245
    1246         if (multipartClass != null) {
    1247             sb.append(",multipartClass=");
    1248             sb.append(multipartClass);
    1249         }
    1250
    1251         if (name != null) {
    1252             sb.append(",name=");
    1253             sb.append(name);
    1254         }
    1255
    1256         if (parameter != null) {
    1257             sb.append(",parameter=");
    1258             sb.append(parameter);
    1259         }
    1260
    1261         if (prefix != null) {
    1262             sb.append(",prefix=");
    1263             sb.append(prefix);
    1264         }
    1265
    1266         if (roles != null) {
    1267             sb.append(",roles=");
    1268             sb.append(roles);
    1269         }
    1270
    1271         if (scope != null) {
    1272             sb.append(",scope=");
    1273             sb.append(scope);
    1274         }
    1275
    1276         if (suffix != null) {
    1277             sb.append(",suffix=");
    1278             sb.append(suffix);
    1279         }
    1280
    1281         if (type != null) {
    1282             sb.append(",type=");
    1283             sb.append(type);
    1284         }
    1285
    1286         return (sb.toString());
    1287     }
    1288 }

------------------------------------------------------------------------

This page was automatically generated by [Maven](http://maven.apache.org/)


text:
layout: post
status: publish
published: true
title: Keyword Classifier v1.4
author:
  display_name: Tomas Restrepo
  login: tomasr
  email: tomas@winterdom.com
  url: http://winterdom.com/
author_login: tomasr
author_email: tomas@winterdom.com
author_url: http://winterdom.com/
wordpress_id: 1367
wordpress_url: http://winterdom.com/?p=1367
date: '2013-08-25 14:43:02 +0000'
date_gmt: '2013-08-25 14:43:02 +0000'
categories:
- Uncategorized
tags: []
comments: []
---

Published another minor update to my KeywordClassifier Visual Studio extension yesterday. The new version adds support for Visual Studio 2013 preview, and also adds a new feature: A custom classification tag to highlight escape sequences within strings:

Use the "String Escape Sequence" classification tag to change the appearance of these. Enjoy!


text:
package dialogs;

import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.View;
import android.widget.TextView;
import com.softcsoftware.aio.R;

@SuppressWarnings("UnusedDeclaration")
public class MakeFavDialog {

    private Dialog popup_dialog;
    private OnClickButtonListener lis;

    public MakeFavDialog(final Context lContext, String titleText, String msgText) {
        popup_dialog = new Dialog(lContext);
        popup_dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        popup_dialog.setContentView(R.layout.abs_message_popup);
        popup_dialog.show();

        TextView title = (TextView) popup_dialog.findViewById(R.id.title);
        title.setTextSize(18.44f);
        title.setText(titleText);

        TextView message = (TextView) popup_dialog.findViewById(R.id.message);
        message.setTextSize(18.30f);
        message.setLineSpacing(1.0f, 1.1f);
        message.setText(msgText);

        TextView ok = (TextView) popup_dialog.findViewById(R.id.ok);
        ok.setTextSize(18.44f);
        ok.setText(" Make a favorite ");

        ok.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (lis != null) {
                    lis.onOKClick(getDialog(), v);
                }
            }
        });

    }

    public Dialog getDialog() {
        return this.popup_dialog;
    }

    public void setListener(OnClickButtonListener v) {
        this.lis = v;
    }

}


text:
using Avalonia.Media;

namespace Avalonia.Controls.Shapes
{
    public class Ellipse : Shape
    {
        static Ellipse()
        {
            AffectsGeometry<Ellipse>(BoundsProperty, StrokeThicknessProperty);
        }

        protected override Geometry CreateDefiningGeometry()
        {
            var rect = new Rect(Bounds.Size).Deflate(StrokeThickness / 2);
            return new EllipseGeometry(rect);
        }

        protected override Size MeasureOverride(Size availableSize)
        {
            return new Size(StrokeThickness, StrokeThickness);
        }
    }
}


text:
package org.springframework.cloud.stream.app.s3.sink;

import javax.validation.constraints.AssertTrue;

import org.hibernate.validator.constraints.Length;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.expression.Expression;

import com.amazonaws.services.s3.model.CannedAccessControlList;

/**
 * @author Artem Bilan
 */
@ConfigurationProperties("s3")
public class AmazonS3SinkProperties {

	/**
	 * AWS bucket for target file(s) to store.
	 */
	private String bucket;

	/**
	 * Expression to evaluate AWS bucket name.
	 */
	private Expression bucketExpression;

	/**
	 * Expression to evaluate S3 Object key.
	 */
	private Expression keyExpression;

	/**
	 * S3 Object access control list.
	 */
	private CannedAccessControlList acl;

	/**
	 * Expression to evaluate S3 Object access control list.
	 */
	private Expression aclExpression;

	@Length(min = 3)
	public String getBucket() {
		return this.bucket;
	}

	public void setBucket(String bucket) {
		this.bucket = bucket;
	}

	public Expression getBucketExpression() {
		return this.bucketExpression;
	}

	public void setBucketExpression(Expression bucketExpression) {
		this.bucketExpression = bucketExpression;
	}

	public Expression getKeyExpression() {
		return this.keyExpression;
	}

	public void setKeyExpression(Expression keyExpression) {
		this.keyExpression = keyExpression;
	}

	public CannedAccessControlList getAcl() {
		return this.acl;
	}

	public void setAcl(CannedAccessControlList acl) {
		this.acl = acl;
	}

	public Expression getAclExpression() {
		return this.aclExpression;
	}

	public void setAclExpression(Expression aclExpression) {
		this.aclExpression = aclExpression;
	}

	@AssertTrue(message = "Exactly one of 'bucket' or 'bucketExpression' must be set")
	public boolean isMutuallyExclusiveBucketAndBucketExpression() {
		return (this.bucket != null && this.bucketExpression == null) ||
				(this.bucket == null && this.bucketExpression != null);
	}

	@AssertTrue(message = "Only one of 'acl' or 'aclExpression' must be set")
	public boolean isMutuallyExclusiveAclAndAclExpression() {
		return this.acl == null || this.aclExpression == null;
	}

}


text:
// Copyright (c) Matt Saville and Alex Forbes-Reed. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.Contracts;
using System.Linq.Expressions;
using System.Runtime.CompilerServices;

namespace Snapchat.Data
{
	/// <summary>
	/// Provides a base implementation of <see cref="INotifyPropertyChanged"/> allowing properties
	/// of derived classes to be observed for changes.
	/// </summary>
	public abstract class ObservableObject
		: INotifyPropertyChanged
	{
		/// <summary>
		/// Occurs when a property value changes.
		/// </summary>
		public event PropertyChangedEventHandler PropertyChanged = delegate { };

		/// <summary>
		/// Assigns the specified <paramref name="value"/> to the specified <paramref name="field"/>
		/// reference, raising the <see cref="PropertyChanged"/> event if the value has been changed.
		/// </summary>
		/// <typeparam name="T">The type of the value.</typeparam>
		/// <param name="field">The reference to a field.</param>
		/// <param name="value">The value to assign to the field.</param>
		/// <param name="suppressEqualityCheck">
		/// If <c>true</c>, always raise the <see cref="PropertyChanged"/> event regardless of whether
		/// the value remains the same before and after this method's invocation.
		/// </param>
		/// <param name="propertyName">
		/// The name of the property. Leave as default to use the member name of the caller of this method.
		/// </param>
		/// <returns>
		/// A boolean value indicating whether the <see cref="PropertyChanged"/> event was raised.
		/// </returns>
		protected bool SetValue<T>(ref T field, T value, bool suppressEqualityCheck = false, [CallerMemberName] string propertyName = "")
		{
			if (!suppressEqualityCheck && EqualityComparer<T>.Default.Equals(field, value))
				return false;

			field = value;
			OnPropertyChanged(propertyName);

			return true;
		}

		/// <summary>
		/// Raises the <see cref="PropertyChanged"/> event.
		/// </summary>
		/// <param name="propertyName">
		/// The name of the property. Leave as default to use the member name of the caller of this method.
		/// </param>
		protected void OnPropertyChanged([CallerMemberName] string propertyName = "")
		{
			Contract.Assume(PropertyChanged != null);
			PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
		}

		/// <summary>
		/// Raises the <see cref="PropertyChanged"/> event for another property.
		/// </summary>
		/// <typeparam name="T"></typeparam>
		/// <param name="propertyExpression"></param>
		protected void OnPropertyChanged<T>(Expression<Func<T>> propertyExpression)
		{
			Contract.Requires<ArgumentNullException>(propertyExpression != null);
			Contract.Assume(PropertyChanged != null);

			var body = propertyExpression.Body as MemberExpression;
			var expression = body.Expression as ConstantExpression;
			PropertyChanged(expression.Value, new PropertyChangedEventArgs(body.Member.Name));
		}
	}
}


text:
package com.billybyte.spanjava.recordtypes.expanded;

public class DeltaSplitAllocation {

	private final String recordId; // "Z "
	private final String exchAcro; // = line.substring(2,5);
	private final String combProdCommCode; // = line.substring(5,15);
	private final String combType; // = line.substring(15,20);
	private final String combConMonth; // = line.substring(20,26);
	private final String combConDayWeekCode; // = line.substring(26,28);
	private final String legNumber; // = line.substring(35,38);
	private final String legRelationship; // = line.substring(38,39);
	private final String legRatio; // = line.substring(39,42);
	private final String legProdCommCode; // = line.substring(42,52);
	private final String legProdType; // = line.substring(52,55);
	private final String legConMonth; // = line.substring(55,61);
	private final String legConDayWeekCode; // = line.substring(61,63);
	private final String legRatioFracPart; // = line.substring(63,67);
	private final String legPriceAvailFlag; // = line.substring(67,68);
	private final String legPriceUsageFlag; // = line.substring(68,70);
	private final String legPrice; // = line.substring(70,77);
	private final String legPriceSign; // = line.substring(77,78);

	public DeltaSplitAllocation(String line) {

		this.recordId = line.substring(0,2);
		this.exchAcro = line.substring(2,5);
		this.combProdCommCode = line.substring(5,15);
		this.combType = line.substring(15,20);
		this.combConMonth = line.substring(20,26);
		this.combConDayWeekCode = line.substring(26,28);
		this.legNumber = line.substring(35,38);
		this.legRelationship = line.substring(38,39);
		this.legRatio = line.substring(39,42);
		this.legProdCommCode = line.substring(42,52);
		this.legProdType = line.substring(52,55);
		this.legConMonth = line.substring(55,61);
		this.legConDayWeekCode = line.substring(61,63);
		this.legRatioFracPart = line.substring(63,67);
		this.legPriceAvailFlag = line.substring(67,68);
		this.legPriceUsageFlag = line.substring(68,70);
		this.legPrice = line.substring(70,77);
		this.legPriceSign = line.substring(77,78);

	}

	public String toString() {
		return recordId+","+exchAcro+","+combProdCommCode+","+combType+","+combConMonth+","+combConDayWeekCode+","+legNumber+","+
				legRelationship+","+legRatio+","+legProdCommCode+","+legProdType+","+legConMonth+","+legConDayWeekCode+","+
				legRatioFracPart+","+legPriceAvailFlag+","+legPriceUsageFlag+","+legPrice+","+legPriceSign;
	}

	public String getRecordId() {
		return recordId;
	}

	public String getExchAcro() {
		return exchAcro;
	}

	public String getCombProdCommCode() {
		return combProdCommCode;
	}

	public String getCombType() {
		return combType;
	}

	public String getCombConMonth() {
		return combConMonth;
	}

	public String getCombConDayWeekCode() {
		return combConDayWeekCode;
	}

	public String getLegNumber() {
		return legNumber;
	}

	public String getLegRelationship() {
		return legRelationship;
	}

	public String getLegRatio() {
		return legRatio;
	}

	public String getLegProdCommCode() {
		return legProdCommCode;
	}

	public String getLegProdType() {
		return legProdType;
	}

	public String getLegConMonth() {
		return legConMonth;
	}

	public String getLegConDayWeekCode() {
		return legConDayWeekCode;
	}

	public String getLegRatioFracPart() {
		return legRatioFracPart;
	}

	public String getLegPriceAvailFlag() {
		return legPriceAvailFlag;
	}

	public String getLegPriceUsageFlag() {
		return legPriceUsageFlag;
	}

	public String getLegPrice() {
		return legPrice;
	}

	public String getLegPriceSign() {
		return legPriceSign;
	}

}


text:
using System;
using System.Collections.Generic;
using System.Reflection;

namespace Entitas.Serialization {

    public class PublicMemberInfo {

        public Type type {
            get {
                return _fieldInfo != null
                    ? _fieldInfo.FieldType
                    : _propertyInfo.PropertyType;
            }
        }

        public string name {
            get {
                return _fieldInfo != null
                    ? _fieldInfo.Name
                    : _propertyInfo.Name;
            }
        }

        readonly FieldInfo _fieldInfo;
        readonly PropertyInfo _propertyInfo;

        public PublicMemberInfo(FieldInfo info) {
            _fieldInfo = info;
            _propertyInfo = null;
        }

        public PublicMemberInfo(PropertyInfo info) {
            _fieldInfo = null;
            _propertyInfo = info;
        }

        public object GetValue(object obj) {
            return _fieldInfo != null
                ? _fieldInfo.GetValue(obj)
                : _propertyInfo.GetValue(obj, null);
        }

        public void SetValue(object obj, object value) {
            if (_fieldInfo != null) {
                _fieldInfo.SetValue(obj, value);
            } else {
                _propertyInfo.SetValue(obj, value, null);
            }
        }
    }

    public static class PublicMemberInfoExtension {

        public static List<PublicMemberInfo> GetPublicMemberInfos(this Type type) {
            const BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.Public;

            var fieldInfos = type.GetFields(bindingFlags);
            var propertyInfos = type.GetProperties(bindingFlags);
            var memberInfos = new List<PublicMemberInfo>(fieldInfos.Length + propertyInfos.Length);

            for (int i = 0, fieldInfosLength = fieldInfos.Length; i < fieldInfosLength; i++) {
                memberInfos.Add(new PublicMemberInfo(fieldInfos[i]));
            }

            for (int i = 0, propertyInfosLength = propertyInfos.Length; i < propertyInfosLength; i++) {
                var info = propertyInfos[i];
                if (info.CanRead && info.CanWrite) {
                    memberInfos.Add(new PublicMemberInfo(info));
                }
            }

            return memberInfos;
        }

        public static object PublicMemberClone(this object obj) {
            var clone = Activator.CreateInstance(obj.GetType());
            CopyPublicMemberValues(obj, clone);
            return clone;
        }

        public static T PublicMemberClone<T>(this object obj) where T : new() {
            var clone = new T();
            CopyPublicMemberValues(obj, clone);
            return clone;
        }

        public static void CopyPublicMemberValues(this object source, object target) {
            var memberInfos = source.GetType().GetPublicMemberInfos();
            for (int i = 0, memberInfosLength = memberInfos.Count; i < memberInfosLength; i++) {
                var info = memberInfos[i];
                info.SetValue(target, info.GetValue(source));
            }
        }
    }
}


text:
#include <memory>
#include <string>
#include <vector>

#include "tensorflow/lite/toco/graph_transformations/graph_transformations.h"
#include "tensorflow/lite/toco/model.h"
#include "tensorflow/lite/toco/tooling_util.h"

namespace toco {

::tensorflow::Status UnpartitionEmbeddingLookup::Run(Model* model,
                                                     std::size_t op_index,
                                                     bool* modified) {
  *modified = false;
  // Collapses a partitioned tf.nn.embedding_lookup back into a single Gather.
  // https://www.tensorflow.org/api_docs/python/tf/nn/embedding_lookup
  // This transform attempts to identify the len(params) > 1 case and collapse
  // it to the len(params) = 1 case by concatenating the original params and
  // reversing the partitioning.
  //
  // If len(params) to the tf.nn.embedding_lookup == 1, the whole op becomes
  // simply a gather:
  // https://github.com/tensorflow/tensorflow/blob/r1.5/tensorflow/python/ops/embedding_ops.py#L150
  //
  // Notes on this implementation:
  // - only supports partition_strategy='mod'
  //
  // A rough graph of a partitioned embedding_lookup looks like:
  //   (ids)--+-->FloorDiv--+-->DynamicPartition-->[[Gather]]--\
  //          \-->FloorMod--/                                  |
  //                 V                                         |
  //   Range-->DynamicPartition-------->DynamicStitch<---------/
  //  (const)                                V
  //                                     (embeddings)

  // First look for the final DynamicStitch.
  auto op_it = model->operators.begin() + op_index;
  if (op_it->get()->type != OperatorType::kDynamicStitch) {
    return ::tensorflow::Status::OK();
  }
  auto* stitch_op = static_cast<DynamicStitchOperator*>(op_it->get());

  // Split up the DynamicStitch inputs into the indices and data.
  std::vector<string> stitch_indices_inputs;
  std::vector<string> stitch_data_inputs;
  for (size_t i = 0; i < stitch_op->num_partitions; ++i) {
    stitch_indices_inputs.push_back(stitch_op->inputs[i]);
  }
  for (size_t i = stitch_op->num_partitions; i < stitch_op->num_partitions * 2;
       ++i) {
    stitch_data_inputs.push_back(stitch_op->inputs[i]);
  }

  // Validate all indices come from the same DynamicPartition.
  DynamicPartitionOperator* indices_partition_op = nullptr;
  for (const string& indices_partition_output_name : stitch_indices_inputs) {
    auto* op = GetOpWithOutput(*model, indices_partition_output_name);
    CHECK(op) << "Source of " << indices_partition_output_name << " not found";
    if (op->type != OperatorType::kDynamicPartition) {
      AddMessageF(
          "Skipping because indices input %s into "
          "%s is unexpected",
          LogName(*op), LogName(*stitch_op));
      return ::tensorflow::Status::OK();
    }
    if (!indices_partition_op) {
      indices_partition_op = static_cast<DynamicPartitionOperator*>(op);
    } else {
      // Ensure this is the same op as previous ones.
      if (op != indices_partition_op) {
        AddMessageF(
            "Skipping because indices input %s into "
            "%s is from a different source op than others",
            LogName(*op), LogName(*stitch_op));
        return ::tensorflow::Status::OK();
      }
    }
  }
  CHECK(indices_partition_op) << "No indices inputs";

  // The data for the indices must be a constant range of the array shape.
  if (!IsConstantParameterArray(*model, indices_partition_op->inputs[0])) {
    AddMessageF("Skipping because indices partition data is non-constant");
    return ::tensorflow::Status::OK();
  }
  auto& indices_data_array = model->GetArray(indices_partition_op->inputs[0]);
  if (indices_data_array.data_type == ArrayDataType::kNone) {
    // Yield until data types are propagated.
    return ::tensorflow::Status::OK();
  }
  CHECK(indices_data_array.data_type == ArrayDataType::kInt32)
      << "Indices partition inputs must be int32";
  const auto& indices_data_buffer =
      indices_data_array.GetBuffer<ArrayDataType::kInt32>().data;
  for (size_t i = 0; i < indices_data_buffer.size(); ++i) {
    CHECK_EQ(indices_data_buffer[i], i) << "Indices range must be identity";
  }

  // Find all of the gathers used for the data inputs.
  std::vector<GatherOperator*> gather_ops;
  for (const string& gather_output_name : stitch_data_inputs) {
    auto* op = GetOpWithOutput(*model, gather_output_name);
    CHECK(op) << "Source of " << gather_output_name << " not found";
    if (op->type != OperatorType::kGather) {
      AddMessageF(
          "Skipping because data input %s into %s "
          "is unexpected",
          LogName(*op), LogName(*stitch_op));
      return ::tensorflow::Status::OK();
    }
    gather_ops.push_back(static_cast<GatherOperator*>(op));
  }

  // Validate all gathers come from the same DynamicPartition.
  DynamicPartitionOperator* data_partition_op = nullptr;
  for (auto* gather_op : gather_ops) {
    auto* op = GetOpWithOutput(*model, gather_op->inputs[1]);
    CHECK(op) << "Source of " << gather_op->inputs[1] << " not found";
    if (op->type != OperatorType::kDynamicPartition) {
      AddMessageF(
          "Skipping because data input %s into "
          "%s is unexpected",
          LogName(*op), LogName(*gather_op));
      return ::tensorflow::Status::OK();
    }
    if (!data_partition_op) {
      data_partition_op = static_cast<DynamicPartitionOperator*>(op);
    } else {
      // Ensure this is the same op as previous ones.
      if (op != data_partition_op) {
        AddMessageF(
            "Skipping because data input %s into "
            "%s is from a different source op than others",
            LogName(*op), LogName(*gather_op));
        return ::tensorflow::Status::OK();
      }
    }
  }
  CHECK(data_partition_op) << "No data inputs";

  // Validate the partition ops have the same sizes.
  CHECK_EQ(indices_partition_op->num_partitions,
           data_partition_op->num_partitions)
      << "Indices and data partition ops have differing dimensions";
  int num_partitions = indices_partition_op->num_partitions;

  // Partition strategy of 'mod' gives us a FloorMod and FloorDiv.
  // The gather partition uses the FloorDiv as the data and FloorMod as the
  // partitions and the indices use the FloorMod as their partitions.
  Operator* div_op = GetOpWithOutput(*model, data_partition_op->inputs[0]);
  Operator* mod_op = GetOpWithOutput(*model, data_partition_op->inputs[1]);
  CHECK(div_op && div_op->type == OperatorType::kFloorDiv)
      << "Unsupported partition strategy";
  CHECK(mod_op && mod_op->type == OperatorType::kFloorMod)
      << "Unsupported partition strategy";
  CHECK_EQ(mod_op, GetOpWithOutput(*model, indices_partition_op->inputs[1]))
      << "Indices and data partition ops require the same partition strategy "
         "and inputs";

  // Glob together all of the gather data. This is not yet in the correct order.
  auto* gather_params_concat_op = new ConcatenationOperator;
  for (const auto& gather_op : gather_ops) {
    gather_params_concat_op->inputs.push_back(gather_op->inputs[0]);
  }
  gather_params_concat_op->outputs.push_back(
      AvailableArrayName(*model, gather_ops[0]->inputs[0] + "_unpartitioned"));
  op_it = model->operators.emplace(op_it, gather_params_concat_op) + 1;
  model->GetOrCreateArray(gather_params_concat_op->outputs[0]);

  // Permute the gather params to undo the partitioning that was originally
  // done.
  auto* gather_params_permute_op = new GatherOperator;
  gather_params_permute_op->inputs.push_back(
      gather_params_concat_op->outputs[0]);
  gather_params_permute_op->inputs.push_back(
      AvailableArrayName(*model, gather_ops[0]->inputs[0] + "_permuted/perm"));
  gather_params_permute_op->outputs.push_back(
      AvailableArrayName(*model, gather_ops[0]->inputs[0] + "_permuted"));
  gather_params_permute_op->axis = {0};
  op_it = model->operators.emplace(op_it, gather_params_permute_op) + 1;
  model->GetOrCreateArray(gather_params_permute_op->outputs[0]);
  const auto& partition_array = model->GetArray(gather_ops[0]->inputs[0]);
  const auto& partition_array_dims = partition_array.shape().dims();
  gather_params_permute_op->input_rank =
      partition_array.shape().dimensions_count();
  auto& perm_array =
      model->GetOrCreateArray(gather_params_permute_op->inputs[1]);
  perm_array.data_type = ArrayDataType::kInt32;
  perm_array.mutable_shape()->ReplaceDims(
      {num_partitions * partition_array_dims[0]});
  auto& perm_data = perm_array.GetMutableBuffer<ArrayDataType::kInt32>().data;
  perm_data.resize(RequiredBufferSizeForShape(perm_array.shape()));
  // NOTE: this is what relies on the partition_strategy.
  for (int i = 0; i < num_partitions * partition_array_dims[0]; ++i) {
    int p = i % num_partitions;
    perm_data[i] = p * partition_array_dims[0] + i / num_partitions;
  }

  // Insert the new unpartitioned gather op.
  auto* merged_gather_op = new GatherOperator;
  merged_gather_op->inputs = {gather_params_permute_op->outputs[0],
                              mod_op->inputs[0]};
  merged_gather_op->outputs = {stitch_op->outputs[0]};
  merged_gather_op->input_rank = partition_array.shape().dimensions_count();
  merged_gather_op->axis = {0};
  model->operators.emplace(op_it, merged_gather_op);

  AddMessageF(
      "Replacing suspected partitioned tf.nn.embedding_lookup (starting at %s "
      "+ %s and ending at %s) with a single unpartitioned gather %s",
      LogName(*div_op), LogName(*mod_op), LogName(*stitch_op),
      LogName(*merged_gather_op));

  // Ensure the stitch output array is dead, as we don't want whatever was in it
  // previously now that we've redefined it. It'll be recreated when needed.
  model->EraseArray(stitch_op->outputs[0]);
  model->GetOrCreateArray(merged_gather_op->outputs[0]);

  // Erase all the original ops.
  DeleteOpAndArraysIfUnused(model, div_op);
  DeleteOpAndArraysIfUnused(model, mod_op);
  for (auto* gather_op : gather_ops) {
    DeleteOpAndArraysIfUnused(model, gather_op);
  }
  DeleteOpAndArraysIfUnused(model, indices_partition_op);
  DeleteOpAndArraysIfUnused(model, data_partition_op);
  DeleteOpAndArraysIfUnused(model, stitch_op);
  *modified = true;
  return ::tensorflow::Status::OK();
}

}  // namespace toco


text:
require 'tagomatic/known_formats'

module Tagomatic

  class FormatsApplier

    include Tagomatic::KnownFormats

    def initialize(options, format_compiler, file_system)
      @options = options
      @format_compiler = format_compiler
      @file_system = file_system
    end

    def process(tagger_context)
      @context = tagger_context
      if custom_formats_available?
        apply_custom_formats
      end
      if guessing_allowed? and not tags_already_set?
        apply_known_formats
      end
    end

    protected

    def custom_formats_available?
      @options[:formats] and not @options[:formats].empty?
    end

    def apply_custom_formats
      @formats_error_subject = "custom format"
      do_apply_formats @options[:formats]
    end

    def do_apply_formats(list_of_formats)
      @tags = guess_tags_using(list_of_formats)
      if tags_found?
        store_tags_in_context
      else
        show_failed_matching_error
      end
    end

    def guess_tags_using(formats)
      formats.each do |format|
        format_matcher = @format_compiler.compile_format(format)
        format_matcher.reset
        format_matcher.match(@context.file_path)
        return format_matcher.tags if format_matcher.valid_match?
      end
      nil
    end

    def tags_found?
      not (@tags.nil? or @tags.empty?)
    end

    def store_tags_in_context
      @context.tags = @tags
    end

    def show_failed_matching_error
      @context.show_error "no #{@formats_error_subject} matched #{@context.file_path}"
    end

    def guessing_allowed?
      @options[:guess]
    end

    def tags_already_set?
      @context.has_tags?
    end

    def apply_known_formats
      @formats_error_subject = "guessable format"
      do_apply_formats KNOWN_FORMATS
    end

  end

end


text:
import {NgModule}      from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import { HttpModule } from '@angular/http';

import {AppComponent}  from './app.component';

import { layoutModule } from './components/layout/layout.module';

@NgModule({
    imports:        [BrowserModule, HttpModule, layoutModule],
    declarations:   [AppComponent],
    bootstrap:      [AppComponent]
})

export class AppModule {}


text:
/*
 *
 *
 * @bug 4906490
 * @summary Dummy security service provider.
 *          It is cited by the AltProviderPath.sh script.
 */
package org.test.dummy;

import java.util.*;
import java.security.*;

public class DummyProvider extends Provider {
    public DummyProvider() {
        super("Dummy", 0.1, "Dummy Provider");

        //
        // KeyStore
        //
        put("KeyStore.DummyKS", "sun.security.provider.JavaKeyStore$JKS");

        //
        // Signature engines
        //
        put("Signature.SHA1withDSA",
            "sun.security.provider.DSA$SHA1withDSA");
        put("Alg.Alias.Signature.DSA", "SHA1withDSA");

        //
        // Key Pair Generator engines
        //
        put("KeyPairGenerator.DSA",
            "sun.security.provider.DSAKeyPairGenerator");

        //
        // Digest engines
        //
        put("MessageDigest.SHA", "sun.security.provider.SHA");
        put("Alg.Alias.MessageDigest.SHA1", "SHA");

        //
        // Algorithm Parameter Generator engines
        //
        put("AlgorithmParameterGenerator.DSA",
            "sun.security.provider.DSAParameterGenerator");

        //
        // Algorithm Parameter engines
        //
        put("AlgorithmParameters.DSA",
            "sun.security.provider.DSAParameters");

        //
        // Key factories
        //
        put("KeyFactory.DSA", "sun.security.provider.DSAKeyFactory");

        //
        // Certificate factories
        //
        put("CertificateFactory.X.509",
            "sun.security.provider.X509Factory");
        put("Alg.Alias.CertificateFactory.X509", "X.509");
    }
}


text:
package com.datastax.dse.driver.internal.core.graph.binary.buffer;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.CompositeByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.buffer.UnpooledByteBufAllocator;
import java.nio.ByteBuffer;
import java.util.function.Supplier;
import org.apache.tinkerpop.gremlin.structure.io.Buffer;
import org.apache.tinkerpop.gremlin.structure.io.BufferFactory;

/**
 * Internal BufferFactory impl for creation of Tinkerpop buffers. We implement an internal type here
 * to allow for this class to use shaded Netty types (without bringing all of Tinkerpop into the
 * shaded JAR). The impl is based on the initial impl of {@code
 * org.apache.tinkerpop.gremlin.driver.ser.NettyBufferFactory} but we don't guarantee that this
 * class will mirror changes to that class over time.
 */
public class DseNettyBufferFactory implements BufferFactory<ByteBuf> {

  private static final ByteBufAllocator DEFAULT_ALLOCATOR = new UnpooledByteBufAllocator(false);

  private final ByteBufAllocator allocator;

  public DseNettyBufferFactory() {
    this.allocator = DEFAULT_ALLOCATOR;
  }

  public DseNettyBufferFactory(ByteBufAllocator allocator) {
    this.allocator = allocator;
  }

  @Override
  public Buffer create(final ByteBuf value) {
    return new DseNettyBuffer(value);
  }

  @Override
  public Buffer wrap(final ByteBuffer value) {
    return create(Unpooled.wrappedBuffer(value));
  }

  public Buffer heap() {
    return create(allocator.heapBuffer());
  }

  public Buffer heap(int initialSize) {
    return create(allocator.heapBuffer(initialSize));
  }

  public Buffer heap(int initialSize, int maxSize) {
    return create(allocator.heapBuffer(initialSize, maxSize));
  }

  public Buffer io() {
    return create(allocator.ioBuffer());
  }

  public Buffer io(int initialSize) {
    return create(allocator.ioBuffer(initialSize));
  }

  public Buffer io(int initialSize, int maxSize) {
    return create(allocator.ioBuffer(initialSize, maxSize));
  }

  public Buffer direct() {
    return create(allocator.directBuffer());
  }

  public Buffer direct(int initialSize) {
    return create(allocator.directBuffer(initialSize));
  }

  public Buffer direct(int initialSize, int maxSize) {
    return create(allocator.directBuffer(initialSize, maxSize));
  }

  public Buffer composite(ByteBuf... components) {

    CompositeByteBuf buff = allocator.compositeBuffer(components.length);
    buff.addComponents(components);
    return create(buff);
  }

  public Buffer composite(Buffer... components) {
    ByteBuf[] nettyBufs = new ByteBuf[components.length];
    for (int i = 0; i < components.length; ++i) {
      if (!(components[i] instanceof DseNettyBuffer)) {
        throw new IllegalArgumentException("Can only concatenate DseNettyBuffer instances");
      }
      nettyBufs[i] = ((DseNettyBuffer) components[i]).getUnderlyingBuffer();
    }
    return composite(nettyBufs);
  }

  public Buffer withBytes(int... bytes) {
    return withBytes(this::heap, bytes);
  }

  public Buffer withBytes(Supplier<Buffer> supplier, int... bytes) {
    Buffer buff = supplier.get();
    for (int val : bytes) {
      buff.writeByte(val);
    }
    return buff;
  }
}


text:
package org.apache.camel.component.digitalocean.producer;

import com.myjeeva.digitalocean.common.ActionType;
import com.myjeeva.digitalocean.pojo.Action;
import com.myjeeva.digitalocean.pojo.Actions;
import com.myjeeva.digitalocean.pojo.Delete;
import com.myjeeva.digitalocean.pojo.Image;
import com.myjeeva.digitalocean.pojo.Images;
import org.apache.camel.Exchange;
import org.apache.camel.component.digitalocean.DigitalOceanConfiguration;
import org.apache.camel.component.digitalocean.DigitalOceanEndpoint;
import org.apache.camel.component.digitalocean.constants.DigitalOceanHeaders;
import org.apache.camel.component.digitalocean.constants.DigitalOceanImageTypes;
import org.apache.camel.util.ObjectHelper;

/**
 * The DigitalOcean producer for Images API.
 */
public class DigitalOceanImagesProducer extends DigitalOceanProducer {

    public DigitalOceanImagesProducer(DigitalOceanEndpoint endpoint, DigitalOceanConfiguration configuration) {
        super(endpoint, configuration);
    }

    @Override
    public void process(Exchange exchange) throws Exception {

        switch (determineOperation(exchange)) {

            case list:
                getImages(exchange);
                break;
            case ownList:
                getUserImages(exchange);
                break;
            case listActions:
                getImageActions(exchange);
                break;
            case get:
                getImage(exchange);
                break;
            case update:
                updateImage(exchange);
                break;
            case delete:
                deleteImage(exchange);
                break;
            case transfer:
                transferImage(exchange);
                break;
            case convert:
                convertImageToSnapshot(exchange);
                break;
            default:
                throw new IllegalArgumentException("Unsupported operation");
        }
    }

    private void getUserImages(Exchange exchange) throws Exception {
        Images images
                = getEndpoint().getDigitalOceanClient().getUserImages(configuration.getPage(), configuration.getPerPage());
        LOG.trace("User images : page {} / {} per page [{}] ", configuration.getPage(), configuration.getPerPage(),
                images.getImages());
        exchange.getOut().setBody(images.getImages());
    }

    private void getImages(Exchange exchange) throws Exception {
        DigitalOceanImageTypes type = exchange.getIn().getHeader(DigitalOceanHeaders.TYPE, DigitalOceanImageTypes.class);
        Images images;

        if (ObjectHelper.isNotEmpty(type)) {
            images = getEndpoint().getDigitalOceanClient().getAvailableImages(configuration.getPage(),
                    configuration.getPerPage(), ActionType.valueOf(type.name()));
        } else {
            images = getEndpoint().getDigitalOceanClient().getAvailableImages(configuration.getPage(),
                    configuration.getPerPage());
        }
        LOG.trace("All Images : page {} / {} per page [{}] ", configuration.getPage(), configuration.getPerPage(),
                images.getImages());
        exchange.getOut().setBody(images.getImages());
    }

    private void getImage(Exchange exchange) throws Exception {

        Integer imageId = exchange.getIn().getHeader(DigitalOceanHeaders.ID, Integer.class);
        String slug = exchange.getIn().getHeader(DigitalOceanHeaders.DROPLET_IMAGE, String.class);
        Image image;

        if (ObjectHelper.isNotEmpty(imageId)) {
            image = getEndpoint().getDigitalOceanClient().getImageInfo(imageId);
        } else if (ObjectHelper.isNotEmpty(slug)) {
            image = getEndpoint().getDigitalOceanClient().getImageInfo(slug);
        } else {
            throw new IllegalArgumentException(
                    DigitalOceanHeaders.ID + " or " + DigitalOceanHeaders.DROPLET_IMAGE + " must be specified");
        }

        LOG.trace("Image [{}] ", image);
        exchange.getOut().setBody(image);
    }

    private void getImageActions(Exchange exchange) throws Exception {
        Integer imageId = exchange.getIn().getHeader(DigitalOceanHeaders.ID, Integer.class);

        if (ObjectHelper.isEmpty(imageId)) {
            throw new IllegalArgumentException(DigitalOceanHeaders.ID + " must be specified");
        }

        Actions actions = getEndpoint().getDigitalOceanClient().getAvailableImageActions(imageId, configuration.getPage(),
                configuration.getPerPage());
        LOG.trace("Actions for Image {} : page {} / {} per page [{}] ", imageId, configuration.getPage(),
                configuration.getPerPage(), actions.getActions());
        exchange.getOut().setBody(actions.getActions());
    }

    private void updateImage(Exchange exchange) throws Exception {
        Integer imageId = exchange.getIn().getHeader(DigitalOceanHeaders.ID, Integer.class);

        if (ObjectHelper.isEmpty(imageId)) {
            throw new IllegalArgumentException(DigitalOceanHeaders.ID + " must be specified");
        }

        String name = exchange.getIn().getHeader(DigitalOceanHeaders.NAME, String.class);

        if (ObjectHelper.isEmpty(name)) {
            throw new IllegalArgumentException(DigitalOceanHeaders.NAME + " must be specified");
        }
        Image image = new Image();
        image.setId(imageId);
        image.setName(name);
        image = getEndpoint().getDigitalOceanClient().updateImage(image);
        LOG.trace("Update Image {} [{}] ", imageId, image);
        exchange.getOut().setBody(image);
    }

    private void deleteImage(Exchange exchange) throws Exception {
        Integer imageId = exchange.getIn().getHeader(DigitalOceanHeaders.ID, Integer.class);

        if (ObjectHelper.isEmpty(imageId)) {
            throw new IllegalArgumentException(DigitalOceanHeaders.ID + " must be specified");
        }

        Delete delete = getEndpoint().getDigitalOceanClient().deleteImage(imageId);
        LOG.trace("Delete  Image {} [{}] ", imageId, delete);
        exchange.getOut().setBody(delete);
    }

    private void transferImage(Exchange exchange) throws Exception {
        Integer imageId = exchange.getIn().getHeader(DigitalOceanHeaders.ID, Integer.class);

        if (ObjectHelper.isEmpty(imageId)) {
            throw new IllegalArgumentException(DigitalOceanHeaders.ID + " must be specified");
        }

        String region = exchange.getIn().getHeader(DigitalOceanHeaders.REGION, String.class);

        if (ObjectHelper.isEmpty(region)) {
            throw new IllegalArgumentException(DigitalOceanHeaders.REGION + " must be specified");
        }

        Action action = getEndpoint().getDigitalOceanClient().transferImage(imageId, region);
        LOG.trace("Transfer  Image {} to Region {} [{}] ", imageId, region, action);
        exchange.getOut().setBody(action);
    }

    private void convertImageToSnapshot(Exchange exchange) throws Exception {
        Integer imageId = exchange.getIn().getHeader(DigitalOceanHeaders.ID, Integer.class);

        if (ObjectHelper.isEmpty(imageId)) {
            throw new IllegalArgumentException(DigitalOceanHeaders.ID + " must be specified");
        }

        Action action = getEndpoint().getDigitalOceanClient().convertImage(imageId);
        LOG.trace("Convert Image {} [{}] ", imageId, action);
        exchange.getOut().setBody(action);
    }
}


text:
'use strict';
var redisLib = require('redis');
var AbstractLevelDOWN = require('abstract-leveldown').AbstractLevelDOWN;
var inherits = require('util').inherits;

var RDIterator = require('./iterator');
var scriptsloader = require('./scriptsloader');

/**
 * @param location prefix for the database.
 */
function RedisDown(location) {
  if (!(this instanceof RedisDown)) {
    return new RedisDown(location);
  }
	AbstractLevelDOWN.call(this, location);
}

module.exports = RedisDown;

// default number of items fetched at once during by an iterator
RedisDown.defaultHighWaterMark = 128;

// our new prototype inherits from AbstractLevelDOWN
inherits(RedisDown, AbstractLevelDOWN);

// host:port -> { db: client, locations: [] }
RedisDown.dbs = {};

/**
 * @param options: either one of
 *  - redis-client instance.
 *  - object with { redis: redis-client}
 *  - object with { port: portNumber, host: host, ... other options passed to node-redis }
 *
 * When a client is created it is reused across instances of
 * RedisDOWN unless the option `ownClient` is truthy.
 * For a client to be reused, it requires the same port, host and options.
 */
RedisDown.prototype._open = function (options, callback) {
  this.highWaterMark   = options.highWaterMark   || RedisDown.defaultHighWaterMark;
  if (typeof options.hget === 'function') {
    this.db = options.hget;
    this.quitDbOnClose = false;
  } else if (options.redis && typeof options.redis.hget === 'function') {
    this.db = options.redis;
    this.quitDbOnClose = false;
  } else if (!options.ownClient) {
    this.redisId = _makeRedisId(options);
    var dbDesc = RedisDown.dbs[this.redisId];
    if (dbDesc) {
      this.db = dbDesc.db;
      dbDesc.locations.push(this.location);
    }
  } else {
    this.quitDbOnClose = true;
  }
  if (!this.db) {
    this.db = redisLib.createClient(options.port, options.host, options);
    if (!options.ownClient) {
      RedisDown.dbs[this.redisId] = { db: this.db, locations: [ this.location ] };
    }
  }
  var self = this;

  if (options && options.destroyOnOpen) {
    return this.destroy(false, function() {
      setImmediate(function () { callback(null, self); });
    });
  }
  scriptsloader.preload(this.db, function() {
    setImmediate(function () { callback(null, self); });
  });
};

RedisDown.prototype._get = function (key, options, cb) {
	this.db.hget(this.location+':h', key, function(e, v) {
		if (e) { return cb(e); }
		if (!v) { return cb(new Error('NotFound error ' + key)); }
		var json;
		try {
			json = JSON.parse(v);
		} catch(e) {
			return cb(e);
		}
	  var asBuffer = true;
	  if (options.asBuffer === false || options.raw) {
	    cb(null, json);
	  } else {
			cb(null, new Buffer(json));
		}
	});
};

RedisDown.prototype._put = function (key, rawvalue, opt, cb) {
	this.__exec(this.__appendPutCmd([], key, rawvalue), cb);
};

RedisDown.prototype._del = function (key, opt, cb) {
	this.__exec(this.__appendDelCmd([], key), cb);
};
RedisDown.prototype._batch = function (array, options, callback) {
	var cmds = [];
	for (var i = 0; i < array.length; i++) {
		var op = array[i];
		if (op.type === 'put') {
      this.__appendPutCmd(cmds, op.key, op.value);
		} else if (op.type === 'del') {
      this.__appendDelCmd(cmds, op.key);
		} else {
			return callback(new Error('Unknow type of operation ' + JSON.stringify(op)));
		}
	}
  this.__exec(cmds, callback);
};

RedisDown.prototype.__appendPutCmd = function(cmds, key, value) {
	cmds.push(['hset', this.location+':h', key, JSON.stringify(value) ]);
	cmds.push(['zadd', this.location+':z', 0, key ]);
  return cmds;
};
RedisDown.prototype.__appendDelCmd = function(cmds, key) {
	cmds.push(['hdel', this.location+':h', key ]);
	cmds.push(['zrem', this.location+':z', key ]);
  return cmds;
};
RedisDown.prototype.__exec = function(cmds, callback) {
	this.db.multi(cmds).exec(callback);
};

RedisDown.prototype._close = function (callback) {
  this.closed = true;
  if (this.quitDbOnClose === false) {
    return setImmediate(callback);
  }
  if (this.quitDbOnClose !== true) {
    // close the client only if it is not used by others:
    var dbDesc = RedisDown.dbs[this.redisId];
    if (dbDesc) {
      var location = this.location;
      dbDesc.locations = dbDesc.locations.filter(function(loc) {
        return loc !== location;
      });
      if (dbDesc.locations.length !== 0) {
        // a still used by another RedisDOWN
        return setImmediate(callback);
      }
      delete RedisDown.dbs[this.redisId];
    }
  }
	try {
  	this.db.quit();
	} catch(x) {
		console.log('Error attempting to quit the redis client', x);
	}
	setImmediate(callback);
};

RedisDown.prototype.iterator = function (options) {
  return new RDIterator(this, options);
};

// Special operations
/**
 * Opens a new redis client del the hset.
 * Quit the client.
 * Callbacks
 */
RedisDown.destroy = function (location, options, callback) {
  if (typeof options === 'function') {
    callback = options;
    options = {};
  }
  var client = redisLib.createClient(options.post, options.host, options);
  client.del(location+':h', location+':z', function(e) {
    client.quit();
    callback(e);
  });
};
/**
 * @param doClose: optional parameter, by default true to close the client
 */
RedisDown.prototype.destroy = function (doClose, callback) {
  if (!callback && typeof doClose === 'function') {
    callback = doClose;
    doClose = true;
  }
  var self = this;
  this.db.del(this.location+':h', this.location+':z', function(e) {
    if (doClose) {
      self.close(callback);
    } else {
      callback();
    }
  });
};

/**
 * Internal:
 * create an identifier for a redis client from the options passed to _open.
 * when the identifier is identical, it is safe to reuse the same client.
 */
function _makeRedisId(options) {
  var redisIdOptions = [ 'host', 'port',
    'parser', 'return_buffers', 'detect_buffers', 'socket_nodelay', 'no_ready_check',
    'enable_offline_queue', 'retry_max_delay', 'connect_timeout', 'max_attempts' ];
  var redisOptions = {};
  redisIdOptions.forEach(function(opt) {
    if (options[opt] !== undefined && options[opt] !== null) {
      redisOptions[opt] = options[opt];
    }
  });
  return JSON.stringify(redisOptions);
}

RedisDown.reset = function(callback) {
  for (var k in RedisDown.dbs) {
    if (RedisDown.dbs.hasOwnProperty(k)) {
      try {
        var db = RedisDown.dbs[k].db;
        db.quit();
      } catch(x) {
      }
    }
  }
  if (callback) {
    return callback();
  }
};


text:
Following the tutorial here http://emberigniter.com/test-components-ember-2.0/

[![Build Status](https://travis-ci.org/intrepion/emberigniter-how-to-test-components.svg?branch=master)](https://travis-ci.org/intrepion/emberigniter-how-to-test-components)


text:
/**
 *  Point of contact for component modules
 *
 *  ie: import { Car, Close, Day, Icon, Photo } from 'components/Icons';
 *
 */
export Car from './Car';
export Close from './Close';
export Day from './Day';
export Icon from './Icon';
export Photo from './Photo';