Package org.nimbustools.messaging.gt4_0_elastic.v2008_05_05.rm.defaults

Examples of org.nimbustools.messaging.gt4_0_elastic.v2008_05_05.rm.defaults.DefaultDescribe


    private ArrayList objectList(List<ObjectWrapper> objList, boolean readwrite)
    {
        ArrayList files  = new ArrayList();
        for (ObjectWrapper ow : objList)
        {
            FileListing fl = new FileListing();
            String name = ow.getName();
            String [] parts = name.split("/", 3);
            if(parts.length != 3)
            {
                // if a bad name jsut skip this file... they may have uploaded baddness
                logger.error("The filename " + name + " is not in the proper format");
                continue;
            }
            name = parts[2];
            fl.setName(name);
            fl.setSize(ow.getSize());           

            long tm = ow.getTime();
            Date dt = new Date(tm);
            Calendar cl = Calendar.getInstance();
            cl.setTime(dt);
            String tStr = new Integer(cl.get(Calendar.HOUR_OF_DAY)).toString() + ":" + new Integer(cl.get(Calendar.MINUTE)).toString();
            fl.setTime(tStr);
            String dStr = getMonthStr(cl.get(Calendar.MONTH)) + " " + new Integer(cl.get(Calendar.DAY_OF_MONTH)).toString();
            fl.setDate(dStr);
            fl.setReadWrite(readwrite);
            files.add(fl);
        }
        return files;
    }
