Examples of SerializationManager


Examples of org.apache.sling.ide.serialization.SerializationManager

  public void createChild(final String childNodeName, final String childNodeType) {
      String thisNodeType = getPrimaryType();
      final SerializationKind parentSk = getSerializationKind(thisNodeType);
        final SerializationKind childSk = getSerializationKind(childNodeType);

        final SerializationManager serializationManager = Activator.getDefault().getSerializationManager();
     
      if (parentSk==SerializationKind.METADATA_FULL) {
          createDomChild(childNodeName, childNodeType);
      } else if (parentSk==SerializationKind.FILE) {
            throw new IllegalStateException("cannot create child of nt:file");
      } else if (childSk==SerializationKind.FOLDER) {
            IWorkspaceRunnable r = new IWorkspaceRunnable() {

                @Override
                public void run(IProgressMonitor monitor) throws CoreException {
                    IFolder newFolder = prepareCreateFolderChild(childNodeName);
                    if (parentSk==SerializationKind.METADATA_PARTIAL) {
                        // when the parent is partial and we're creating a folder here,
                        // then we're running into a SLING-3639 type of problem
                        // the way around this is to make a 'pointer' in the 'root'
                        // .content.xml, and have a directory structure leaving to
                        // the new node, together with a .content.xml describing
                        // the type (unless it's a nt:folder that is)
                       
                        // 1) 'pointer' in the 'root .content.xml'
                        createDomChild(childNodeName, null);
                       
                        // 2) directory structure is created above already
                        // 3) new .content.xml is done below
                    }
                    if (!childNodeType.equals("nt:folder")) {
                        createVaultFile(newFolder, ".content.xml", childNodeType);
                    }
                }
            };
         
          try {
              ResourcesPlugin.getWorkspace().run(r, null);
              if (childNodeType.equals("nt:folder") && parentSk==SerializationKind.FOLDER) {
                  // trigger a publish, as folder creation is not propagated to
                  // the SlingLaunchpadBehavior otherwise
                  //TODO: make configurable? Fix in Eclipse/WST?
                  ServerUtil.triggerIncrementalBuild((IFolder)resource, null);
              }
          } catch (CoreException e) {
              Activator.getDefault().getPluginLogger().error("Error creating child "+childNodeName+": "+e, e);
              e.printStackTrace();
              MessageDialog.openError(Display.getDefault().getActiveShell(), "Error creating node", "Error creating child of "+thisNodeType+" with type "+childNodeType+": "+e);
              return;
          }
        } else if ((parentSk == SerializationKind.FOLDER || parentSk == SerializationKind.METADATA_PARTIAL)
                && childSk == SerializationKind.METADATA_FULL) {
            createVaultFile((IFolder) resource, serializationManager.getOsPath(childNodeName) + ".xml", childNodeType);
      } else if (parentSk==SerializationKind.FOLDER && childSk==SerializationKind.METADATA_PARTIAL) {
//          createVaultFile((IFolder)resource, childNodeName+".xml", childNodeType);

            IWorkspaceRunnable r = new IWorkspaceRunnable() {

                @Override
                public void run(IProgressMonitor monitor) throws CoreException {
                    IFolder f = (IFolder)resource;
                    IFolder newFolder = null;
                    newFolder = f.getFolder(serializationManager.getOsPath(childNodeName));
                    newFolder.create(true, true, new NullProgressMonitor());
                    createVaultFile(newFolder, ".content.xml", childNodeType);
                }
            };
           
View Full Code Here

Examples of org.jboss.remoting.serialization.SerializationManager

         return inputStream;
      }
      else
      {
         BufferedInputStream bis = new BufferedInputStream(inputStream);
         SerializationManager manager = SerializationStreamFactory.getManagerInstance(getSerializationType());
         return manager.createInput(bis, customClassLoader);
      }
     
   }
View Full Code Here

