Novice question on gcj - Error finding java imports

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Sorry, but I am a novice at gcc and gcj.  I have attempted to decipher
the man pages and have made several goes at compiling a set of .java
into an .exe.

I have put into this mail the 3 sets of information in order of appearance
- The gcj command that I use
- The error retrun by gcj
- The source code of my java class

##### Command
$ gcj --classpath="/home/Vincent Lim/.;/home/Vincent Lim/stpcc.jar;/home/Vincen
t Lim/stpcmmn.jar;/home/Vincent Lim/stpwvcm.jar;/home/Vincent Lim/jcifs-1.3.14.
jar;/home/Vincent Lim/commons-codec-1.3.jar;/ome/Vincent Lim/remote_core.jar" -
-main=CCQARequest.class *.java

##### Error
HandShake.java:6: error: Class or interface `jcifs.smb.SmbFileOutputStream' not
found in import.
   import jcifs.smb.SmbFileOutputStream;
          ^
HandShake.java:16: error: Type `SPHAuthenticator' not found in declaration of fi
eld `authentic'.
        private final SPHAuthenticator authentic;
                         ^
HandShake.java:27: error: Type `SPHAuthenticator' not found in the declaration o
f the argument `a' of method `<init>'.
        public HandShake(final SPHAuthenticator a) {
                                  ^
HandShake.java:38: error: Type `QaRequest' not found in the declaration of the a
rgument `event' of method `writeHandShake'.
        public void writeHandShake(final QaRequest event) throws HandShakeExcept
ion{
                                            ^
HandShake.java:41: error: Type `ConfigProxy' not found in the declaration of the
 local variable `cp'.
                        final ConfigProxy cp = new ConfigProxy();
                                 ^
HandShake.java:48: error: Type `SmbFileOutputStream' not found in the declaratio
n of the local variable `output'.
                        final SmbFileOutputStream output = new SmbFileOutputStre
am(new SmbFile(url));
                                 ^
6 errors

##### Source
import javax.wvcm.PropertyRequestItem;
import javax.wvcm.ProviderFactory;
import javax.wvcm.PropertyRequestItem.PropertyRequest;
import javax.wvcm.ProviderFactory.Callback;

import com.ibm.rational.wvcm.stp.cc.CcBaseline;
import com.ibm.rational.wvcm.stp.cc.CcProject;
import com.ibm.rational.wvcm.stp.cc.CcProvider;

public class CCQARequest {

    /**
     *
     * @author Vincent Lim
     * This private class is used to provide an authenication ID and
password for the trigger script
     * to call the CM server.
     * Input :    CM server URL
     *             User ID
     *             Password
     * @return Callback class from CM API
     *
     * Purpose     (1) to check if the baseline is in "INITIAL" state,
if not block chbl operation
     *             (2) to check if the requestor belongs to the group
owning the UCM project, if not block chbl operation
     *
     * Logic    - Set the return flag to the trigger to FALSE first to
ensure operation will fail unless we allow it to pass
     *             - Get the environmental variables from ClearCase
available from the trigger event
     *             - Login to CM Server using a Admin ID and encrypted Password
     *             - Get the UCM Project permission property that
tells us which group owns the project
     *             - Get the promotion level of the baseline been
requested to be deploy to QA environment
     *             - Ensure promotion level is "INITIAL", if not
return FALSE to stop chbl operation
     *             - Get the requestor group from creds.exe
     *             - Compare the requestor group to the ucm project group
     *             - If equal, write handshake file and return TRUE to
permit chbl to run
     *             - If not, return FALSE to stop chbl operation
     */
    private static class sphAuthCallback implements Callback {
        private final String serverUrl;
        private final String login;
        private final String password;

        public sphAuthCallback(String serverUrl, String login, String
password) {
            this.serverUrl = serverUrl;
            this.login = login;
            this.password = password;
        }

        /**
         * @param domain, retries
         * Instantiate Authenication class from CM API
         * Input :     AD Domain which CM server is in
         *             retries number of attempts to login to CM
server (set to 0, ie once only)
         */
        public Authentication getAuthentication(String realm, int
retries) {
            // @debug
            trace("Logging in to CCRC server: " + serverUrl);
            trace("Login:    " + login);
            trace("Password: " + password);

            // Retry count > 0 means authentication failed.
            // Perhaps password was wrong or login domain was left out?
            myAssert(retries == 0);

            return new Authentication() {

                /**
                 * Provide loginName() implementation require by CM API
                 */
                public String loginName() {
                    // On Windows servers, this should return domain and
                    // username separated by a backslash
                    return login;
                }

                /**
                 * Provide password() implementation require by CM API
                 */
                public String password() {
                    return password;
                }
            };
        }
    }

    /**
     *
     * @param expr
     * Method to handle return errors from CM Server
     */
    static void myAssert(boolean expr) {
        if ( ! expr) {
            throw new AssertionError();
        }
    }

    /**
     *
     * @param string
     * Method for internal debugging of class
     */
    static void trace(String string) {
             System.out.println("##### " + string);
    }

    /**
     * Get the Provider class of the CM API use as proxy to ClearCase
data in VOBs
     * Establish authentication callback for logging in to the CM server.
     * @return new ClearCase provider
     * @throws Exception if provider cannot be instantiated
     */
    static CcProvider getProvider(String serverUrl, String login,
String password) throws Exception
    {
        // instantiate the callback class
        Callback callback = new sphAuthCallback(serverUrl, login, password);

        // instantiate the CCprovider class using the callback class,
provider set to ClearCase only as ClearQuest is not deployed
        CcProvider provider = (CcProvider)
ProviderFactory.createProvider(CcProvider.CC_ONLY_PROVIDER_CLASS,
callback);

        // set the CM Server URL, ie http://wss33/TeamWeb/services/Team
        provider.setServerUrl(serverUrl);

        // @debug
        trace("Provider created");

        // return the ClearCase provider
        return provider;
    }

    /**
     * @param args Empty arguments from system initialization call
     */
    public static void main(String[] args) {

        // flag to return to calling ClearCase trigger
        // @return non-zero will fail the trigger and block the
ClearCase operation
        // @return 0 will permit the ClearCase operation to continue,
ie change the promotion level
        int returnflag = 1;

        // instantiate the QaRequest class that will get the event
data from the environment variables
        QaRequest event = new QaRequest();

        // @debug
        event.log(event);

        try {
            // create the Authenicator class that retrieves the Admin
ID and password
            final SPHAuthenticator auth = new SPHAuthenticator();
            final ConfigProxy sphConfig = new ConfigProxy();

            // get the CCprovider using the WSS3 URL, Admin ID and Password
            final CcProvider sphProvider =
getProvider(sphConfig.getCmServerURL(),auth.getAdminID(),auth.getAdminPWD());

            // get the UCM project of interest
            // using the information in the ClearCase event
            // UCM project environment variable provide by ClearCase trigger
            CcProject sphProject =
sphProvider.ccProject(sphProvider.stpLocation(event.getUcmProjectSelector()));

            // prepares the properties that we want from the UCM
Project in the VOB
            PropertyRequest wantedProps = new PropertyRequest(new
PropertyRequestItem[] { CcProject.PERMISSIONS });

            // fill the Provider proxy with the actual data from the VOB
            sphProject = (CcProject) sphProject.doReadProperties(wantedProps);

            // get the UCM baseline of interest
            // using the information in the ClearCase event
            // UCM baseline environment variable provide by ClearCase trigger
            CcBaseline sphbl =
sphProvider.ccBaseline(sphProvider.stpLocation(event.getUcmBaselineSelector()));

            PropertyRequest wantedPropsAgain = new PropertyRequest(new
PropertyRequestItem[] { CcBaseline.PROMOTION_LEVEL });

            // fill the Provider proxy with the actual data from the VOB
            sphbl = (CcBaseline) sphbl.doReadProperties(wantedPropsAgain);

            // get the promotion level as a string for string comparison
            String plevel = sphbl.getPromotionLevel();

            // @debug
            System.out.println(plevel);

            // check if promotion level is "INITIAL", otherwise do not
permit baseline to be send to QA implementation
            if (plevel.equalsIgnoreCase("INITIAL")) {

                // get the group that owns the UCM project, ie CMIS, ADNET or ZZ
                String sphGroup =  sphProject.getPermissions().getGroupName();

                // instaniate the proxy for the user to fire the
trigger/ClearCase event
                // ie the person trying to implement the baseline to QA
                UserProxy usergrps = new UserProxy();

                // check if the person submit a QA request (via
promotion level change) is a member
                // of the group that owns the UCM project
                // if not, person will not be permitted to make the QA request
                // else we will prepare the handshake file require by
PRE_AUTOGEN
                if (usergrps.chkUserInGroup(event.getRequestor(), sphGroup)) {

                    try {
                        // instantiate the HandShake class to write
the data require by PRE_AUTOGEN
                        HandShake passon = new HandShake(auth);

                        // send the QA request to the handshake class
to write out
                        passon.writeHandShake(event);

                        // allow the trigger operation, ie chbl to continue
                        System.out.println("Finish writing handshake");
                        returnflag = 0;
                    } catch (HandShakeException e) {
                        returnflag = 1;
                        System.out.println(e.toString());
                        e.printStackTrace();
                    }
                }
            }

        } catch (Exception e) {
            System.out.println(e.toString());
            e.printStackTrace();
        }

        System.out.println("Exiting trigger");
        System.exit(returnflag);
    }

}


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux