All Downloads are FREE. Search and download functionalities are using the official Maven repository.

at.spardat.xma.exception.Codes Maven / Gradle / Ivy

There is a newer version: 6.0.2
Show newest version
/*******************************************************************************
 * Copyright (c) 2003, 2007 s IT Solutions AT Spardat GmbH .
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     s IT Solutions AT Spardat GmbH - initial API and implementation
 *******************************************************************************/

// @(#) $Id: Codes.java 2089 2007-11-28 13:56:13Z s3460 $
package at.spardat.xma.exception;

import java.util.MissingResourceException;
import java.util.ResourceBundle;

/**
 * Defines error constants and a method to get a localized text for some of them.
 * 
 * @author YSD, 26.05.2003 13:51:20
 */
public class Codes {
    
    // module constant
    public static final int         MODULE = 1001000;
    
    /**
     * RemoteCall, page deltas cannot be externalized 
     */
    public static final int         EXT_PAGES_CLIENT =           MODULE + 1;  // no text
    
    /**
     * RemoteCall, upstream cannot be produced
     */
    public static final int         EXT_STREAM_CLIENT =          MODULE + 2;  // no text
    
    /**
     * RemoteCall, the server could not be contacted
     */
    public static final int         SERVER_UNREACHABLE =         MODULE + 3;
    
    /**
     * RemoteCall, the server has been contacted but returned an unknown error
     */
    public static final int         SERVER_ERROR =               MODULE + 4;
    
    /**
     * RemoteCall, length mismatch in the stream returned by the server
     */
    public static final int         LENGTH_MISMATCH_AT_CLIENT =  MODULE + 5;   // no text
    
    /**
     * RPCServletServer, exception in server xma runtime
     */
    public static final int         SERVER_RUNTIME_ERROR =       MODULE + 6;   // no text

    /**
     * RPCServletServer, downstream cannot be produced
     */
    public static final int         EXT_STREAM_SERVER =          MODULE + 7;  // no text
    
    /**
     * RPCServletServer, cannot read first 4 bytes from ServletInputStream (length information)
     */
    public static final int         READ_LENGTH_SERVER =         MODULE + 8;  // no text
    
    /**
     * RPCServletServer, cannot read ServletInputStream as indicated by length information
     */
    public static final int         READ_SERVER =                MODULE + 9;  // no text
    
    /**
     * RPCServletServer, cannot reconstruct RemoteCall from servlet input stream 
     */
    public static final int         SERVER_READ_CALL_FROM_SERVLETINPUT = MODULE + 10;  // no text
    
    /**
     * RPCServletServer, the session does not exist at the server 
     */
    public static final int         SERVER_INVALID_SESSION =     MODULE + 11;
    
    /**
     * RPCServletServer, component cannot be created 
     */
    public static final int         SERVER_COMPONENT_CREATE =    MODULE + 12;  // no text

    /**
     * RPCServletServer, cannot internalize page deltas from client 
     */
    public static final int         SERVER_INTERNALIZE_DELTAS =  MODULE + 13;  // no text

    /**
     * RPCServletServer, the client and the server state are out of sync 
     */
    public static final int         OUT_OF_SYNC =                MODULE + 14;

    /**
     * RPCServletServer, the target dispatch page cannot be found
     */
    public static final int         SERVER_INVALID_PAGE =        MODULE + 15;  // no text

    /**
     * RPCServletServer, the target dispatch method cannot be found
     */
    public static final int         SERVER_METHOD_NOT_FOUND =    MODULE + 16;  // no text
    
    /**
     * RPCServletServer, the target dispatch method has been executed but terminated with
     * an exception that was not an BaseException.
     */
    public static final int         SERVER_METHOD_EXECUTE =      MODULE + 17;  // no text    

    /**
     * ComponentServer, event method cannot be invoked
     */
    public static final int         SERVER_METHOD_INVOKE =       MODULE + 18;  // no text    
    
    /**
     * RPCServletServer, cannot externalize page deltas to client 
     */
    public static final int         SERVER_EXTERNALIZE_DELTAS =  MODULE + 19;  // no text
    
