Package org.infoset.xml.util

Examples of org.infoset.xml.util.WriterItemDestination


            conf.getInterfaces().add(iface);
            conf.setKeyStorePath(keystoreFile);
            conf.setKeyStorePassword("atomojo");
            conf.setKeyPassword("atomojo");
            Writer w = new OutputStreamWriter(new FileOutputStream(confFile),"UTF-8");
            conf.store(confFile.toURI(),new WriterItemDestination(w,"UTF-8"));
            w.flush();
            w.close();
            if (!keystoreFile.exists()) {
               copyResource("/org/atomojo/auth/service/keystore",keystoreFile);
            }
View Full Code Here


         public void write(OutputStream os)
            throws IOException
         {
            setCharacterSet(CharacterSet.UTF_8);
            try {
               generate(storage,feed,myself,feedRef,resourceBase,new WriterItemDestination(new OutputStreamWriter(os,"UTF-8"),"UTF-8"));
            } catch (XMLException ex) {
               getContext().getLogger().log(Level.SEVERE,"Cannot serialize metadata feed.",ex);
               throw new IOException("Cannot serialize metadata feed: "+ex.getMessage());
            }
         }
View Full Code Here

            throws IOException
         {
            try {
               Iterator<SyncProcess> procs = db.getSyncProcesses();
               Writer out = new OutputStreamWriter(os,"UTF-8");
               ItemDestination dest = new WriterItemDestination(out,"UTF-8");
               ItemConstructor constructor = InfosetFactory.getDefaultInfoset().createItemConstructor();
               dest.send(constructor.createDocument());
               dest.send(constructor.createElement(AdminXML.NM_SYNC_PROCESSES));
               while (procs.hasNext()) {
                  SyncProcess proc = procs.next();
                  proc.marshall();
                  DocumentSource.generate(proc.getElement(),false,dest);
               }
               dest.send(constructor.createElementEnd(AdminXML.NM_SYNC_PROCESSES));
               dest.send(constructor.createDocumentEnd());
               out.flush();
               out.close();
            } catch (XMLException ex) {
               getContext().getLogger().log(Level.SEVERE,"Cannot get list of sync processes from DB: "+ex.getMessage(),ex);
               getResponse().setStatus(Status.SERVER_ERROR_INTERNAL,"Cannot get list of sync processes due to XML DB error.");
View Full Code Here

         }
      }
      OutputStream os = new FileOutputStream(authFile);
      Writer w = new OutputStreamWriter(os,"UTF-8");

      generate(new WriterItemDestination(w,"UTF-8"));
      w.flush();
      w.close();
      lastModified = authFile.lastModified();
      if (backupFile.exists()) {
         backupFile.delete();
View Full Code Here

            if (storageClassName!=null) {
               conf.setStorageClassName(storageClassName);
            }
            File serverConfFile = new File(dir,"server.conf");
            Writer out = new OutputStreamWriter(new FileOutputStream(serverConfFile),"UTF-8");
            WriterItemDestination dest = new WriterItemDestination(out,"UTF-8");
            conf.store(serverConfFile.toURI(),dest);
            out.flush();
            out.close();
            if (!keystoreFile.exists()) {
               copyResource("/org/atomojo/app/db/conf/keystore",keystoreFile);
View Full Code Here

         conf.getHosts().put(host.getName(),host);
         conf.setKeystoreFile(keystoreFile);
         conf.setKeystorePassword("atomojo");
         conf.setKeyPassword("atomojo");
         Writer out = new OutputStreamWriter(new FileOutputStream(serverConfFile),"UTF-8");
         WriterItemDestination dest = new WriterItemDestination(out,"UTF-8");
         conf.store(serverConfFile.toURI(),dest);
         out.flush();
         out.close();
         if (!keystoreFile.exists()) {
            Main.copyResource("/org/atomojo/app/db/conf/keystore",keystoreFile);
View Full Code Here

   public void write(OutputStream os)
      throws IOException
   {
      OutputStreamWriter w = new OutputStreamWriter(os,getCharacterSet().toString());
      try {
         WriterItemDestination dest = new WriterItemDestination(w,getCharacterSet().toString());
         ItemConstructor constructor = InfosetFactory.getDefaultInfoset().createItemConstructor();
         dest.send(constructor.createDocument());
         dest.send(constructor.createElement(root));
         while (iter.hasNext()) {
            DBObject obj = iter.next();
            if (obj instanceof XMLObject) {
               ((XMLObject)obj).generate(constructor,dest,contents);
            }
         }
         dest.send(constructor.createElementEnd(root));
         dest.send(constructor.createDocumentEnd());
      } catch (XMLException ex) {
         throw new IOException(ex.getMessage());
      }
      w.flush();
   }
View Full Code Here

            throws IOException
         {
            try {
               Iterator<RemoteApp> apps = db.getRemoteApps();
               Writer out = new OutputStreamWriter(os,"UTF-8");
               ItemDestination dest = new WriterItemDestination(out,"UTF-8");
               ItemConstructor constructor = InfosetFactory.getDefaultInfoset().createItemConstructor();
               dest.send(constructor.createDocument());
               dest.send(constructor.createElement(AdminXML.NM_APPS));
               while (apps.hasNext()) {
                  RemoteApp app = apps.next();
                  app.marshall();;
                  DocumentSource.generate(app.getElement(),false,dest);
               }
               dest.send(constructor.createElementEnd(AdminXML.NM_APPS));
               dest.send(constructor.createDocumentEnd());
               out.flush();
               out.close();
            } catch (XMLException ex) {
               getContext().getLogger().log(Level.SEVERE,"Cannot get list of remotes from DB: "+ex.getMessage(),ex);
               getResponse().setStatus(Status.SERVER_ERROR_INTERNAL,"Cannot get list of remotes due to XML DB error.");
View Full Code Here

            throws IOException
         {
            try {
               Iterator<SyncTarget> targets = db.getSyncTargets();
               Writer out = new OutputStreamWriter(os,"UTF-8");
               ItemDestination dest = new WriterItemDestination(out,"UTF-8");
               ItemConstructor constructor = InfosetFactory.getDefaultInfoset().createItemConstructor();
               dest.send(constructor.createDocument());
               dest.send(constructor.createElement(AdminXML.NM_TARGETS));
               while (targets.hasNext()) {
                  SyncTarget target = targets.next();
                  target.marshall();
                  DocumentSource.generate(target.getElement(),false,dest);
               }
               dest.send(constructor.createElementEnd(AdminXML.NM_TARGETS));
               dest.send(constructor.createDocumentEnd());
               out.flush();
               out.close();
            } catch (XMLException ex) {
               getContext().getLogger().log(Level.SEVERE,"Cannot get list of targets from DB: "+ex.getMessage(),ex);
               getResponse().setStatus(Status.SERVER_ERROR_INTERNAL,"Cannot get list of targets due to XML DB error.");
View Full Code Here

      throws IOException
   {
      if (obj instanceof XMLObject) {
         OutputStreamWriter w = new OutputStreamWriter(os,getCharacterSet().toString());
         try {
            WriterItemDestination dest = new WriterItemDestination(w,getCharacterSet().toString());
            ItemConstructor constructor =InfosetFactory.getDefaultInfoset().createItemConstructor();
            dest.send(constructor.createDocument());
            ((XMLObject)obj).generate(constructor, dest,contents);
            dest.send(constructor.createDocumentEnd());
         } catch (XMLException ex) {
            throw new IOException(ex.getMessage());
         }
         w.flush();
      }
View Full Code Here

TOP

Related Classes of org.infoset.xml.util.WriterItemDestination

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.