Examples of org.jboss.remoting.serialization.SerializationManager

      //EOS intercepts the close() call and does not close the stream
      EncryptionOutputStream eos = new EncryptionOutputStream(output);
      
      CipherOutputStream cos = new CipherOutputStream(eos, cipher);
      
      SerializationManager sm = SerializationStreamFactory.getManagerInstance(getSerializationType());
      ObjectOutputStream oos = sm.createOutput(cos);
     
      if(wrappedMarshaller != null)
      {
         if (wrappedMarshaller instanceof VersionedMarshaller)
            ((VersionedMarshaller) wrappedMarshaller).write(dataObject, oos, version);
View Full Code Here

Examples of org.jboss.remoting.serialization.SerializationManager

   public Object read(InputStream inputStream, Map metadata, int version) throws IOException, ClassNotFoundException
  
      if(cipher == null)
         throw new IllegalStateException("Cipher is null for algo="+ this.cipherAlgorithm);
      CipherInputStream cis = new CipherInputStream(inputStream,cipher);
      SerializationManager sm = SerializationStreamFactory.getManagerInstance(getSerializationType());
      ObjectInputStream ois = sm.createRegularInput(cis);
      
      Object obj = null;
      if(wrappedUnMarshaller != null)
      {
         if (wrappedUnMarshaller instanceof VersionedUnMarshaller)
View Full Code Here

Examples of org.jboss.remoting.serialization.SerializationManager

      {
         gzis = new SelfCleaningGZipInputStream(inputStream);
         bis = new DecomposableBufferedInputStream(gzis);
      }

      SerializationManager manager = SerializationStreamFactory.getManagerInstance(getSerializationType());
      ObjectInputStream ois =  manager.createRegularInput(bis);

      try
      {
         if(wrappedUnMarshaller != null)
         {
View Full Code Here

Examples of org.jboss.remoting.serialization.SerializationManager

              
               if (rmiOnewayMarshalling)
               {
                  // Legacy treatment, pre 2.4.0.
                  ByteArrayInputStream bais = new ByteArrayInputStream(byteOut.toByteArray());
                  SerializationManager manager = SerializationStreamFactory.getManagerInstance(getSerializationType());
                  ObjectInputStream ois = manager.createInput(bais, getClassLoader());

                  try
                  {
                     byteOut.close();
                     payload = ois.readObject();
View Full Code Here

Examples of org.jboss.remoting.serialization.SerializationManager

            ByteArrayInputStream is = null;
            if (rmiOnewayMarshalling)
            {
               // Legacy treatment, pre 2.4.0
               ByteArrayOutputStream baos = new ByteArrayOutputStream();
               SerializationManager manager = SerializationStreamFactory.getManagerInstance(getSerializationType());
               ObjectOutputStream oos = manager.createOutput(baos);
               oos.writeObject(payload);
               oos.flush();
               oos.close();
               is = new ByteArrayInputStream(baos.toByteArray());
            }
View Full Code Here

Examples of org.jboss.remoting.serialization.SerializationManager

         return inputStream;
      }
      else
      {
         BufferedInputStream bis = new BufferedInputStream(inputStream);
         SerializationManager manager = SerializationStreamFactory.getManagerInstance(getSerializationType());
         return manager.createInput(bis, customClassLoader);
      }
     
   }
View Full Code Here

Examples of org.jboss.remoting.serialization.SerializationManager

         return outputStream;
      }
      else
      {
         BufferedOutputStream bos = new BufferedOutputStream(outputStream);
         SerializationManager manager = SerializationStreamFactory.getManagerInstance(getSerializationType());
         ObjectOutputStream oos = manager.createOutput(bos);
         oos.flush();
         return oos;
      }
   }
View Full Code Here

Examples of org.jboss.remoting.serialization.SerializationManager

            ByteArrayInputStream is = null;
            if (rmiOnewayMarshalling)
            {
               // Legacy treatment, pre 2.4.0
               ByteArrayOutputStream baos = new ByteArrayOutputStream();
               SerializationManager manager = SerializationStreamFactory.getManagerInstance(getSerializationType());
               ObjectOutputStream oos = manager.createOutput(baos);
               writeObject(oos, payload);
               oos.flush();
               oos.close();
               is = new ByteArrayInputStream(baos.toByteArray());
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.