    /**
     * RemoteCall, client cannot deserialize RemoteResponse
     */
    public static final int         CLIENT_INTERNALIZE_RESPONSE = MODULE + 20; // no text
    
    /**
     * RemoteCall, client cannot deserialize and apply deltas from server
     */
    public static final int         CLIENT_INTERNALIZE_DELTAS =  MODULE + 21;  // no text
    
    /**
     * RemoteCall, client cannot process server response
     */
    public static final int         CLIENT_PROCESS_SERVER_RESPONSE = MODULE + 22; // no text
    
    /**
     * RemoteCall, client cannot even read first 4 bytes of server response 
     */
    public static final int         CLIENT_READ_LENGTH =         MODULE + 23; // no text
    
    /**
     * Thrown in widget model classes if transfers between AtomicAttrVals and 
     * widget models are not possible due to incompatible type codes.
     */
    public static final int         INCOMPATIBLE_TYPES =         MODULE + 24;  // no text
    
    /**
     * Thrown when transfers between AtomicAttrVals and widget models is not possbible
     * due to the class or properties of widget models.
     */
    public static final int         NOT_AV_TRANSFERRABLE =       MODULE + 25;  // no text
    
    /**
     * Thrown when a client calls a second RPC while the first is not finished yet
     */
    public static final int         CLIENT_RECURSIVE_RPC =       MODULE + 26;  // no text
    

    
    /**
     * RemoteCall, the server could not be contacted with autoexit enabled
     */
    public static final int         SERVER_UNREACHABLE_AUTOEXIT =         MODULE + 53;

    /**
     * RPCServletServer, the session does not exist at the server with autoexit enabled
     */
    public static final int         SERVER_INVALID_SESSION_AUTOEXIT =     MODULE + 61;
    
    
    /**
     * 
     * from Package ...xma.datasource
     * 
     */
    
    /**
     * client requests a datasource via tabular servlet but no session exists yet.
     */
    public static final int         DS_INVALID_SESSION =         MODULE + 100; // no text
    
    /**
     * missing parameter to the tablar servlet
     */
    public static final int         DS_MISSING_REQUEST_PARAM =   MODULE + 101; // no text
    
    /**
     * specification of a data source is wrong
     */
    public static final int         DS_INVALID_TABLE_SPEC =      MODULE + 102; // no text
    
    /**
     * TabularDataSourceServer.provideTable returned null
     */
    public static final int         DS_PROVIDE_TABLE_RETURNS_NULL = MODULE + 103; // no text

    /**
     * TabularDataSourceServer.provideTable returned a null table
     */
    public static final int         DS_PROVIDE_TABLE_RETURNS_NULL_TABLE = MODULE + 104; // no text

    /**
     * RessourceBundleProviderServer: Missing bundle=-attribute
     */
    public static final int         DS_MISSING_BUNDLE_ATTRIBUTE = MODULE + 105; // no text
    
    /**
     * RessourceBundleProviderServer: Syntax error in line
     */
    public static final int         DS_RSC_INVALID_LINE =         MODULE + 106; // no text

    /**
     * RessourceBundleProviderServer: no ITableProvider for a particular type
     */
    public static final int         DS_NO_TABLE_PROVIDER =        MODULE + 107; // no text
    
    /**
     * TabularServletServer: The server side implementation class of ITabularDataSource
     * does not extend TabularDataSourceServer.
     */
    public static final int         DS_SERVER_WRONG_PLUNGIN_CLASS = MODULE + 108; // no text 
    
    /**
     * RessourceBundleProviderServer: Line that defines columns missing
     */
    public static final int         DS_RSC_MISSING_HEADER =       MODULE + 109;  // no text
    
    /**
     * TabularDataSourceClient: Invalid table spec in getTable
     */
    public static final int         DS_CLIENT_INVALID_TABLE_SPEC = MODULE + 110; // no text    
    
    /**
     * TabularDataSourceClient: 
     */
    public static final int         DS_CLIENT_LOAD_TABLE_FROM_CACHE = MODULE + 111; // no text    
    
    
    /**
     * Security
     */
    
    /**
     * The client login module denied the user login
     */
    public static final int         LOGIN_DENIED = MODULE + 200;
    
