You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by pc...@apache.org on 2004/02/25 22:26:26 UTC

cvs commit: xml-xmlbeans/v2/src/turnbuckle/org/apache/xmlbeans/impl/turnbuckle/parameter ParameterService.java

pcal        2004/02/25 13:26:26

  Added:       v2/src/jeti/org/apache/xmlbeans/impl/jeti ToolContext.java
               v2/src/jeti/org/apache/xmlbeans/impl/jeti/javatype
                        JavaTypeService.java
               v2/src/jeti/org/apache/xmlbeans/impl/jeti/logging
                        Logger.java LoggingService.java Message.java
                        MessageConsumer.java
               v2/src/jeti/org/apache/xmlbeans/impl/jeti/output
                        OutputService.java
               v2/src/jeti/org/apache/xmlbeans/impl/jeti/parameter
                        ParameterService.java
  Removed:     v2/src/turnbuckle/org/apache/xmlbeans/impl/turnbuckle
                        ToolContext.java
               v2/src/turnbuckle/org/apache/xmlbeans/impl/turnbuckle/javatype
                        JavaTypeService.java
               v2/src/turnbuckle/org/apache/xmlbeans/impl/turnbuckle/logging
                        Logger.java LoggingService.java Message.java
                        MessageConsumer.java
               v2/src/turnbuckle/org/apache/xmlbeans/impl/turnbuckle/output
                        OutputService.java
               v2/src/turnbuckle/org/apache/xmlbeans/impl/turnbuckle/parameter
                        ParameterService.java
  Log:
  rename turnbuckle->jeti, add some forgotten jam test classes
  
  Revision  Changes    Path
  1.1                  xml-xmlbeans/v2/src/jeti/org/apache/xmlbeans/impl/jeti/ToolContext.java
  
  Index: ToolContext.java
  ===================================================================
  /*   Copyright 2004 The Apache Software Foundation
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *  limitations under the License.
   */
  package org.apache.xmlbeans.impl.jeti;
  
  import org.apache.xmlbeans.impl.jam.JServiceFactory;
  import org.apache.xmlbeans.impl.jeti.parameter.ParameterService;
  import org.apache.xmlbeans.impl.jeti.output.OutputService;
  import org.apache.xmlbeans.impl.jeti.logging.LoggingService;
  
  
  // user->ide/ant/commandline->xbeans
  
  /**
   * <p>Encapsulates a set of services to be used by in a single invocation
   * of a tool.  This abstraction isolates the tool code from any particular
   * means of, for example, retrieving user parameters or logging diagnostic
   * information.  This isolation allows the same tools code to run in
   * a variety of environments - e.g. in ant script or within an IDE.</p>
   *
   * @author Patrick Calahan <pc...@bea.com>
   */
  public interface ToolContext {
  
    /**
     * <p>Returns a service which can be used to log diagnostic messages
     * that the tool encounters.</p>
     */
    public LoggingService getLoggingService();
  
    /**
     * <p>Returns a service which should be used for producing output artifacts
     * such java code or xml files.</p>
     */
    public OutputService getOutputService();
  
    /**
     * <p>Returns an entry point into the JAM service, which provides a model
     * of java type information.</p>
     */
    public JServiceFactory getJavaTypeService();
  
    /**
     * <p>Returns a service which exposes user-specified parameters for
     * the tool invocation.</p>
     */
    public ParameterService getParameterService();
  }
  
  
  
  1.1                  xml-xmlbeans/v2/src/jeti/org/apache/xmlbeans/impl/jeti/javatype/JavaTypeService.java
  
  Index: JavaTypeService.java
  ===================================================================
  /*   Copyright 2004 The Apache Software Foundation
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *  limitations under the License.
   */
  package org.apache.xmlbeans.impl.jeti.javatype;
  
  import org.apache.xmlbeans.impl.jam.JClassIterator;
  
  /**
   *
   * @author Patrick Calahan <pc...@bea.com>
   */
  public abstract class JavaTypeService {
  
    /**
     * If this tool takes as input a set of java types, returns
     * @return
     */
    public abstract JClassIterator getInputJavaTypes();
  
  
  }
  
  
  
  1.1                  xml-xmlbeans/v2/src/jeti/org/apache/xmlbeans/impl/jeti/logging/Logger.java
  
  Index: Logger.java
  ===================================================================
  /*   Copyright 2004 The Apache Software Foundation
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *  limitations under the License.
   */
  package org.apache.xmlbeans.impl.jeti.logging;
  
  import org.apache.xmlbeans.impl.jam.JElement;
  
  import java.util.logging.Level;
  
  /**
   *
   * @author Patrick Calahan <pc...@bea.com>
   */
  public interface Logger {
  
    /**
     */
    public void log(Level level,
                    String msgId,
                    Object[] msgArgs);
  
    /**
     */
    public void log(Level level,
                    String msgId,
                    Object[] msgArgs,
                    Throwable error);
  
    /**
     *
     *
     * @param level
     * @param javaContext
     * @param msgId
     * @param msgArgs
     */
    public void log(Level level,
                    JElement javaContext,
                    String msgId,
                    Object[] msgArgs);
  
  
  
    public void log(Message m);
  
  
  }
  
  
  
  1.1                  xml-xmlbeans/v2/src/jeti/org/apache/xmlbeans/impl/jeti/logging/LoggingService.java
  
  Index: LoggingService.java
  ===================================================================
  /*   Copyright 2004 The Apache Software Foundation
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *  limitations under the License.
   */
  package org.apache.xmlbeans.impl.jeti.logging;
  
  import org.apache.xmlbeans.impl.jam.JElement;
  
  /**
   *
   * @author Patrick Calahan <pc...@bea.com>
   */
  public interface LoggingService {
  
    public Logger getLogger();
  
  
  }
  
  
  
  1.1                  xml-xmlbeans/v2/src/jeti/org/apache/xmlbeans/impl/jeti/logging/Message.java
  
  Index: Message.java
  ===================================================================
  /*   Copyright 2004 The Apache Software Foundation
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *  limitations under the License.
   */
  package org.apache.xmlbeans.impl.jeti.logging;
  
  import org.apache.xmlbeans.impl.jam.JElement;
  
  import java.util.logging.Level;
  
  /**
   * <p>Encapsulates diagnostic information produced while running a tool.
   *
   * @author Patrick Calahan <pc...@bea.com>
   */
  public interface Message {
  
    /**
     * @return The severity level of the message.  This must never return null.
     */
    public Level getLevel();
  
    /**
     * @return The internationalized text of the message.
     * This must never return null.
     */
    public String getText();
  
    /**
     * @return The message text id for this message.
     */
    public String getTextId();
  
    /**
     * @return The exception which caused the message, or null.
     */
    public Throwable getException();
  
    /**
     * @return The JElement representing the java construct to which the message
     * applies, or null.
     */
    public JElement getJavaContext();
  
    /**
     * @return The SchemaType representing the xsd type to which the message
     * applies, or null.
     */
  //  public SchemaType getSchemaTypeContext();
  
  }
  
  
  1.1                  xml-xmlbeans/v2/src/jeti/org/apache/xmlbeans/impl/jeti/logging/MessageConsumer.java
  
  Index: MessageConsumer.java
  ===================================================================
  /*   Copyright 2004 The Apache Software Foundation
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *  limitations under the License.
   */
  package org.apache.xmlbeans.impl.jeti.logging;
  
  /**
   * To be implemented by providers who want to handle messages/diagnostics
   * from tools.
   *
   * @author Patrick Calahan <pc...@bea.com>
   */
  public interface MessageConsumer {
  
    public void log(Message msg);
  }
  
  
  
  1.1                  xml-xmlbeans/v2/src/jeti/org/apache/xmlbeans/impl/jeti/output/OutputService.java
  
  Index: OutputService.java
  ===================================================================
  /*   Copyright 2004 The Apache Software Foundation
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *  limitations under the License.
   */
  package org.apache.xmlbeans.impl.jeti.output;
  
  import javax.xml.stream.XMLStreamWriter;
  import java.io.Writer;
  
  /**
   *
   * @author Patrick Calahan <pc...@bea.com>
   */
  public abstract class OutputService {
  
    /**
     * <p>Returns a Writer into which generated java source can be written.</p>
     *
     * @param resourceName path to the file (relative to the output root) to
     * generate.
     * @param qualifiedClassName Name of the java class to be codegenned
     */
    public Writer createJavaSourceWriter(String resourceName,
                                         String qualifiedClassName) {
      throw new UnsupportedOperationException();
    }
  
    /**
     * <p>Returns an XMLStreamWriter on a resource relative to the
     * output root.</p>
     *
     * REVIEW i think we may need to introduce something
     * to model the structure of whatever it is the tool is trying to output.
     *
     */
    public XMLStreamWriter createXmlStreamWriter(String resourceName) {
      throw new UnsupportedOperationException();
    }
  
  
  }
  
  
  
  1.1                  xml-xmlbeans/v2/src/jeti/org/apache/xmlbeans/impl/jeti/parameter/ParameterService.java
  
  Index: ParameterService.java
  ===================================================================
  /*   Copyright 2004 The Apache Software Foundation
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *  limitations under the License.
   */
  package org.apache.xmlbeans.impl.jeti.parameter;
  
  import org.apache.tools.ant.taskdefs.Property;
  
  /**
   * <p>Provides the tool with access to user-specified parameters.  Note
   * that many typical parameters, such as 'verbose' or as set of input java
   * file set, are implicitly handled by the tool context in the services
   * it provides.</p>
   *
   * @author Patrick Calahan <pc...@bea.com>
   */
  public interface ParameterService {
  
    /**
     * <p>Returns a properties object containing the flags and options
     * specified by the user.</p>
     */
    public Property getParameters();
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-cvs-help@xml.apache.org