Package org.apache.jetspeed.om.profile

Examples of org.apache.jetspeed.om.profile.PSMLDocument


                {
                    String psml = ((File) it.next()).getPath();
                    path = psml.substring(copyFrom.length() + 1);
                    ProfileLocator locator = this.mapFileToLocator(path);

                    PSMLDocument doc = this.loadDocument(psml);

                    //
                    // create a new profile
                    //
                    if(doc != null)
                    {
                        Portlets portlets = doc.getPortlets();
                        //
                        // Profiler does not provide update capability - must remove before replacing
                        //
                        if (PsmlManager.getDocument(locator) != null)
                        {
View Full Code Here


     * @param fileOrUrl a String representing either an absolute URL or an
     * absolute filepath
     */
    private PSMLDocument loadDocument(String fileOrUrl)
    {
        PSMLDocument doc = null;

        if (fileOrUrl != null)
        {

            // we'll assume the name is the the location of the file
            File f = null;

            f = new File(fileOrUrl);

            if (!f.exists())
            {
                return null;
            }

            doc = new BasePSMLDocument();
            doc.setName(fileOrUrl);

            // now that we have a file reference, try to load the serialized PSML
            Portlets portlets = null;
            FileReader reader = null;
            try
            {
                reader = new FileReader(f);

                Unmarshaller unmarshaller = new Unmarshaller(this.loadMapping());
                portlets = (Portlets) unmarshaller.unmarshal(reader);

                doc.setPortlets(portlets);

            }
            catch (IOException e)
            {
                Log.error("PSMLUpdateAction: Could not load the file " + f.getAbsolutePath(), e);
View Full Code Here

            //
            // create a new profile
            //
            if(baseProfile != null)
            {
                PSMLDocument doc = baseProfile.getDocument();
                if(doc != null)
                {
                    Portlets portlets = doc.getPortlets();
                   
                    Portlets clonedPortlets = (Portlets) SerializationUtils.clone(portlets);
                    org.apache.jetspeed.util.PortletUtils.regenerateIds(clonedPortlets);
                    profile = Profiler.createProfile(locator, clonedPortlets);
                }
View Full Code Here

            //
            // Export profile
            //
            if(baseProfile != null)
            {
                PSMLDocument doc = baseProfile.getDocument();
                if(doc != null)
                {
                    if (!this.saveDocument(copyTo,doc))
                        throw new Exception("Failed to save PSML document");
                    rundata.addMessage("Profile [" + copyFrom + "] has been saved to disk in [" + copyTo + "]<br>");
View Full Code Here

            //
            Iterator i = Profiler.query(new QueryLocator(QueryLocator.QUERY_ALL));
            while (i.hasNext())
            {
                Profile profile = (Profile) i.next();
                PSMLDocument doc = profile.getDocument();
                if(doc != null)
                {
                    // Build the fully qualified file name
                    StringBuffer copyToFile = new StringBuffer(copyTo);
                    copyToFile.append(File.separator);
View Full Code Here

            }

            //
            // Retrieve the document to import
            //
            PSMLDocument doc = this.loadDocument(copyFrom);

            //
            // create a new profile
            //
            if(doc != null)
            {
                Portlets portlets = doc.getPortlets();
                //
                // Profiler does not provide update capability - must remove before replacing
                //
                if (PsmlManager.getDocument(locator) != null)
                {
View Full Code Here

                {
                    String psml = ((File) it.next()).getPath();
                    path = psml.substring(copyFrom.length() + 1);
                    ProfileLocator locator = this.mapFileToLocator(path);

                    PSMLDocument doc = this.loadDocument(psml);

                    //
                    // create a new profile
                    //
                    if(doc != null)
                    {
                        Portlets portlets = doc.getPortlets();
                        //
                        // Profiler does not provide update capability - must remove before replacing
                        //
                        if (PsmlManager.getDocument(locator) != null)
                        {
View Full Code Here

     * @param fileOrUrl a String representing either an absolute URL or an
     * absolute filepath
     */
    private PSMLDocument loadDocument(String fileOrUrl)
    {
        PSMLDocument doc = null;

        if (fileOrUrl != null)
        {

            // we'll assume the name is the the location of the file
            File f = null;

            f = new File(fileOrUrl);

            if (!f.exists())
            {
                return null;
            }

            doc = new BasePSMLDocument();
            doc.setName(fileOrUrl);

            // now that we have a file reference, try to load the serialized PSML
            Portlets portlets = null;
            FileReader reader = null;
            try
            {
                reader = new FileReader(f);

                Unmarshaller unmarshaller = new Unmarshaller(this.loadMapping());
                portlets = (Portlets) unmarshaller.unmarshal(reader);

                doc.setPortlets(portlets);

            }
            catch (IOException e)
            {
                logger.error("PSMLUpdateAction: Could not load the file " + f.getAbsolutePath(), e);
View Full Code Here

            profiles = PsmlManager.query(locator);

            while (profiles.hasNext() )
            {
                Profile profile = (Profile)profiles.next();               
                PSMLDocument doc = profile.getDocument();
                // System.out.println("Scanning: " + doc.getName());
                Entry entry = doc.getEntry(name);
                if (entry != null)
                {
                    // System.out.println("***** REMOVING ENTRY : " + entry.getName());
                    doc.removeEntryById(entry.getId());
                    PsmlManager.store(profile);
                }
            }
        }
        catch(Exception e)
View Full Code Here

                //System.out.println("Profile title: " + profile.getDocument().getPortlets().getTitle() + " for " + profile.getDocument().getPortlets());
                setRefreshPsmlFlag(rundata, TRUE);
            }
            else if (baseProfile != null)
            {
                PSMLDocument doc = baseProfile.getDocument();
                if (doc != null)
                {
                    Portlets portlets = doc.getPortlets();
                   
                    Portlets clonedPortlets = (Portlets) SerializationUtils.clone(portlets);
                    org.apache.jetspeed.util.PortletUtils.regenerateIds(clonedPortlets);
                    profile = Profiler.createProfile(locator, clonedPortlets);
          profile.getDocument().getPortlets().setTitle(title);
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.profile.PSMLDocument

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.