Package com.sun.pkg.client

Examples of com.sun.pkg.client.Image


         return getUpdateCenterImage((String)GuiUtil.getSessionValue("topDir"), false);
        }
    }

    public static Image getUpdateCenterImage(String ucDir, boolean force){
        Image image = null;
        try{
            image = new Image (new File (ucDir));
            if (force || (GuiUtil.getSessionValue(CATALOG_REFRESHED) == null)){
                if (image != null){
        image.refreshCatalogs();
        GuiUtil.setSessionValue(CATALOG_REFRESHED, "TRUE");
    }
            }
        }catch(Exception ex){
            if(force && (image == null)){
View Full Code Here


        final Timer pingTimer = new Timer("PingService", true); //Mark the timer as daemon so that it does not hold up appserver shutdown

        TimerTask pingTask = new TimerTask() {
            public void run() {
                Image img = null;
                try {
                    HashMap<String,String> map = new HashMap<String,String>();

                    map.put("product", version.getProductName().replace(";", ":"));
                    map.put("version", getVersionNumber());
                    map.put("context", CONTEXT);

                    img = RegistrationUtil.getUpdateCenterImage();
                    img.setMetaData(map);
                    img.refreshCatalog(img.getPreferredAuthorityName()); // this gets the information from the server
                    logger.log(Level.INFO, "Domain Pinged: {0}", img.getPreferredAuthorityName());

                } catch (Exception e) {
                    // should the timer schedule be changed in case of
                    // exception?
                    if (img != null)
                        logger.log(Level.FINE, "Domain Ping: Unable to refresh catalog: {0}", img.getPreferredAuthorityName());
                    else
                        logger.log(Level.FINE, "Domain Ping: Unable to refresh catalog.  Null image.");
                    logger.fine(e.getMessage());
                }
                // set the time stamp even in case of failure to ping,
View Full Code Here

        final Timer pingTimer = new Timer("PingService", true); //Mark the timer as daemon so that it does not hold up appserver shutdown

        TimerTask pingTask = new TimerTask() {
            public void run() {
                Image img = null;
                try {
                    HashMap<String,String> map = new HashMap<String,String>();

                    map.put("product", Version.getProductName().replace(";", ":"));
                    map.put("version", getVersionNumber());
                    map.put("context", CONTEXT);
                    // Disable module status usage tracking.
                    //map.put("modules", activeModules.generateModuleStatus());


                    img = RegistrationUtil.getUpdateCenterImage();
                    img.setMetaData(map);
                    img.refreshCatalog(img.getPreferredAuthorityName());
                    logger.log(Level.INFO, "Domain Pinged: {0}",
                        img.getPreferredAuthorityName());
                    if (logger.isLoggable(Level.FINE)) {
                        logger.fine("X-JPkg-Metadata: product: " +
                            map.get("product"));
                        logger.fine("X-JPkg-Metadata: version: " +
                            map.get("version"));
                        logger.fine("X-JPkg-Metadata: context: " +
                            map.get("context"));
                        //logger.fine("X-JPkg-Metadata: modules: " + map.get("modules"));
                    }

                } catch (Exception e) {
                    // should the timer schedule be changed in case of
                    // exception?
                    if (img != null)
                        logger.log(Level.FINE, "Domain Ping: Unable to refresh catalog: {0}", img.getPreferredAuthorityName());
                    else
                        logger.log(Level.FINE, "Domain Ping: Unable to refresh catalog.  Null image.");
                    logger.fine(e.getMessage());
                }
                // set the time stamp even in case of failure to ping,
View Full Code Here

    }

    public static Image getUpdateCenterImage() throws Exception {
        File installRoot =
            new File(System.getProperty(SystemPropertyConstants.INSTALL_ROOT_PROPERTY));
        return new Image (installRoot.getParent());
    }
View Full Code Here

    public static void setUpdateCenterUUID(String instanceURN)
            throws RegistrationException {
        final String prefix = "urn:st:";
        try {
            Image image = getUpdateCenterImage();
            String[] authorities = image.getAuthorityNames();
            if (instanceURN.startsWith(prefix))
                instanceURN = instanceURN.substring(prefix.length());
            for (String authority : authorities) {
                image.setAuthority(authority, null, instanceURN);
            }
            image.saveConfig();
        } catch(Exception ex) {
            throw new RegistrationException(ex);
        }
    }
View Full Code Here

    @Handler(id="getInstalledPath",
        output={
        @HandlerOutput(name="result", type=String.class)})
    public static void getInstalledPath(HandlerContext handlerCtx) {
        Image image = getUpdateCenterImage();
        handlerCtx.setOutputValue("result"(image == null) ?
            GuiUtil.getMessage(BUNDLE, "updateCenter.NoImageDirectory") : image.getRootDirectory());
    }
View Full Code Here

   
    @Handler(id="getAuthority",
        output={
        @HandlerOutput(name="result", type=String.class)})
    public static void getAuthority(HandlerContext handlerCtx) {
        Image image = getUpdateCenterImage();
        handlerCtx.setOutputValue("result"(image == null) ? "" : image.getPreferredAuthorityName());
    }
View Full Code Here

            handlerCtx.setOutputValue("details", new HashMap());
            return;
        }
        Fmri fmri = new Fmri(fmriStr);
        Map details = new HashMap()
        Image img = getUpdateCenterImage();
        try{
            details.put("pkgName", fmri.getName());
            details.put("uid", fmri.toString());
            details.put("version", getPkgVersion(fmri.getVersion()));
            details.put("date", fmri.getVersion().getPublishDate());
            details.put("auth", (String) handlerCtx.getInputValue("auth"));
            details.put("url", fmri.getURLPath());
            if (img != null){
                Manifest manifest = img.getManifest(fmri);
                details.put("category", getCategory(manifest));
                details.put("bytes", "" + manifest.getPackageSize() );
                details.put("pkgSize", getPkgSize(manifest));
                // look for description in the following order:
                // pkg.description, description_long, pkg.summary, description
View Full Code Here

        if (Boolean.TRUE.equals(GuiUtil.getSessionValue("_noNetwork"))){
            handlerCtx.setOutputValue("result", result);
            return;
        }
        try {
            Image img = getUpdateCenterImage();
            if (img == null){
                handlerCtx.setOutputValue("result", result);
                return;
            }
            String state= (String)handlerCtx.getInputValue("state");
            if (state.equals("update")){
                handlerCtx.setOutputValue("result", getUpdateDisplayList(img, false));
                return;
            }
           
            List<Fmri> displayList = null;
            if (state.equals("installed"))
                displayList = getInstalledList(img);
            else
            if (state.equals("addOn"))
                displayList = getAddOnList(img);

          if (displayList != null){
            for (Fmri fmri : displayList){
                Map oneRow = new HashMap();
                try{
                    Manifest manifest = img.getManifest(fmri);
                    oneRow.put("selected", false);
                    oneRow.put("fmri", fmri);
                    oneRow.put("fmriStr", fmri.toString());
                    putInfo(oneRow, "pkgName", fmri.getName());
                    putInfo(oneRow, "version", getPkgVersion(fmri.getVersion()));
View Full Code Here

        @HandlerOutput(name="result", type=java.util.List.class)})
    public static void getAuthList(HandlerContext handlerCtx) {
       
        List result = new ArrayList();
        try {
            Image image = getUpdateCenterImage();
            if (image == null){
                handlerCtx.setOutputValue("result", result);
                return;
            }
            String[] auths = image.getAuthorityNames();
            for(int i=0; i< auths.length; i++){
                Map oneRow = new HashMap();
                    oneRow.put("authName", auths[i]);
                    result.add(oneRow);
            }
View Full Code Here

TOP

Related Classes of com.sun.pkg.client.Image

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.