logo       


ruper2/src/java/core/org/krysalis/ruper2/api FileAPI.java,NONE,1.1: msg#00494

Subject: ruper2/src/java/core/org/krysalis/ruper2/api FileAPI.java,NONE,1.1
Update of /cvsroot/metamorphosis/ruper2/src/java/core/org/krysalis/ruper2/api
In directory 
sc8-pr-cvs1:/tmp/cvs-serv30481/src/java/core/org/krysalis/ruper2/api

Added Files:
        FileAPI.java 
Log Message:
Avoid clash with existing Ruper...

--- NEW FILE: FileAPI.java ---
/*
 * Created on Aug 27, 2003
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
package org.krysalis.ruper2.api;

import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.krysalis.ruper2.RuperException;
import org.krysalis.ruper2.files.DefaultResourceFilenameAnalyzer;
import org.krysalis.ruper2.files.ResourceFilenameAnalyzer;
import org.krysalis.ruper2.protocols.VirtualResourceLocator;
import org.krysalis.ruper2.resource.Resource;
import org.krysalis.ruper2.resource.ResourceSpecifier;
import org.krysalis.ruper2.util.io.ResolvedFile;
import org.krysalis.version.util.SystemUtils;

/**
 * @author arb_jack
 */
public class FileAPI /* implements Referenceable */ {
        private File m_baseFile = null;
        private ResourceFilenameAnalyzer m_analyzer = null;

        /**
         * 
         */
        public FileAPI() {
                this(SystemUtils.getCWD());
        }

        /**
         * 
         */
        public FileAPI(File baseFile) {
                m_analyzer =
                        new DefaultResourceFilenameAnalyzer(
                                new VirtualResourceLocator(baseFile));

                m_baseFile = baseFile;
        }

        /**
         * 
         * Resolve a file (i.e. get absolute path) within the "context" 
         * of this API's baseFile (i.e. CWD or whatever)
         * 
         * @param file
         * @return
         */
        public File resolveFile(Object file) {
                return ResolvedFile.resolve(m_baseFile, file);
        }

        public List getResourceSpecifiersForFiles(List files)
                throws RuperException {
                List specifiers = new ArrayList();

                for (Iterator i = files.iterator(); i.hasNext();) {
                        specifiers.add(getResourceSpecifierForFile(((File) 
i.next())));
                }

                return specifiers;
        }

        public ResourceSpecifier getResourceSpecifierForFile(File file)
                throws RuperException {
                Resource resource = m_analyzer.determineResource(file);
                return resource.getSpecifier();
        }

        public static void main(String args[]) throws Exception {
                String file = "test.jar";
                if (args.length > 0)
                        file = args[0];

                FileAPI fa = new FileAPI(SystemUtils.getCWD());

                fa.getResourceSpecifierForFile(new File(file));
        }
}




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf


Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
Search:
Java, servers, webhosting, windows, cisco ...
more...
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
encryption.gpg....    ietf.rfc822/199...    freebsd.devel.i...    lang.haskell.li...    mail.squirrelma...    web.zope.plone....    yellowdog.gener...    text.xml.xalan....    recreation.phot...    kde.devel.educa...    hardware.bus.ca...    printing.ghosts...    voip.peering/20...    assembly/2006-0...    org.user-groups...    culture.interne...    network.i2p/200...    boot-loaders.ya...    xfree86.render/...    qnx.openqnx.dev...    jakarta.velocit...    user-groups.pal...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe