Package jodd.madvoc

Examples of jodd.madvoc.RootPackages


  protected String readPackageActionPath(Class actionClass, String[] actionPathElements) {

    Package actionPackage = actionClass.getPackage();
    String actionPackageName = actionPackage.getName();

    final RootPackages rootPackages = madvocConfig.getRootPackages();

    String packagePath = rootPackages.getPackageActionPath(actionPackageName);

    if (packagePath == null) {

      packagePath = rootPackages.findPackagePathForActionPackage(actionPackageName);

      String rootPackage = null;

      if (packagePath != null) {
        rootPackage = rootPackages.findRootPackageForActionPath(packagePath);
      }

      // try locating marker class
      {
        String packageName = actionPackageName;
        String madvocRootPackageClassName = madvocConfig.getMadvocRootPackageClassName();

        if (madvocRootPackageClassName != null) {
          while (true) {
            String className = packageName + '.' + madvocRootPackageClassName;
            try {
              Class<?> madvocRootPackageClass = ClassLoaderUtil.loadClass(className, actionClass.getClassLoader());

              // class found, find the mapping
              String mapping = StringPool.EMPTY;
              MadvocAction madvocAction = madvocRootPackageClass.getAnnotation(MadvocAction.class);

              if (madvocAction != null) {
                mapping = madvocAction.value();
              }

              // register root package - so not to lookup twice
              madvocConfig.getRootPackages().addRootPackage(packageName, mapping);

              // repeat lookup
              packagePath = rootPackages.findPackagePathForActionPackage(actionPackageName);

              break;
            } catch (ClassNotFoundException ignore) {

              // continue
              int dotNdx = packageName.lastIndexOf('.');
              if (dotNdx == -1) {
                break;
              }

              packageName = packageName.substring(0, dotNdx);

              if (rootPackage != null) {
                // don't go beyond found root package
                if (packageName.equals(rootPackage)) {
                  break;
                }
              }
            }
          }
        }
      }

      rootPackages.registerPackageActionPath(actionPackageName, packagePath);
    }


    // read package-level annotation
View Full Code Here


    defaultResultType = ServletDispatcherResult.NAME;
    defaultInterceptors = new Class[] {ServletConfigInterceptor.class};
    defaultFilters = null;
    defaultActionMethodNames = new String[] {"view", "execute"};
    defaultExtension = "html";
    rootPackages = new RootPackages();
    madvocRootPackageClassName = "MadvocRootPackage";
    detectDuplicatePathsEnabled = true;
    preventCaching = true;
    requestScopeInjectorConfig = new RequestScopeInjector.Config();
    attributeMoveId = "_m_move_id";
View Full Code Here

  protected void readPackageActionPath(ActionNames actionNames, Class actionClass) {

    Package actionPackage = actionClass.getPackage();
    String actionPackageName = actionPackage.getName();

    final RootPackages rootPackages = madvocConfig.getRootPackages();

    String packagePath = rootPackages.getPackageActionPath(actionPackageName);

    if (packagePath == null) {

      packagePath = rootPackages.findPackagePathForActionPackage(actionPackageName);

      String rootPackage = null;

      if (packagePath != null) {
        rootPackage = rootPackages.findRootPackageForActionPath(packagePath);
      }

      // try locating marker class
      {
        String packageName = actionPackageName;
        String madvocRootPackageClassName = madvocConfig.getMadvocRootPackageClassName();

        if (madvocRootPackageClassName != null) {
          while (true) {
            String className = packageName + '.' + madvocRootPackageClassName;
            try {
              Class<?> madvocRootPackageClass = ClassLoaderUtil.loadClass(className, actionClass.getClassLoader());

              // class found, find the mapping
              String mapping = StringPool.EMPTY;
              MadvocAction madvocAction = madvocRootPackageClass.getAnnotation(MadvocAction.class);

              if (madvocAction != null) {
                mapping = madvocAction.value();
              }

              // register root package - so not to lookup twice
              madvocConfig.getRootPackages().addRootPackage(packageName, mapping);

              // repeat lookup
              packagePath = rootPackages.findPackagePathForActionPackage(actionPackageName);

              break;
            } catch (ClassNotFoundException ignore) {

              // continue
              int dotNdx = packageName.lastIndexOf('.');
              if (dotNdx == -1) {
                break;
              }

              packageName = packageName.substring(0, dotNdx);

              if (rootPackage != null) {
                // don't go beyond found root package
                if (packageName.equals(rootPackage)) {
                  break;
                }
              }
            }
          }
        }
      }

      rootPackages.registerPackageActionPath(actionPackageName, packagePath);
    }


    // read package-level annotation
View Full Code Here

    defaultInterceptors = new Class[] {ServletConfigInterceptor.class};
    defaultFilters = null;
    defaultActionMethodNames = new String[] {"view", "execute"};
    defaultExtension = "html";
    defaultNamingStrategy = DefaultActionPath.class;
    rootPackages = new RootPackages();
    madvocRootPackageClassName = "MadvocRootPackage";
    detectDuplicatePathsEnabled = true;
    preventCaching = true;
    attributeMoveId = "_m_move_id";
    pathMacroClass = WildcardPathMacros.class;
View Full Code Here

TOP

Related Classes of jodd.madvoc.RootPackages

Copyright © 2018 www.massapicom. 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.