Examples of PackageConfig


Examples of com.opensymphony.xwork2.config.entities.PackageConfig

    public List<PackageConfig> getPackages() {
        List<PackageConfig> pkgs = new ArrayList<PackageConfig>();
        Bundle bundle = getBundle();
        if (bundle.getState() == Bundle.ACTIVE) {
            for (String name : bundleAccessor.getPackagesByBundle(bundle)) {
                PackageConfig packageConfig = configuration.getPackageConfig(name);
                if (packageConfig != null)
                    pkgs.add(packageConfig);
            }
        }
        return pkgs;
View Full Code Here

Examples of com.opensymphony.xwork2.config.entities.PackageConfig

    public Container getContainer() {
        return container;
    }

    public void addPackageConfig(String name, PackageConfig packageContext) {
        PackageConfig check = packageContexts.get(name);
        if (check != null) {
            if (check.getLocation() != null && packageContext.getLocation() != null
                    && check.getLocation().equals(packageContext.getLocation())) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("The package name '" + name
                    + "' is already been loaded by the same location and could be removed: "
                    + packageContext.getLocation());
                }
            } else {
                throw new ConfigurationException("The package name '" + name
                        + "' at location "+packageContext.getLocation()
                        + " is already been used by another package at location " + check.getLocation(),
                        packageContext);
            }
        }
        packageContexts.put(name, packageContext);
    }
View Full Code Here

Examples of com.opensymphony.xwork2.config.entities.PackageConfig

        protected MyPackageConfig(PackageConfig packageConfig) {
            super(packageConfig);
        }

        public boolean equals(Object obj) {
            PackageConfig other = (PackageConfig) obj;
            return getName().equals(other.getName()) && getNamespace().equals(other.getNamespace()) &&
                getParents().get(0) == other.getParents().get(0) && getParents().size() == other.getParents().size();
        }
View Full Code Here

Examples of com.opensymphony.xwork2.config.entities.PackageConfig

public class XmlConfigurationProviderResultTypesTest extends ConfigurationTestBase {

  public void testPlainResultTypesParams() throws Exception {
    ConfigurationProvider configurationProvider = buildConfigurationProvider("com/opensymphony/xwork2/config/providers/xwork-test-result-types.xml");
   
    PackageConfig packageConfig = configuration.getPackageConfig("xworkResultTypesTestPackage1");
    Map resultTypesConfigMap = packageConfig.getResultTypeConfigs();
   
    assertEquals(resultTypesConfigMap.size(), 2);
    assertTrue(resultTypesConfigMap.containsKey("result1"));
    assertTrue(resultTypesConfigMap.containsKey("result2"));
    assertFalse(resultTypesConfigMap.containsKey("result3"));
View Full Code Here

Examples of com.opensymphony.xwork2.config.entities.PackageConfig

  }
 
  public void testInheritedResultTypesParams() throws Exception {
    ConfigurationProvider configurationProvider = buildConfigurationProvider("com/opensymphony/xwork2/config/providers/xwork-test-result-types.xml");
   
    PackageConfig packageConfig = configuration.getPackageConfig("xworkResultTypesTestPackage2");
    Map actionConfigMap = packageConfig.getActionConfigs();
   
   
    ActionConfig action1ActionConfig = (ActionConfig) actionConfigMap.get("action1");
    ActionConfig action2ActionConfig = (ActionConfig) actionConfigMap.get("action2");
   
View Full Code Here

Examples of com.opensymphony.xwork2.config.entities.PackageConfig

                actionConfig = configuration.getRuntimeConfiguration().getActionConfig(redirectNamespace, "index");
                if (actionConfig != null) {
                    if (LOG.isTraceEnabled())
                        LOG.trace("Found action config");

                    PackageConfig packageConfig = configuration.getPackageConfig(actionConfig.getPackageName());
                    if (redirectNamespace.equals(packageConfig.getNamespace())) {
                        if (LOG.isTraceEnabled())
                            LOG.trace("Action is not a default - redirecting");
                        return buildActionConfig(redirectNamespace + "/", redirectResultTypeConfig);
                    }
View Full Code Here

Examples of com.opensymphony.xwork2.config.entities.PackageConfig

        if (resultTypeConfig.getParams() != null) {
            params.putAll(resultTypeConfig.getParams());
        }
        params.put(resultTypeConfig.getDefaultResultParam(), path);

        PackageConfig pkg = configuration.getPackageConfig(defaultParentPackageName);
        List<InterceptorMapping> interceptors = InterceptorBuilder.constructInterceptorReference(pkg, pkg.getFullDefaultInterceptorRef(), Collections.<String, String>emptyMap(), null, objectFactory);
        ResultConfig config = new ResultConfig.Builder(Action.SUCCESS, resultTypeConfig.getClassName()).
                addParams(params).build();
        results.put(Action.SUCCESS, config);

        return new ActionConfig.Builder(defaultParentPackageName, "execute", ActionSupport.class.getName()).
View Full Code Here

Examples of com.opensymphony.xwork2.config.entities.PackageConfig

    }

    public Result handleUnknownResult(ActionContext actionContext, String actionName,
                                      ActionConfig actionConfig, String resultCode) throws XWorkException {

        PackageConfig pkg = configuration.getPackageConfig(actionConfig.getPackageName());
        String ns = pkg.getNamespace();
        String pathPrefix = determinePath(actionConfig, ns);

        Result result = scanResultsByExtension(ns, actionName, pathPrefix, resultCode, actionContext);

        if (result == null) {
            // Try /idx/action/index.jsp
            Map<String, ResultTypeConfig> resultsByExtension = conventionsService.getResultTypesByExtension(pkg);
            for (String ext : resultsByExtension.keySet()) {
                if (LOG.isTraceEnabled()) {
                    String fqan = ns + "/" + actionName;
                    LOG.trace("Checking for [#0/index.#1]", fqan, ext);
                }

                String path = string(pathPrefix, actionName, "/index", nameSeparator, resultCode, ".", ext);
                result = findResult(path, resultCode, ext, actionContext, resultsByExtension);
                if (result != null) {
                    break;
                }

                path = string(pathPrefix, actionName, "/index.", ext);
                result = findResult(path, resultCode, ext, actionContext, resultsByExtension);
                if (result != null) {
                    break;
                }
            }
        }

        if (result == null && resultCode != null) {
            //try to find an action to chain to. If the source action is "foo" and
            //the result is "bar", we will try to find an action called "foo-bar"
            //in the same package
            String chainedTo = actionName + nameSeparator + resultCode;
            ActionConfig chainedToConfig = pkg.getActionConfigs().get(chainedTo);
            if (chainedToConfig != null) {
                if (LOG.isTraceEnabled()) {
                    LOG.trace("Action [#0] used as chain result for [#1] and result [#2]", chainedTo, actionName, resultCode);
                }

                ResultTypeConfig chainResultType = pkg.getAllResultTypeConfigs().get("chain");
                result = buildResult(chainedTo, resultCode, chainResultType, actionContext);
            }
        }

        return result;
View Full Code Here

Examples of com.opensymphony.xwork2.config.entities.PackageConfig

        //add
        pkgCfg.addActionConfig(actionName, actionConfig.build());

        //check if an action with the same name exists on that package (from XML config probably)
        PackageConfig existingPkg = configuration.getPackageConfig(pkgCfg.getName());
        if (existingPkg != null) {
            // there is a package already with that name, check action
            ActionConfig existingActionConfig = existingPkg.getActionConfigs().get(actionName);
            if (existingActionConfig != null && LOG.isWarnEnabled())
                LOG.warn("Duplicated action definition in package [#0] with name [#1].", pkgCfg.getName(), actionName);
        }

        //watch class file
View Full Code Here

Examples of com.opensymphony.xwork2.config.entities.PackageConfig

        if (parentName == null) {
            throw new ConfigurationException("Unable to determine the parent XWork package for the action class [" +
                    actionClass.getName() + "]");
        }

        PackageConfig parentPkg = configuration.getPackageConfig(parentName);
        if (parentPkg == null) {
            throw new ConfigurationException("Unable to locate parent package [" + parentName + "] for [" + actionClass + "]");
        }

        // Grab based on package-namespace and if it exists, we need to ensure the existing one has
        // the correct parent package. If not, we need to create a new package config
        String name = actionPackage + "#" + parentPkg.getName() + "#" + actionNamespace;
        PackageConfig.Builder pkgConfig = packageConfigs.get(name);
        if (pkgConfig == null) {
            pkgConfig = new PackageConfig.Builder(name).namespace(actionNamespace).addParent(parentPkg);
            packageConfigs.put(name, pkgConfig);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.