Examples of DelegatingHandler


Examples of de.danet.an.util.sax.DelegatingHandler

     */
    public void scopedParse2() throws Exception {
  final Set outerTags = new HashSet();
  final Set innerTags = new HashSet();
  XMLReader reader = getReader();
  DelegatingHandler dh = new DelegatingHandler () {
    public void startElement
        (String uri, String localName, String qName,
         Attributes atts) throws SAXException {
        outerTags.add (qName);
        super.startElement (uri, localName, qName, atts);
    }
      };
  dh.addHandler ("http://www.wfmc.org/2002/XPDL1.0",
           "TransitionRestrictions", SubHandler.class);
  HandlerStack stack = new HandlerStack (reader, dh);
  stack.setContextData ("innerTags", innerTags);
  reader.parse
      (new InputSource
View Full Code Here

Examples of de.danet.an.util.sax.DelegatingHandler

     */
    public void scopedParse3() throws Exception {
  final Set outerTags = new HashSet();
  final Set innerTags = new HashSet();
  XMLReader reader = getReader();
  DelegatingHandler dh = new DelegatingHandler () {
    public void startElement
        (String uri, String localName, String qName,
         Attributes atts) throws SAXException {
        outerTags.add (qName);
        super.startElement (uri, localName, qName, atts);
    }
      };
  dh.addHandler
      ("{http://www.wfmc.org/2002/XPDL1.0}Activity"
       + "/{http://www.wfmc.org/2002/XPDL1.0}TransitionRestrictions",
       SubHandler.class);
  HandlerStack stack = new HandlerStack (reader, dh);
  stack.setContextData ("innerTags", innerTags);
View Full Code Here

Examples of de.danet.an.util.sax.DelegatingHandler

     */
    public void scopedParse4() throws Exception {
  final Set outerTags = new HashSet();
  final Set innerTags = new HashSet();
  XMLReader reader = getReader();
  DelegatingHandler dh = new DelegatingHandler () {
    public void startElement
        (String uri, String localName, String qName,
         Attributes atts) throws SAXException {
        outerTags.add (qName);
        super.startElement (uri, localName, qName, atts);
    }
      };
  dh.addHandler
      ("/{http://www.wfmc.org/2002/XPDL1.0}Package"
       + "/{http://www.wfmc.org/2002/XPDL1.0}WorkflowProcesses"
       + "/{http://www.wfmc.org/2002/XPDL1.0}WorkflowProcess"
       + "/{http://www.wfmc.org/2002/XPDL1.0}Activities"
       + "/{http://www.wfmc.org/2002/XPDL1.0}Activity"
View Full Code Here

Examples of de.danet.an.util.sax.DelegatingHandler

  final String dfRelPath = "/{" + XPDLUtil.XPDL_NS + "}DataFields";
  final String partiRelPath
      = "/{" + XPDLUtil.XPDL_NS + "}Participants"
      + "/{" + XPDLUtil.XPDL_NS + "}Participant";
  try {
      DelegatingHandler dh = new MyDelegatingHandler ();
      processHeader = new DefaultProcessHeader();
      dh.addHandler
    (packagePath + "/{" + XPDLUtil.XPDL_NS + "}PackageHeader",
     ((DefaultPackageHeader)processHeader.packageHeader())
     .saxInitializer());
      dh.addHandler
    (processPath + "/{" + XPDLUtil.XPDL_NS + "}ProcessHeader",
     ((DefaultProcessHeader)processHeader).saxInitializer());
      dh.addHandler
    (packagePath + "/{" + XPDLUtil.XPDL_NS + "}RedefinableHeader",
     ((DefaultProcessHeader)processHeader).saxInitializer());
      dh.addHandler
    (processPath + "/{" + XPDLUtil.XPDL_NS + "}RedefinableHeader",
     ((DefaultProcessHeader)processHeader).saxInitializer());
      StackedHandler dfh = new SAXDataFieldHandler ();
      contextSignature = new DefaultProcessDataInfo();
      dh.addHandler (packagePath + dfRelPath, dfh);
      dh.addHandler (processPath + dfRelPath, dfh);
      resultSignature = new DefaultProcessDataInfo();
      dh.addHandler
    (processPath + "/{" + XPDLUtil.XPDL_NS + "}FormalParameters",
     new SAXFormalParameterHandler ());
      participants = new HashMap();
      dh.addHandler (packagePath + partiRelPath,
         DefaultParticipant.SAXInitializer.class);
      dh.addHandler (processPath + partiRelPath,
         DefaultParticipant.SAXInitializer.class);
      StackedHandler extAttrHandler = new SAXExtAttrHandler ();
      dh.addHandler (packagePath + extAttrRelPath, extAttrHandler);
      dh.addHandler (processPath + extAttrRelPath, extAttrHandler);
      applications = new HashMap ();
      HandlerStack hs = new HandlerStack (dh);
      procDef.emit(hs.contentHandler(), null);
      for (Iterator i = applications().iterator(); i.hasNext();) {
          ApplicationDefinition applDef
View Full Code Here

Examples of org.jboss.virtual.plugins.context.DelegatingHandler

            {
               boolean useCopyMode = forceCopy;
               if (useCopyMode == false)
                  useCopyMode = getAggregatedOptions().getBooleanOption(VFSUtils.USE_COPY_QUERY);

               DelegatingHandler delegator;

               if (useCopyMode)
               {
                  File dest = null;
                  String entryName = ent.getName();
                  String path = null;

                  VFSContext context = getPeerContext();
                  if (context != null)
                  {
                     path = getPath(context, entryName);
                     TempInfo ti = context.getTempInfo(path);
                     if (ti != null && ti.isValid())
                     {
                        dest = ti.getTempFile();
                     }
                  }

                  boolean createNewTempInfo = (dest == null || dest.exists() == false);

                  if (createNewTempInfo)
                  {
                     // extract it to temp dir
                     String tempName = getTempFileName(entryName);
                     TempStore store = (context != null) ? context.getTempStore() : null;
                     if (store != null)
                     {
                        File tempDir = store.createTempFolder(zipSource.getName(), ent.getName());
                        if (tempDir != null)
                           dest = new File(tempDir, tempName);
                     }
                     if (dest == null)
                        dest = new File(getTempDir() + "/" + tempName);
                     dest.deleteOnExit();

                     if (trace)
                     {
                        StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
                        log.trace("Dest: " + dest + ", Stack-trace:\n" + Arrays.toString(stackTraceElements));
                     }

                     // ensure parent exists
                     dest.getParentFile().mkdirs();

                     InputStream is = zipSource.openStream(new DefaultZipEntryInfo(ent));
                     OutputStream os = new BufferedOutputStream(new FileOutputStream(dest));
                     VFSUtils.copyStreamAndClose(is, os);
                  }

                  // mount another instance of ZipEntryContext
                  delegator = mountZipFile(parent, name, dest);

                  if (context != null && path != null && createNewTempInfo)
                     context.addTempInfo(new ZipEntryTempInfo(path, dest, delegator, this));
               }
               else
               {
                  // mount another instance of ZipEntryContext
                  delegator = mountZipStream(parent, name, zipSource.openStream(new DefaultZipEntryInfo(ent)));
               }

               entries.put(delegator.getLocalPathName(), new EntryInfo(delegator, ent));
               addChild(parent, delegator);
            }
            else
            {
               ZipEntryHandler wrapper = new ZipEntryHandler(this, parent, name, ent.isDirectory() == false);
View Full Code Here

Examples of org.jboss.virtual.plugins.context.DelegatingHandler

    * @throws IOException for any error
    * @throws URISyntaxException for any URI syntax error
    */
   protected DelegatingHandler mountZipFile(VirtualFileHandler parent, String name, File file) throws IOException, URISyntaxException
   {
      DelegatingHandler delegator = new DelegatingHandler(this, parent, name);
      URL fileUrl = file.toURI().toURL();
      URL delegatorUrl = fileUrl;

      if (parent != null)
         delegatorUrl = getChildURL(parent, name);

      delegatorUrl = setOptionsToURL(delegatorUrl);
      ZipEntryContext ctx = new ZipEntryContext(delegatorUrl, delegator, fileUrl, true);

      VirtualFileHandler handler = ctx.getRoot();
      delegator.setDelegate(handler);

      return delegator;
   }
View Full Code Here

Examples of org.jboss.virtual.plugins.context.DelegatingHandler

    * @throws IOException for any error
    * @throws URISyntaxException for any URI syntax error
    */
   protected DelegatingHandler mountZipStream(VirtualFileHandler parent, String name, InputStream zipStream) throws IOException, URISyntaxException
   {
      DelegatingHandler delegator = new DelegatingHandler(this, parent, name);
      long lastModified = (parent != null) ? parent.getLastModified() : System.currentTimeMillis();
      ZipStreamWrapper wrapper = new ZipStreamWrapper(zipStream, name, lastModified);

      URL delegatorUrl = null;

      if (parent != null)
         delegatorUrl = getChildURL(parent, name);

      delegatorUrl = setOptionsToURL(delegatorUrl);
      ZipEntryContext ctx = new ZipEntryContext(delegatorUrl, delegator, wrapper, false);

      VirtualFileHandler handler = ctx.getRoot();
      delegator.setDelegate(handler);

      return delegator;
   }
View Full Code Here

Examples of org.jboss.virtual.plugins.context.DelegatingHandler

   {
      ensureEntries();
      ZipEntryContextInfo parentEntry = entries.get(parent.getLocalPathName());
      if (parentEntry != null)
      {
         DelegatingHandler newOne;

         if (replacement instanceof DelegatingHandler)
         {
            newOne = (DelegatingHandler) replacement;
         }
View Full Code Here

Examples of org.jboss.virtual.plugins.context.DelegatingHandler

      VFSContextFactory factory = VFSContextFactoryLocator.getFactory(linkURI);
      VFSContext context = factory.getVFS(linkURI);
      VirtualFileHandler rootHandler = context.getRoot();
      // Wrap the handler in a delegate so we can change the parent and name
      // TODO: if the factory caches contexts the root handler may not point to the link
      return new DelegatingHandler(this.getVFSContext(), parent, name, rootHandler);
   }
View Full Code Here

Examples of org.jboss.virtual.plugins.context.DelegatingHandler

    * @throws IOException for any error
    * @throws URISyntaxException for any URI syntax error
    */
   protected DelegatingHandler mountZipFS(VirtualFileHandler parent, String name, File file) throws IOException, URISyntaxException
   {
      DelegatingHandler delegator = new DelegatingHandler(this, parent, name);
      URL fileUrl = file.toURI().toURL();
      URL delegatorUrl = fileUrl;

      if (parent != null)
         delegatorUrl = getChildURL(parent, name);

      delegatorUrl = setOptionsToURL(delegatorUrl);
      ZipEntryContext ctx = new ZipEntryContext(delegatorUrl, delegator, fileUrl);

      VirtualFileHandler handler = ctx.getRoot();
      delegator.setDelegate(handler);

      return delegator;
   }
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.