Examples of Archive


Examples of SmartGen.Archive

        if (result == null) result = caseConfigurableElement(folder);
        if (result == null) result = defaultCase(theEObject);
        return result;
      }
      case SmartGenPackage.ARCHIVE: {
        Archive archive = (Archive)theEObject;
        Object result = caseArchive(archive);
        if (result == null) result = casePackage(archive);
        if (result == null) result = caseFile(archive);
        if (result == null) result = caseData(archive);
        if (result == null) result = caseValue(archive);
View Full Code Here

Examples of co.cask.cdap.app.program.Archive

      Preconditions.checkArgument(mainClassName != null && !mainClassName.isEmpty(),
                                  "Main class attribute cannot be empty");

      File unpackedJarDir = Files.createTempDir();
      try {
        Object appMain = new Archive(BundleJarUtil.unpackProgramJar(archive, unpackedJarDir),
                                                                  mainClassName).getMainClass().newInstance();
        if (!(appMain instanceof Application)) {
          throw new IllegalStateException(String.format("Application main class is of invalid type: %s",
                                                        appMain.getClass().getName()));
        }
View Full Code Here

Examples of com.adobe.epubcheck.util.Archive

    if(!parent.exists() || !parent.isDirectory())
      throw new InvalidParameterException(parent.getAbsolutePath());
       
    boolean hadError = false;
    for(File epubDir : parent.listFiles(dirFilter)) {
      Archive epub = new Archive(epubDir.getAbsolutePath(), false);
      epub.createArchive();
      Report report = new DefaultReportImpl(epub.getEpubName());
      EpubCheck check = new EpubCheck(epub.getEpubFile(), report);
      if (check.validate()) {
        System.out.println(Messages.NO_ERRORS__OR_WARNINGS);
        String name = epub.getEpubName();
        name = name.replace(".epub", "-"+now+".epub");
        epub.getEpubFile().renameTo(new File(buildDir,name));
      } else {
        hadError = true;
        System.err.println(Messages.THERE_WERE_ERRORS);
      }
    }
View Full Code Here

Examples of com.github.junrar.Archive

        .println("usage: java -jar extractArchive.jar <thearchive> <the destination directory>");
  }
    }

    public static void extractArchive(File archive, File destination) {
  Archive arch = null;
  try {
      arch = new Archive(archive);
  } catch (RarException e) {
      logger.error(e);
  } catch (IOException e1) {
      logger.error(e1);
  }
  if (arch != null) {
      if (arch.isEncrypted()) {
    logger.warn("archive is encrypted cannot extreact");
    return;
      }
      FileHeader fh = null;
      while (true) {
    fh = arch.nextFileHeader();
    if (fh == null) {
        break;
    }
    if (fh.isEncrypted()) {
        logger.warn("file is encrypted cannot extract: "
          + fh.getFileNameString());
        continue;
    }
    logger.info("extracting: " + fh.getFileNameString());
    try {
        if (fh.isDirectory()) {
      createDirectory(fh, destination);
        } else {
      File f = createFile(fh, destination);
      OutputStream stream = new FileOutputStream(f);
      arch.extractFile(fh, stream);
      stream.close();
        }
    } catch (IOException e) {
        logger.error("error extracting the file", e);
    } catch (RarException e) {
View Full Code Here

Examples of com.github.junrar.Archive

    if(s.equalsIgnoreCase("rar")){
      System.out.println(file.toString());
      ReadOnlyAccessFile readFile = null;
      try {
//        readFile = new ReadOnlyAccessFile(file);
        Archive arc = null;
        try {
          arc = new Archive(file);
        } catch (RarException e) {
          logger.error("archive consturctor error",e);
          errorFiles.add(file.toString());
          return;
        }
        if(arc != null){
          if(arc.isEncrypted()){
            logger.warn("archive is encrypted cannot extreact");
            unsupportedFiles.add(file.toString());
            return;
          }
          List<FileHeader> files = arc.getFileHeaders();
          for(FileHeader fh : files)
          {
            if(fh.isEncrypted()){
              logger.warn("file is encrypted cannot extract: "+fh.getFileNameString());
              unsupportedFiles.add(file.toString());
              return;
            }
            logger.info("extracting file: "+fh.getFileNameString());
            if(fh.isFileHeader() && fh.isUnicode()){
              logger.info("unicode name: "+fh.getFileNameW());
            }
            logger.info("start: "+new Date());
           
            ByteArrayOutputStream os = new ByteArrayOutputStream();
           
           
            try {
              arc.extractFile(fh, os);
            } catch (RarException e) {
              if(e.getType().equals(RarExceptionType.notImplementedYet)){
                logger.error("error extracting unsupported file: "+fh.getFileNameString(),e);
                unsupportedFiles.add(file.toString());
                return;
View Full Code Here

Examples of com.github.junrar.Archive

  public void init() throws FileSystemException {
    super.init();

    try {
      try {
        archive = new Archive(new VFSVolumeManager(parentLayer));
        // Build the index
        List<RARFileObject> strongRef = new ArrayList<RARFileObject>(
            100);
        for (final FileHeader header : archive.getFileHeaders()) {
          AbstractFileName name = (AbstractFileName) getFileSystemManager()
View Full Code Here

Examples of com.m11n.android.model.Archive

    for(int k=0; k<children.getLength(); k++)
    {
      Node archiveNode = children.item(k);
      NodeList archiveNodeChildren = archiveNode.getChildNodes();
     
      Archive archive = new Archive();
      boolean propertySet = false;
     
      NamedNodeMap attributes = archiveNode.getAttributes();
     
      if(attributes!=null)
      {
        for(int j=0; j<attributes.getLength(); j++)
        {
          Node attribute = attributes.item(j);
         
          if(Archive.OS.equals(attribute.getNodeName()))
          {
            archive.setOs(attribute.getTextContent());
            propertySet = true;
          }
          else if(Archive.ARCH.equals(attribute.getNodeName()))
          {
            archive.setArchitecture(attribute.getTextContent());
            propertySet = true;
          }
        }
      }
     
      for(int i=0; i<archiveNodeChildren.getLength(); i++)
      {
        Node node = archiveNodeChildren.item(i);
       
        if(Archive.CHECKSUM.equals(node.getNodeName()))
        {
          archive.setChecksum(node.getTextContent());
         
          archive.setChecksumType(node.getAttributes().getNamedItem(Archive.TYPE).getTextContent());
          propertySet = true;
        }
        else if(Archive.SIZE.equals(node.getNodeName()))
        {
          String value = node.getTextContent();
         
          if(value!=null)
          {
            archive.setSize(Integer.valueOf(value));
            propertySet = true;
          }
        }
        if(Archive.URL.equals(node.getNodeName()))
        {
          archive.setUrl(node.getTextContent());
          propertySet = true;
        }
      }

      if(propertySet)
View Full Code Here

Examples of com.sun.enterprise.admin.servermgmt.xml.stringsubs.Archive

     */
    private void extract() throws IOException {
        for(Object object : _archive.getArchiveOrMemberEntry()) {
            String extratFilePath = _extractDir.getAbsolutePath() + File.separator;
            if (object instanceof Archive) {
                Archive archive = (Archive)object;
                File file = new File(extratFilePath + archive.getName());
                try {
                    extractEntry(archive.getName(), file);
                } catch (IllegalArgumentException e) {
                    continue;
                }
                _extractedEntries.put(archive.getName(), file);
                new ArchiveEntryWrapperImpl(archive, extratFilePath, this);
                _noOfExtractedEntries.incrementAndGet();
            } else if (object instanceof MemberEntry) {
                MemberEntry entry = (MemberEntry)object;
                File file = new File(extratFilePath + entry.getName());
View Full Code Here

Examples of com.sun.enterprise.deployment.deploy.shared.Archive

            serverId.getPassword(), module);
    }

    public void run() {
        ConnectionSource dasConnection= (ConnectionSource) args[0];
        Archive deployArchive = (Archive) args[1];
        Archive deployPlan = (Archive) args[2];
        Map deployOptions = (Map) args[3];
        SunTarget[] targetList = (SunTarget[]) args[4];
        SunTarget domain = (SunTarget) args[5];
        boolean isLocalConnectionSource = ((Boolean) args[6]).booleanValue();
        ServerConnectionIdentifier serverId =
            (ServerConnectionIdentifier) args[7];
        Object archiveUploadID = null;
        Object planUploadID = null;
        Map deployedTargets = null;
        Object deployActionID = null;
        boolean isDirectoryDeploy = false;
        boolean isRedeploy = false;

        //Make sure the file permission is correct when deploying a file
        //Note that if using JSR88 deploying from InputStream, the
        //deployArchive.getArchiveUri() would be null, and not directory
        //deploy
        if (deployArchive == null) {
            setupForAbnormalExit(localStrings.getString("enterprise.deployment.client.archive_not_specified"), domain);
            return;                           
        }
        if (deployArchive.getURI() != null) {
           
            File tmpFile = new File(deployArchive.getURI().getPath());
            if(!tmpFile.exists()) {
                setupForAbnormalExit(localStrings.getString("enterprise.deployment.client.archive_not_in_location"), domain);
                return;               
            }
            if(!tmpFile.canRead()) {
                setupForAbnormalExit(localStrings.getString("enterprise.deployment.client.archive_no_read_permission"), domain);
                return;
            }
            if (tmpFile.isDirectory()) {
                isDirectoryDeploy = true;
            }
        }
       
        try {
            // Get the module ID
            this.moduleID = (String)deployOptions.get(DeploymentProperties.DEPLOY_OPTION_NAME_KEY);
            boolean isModuleDeployed = isModuleDeployed(dasConnection, moduleID);
            // for redeploy, force should be true - enforce it here it self
            if(("false".equals(deployOptions.get(DeploymentProperties.DEPLOY_OPTION_FORCE_KEY))) &&
               (isModuleDeployed) ) {
                setupForAbnormalExit(localStrings.getString("enterprise.deployment.client.deploy_error_module_exists"), domain);
                return;
            }

            deplMgr = ProxyFactory.getInstance(dasConnection).getDomainRoot().getDeploymentMgr();
           
            /**
             * If there is only one target and that target is a stand alone server target, set WSDL_TARGET_HINT
             * in options to enable WSDL generation with the target's host and port. Refer to bug 6157923 for more info
             */
            if( (targetList.length == 1) &&  (TargetType.STAND_ALONE_SERVER.equals(targetList[0].getTargetType())) && !("server".equals(targetList[0].getName())) ) {
                deployOptions.put(DeploymentProperties.WSDL_TARGET_HINT, targetList[0].getName());
            }

            // Do redeploy if force=true and the module is already deployed
            if( ("true".equals(deployOptions.get(DeploymentProperties.DEPLOY_OPTION_FORCE_KEY))) &&
                (isModuleDeployed) ) {
                isRedeploy = true;

                // Get list of all targets on which this module is already deployed
                deployedTargets = DeploymentClientUtils.getDeployedTargetList(dasConnection, moduleID);
             
                // Check if any of the specified targets is not part of the deployed target list
                // If so, it means user has to use create-app-ref and not redeploy; flag error
                if(DeploymentClientUtils.isNewTarget(deployedTargets, targetList)) {
                    setupForAbnormalExit(localStrings.getString("enterprise.deployment.client.useCreateAppRef",
                                        moduleID), domain);                   
                }
               
                // if there is already app ref associated with this app
                if (deployedTargets.size() > 0) {
                    // if it's redeploy to domain, then it's equivalent
                    // to redeploy to all targets
                    if ((TargetType.DOMAIN.equals(targetList[0].getName()))) {
                        DeploymentFacility deploymentFacility;
                        if(isLocalConnectionSource) {
                            deploymentFacility = DeploymentFacilityFactory.getLocalDeploymentFacility();
                        } else {
                            deploymentFacility = DeploymentFacilityFactory.getDeploymentFacility();
                        }
                        deploymentFacility.connect(
                            targetList[0].getConnectionInfo());
                        Set nameSet = deployedTargets.keySet();
                        String[] targetNames = (String[])nameSet.toArray(
                            new String[nameSet.size()]);
                        Target[] targetList2 =
                            deploymentFacility.createTargets(targetNames);
                        if (targetList2 == null) {
                            setupForAbnormalExit(localStrings.getString("enterprise.deployment.client.createTargetsFailed"), domain);
                            return;
                        }
                        targetList = new SunTarget[targetList2.length];
                        for (int ii = 0; ii < targetList2.length; ii++) {
                            targetList[ii] = (SunTarget)targetList2[ii];
                        }
                    }
                    // if all targets on which the app is deployed is not
                    // given, return error
                    else if (!DeploymentClientUtils.isTargetListComplete(
                        deployedTargets, targetList)) {
                        setupForAbnormalExit(
                           localStrings.getString("enterprise.deployment.client.specifyAllTargets", moduleID, "redeploy"),
                           domain);
                        return;
                    }

                    // Stop all apps;
                    Map options = new HashMap();
                    options.putAll(deployOptions);
                    options.put(DeploymentProperties.REDEPLOY, Boolean.toString(isModuleDeployed));
                    RollBackAction undeplRollback = new RollBackAction(RollBackAction.DELETE_APP_REF_OPERATION,
                                                                moduleID, deployOptions);
                    for(int i=0; i<targetList.length; i++) {
                        options.put(DeploymentProperties.DEPLOY_OPTION_CASCADE_KEY, "true");

                        // We dont rollback for stop failure because the failure may be because of server being down
                        // We just add DeploymentStatus of this phase to the complete DeploymentStatus
                       
                        DeploymentClientUtils.setResourceOptions(
                            options,
                            DeploymentProperties.RES_UNDEPLOYMENT,
                            targetList[i].getName());
                        DeploymentStatus stat =
                            DeploymentClientUtils.stopApplication(
                                dasConnection.getExistingMBeanServerConnection(),
                                moduleID, targetList[i], options);
                        if (!checkStatusAndAddStage(targetList[i], null, localStrings.getString("enterprise.deployment.client.redeploy_stop", targetList[i].getName()) , dasConnection, stat)) {
                            return;
                        }
                       
                        // del-app-ref from all targets
                        options.put(DeploymentProperties.DEPLOY_OPTION_CASCADE_KEY, "false");
                        // set enable flag of options as per state of the app
                        // before redeploy
                        options.put(DeploymentProperties.DEPLOY_OPTION_ENABLE_KEY, deployedTargets.get(targetList[i].getName()).toString());
                        stat = DeploymentClientUtils.deleteApplicationReference(
                                dasConnection.getExistingMBeanServerConnection(),
                                moduleID, targetList[i], options);
                        if(!checkStatusAndAddStage(targetList[i], undeplRollback, localStrings.getString("enterprise.deployment.client.redeploy_remove_ref", targetList[i].getName()), dasConnection, stat)) {
                            return;
                        }
                        undeplRollback.addTarget(targetList[i], RollBackAction.APP_REF_DELETED);
                    }
                }
            }

            // Get a deploy ID
            deployActionID = deplMgr.initDeploy();
           
            // Make a copy of deployOptions and set the ENABLE flag in this copy to true
            // This is so that the enabled flag during deploy-to-domain is always true
            // This might need to be replaced with an efficient logic to look up the current enabled flag
            // using AMX
            Map dupOptions = new HashMap();
            dupOptions.putAll(deployOptions);
            dupOptions.put(DeploymentProperties.DEPLOY_OPTION_ENABLE_KEY, Boolean.TRUE.toString());
            dupOptions.put(DeploymentProperties.REDEPLOY, Boolean.toString(isModuleDeployed));
    
            // if deploy to "domain" or redeploy to "domain" with no
            // existing application-ref
            if ((TargetType.DOMAIN.equals(targetList[0].getName()))) {
                if (isRedeploy) {
                    DeploymentClientUtils.setResourceOptions(
                        dupOptions,
                        DeploymentProperties.RES_REDEPLOYMENT,
                        targetList);
                } else {
                    DeploymentClientUtils.setResourceOptions(
                        dupOptions,
                        DeploymentProperties.RES_DEPLOYMENT,
                        targetList);
                }
            } else {
                DeploymentClientUtils.setResourceOptions(
                    dupOptions,
                    DeploymentProperties.RES_NO_OP,
                    targetList);
            }
           
            // Now start a fresh deploy in domain
            // upload file only if this not a directory deploy AND it is not a local connection source (not from gui)
           
            String uploadProp = (String) deployOptions.get(DeploymentProperties.UPLOAD);
            boolean upload = new Boolean((uploadProp != null) ? uploadProp : DeploymentProperties.DEFAULT_UPLOAD).booleanValue();
            if(!isDirectoryDeploy && !isLocalConnectionSource && upload) {
                // upload the archive

                long startTime = System.currentTimeMillis();
                long endTime = startTime;

                // we use jmx upload for following scenarios:
                // 1. for secure connection: https
                // 2. if the JMX_UPLOAD_CHUNK_SIZE system property is set
                // 3. if the HTTP_PROXYHOST system property is set
          if ( serverId.isSecure() ||
                     (jmxUploadChunkSizeProp != null &&
                      jmxUploadChunkSizeProp.length() > 0) ||
                     (httpProxyHostProp != null &&
                      httpProxyHostProp.length() > 0) ){
                    // using jmx
                    archiveUploadID = uploadArchive(deployArchive);
                   
                    // If there is a plan, upload the plan
                    if (deployPlan != null){
                        if (deployPlan.getURI()!=null) {
                            File f = new File(deployPlan.getURI().getPath());
                            if (f.length()!= 0) {
                                planUploadID = uploadArchive(deployPlan);
                            }
                        }
                    }

                    endTime = System.currentTimeMillis();

                    // Call DeploymentMgr to start deploy
                    deplMgr.startDeploy(deployActionID, archiveUploadID, planUploadID, dupOptions);
                } else {
                    // using http
                    String archivePath = uploadArchiveOverHTTP(serverId,
                        deployArchive);
                    DeploymentSourceImpl archiveSource =
                        new DeploymentSourceImpl(archivePath, true,
                            new String[1], new String[1], new String[1],
                            new HashMap());

                    String planPath = null;
                    DeploymentSourceImpl planSource = null;

                    // If there is a plan, upload the plan
                    if (deployPlan != null){
                        if (deployPlan.getURI()!=null){
                            File f = new File(deployPlan.getURI().getPath());
                            if (f.length()!= 0) {
                                planPath = uploadArchiveOverHTTP(serverId, deployPlan);
                                planSource =
                                    new DeploymentSourceImpl(planPath, true,
                                    new String[1], new String[1], new String[1],
View Full Code Here

Examples of com.tapestry5book.tlog.core.entities.Archive

            final Number count = (Number) array[0];

            Month month = new Month((Integer) array[1], (Integer) array[2]);

            archives.add(new Archive(month, count));
        }

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