Package com.bradmcevoy.common

Examples of com.bradmcevoy.common.Path


    this.ssoSessionProvider = ssoSessionProvider;
  }


  public Resource getResource(String host, String url) {
    Path p = Path.path(url);
    String firstComp = p.getFirst();
    Object oUserTag = null;
    if( firstComp != null ) {
      oUserTag = ssoSessionProvider.getUserTag(firstComp);
    }
   
    if (oUserTag == null) {
      log.trace("not a SSO path");
      return resourceFactory.getResource(host, url);
    } else {
      log.trace("is an SSO path");
      Path strippedPath = p.getStripFirst();
      HttpManager.request().getAttributes().put("_sso_user", oUserTag);
      return resourceFactory.getResource(host, strippedPath.toString());
    }
  }
View Full Code Here


        ColRes col2 = new ColRes("col2");
        col1.children.put("col2",col2);
        Res page = new Res("page");
        col2.children.put("page",page);
       
        Path path = Path.path("col2/page");
        Resource r = Utils.findChild(col1, path);
        assertEquals(page, r);
    }
View Full Code Here

    }
   
   
    public Resource getResource(String host, String url) {
        log.debug("getResource: url: " + url );
        Path path = Path.path(url);
        Resource r = find(path);
        log.debug("_found: " + r);
        return r;
    }
View Full Code Here

            serverPath = params.get( "ServerPath" );
        }

        void process() throws ConflictException {
            String relFolder = sFolder.substring( 1 );
            Path p = Path.path( relFolder );
            Resource r = find( wrappedResource, p );
            if( r instanceof CollectionResource ) {
                target = (CollectionResource) r;
            } else {
                log.warn("not found or not CollectionResource: " + r);
View Full Code Here

        private void processFileUpload( FileItem f ) throws ConflictException {
            String sFolder = params.get( "CurrentFolder" );
            log.debug( "sFolder: " + sFolder + " - " + sFolder.length() );
            String relFolder = sFolder.substring( 1 );
            Path p = Path.path( relFolder );
            Resource r = find( wrappedResource, p );
            if( r instanceof PutableResource ) {
                target = (PutableResource) r;
            }
            if( target == null ) {
View Full Code Here

        this.wrappedFactory = wrappedFactory;
    }

    @Override
    public Resource getResource(String host, String url) {
        Path path = Path.path(url);
        if (FckFileManagerResource.URL.equals(path)) {
            CollectionResource h = getParent(host, path.getParent());
            if( h == null ) return null;
            FckFileManagerResource fck = new FckFileManagerResource(h);
            return fck;
        } else if (FckQuickUploaderResource.URL.equals(path)) {
            CollectionResource h = getParent(host, path.getParent());
            if( h == null ) return null;
            FckQuickUploaderResource fck = new FckQuickUploaderResource(h);
            return fck;
        } else {
            return null;
View Full Code Here

  private Long maxAgeSeconds = 60 * 60 * 24 * 7l;
  private com.bradmcevoy.http.SecurityManager securityManager;
  private Date modifiedDate = new Date();

  public Resource getResource(String host, String path) {
    Path p = Path.path(path);
    if (basePath != null) {
      if (p.getFirst().equals(basePath)) {
        p = p.getStripFirst();
      } else {
        return null;
      }
    }

    // try to locate a resource with the given path
    InputStream content = this.getClass().getResourceAsStream(p.toString());
    if (content == null) {
      return null;
    } else {
      log.trace("return class path resource");
      return new ClassPathResource(host, p, content);
View Full Code Here

    this.sessionFactory = sessionFactory;
 
 
  @Override
  public Resource getResource(String host, String p) {   
    Path path = Path.path(p).getStripFirst();
    log.debug("getResource: " + path);
    Session session = sessionFactory.openSession();
    if( path.isRoot() ) {
      return new AllDepartmentsResource(this, session);
    } else if( path.getLength() == 1 ) {
      return findDepartment(path.getName(), session);
    } else if( path.getLength() == 2) {
      // TODO
      return null;
    } else {
      return null;
    }
View Full Code Here

        return wrap( homePath, current );
    }

    public boolean changeWorkingDirectory( String dir ) throws FtpException {
        log.debug( "cd: " + dir + " from " + currentPath );
        Path p = Path.path( dir );
        ResourceAndPath rp = getResource( p );
        if( rp.resource == null ) {
            log.debug( "not found: " + p );
            return false;
        } else if( rp.resource instanceof CollectionResource ) {
View Full Code Here

        log.debug( "getFile: " + path );
        if( path.startsWith( "." ) ) {
            path = currentPath.toString() + path.substring( 1 );
            log.debug( "getFile2: " + path );
        }
        Path p = Path.path( path );
        ResourceAndPath rp = getResource( p );
        if( rp.resource == null ) {
            log.debug( "returning new file" );
            return new MiltonFtpFile( this, rp.path, this.current, null, user );
        } else {
View Full Code Here

TOP

Related Classes of com.bradmcevoy.common.Path

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.