    /**
     * Some Execption was thrown in the client or server side login procedure.
     */
    public static final int         LOGIN_TECHNICAL_ERROR = MODULE + 201;

    /**
     * Serverevent is not allowed for the user
     */
    public static final int         PERMISSION_DENIED = MODULE + 202;
    
    /**
     * The server login module denied the user login
     */
    public static final int         LOGIN_DENIED_SERVER = MODULE + 203;

    /**
     * 
     * Other classes
     * 
     */
    
    /**
     * PluginManager cannot construct object with default constructor
     */
    public static final int         PLUGIN_CANNOT_CONSTRUCT_OBJECT = MODULE + 300;  // no text
    
    /**
     * Component can not be created
     */
    public static final int         CANNOT_CONSTRUCT_COMPONENT = MODULE + 301;
    
    /**
     * The application version differs between client and server
     */
    public static final int         DIFFERENT_SERVER_VERSION_FOUND = MODULE + 302;
    
    /**
     * Exception at setting component property
     */
    public static final int         COMPONENT_PROPERTY_SETTING_EXCEPTION = MODULE + 303;
    
    /**
     * Exception at setting component property
     */
    public static final int         COMPONENT_PROPERTY_DATE_SETTING_EXCEPTION = MODULE + 304;
    
    /**
     * 
     * Package baserpc 
     * 
     */
    
    /**
     * Cannot serialize data at client
     */
    public static final int         BASERPC_CLIENT_EXTERNALIZE = MODULE + 400;   // no text
    
    /**
     * Error from transport
     */
    public static final int         BASEPRC_CLIENT_TRANSPORT_ERROR = MODULE + 401;  // no text
    
    /**
     * Server returned less than 4 bytes
     */
    public static final int         BASERPC_CLIENT_READ_LENGTH = MODULE + 402;  // no text
    
    /**
     * Wrong length of returned data
     */
    public static final int         BASERPC_CLIENT_LENGTH_MISMATCH = MODULE + 403;  // no text
    
    /**
     * Cannot deserialize reply from server
     */
    public static final int         BASERPC_INTERNALIZE_RESPONSE = MODULE + 404;  // no text
    
    /**
     * Client sent less than 4 bytes
     */
    public static final int         BASERPC_SERVER_READ_LENGTH = MODULE + 405;  // no text
    
    /**
     * Data sent to the server and header-length are different 
     */
    public static final int         BASERPC_SERVER_LENGTH_MISMATCH = MODULE + 406; // no text
    
    /**
     * Data sent to the server cannot be deserialized
     */
    public static final int         BASERPC_SERVER_INTERNALIZE = MODULE + 407;   // no text
    
    /**
     * The server side end point method of the base rpc throws an exception 
     */
    public static final int         BASERPC_SERVER_ENDPOINTMETHODFAULT = MODULE + 408;   // no text
    
    /**
     * Remaining errors that occur at the server side
     */
    public static final int         BASERPC_SERVER_ERROR = MODULE + 409;  // no text
    
    /**
     * Error in serializing data that should be sent back to the client
     */
    public static final int         BASERPC_SERVER_EXT_STREAM = MODULE + 410;   // no text
    
    /**
     * Error in winReuse: An application with this winReuse ID and url is already started
     */
    public static final int         WINREUSE_STARTUP = MODULE + 500;   // no text
    
    /**
     * Returns true if a provided BaseException code originates from this
     * module, i.e., is defined above.
     */
    public boolean isXMAExceptionCode (int code) {
        return code - (code%1000) == MODULE;
    }


    private static final String BUNDLE_NAME = "at.spardat.xma.exception.Texts"; //$NON-NLS-1$

    private static final ResourceBundle RESOURCE_BUNDLE =
        ResourceBundle.getBundle(BUNDLE_NAME);

    /**
     * Returns the localized text for a particular code. The resource bundle is
     * expected to provide an entry for a key that equals the code minus the
     * MODULE constant.
     * 
     * @param code a code defined by one of the constants above
     * @return a localized String never null
     */
    public static String getText (int code) {
        String          key = "";
        try {
            key = String.valueOf (code - MODULE);
            return RESOURCE_BUNDLE.getString (key);
        } catch (MissingResourceException e) {
            return '!' + key + '!';
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy