/** * It loads the objects using their non singleton implementations. * * @param propFileName the name of the properties file that needs to be picked up from * PEGASUS_HOME/etc directory.If it is null, then the default properties file should be picked * up. */ public void loadNonSingletonObjects(String propFileName) { // these should be invoked in non singleton // manner but is not. mLogger = LogManagerFactory.loadSingletonInstance(); mLogMsg = new String(); mPoolProvider = new String(); mProps = PegasusProperties.getInstance( (propFileName == null) ? // load the default properties file edu.isi.pegasus.common.util.CommonProperties.PROPERTY_FILENAME : // load the file with this name from $PEGASUS_HOME/etc directory propFileName); // these should be invoked in non singleton // manner but is not. mUserOpts = UserOptions.getInstance(); mWorkDir = mProps.getExecDirectory(); mStorageDir = mProps.getStorageDirectory(); mDeepStorageStructure = mProps.useDeepStorageDirectoryStructure(); }
/** * It loads the objects that the pool providers need in a singleton manner, wherever possible. If * the class in not implemented in Singleton manner, the objects would be loaded normally. */ protected void loadSingletonObjects() { mLogger = LogManagerFactory.loadSingletonInstance(); mLogMsg = new String(); mPoolProvider = new String(); mProps = PegasusProperties.getInstance(); mUserOpts = UserOptions.getInstance(); mWorkDir = mProps.getExecDirectory(); mStorageDir = mProps.getStorageDirectory(); mDeepStorageStructure = mProps.useDeepStorageDirectoryStructure(); }
/** * The main program * * @param args the arguments */ public static void main(String[] args) { String directory = "/lfs1/work/pegasus-features/PM-659"; // Properties p = new Properties(); // p.put( "directory", directory ); // load the Pegasus Properties String prefix = ReplicaCatalog.c_prefix + "."; // pegasus.catalog.replica. PegasusProperties props = PegasusProperties.getInstance(); // specify the implementor to load this class props.setProperty(ReplicaCatalog.c_prefix, "Directory"); // specify the path to directory props.setProperty(prefix + Directory.DIRECTORY_PROPERTY_KEY, directory); // specify the optional site handle to associate // defaults to local props.setProperty(prefix + Directory.SITE_PROPERTY_KEY, "isi"); // specify the optional URL prefix to associate with the URL's // defaults to file:// props.setProperty(prefix + Directory.URL_PRFIX_PROPERTY_KEY, "gsiftp://myhost.domain.edu"); ReplicaCatalog c = null; try { c = ReplicaFactory.loadInstance(props); } catch (Exception ex) { System.err.println("Unable to connect to the Replica Catlog Backend " + ex.getMessage()); System.exit(1); } // do the listing Set<String> lfns = c.list(); for (String lfn : lfns) { System.out.println(lfn + " " + c.lookup(lfn)); } // disconnect c.list(); }