Package java.io

Examples of java.io.File


                org.apache.synapse.config.xml.endpoints.TemplateFactory templateFactory =
                        new org.apache.synapse.config.xml.endpoints.TemplateFactory();

                Template tm = templateFactory.createEndpointTemplate(artifactConfig, properties);

                tm.setFileName(new File(fileName).getName());
                if (log.isDebugEnabled()) {
                    log.debug("Endpoint Template named '" + tm.getName()
                            + "' has been built from the file " + fileName);
                }

                Template existingSt = getSynapseConfiguration().
                        getEndpointTemplate(existingArtifactName);

                if (existingArtifactName.equals(tm.getName())) {
                    getSynapseConfiguration().updateEndpointTemplate(tm.getName(), existingSt);
                } else {
                    getSynapseConfiguration().addEndpointTemplate(tm.getName(), tm);
                    getSynapseConfiguration().removeEndpointTemplate(existingSt.getName());
                    log.info("Template: " + existingArtifactName + " has been undeployed");
                }

                log.info("Template: " + tm.getName() + " has been updated from the file: " + fileName);
                return tm.getName();
            } else {
                element = artifactConfig.getFirstChildWithName(
                        new QName(SynapseConstants.SYNAPSE_NAMESPACE, "sequence"));
                if (element != null) {
                    Mediator mediator = MediatorFactoryFinder.getInstance().
                            getMediator(artifactConfig, properties);
                    if (mediator instanceof TemplateMediator) {
                        TemplateMediator tm = (TemplateMediator) mediator;

                        tm.setFileName((new File(fileName)).getName());
                        if (log.isDebugEnabled()) {
                            log.debug("Sequence Template named '" + tm.getName()
                                    + "' has been built from the file " + fileName);
                        }
View Full Code Here


   **/
  public static void initializeLogging() {
    final String configfile = "logging.conf";

   
    File f=new File(configfile);
    if (f.exists()) {
      // read the logging properties from configuration file
      PropertyConfigurator.configure(configfile);
    } else {
      BasicConfigurator.configure();
    }
View Full Code Here

        }
        backedUpFiles.remove(fileName);
    }

    public static String getNormalizedAbsolutePath(String fileName) {
        return FilenameUtils.normalize(new File(fileName).getAbsolutePath());
    }
View Full Code Here

    }
   
   
    private void checkSizeForRollover() {
        try {
            File f = new File(getFile());
            // check if bigger
            if (f.length() > maxFileSize) {
                rollover();
            }
        }
        catch (Exception ex) {
            String msg = "Failed to rollover log files: " + ex.getMessage();
View Full Code Here

    private void rollover() throws IOException {
        close();
        StringBuffer msg = new StringBuffer();
        Exception ex = null;
        try {
            File master = new File(getFile());
            if (maxSizeRollBackups == 0) {
                if (!master.delete())
                    msg.append("Failed to delete file: " + master.getAbsolutePath() + LINE_SEP);
            }
            else // roll all files
            {
                // delete highest if exists
                File f = new File(getFile() + "." + maxSizeRollBackups);
                if (f.exists()) {
                    if (!f.delete())
                        msg.append("Failed to delete file: " + f.getAbsolutePath() + LINE_SEP);
                }
                for (int i = maxSizeRollBackups - 1; i > 0; i--) {
                    f = new File(getFile() + "." + i);
                    if (f.exists()) {
                        File renamed = new File(getFile() + "." + (i + 1));
                        if (!f.renameTo(renamed))
                            msg.append("Failed to rename file: " + f.getAbsolutePath() + " to " + renamed.getAbsolutePath() + LINE_SEP);
                    }
                }
                f = new File(getFile() + ".1");
                if (!master.renameTo(f))
                    msg.append("Failed to rename file: " + master.getAbsolutePath() + " to " + f.getAbsolutePath() + LINE_SEP);
            }
        }
        catch (Exception e) {
View Full Code Here

  /**
   * write the settings to an XML file
   */
  public void saveConfig(String filename) {
    File f1 = new File(mappingfile);

    if (f1.exists()) {
      Mapping mapping = new Mapping();
      try {
  mapping.loadMapping(mappingfile);
  Writer writer = new FileWriter(filename);
  Marshaller marshaller = new Marshaller(writer);
View Full Code Here

  {
    JoBoBase baseobj = null;
   
    xmlconfig="jobo.xml";

    File f1 = new File(configDirectory+File.separatorChar+mappingfile);
    File f2 = new File(configDirectory+File.separatorChar+xmlconfig);

    if (f1.exists() && f2.exists()) {
      Mapping mapping = new Mapping();
      try {
  mapping.loadMapping(f1.getPath());
  Unmarshaller unmar = new Unmarshaller(mapping);
  unmar.setDebug(true);
  baseobj=(JoBoBase)unmar.unmarshal(new InputSource(f2.getPath()));
 
  log.info("configured from XML");
       
      } catch (Exception e) {
  log.error(e.getMessage());
View Full Code Here

 
  /**
   * sets the title (i.e. filename)
   */
  private void createTitle() {
    File              file;
   
    if (m_Filename.equals("")) {
      m_Title = "-none-";
    }
    else if (m_Filename.equals(TAB_INSTANCES)) {
      m_Title = TAB_INSTANCES;
    }
    else {
      try {
        file  = new File(m_Filename);
        m_Title = file.getName();
      }
      catch (Exception e) {
        m_Title = "-none-";
      }
    }
View Full Code Here

   protected final Log log = LogFactory.getLog(getClass());

 
   public WSDLReference createWSDLReference(BPELEngineImpl engine, QName processId, QName serviceName, String portName)
    {
      File targetWSDLFile = findWSDLFile(engine, processId, serviceName, portName);
      Definition wsdlDefinition = getWSDLDefinition(engine, processId, serviceName);
      return new WSDLReference(wsdlDefinition, targetWSDLFile.toURI());
    }
View Full Code Here

    private File findWSDLFile(BPELEngineImpl engine, QName processId, QName serviceName, String portName)
    {
      ProcessConf pconf = engine._store.getProcessConfiguration(processId);
      List<File> files = pconf.getFiles();
      File targetWsdlFile = null;
      for(File f : files)
      {
        if(f.getName().endsWith(".wsdl"))
        {
          try
View Full Code Here

TOP

Related Classes of java.io.File

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.