View Full Code Here


                len -= 1;
                continue; // *** SKIP ***
            }

            if (nameScoped == null || nameScoped.length == 0) {
                final FileListing listing = this.getOneListing(f, ownerScoped);
                if (listing != null) {
                    files.add(listing);
                }
            } else {

                for (int i = 0; i < nameScoped.length; i++) {
                    if (fileName.equals(nameScoped[i])) {
                        final FileListing listing =
                                this.getOneListing(f, ownerScoped);
                        if (listing != null) {
                            files.add(listing);
                        }
                        break; // assuming unique file names..
View Full Code Here

        if (f == null) {
            throw new IllegalArgumentException("f may not be null");
        }

        final FileListing fl = new FileListing();

        fl.setName(f.getFileName());

        final String sizeStr = f.get("size");
        if (sizeStr == null) {
            fl.setSize(-1);
        } else {
            long x = -1;
            try {
                x = Long.parseLong(sizeStr);
            } catch (NumberFormatException e) {
                // pass.
            }
            fl.setSize(x);
        }

        final String modified = f.get("modify");
        // 20080522161726
        if (modified == null || modified.length() != 14) {
            throw new Exception("cannot parse modified time");
        }
        fl.setDate(parseDate(modified));
        fl.setTime(parseTime(modified));

        final String type = f.get("type");
        if (type != null && type.equals("dir")) {
            fl.setDirectory(true);
        }


        // If user is root and perms are group no-write and all no-write,
        // we can, because of several conventions, safely say that the user
        // only has read-only access.
        final String owner = f.get("unix.owner");
        final String mode = f.get("unix.mode");
        if (mode == null) {
            fl.setReadWrite(false);
        } else if (mode.substring(3,4).equals("6")) {
            fl.setReadWrite(true);
        } else if (mode.substring(1,2).equals("6")) {
            if (owner != null && owner.equals("root")) {
                fl.setReadWrite(false);
            } else {
                fl.setReadWrite(true);
            }
        } else if (mode.substring(2,3).equals("6")) {
            fl.setReadWrite(true); // unknown to be actually true.
        }

        if (ownerScoped != null) {
            for (int i = 0; i < ownerScoped.length; i++) {
                final String s = ownerScoped[i];
View Full Code Here

            return (FileListing[]) files.toArray(new FileListing[files.size()]);
        }
        catch(AuthzDBException ex)
        {
            throw new ListingException("file listing failed when accessing authz db", ex);                   
        }
    }
View Full Code Here

                                   String[] nameScoped,
                                   String[] ownerScoped)
            throws CannotTranslateException, ListingException {

        if (!this.enableListing) {
            throw new ListingException(
                    "Repository interaction has been disabled");
        }

        final String ownerID = this.container.getOwnerID(caller);
        try {
            return this.listFilesImpl(ownerID, nameScoped, ownerScoped);
        } catch (Exception e) {
            if (logger.isDebugEnabled()) {
                logger.error(e.getMessage(), e);
            } else {
                logger.error(e.getMessage());
            }
            throw new ListingException("Failed to list repository files.");
        }
    }
View Full Code Here

                                                      String keyName)
            throws DisabledException, KeyGenException {
        try {
            return this.newKey(this.container.getOwnerID(caller), keyName);
        } catch (IOException e) {
            throw new KeyGenException(e.getMessage(), e);
        } catch (CannotTranslateException e) {
            throw new KeyGenException(e.getMessage(), e);
        }
    }
View Full Code Here

        final JSch jsch=new JSch();
        final KeyPair kpair;
        try {
            kpair = KeyPair.genKeyPair(jsch, this.keyType, this.keySize);
        } catch (JSchException e) {
            throw new KeyGenException(e.getMessage(), e);
        }

        final String generatedFingerprint = kpair.getFingerPrint();
        if (generatedFingerprint == null) {
            throw new KeyGenException("fingerprint is missing");
        }
        final String[] parts = generatedFingerprint.split(" ");
        if (parts.length != 2) {
            throw new KeyGenException("fingerprint not in expected " +
                    "format: '" + generatedFingerprint + "'");
        }

        final String fingerprint = parts[1];
        if (fingerprint == null || fingerprint.trim().length() == 0) {
            throw new KeyGenException("fingerprint not in expected " +
                    "format: '" + generatedFingerprint + "'");
        }
       
        final StringOutputStream pubsos = new StringOutputStream();
        final StringOutputStream privsos = new StringOutputStream();

        kpair.writePublicKey(pubsos, "clouduser-" + ownerID);
        kpair.writePrivateKey(privsos);

        final String pubKeyString = pubsos.toString();
        if (pubKeyString == null || pubKeyString.trim().length() == 0) {
            throw new KeyGenException("generated pubkey is missing");
        }

        final String privKeyString = privsos.toString();
        if (privKeyString == null || privKeyString.trim().length() == 0) {
            throw new KeyGenException("generated privkey is missing");
        }

        // register it before returning
        this.sshKeys.newKey(ownerID, keyName, pubKeyString, fingerprint);
View Full Code Here

            }
            rs = pstmt.executeQuery();

            List<SSHKey> keys = new ArrayList<SSHKey>(4);
            while (rs.next()) {
                SSHKey key = new SSHKey(
                        rs.getString("owner"),
                        rs.getString("keyname"),
                        rs.getString("pubkey"),
                        rs.getString("fingerprint"));
                keys.add(key);
View Full Code Here

        final _CustomizationRequest cust;
        final String keyname = launchSpec.getKeyName();
        if (keyname != null && this.sshKeys != null) {
            cust = this.repr._newCustomizationRequest();
            final SSHKey key = this.sshKeys.findKey(ownerID, keyname);
            if (key == null) {
                throw new RemoteException("There is no key '" + keyname +
                        "' registered for you to use");
            }
            cust.setContent(key.getPubKeyValue());
            cust.setPathOnVM("/root/.ssh/authorized_keys");
        } else {
            cust = null;
        }
View Full Code Here

        final _CustomizationRequest cust;
        final String keyname = req.getKeyName();
        if (keyname != null && this.sshKeys != null) {
            cust = this.repr._newCustomizationRequest();
            final SSHKey key = this.sshKeys.findKey(ownerID, keyname);
            if (key == null) {
                throw new RemoteException("There is no key '" + keyname +
                        "' registered for you to use");
            }
            cust.setContent(key.getPubKeyValue());
            cust.setPathOnVM("/root/.ssh/authorized_keys");
        } else {
            cust = null;
        }
View Full Code Here

TOP

Related Classes of org.nimbustools.messaging.gt4_0_elastic.v2008_05_05.rm.defaults.DefaultDescribe

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.